text stringlengths 2 1.04M | meta dict |
|---|---|
import org.junit.rules.ExternalResource;
import org.sql2o.*;
public class DatabaseRule extends ExternalResource {
protected void before() {
DB.sql2o = new Sql2o("jdbc:postgresql://localhost:5432/library_test", null, null);
}
protected void after() {
try(Connection con = DB.sql2o.open()) {
String deleteBooksQuery = "DELETE FROM books;";
String deleteAuthorsQuery = "DELETE FROM authors;";
String deleteGenresQuery = "DELETE FROM genres;";
String deletePatronsQuery = "DELETE FROM patrons;";
String deleteCheckoutsQuery = "DELETE FROM checkouts;";
String deleteCopiesQuery = "DELETE FROM copies;";
con.createQuery(deleteCopiesQuery).executeUpdate();
con.createQuery(deleteCheckoutsQuery).executeUpdate();
con.createQuery(deletePatronsQuery).executeUpdate();
con.createQuery(deleteGenresQuery).executeUpdate();
con.createQuery(deleteAuthorsQuery).executeUpdate();
con.createQuery(deleteBooksQuery).executeUpdate();
}
}
}
| {
"content_hash": "bba23ac6f6c2d68703a9f22eded5fc15",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 86,
"avg_line_length": 37.629629629629626,
"alnum_prop": 0.718503937007874,
"repo_name": "midoribowen/Library",
"id": "baddbb60edcf2a3cb3e4fbdae75e504a18dc5c96",
"size": "1016",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/DatabaseRule.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "123"
},
{
"name": "Java",
"bytes": "39020"
}
],
"symlink_target": ""
} |
for file in $(find spec/fixtures/approvals -ipath "*.received.*"); do
approved_path=$(echo "$file" | sed 's/received/approved/')
mv "$file" "$approved_path"
done;
| {
"content_hash": "fd4275fb3e10b78367c713f377b3ce68",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 69,
"avg_line_length": 41.75,
"alnum_prop": 0.6646706586826348,
"repo_name": "pact-foundation/pact_broker",
"id": "5eecca0973d9e96d10a39f52e0db166ae26b05b2",
"size": "178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "script/test/approval-all.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15870"
},
{
"name": "Dockerfile",
"bytes": "1637"
},
{
"name": "HTML",
"bytes": "23887"
},
{
"name": "Haml",
"bytes": "36282"
},
{
"name": "JavaScript",
"bytes": "421631"
},
{
"name": "Ruby",
"bytes": "2792209"
},
{
"name": "Shell",
"bytes": "15107"
}
],
"symlink_target": ""
} |
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/PublicLastTestDate.svg" />
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/PublicDeployment.svg" />
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/FairfaxLastTestDate.svg" />
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/FairfaxDeployment.svg" />
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/BestPracticeResult.svg" />
<IMG SRC="https://azurequickstartsservice.blob.core.windows.net/badges/wordpress-single-vm-ubuntu/CredScanResult.svg" />
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fwordpress-single-vm-ubuntu%2Fazuredeploy.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.png"/>
</a>
<a href="http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fwordpress-single-vm-ubuntu%2Fazuredeploy.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.png"/>
</a>
This template deploys a complete LAMP stack, then installs and initializes WordPress.
Once the deployment is finished, you need to go to http://fqdn.of.your.vm/wordpress/ to finish the configuration, create an account, and get started with WordPress.
| {
"content_hash": "0c928ee01d12c1a9137fd6707ad92761",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 216,
"avg_line_length": 86.3,
"alnum_prop": 0.8001158748551565,
"repo_name": "mumian/azure-quickstart-templates",
"id": "88e4611c37ec0e823abdb182438619f08c628233",
"size": "1767",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wordpress-single-vm-ubuntu/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1260"
},
{
"name": "C#",
"bytes": "7685"
},
{
"name": "CSS",
"bytes": "2455"
},
{
"name": "Dockerfile",
"bytes": "460"
},
{
"name": "Groovy",
"bytes": "1440"
},
{
"name": "HCL",
"bytes": "40614"
},
{
"name": "HTML",
"bytes": "2444"
},
{
"name": "Java",
"bytes": "6880"
},
{
"name": "JavaScript",
"bytes": "20664"
},
{
"name": "PHP",
"bytes": "645"
},
{
"name": "Perl",
"bytes": "20767"
},
{
"name": "PowerShell",
"bytes": "1667614"
},
{
"name": "Python",
"bytes": "240688"
},
{
"name": "Ruby",
"bytes": "3951"
},
{
"name": "Shell",
"bytes": "1488945"
},
{
"name": "TSQL",
"bytes": "4022"
},
{
"name": "XSLT",
"bytes": "4424"
}
],
"symlink_target": ""
} |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from '../../css/styles.css';
import classNames from 'classnames/bind';
class Button extends Component {
onClick (action, event) {
const { showPopup } = this.props;
return showPopup(event, action);
}
shouldComponentUpdate(nextProps) {
return this.props.active !== nextProps.active
|| this.props.action !== nextProps.action;
}
render()
{
const { action, children, active } = this.props;
let buttonClasses = classNames({
gte_button: true,
gte_btn_disabled: active
});
return (
<div
className="gte_buttons_container"
data-action={action}
onClick={(active === false) ? this.onClick.bind(this, action) : undefined}>
<div data-action={action} className={buttonClasses}>
<span data-action={action} >{children}</span>
</div>
<div className={styles.clear}></div>
</div>
)
}
}
Button.propTypes = {
action: PropTypes.string,
active: PropTypes.bool,
showPopup: PropTypes.func,
};
export default Button
| {
"content_hash": "5a91245b689b5f2ee6bcedd77e37745a",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 83,
"avg_line_length": 24.608695652173914,
"alnum_prop": 0.6307420494699647,
"repo_name": "GigaTables/reactables",
"id": "f05dc2c9da8c5151d3f5ac3ca58f977b4a86d6d1",
"size": "1132",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/form/Button.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17710"
},
{
"name": "HTML",
"bytes": "359"
},
{
"name": "JavaScript",
"bytes": "260013"
}
],
"symlink_target": ""
} |
#ifndef RTTR_VARIANT_DATA_CONVERTER_H_
#define RTTR_VARIANT_DATA_CONVERTER_H_
#include "rttr/detail/conversion/std_conversion_functions.h"
#include "rttr/detail/conversion/number_conversion.h"
#include "rttr/detail/enumeration/enumeration_helper.h"
namespace rttr
{
class argument;
namespace detail
{
template<typename T>
struct convert_from;
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* The default converter manager class.
*
* It will check at runtime the incoming argument type and will forward its value to the corresponding conversion function.
* All basic fixed integer and floating-point (float, double) types are handled.
*
* \remark Custom types will not be handled here,
* therefore a converter function has to be registered explicitly. See \ref type::register_converter_func.
* With this class we can avoid this step.
*/
template<typename T, typename Type_Converter = convert_from<T>>
struct default_type_converter
{
static bool convert_to(const T& value, argument& arg)
{
const type target_type = arg.get_type();
if (target_type == type::get<bool>())
return Type_Converter::to(value, arg.get_value<bool>());
else if (target_type == type::get<char>())
return Type_Converter::to(value, arg.get_value<char>());
else if (target_type == type::get<int8_t>())
return Type_Converter::to(value, arg.get_value<int8_t>());
else if (target_type == type::get<int16_t>())
return Type_Converter::to(value, arg.get_value<int16_t>());
else if (target_type == type::get<int32_t>())
return Type_Converter::to(value, arg.get_value<int32_t>());
else if (target_type == type::get<int64_t>())
return Type_Converter::to(value, arg.get_value<int64_t>());
else if (target_type == type::get<uint8_t>())
return Type_Converter::to(value, arg.get_value<uint8_t>());
else if (target_type == type::get<uint16_t>())
return Type_Converter::to(value, arg.get_value<uint16_t>());
else if (target_type == type::get<uint32_t>())
return Type_Converter::to(value, arg.get_value<uint32_t>());
else if (target_type == type::get<uint64_t>())
return Type_Converter::to(value, arg.get_value<uint64_t>());
else if (target_type == type::get<float>())
return Type_Converter::to(value, arg.get_value<float>());
else if (target_type == type::get<double>())
return Type_Converter::to(value, arg.get_value<double>());
else if (target_type == type::get<std::string>())
return Type_Converter::to(value, arg.get_value<std::string>());
else if (is_variant_with_enum(arg))
return Type_Converter::to_enum(value, arg);
else
return false;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* The empty converter class, does nothing. The only purpose is to avoid a compile time error.
* The conversion of custom types will be handled via registered conversion functions. See \ref type::register_converter_func.
*/
template<typename T>
struct empty_type_converter
{
static RTTR_INLINE bool convert_to(const T& value, argument& arg)
{
return false;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/*!
* The default implementation of the converter class for all basic types.
*
* That are:
* - all integral fixed types: int8_t till uint64_t
* - all floating point types
* - std::string
*/
template<typename T>
struct convert_from
{
static RTTR_INLINE bool to(const T& from, bool& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, char& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, int8_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, int16_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, int32_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, int64_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, uint8_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, uint16_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, uint32_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, uint64_t& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, float& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, double& to)
{
return false;
}
static RTTR_INLINE bool to(const T& from, std::string& to)
{
return false;
}
static RTTR_INLINE bool to_enum(const T& from, argument& to)
{
return false;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// here come the specialization for several atomic types
template<>
struct RTTR_API convert_from<bool>
{
static RTTR_INLINE bool to(const bool& from, bool& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const bool& from, char& to)
{
to = static_cast<char>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, int8_t& to)
{
to = static_cast<int8_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, int16_t& to)
{
to = static_cast<int16_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, int32_t& to)
{
to = static_cast<int32_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, int64_t& to)
{
to = static_cast<int64_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, uint8_t& to)
{
to = static_cast<uint8_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, uint16_t& to)
{
to = static_cast<uint16_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, uint32_t& to)
{
to = static_cast<uint32_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, uint64_t& to)
{
to = static_cast<uint64_t>(from ? 1 : 0);
return true;
}
static RTTR_INLINE bool to(const bool& from, float& to)
{
to = static_cast<float>(from ? 1.0f : 0.0f);
return true;
}
static RTTR_INLINE bool to(const bool& from, double& to)
{
to = static_cast<double>(from ? 1.0 : 0.0);
return true;
}
static RTTR_INLINE bool to(const bool& from, std::string& to)
{
to = (from ? "true" : "false");
return true;
}
static RTTR_INLINE bool to_enum(const bool& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<char>
{
static RTTR_INLINE bool to(const char& from, bool& to)
{
to = (from != '\0');
return true;
}
static RTTR_INLINE bool to(const char& from, char& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const char& from, int8_t& to)
{
to = static_cast<int8_t>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, int16_t& to)
{
to = static_cast<int16_t>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, int32_t& to)
{
to = static_cast<int32_t>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, int64_t& to)
{
to = static_cast<int64_t>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const char& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const char& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const char& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const char& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const char& from, std::string& to)
{
to = std::string(1, from);
return true;
}
static RTTR_INLINE bool to_enum(const char& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<int8_t>
{
static RTTR_INLINE bool to(const int8_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const int8_t& from, char& to)
{
to = static_cast<char>(from);
return true;
}
static RTTR_INLINE bool to(const int8_t& from, int8_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int8_t& from, int16_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int8_t& from, int32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int8_t& from, int64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int8_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int8_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int8_t& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int8_t& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int8_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const int8_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const int8_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const int8_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<int16_t>
{
static RTTR_INLINE bool to(const int16_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const int16_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, int16_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int16_t& from, int32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int16_t& from, int64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int16_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int16_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const int16_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const int16_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const int16_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<int32_t>
{
static RTTR_INLINE bool to(const int32_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const int32_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, int32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int32_t& from, int64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int32_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int32_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const int32_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const int32_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const int32_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<int64_t>
{
static RTTR_INLINE bool to(const int64_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const int64_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, int64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const int64_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const int64_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const int64_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const int64_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const int64_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<uint8_t>
{
static RTTR_INLINE bool to(const uint8_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint8_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint8_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint8_t& from, int32_t& to)
{
to = static_cast<int32_t>(from);
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, int64_t& to)
{
to = static_cast<int64_t>(from);
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, uint8_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, uint16_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, uint32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, uint64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const uint8_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const uint8_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<uint16_t>
{
static RTTR_INLINE bool to(const uint16_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint16_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint16_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint16_t& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint16_t& from, int64_t& to)
{
to = static_cast<int64_t>(from);
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint16_t& from, uint16_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, uint32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, uint64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const uint16_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const uint16_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<uint32_t>
{
static RTTR_INLINE bool to(const uint32_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const uint32_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, int64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint32_t& from, uint32_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint32_t& from, uint64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint32_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const uint32_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const uint32_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const uint32_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<uint64_t>
{
static RTTR_INLINE bool to(const uint64_t& from, bool& to)
{
to = (from != 0);
return true;
}
static RTTR_INLINE bool to(const uint64_t& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, int64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const uint64_t& from, uint64_t& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const uint64_t& from, float& to)
{
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const uint64_t& from, double& to)
{
to = static_cast<double>(from);
return true;
}
static RTTR_INLINE bool to(const uint64_t& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const uint64_t& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<float>
{
static RTTR_INLINE bool to(const float& from, bool& to)
{
to = !(from <= std::numeric_limits<float>::min() &&
from >= -1 * std::numeric_limits<float>::min());
return true;
}
static RTTR_INLINE bool to(const float& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, int64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const float& from, float& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const float& from, double& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const float& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const float& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<double>
{
static RTTR_INLINE bool to(const double& from, bool& to)
{
to = !(from <= std::numeric_limits<double>::min() &&
from >= -1 * std::numeric_limits<double>::min());
return true;
}
static RTTR_INLINE bool to(const double& from, char& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, int8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, int16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, int32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, int64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, uint8_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, uint16_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, uint32_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, uint64_t& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to(const double& from, float& to)
{
RTTR_CONSTEXPR_OR_CONST double float_min = -1 * std::numeric_limits<float>::max();
RTTR_CONSTEXPR_OR_CONST double float_max = std::numeric_limits<float>::max();
if (from < float_min || from > float_max)
return false;
to = static_cast<float>(from);
return true;
}
static RTTR_INLINE bool to(const double& from, double& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to(const double& from, std::string& to)
{
return convert_to(from, to);
}
static RTTR_INLINE bool to_enum(const double& from, argument& to)
{
return to_enumeration(from, to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
template<>
struct RTTR_API convert_from<std::string>
{
static RTTR_INLINE bool to(const std::string& from, bool& to)
{
bool ok;
to = string_to_bool(from, &ok);
return ok;
}
static RTTR_INLINE bool to(const std::string& from, char& to)
{
const auto& val = from;
if (val.empty())
to ='\0';
else
to = val[0];
return true;
}
static RTTR_INLINE bool to(const std::string& from, int8_t& to)
{
bool ok;
int val = string_to_int(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, int16_t& to)
{
bool ok;
int val = string_to_int(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, int32_t& to)
{
bool ok;
to = string_to_int(from, &ok);
return ok;
}
static RTTR_INLINE bool to(const std::string& from, int64_t& to)
{
bool ok;
to = string_to_long_long(from, &ok);
return ok;
}
static RTTR_INLINE bool to(const std::string& from, uint8_t& to)
{
bool ok;
unsigned int val = string_to_int(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, uint16_t& to)
{
bool ok;
unsigned int val = string_to_int(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, uint32_t& to)
{
bool ok;
const auto val = string_to_ulong(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, uint64_t& to)
{
bool ok;
const auto val = string_to_ulong_long(from, &ok);
if (!ok)
return false;
return convert_to(val, to);
}
static RTTR_INLINE bool to(const std::string& from, float& to)
{
bool ok;
to = string_to_float(from, &ok);
return ok;
}
static RTTR_INLINE bool to(const std::string& from, double& to)
{
bool ok;
to = string_to_double(from, &ok);
return ok;
}
static RTTR_INLINE bool to(const std::string& from, std::string& to)
{
to = from;
return true;
}
static RTTR_INLINE bool to_enum(const std::string& from, argument& to)
{
return to_enumeration(string_view(from), to);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
// MSVC generates following warning: 'warning C4800: 'const enum_bool' : forcing value to bool 'true' or 'false' (performance warning)'
// For unknown reason the MSVC compiler is too dump to recognize that I can safely convert an enumeration
// with underlying type bool, to type bool (thats no int to bool conversion!)
// so we disable the warning for enum conversions:
#if RTTR_COMPILER == RTTR_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable:4800)
#endif
template<typename T>
struct convert_from_enum
{
template<typename T_>
using enum_type_t = typename std::underlying_type<T_>::type;
static RTTR_INLINE enum_type_t<T> get_underlying_value(const T& from)
{
return static_cast<enum_type_t<T>>(from);
}
template<typename T1>
static RTTR_INLINE
enable_if_t<!std::is_same<bool, enum_type_t<T1> >::value, bool>
to(const T1& from, bool& to)
{
const auto value = get_underlying_value(from);
if (value == 0)
{
to = false;
return true;
}
else if (value == 1)
{
to = true;
return true;
}
else
{
return false;
}
}
template<typename T1>
static RTTR_INLINE
enable_if_t<std::is_same<bool, enum_type_t<T1> >::value, bool>
to(const T1& from, bool& to)
{
// for unknown reason MSVC will here scream a warning 'C4800'...
to = static_cast<bool>(from);
return true;
}
static RTTR_INLINE bool to(const T& from, char& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, int8_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, int16_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, int32_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, int64_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, uint8_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, uint16_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, uint32_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, uint64_t& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, float& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, double& to)
{
return convert_from<enum_type_t<T>>::to(get_underlying_value(from), to);
}
static RTTR_INLINE bool to(const T& from, std::string& to)
{
to = get_enumeration_name(from).to_string();
return (to.empty() == false);
}
static RTTR_INLINE bool to_enum(const T& from, argument& to)
{
return false;
}
};
/////////////////////////////////////////////////////////////////////////////////////////
#if RTTR_COMPILER == RTTR_COMPILER_MSVC
// restore warning level
#pragma warning(pop)
#endif
/////////////////////////////////////////////////////////////////////////////////////////
} // end namespace detail
} // end namespace rttr
#endif // RTTR_VARIANT_DATA_CONVERTER_H_
| {
"content_hash": "ae4fd3e2a06f0f23003954ec0d58bcd8",
"timestamp": "",
"source": "github",
"line_count": 1432,
"max_line_length": 135,
"avg_line_length": 24.38477653631285,
"alnum_prop": 0.5375869870271199,
"repo_name": "rttrorg/rttr",
"id": "d0e94e4a7904ae96cb77b7a125e3c5af4c4f79db",
"size": "37155",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/rttr/detail/variant/variant_data_converter.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "2684229"
},
{
"name": "CMake",
"bytes": "158994"
}
],
"symlink_target": ""
} |
package Jan2021Leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class _0040CombinationSumII {
public static void main(String[] args) {
System.out.println(combinationSum2(new int[] { 10, 1, 2, 7, 6, 1, 5 }, 8));
System.out.println(combinationSum2(new int[] { 2, 5, 2, 1, 2 }, 5));
}
public static List<List<Integer>> combinationSum2(int[] candidates, int target) {
List<List<Integer>> output = new ArrayList<List<Integer>>();
Arrays.sort(candidates);
combinationSum(0, candidates, target, 0, new ArrayList<Integer>(), output, new HashSet<List<Integer>>());
return output;
}
public static void combinationSum(int index, int[] candidates, int target, int currSum, List<Integer> list,
List<List<Integer>> output, HashSet<List<Integer>> set) {
if (currSum == target) {
if (!set.contains(list)) {
set.add(list);
output.add(new ArrayList<Integer>(list));
}
return;
}
if (currSum > target || index >= candidates.length) {
return;
}
for (int i = index; i < candidates.length; i++) {
list.add(candidates[i]);
combinationSum(i + 1, candidates, target, currSum + candidates[i], list, output, set);
list.remove(list.size() - 1);
}
}
}
| {
"content_hash": "ab5a9dc17dc6f10edfdbc42ecbfe0003",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 108,
"avg_line_length": 30.73170731707317,
"alnum_prop": 0.6753968253968254,
"repo_name": "darshanhs90/Java-InterviewPrep",
"id": "1456e6e250a65f1da4f51f6af1d3c4bd6c754cc7",
"size": "1260",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Jan2021Leetcode/_0040CombinationSumII.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1870066"
}
],
"symlink_target": ""
} |
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0, parentdir)
import base64
import click
import config
import service
import requests
import urlparse
import utilities as util
REQUEST_TOKEN_URL = 'https://accounts.spotify.com/en/authorize'
ACCESS_TOKEN_URL = 'https://accounts.spotify.com/api/token'
CALLBACK_URI = 'http://127.0.0.1/spotify-smart-radio'
API_BASE_URL = 'https://api.spotify.com'
class SpotifyStateError(Exception):
"""
A Spotify error to be raised when the state values between Spotify requests
and responses don't match.
"""
pass
def authorize(client_id, client_secret, config):
"""
A module method to authorize Spotify using a OAuth client ID and client
secret.
"""
state = util.random_string(14)
scope = 'playlist-modify-private'
authorization_url = '{}?client_id={}&response_type=code'.format(
REQUEST_TOKEN_URL,
client_id
)
authorization_url += '&redirect_uri={}&state={}&scope={}'.format(
CALLBACK_URI,
state,
scope
)
if config.verbose:
util.debug('Authorization URL constructed: {}'.format(authorization_url))
# Prompt the user to authorize via a browser:
util.info('Now opening a browser to authorize your Spotify account.')
util.info('Once authorized, copy/paste the URL of that browser window here.')
util.info('Finally, hit enter to complete the auhtorization process.')
util.confirm('Do you want to continue?')
util.open_url(authorization_url)
# Deal with the return code:
authorization_response = util.prompt('Enter the URL', None)
parsed = urlparse.urlparse(authorization_response)
authorization_args = urlparse.parse_qs(parsed.query)
if config.verbose:
util.debug('Authorization arguments: {}'.format(authorization_args))
# Check to make sure the states between request and response match:
if state == authorization_args.get('state')[0]:
if 'code' in authorization_args:
# The authorization succeeded:
params = {
'client_id': client_id,
'client_secret': client_secret,
'grant_type': 'authorization_code',
'code': authorization_args.get('code')[0],
'redirect_uri': CALLBACK_URI
}
r = requests.post(ACCESS_TOKEN_URL, data=params)
if config.verbose:
util.debug('Access response: {}'.format(r.content))
return r.json()
else:
# The authorization failed:
if 'error' in authorization_args:
raise music_service.AuthorizationError(authorization_args.get('error')[0])
else:
raise music_service.AuthorizationError('unknown authorization error')
else:
raise SpotifyStateError()
| {
"content_hash": "72ececb0458e9275ac988a1d3e7e1486",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 90,
"avg_line_length": 34.082352941176474,
"alnum_prop": 0.6444597859855022,
"repo_name": "bachya/spotify-smart-radio",
"id": "15748019e8f95324667a678c046d16e71e0ac49d",
"size": "2897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/services/spotify.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "13804"
}
],
"symlink_target": ""
} |
import * as db from '../db'
import { State } from '../types'
type UpsertRemote = Pick<
Schema.ApplicationRemote,
'remote' | 'state' | 'state' | 'sha' | 'seen' | 'age'
>
export async function insertRemote(app: Schema.Application, props: UpsertRemote) {
const existing = await db.getRemote(app.id, props.remote)
if (existing) {
const error = 'Attempting to insert remote that already exists'
log.error(error)
throw new Error(error)
}
await db.insertRemote({
applicationId: app.id,
remote: props.remote,
seen: props.seen,
sha: props.sha,
state: props.state,
age: props.age
} as Schema.ApplicationRemote)
}
export async function updateRemoteState(app: Schema.Application, remote: string, state: State) {
await db.updateRemote(app.id, remote, { state })
}
| {
"content_hash": "d8a26bcea9a201caf24be4bddfad2cf0",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 96,
"avg_line_length": 27.82758620689655,
"alnum_prop": 0.6840148698884758,
"repo_name": "the-concierge/concierge",
"id": "202e718c3a5969b25d80d3b76be89c67eec702ac",
"size": "807",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/api/applications/monitor/util.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "302"
},
{
"name": "HTML",
"bytes": "574"
},
{
"name": "JavaScript",
"bytes": "2337"
},
{
"name": "TypeScript",
"bytes": "137494"
},
{
"name": "Vue",
"bytes": "95369"
}
],
"symlink_target": ""
} |
all:printhzk
printhzk:main.c
gcc -fexec-charset=gbk -o printhzk main.c
clean:
rm -rf printhzk
| {
"content_hash": "13fe374ae8016d9dff620905b5d5ac23",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 42,
"avg_line_length": 19.2,
"alnum_prop": 0.7604166666666666,
"repo_name": "x7hub/arm_hzk",
"id": "c0fed31c7a76f2b74c095e245d1437f6898b9e78",
"size": "96",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "i686/Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4568"
},
{
"name": "Erlang",
"bytes": "61"
},
{
"name": "JavaScript",
"bytes": "64"
},
{
"name": "Perl",
"bytes": "15413"
},
{
"name": "Python",
"bytes": "930"
},
{
"name": "Ruby",
"bytes": "216"
},
{
"name": "Scala",
"bytes": "79"
},
{
"name": "Shell",
"bytes": "99789"
}
],
"symlink_target": ""
} |
package shadowsocks.crypto;
import org.bouncycastle.crypto.StreamCipher;
import java.io.ByteArrayOutputStream;
import shadowsocks.crypto.CryptoException;
import shadowsocks.crypto.Utils;
import shadowsocks.crypto.DecryptState;
/**
* Crypt base class implementation
*/
public abstract class BaseStreamCrypto implements SSCrypto
{
protected final String mName;
protected final byte[] mKey;
protected final int mIVLength;
protected final int mKeyLength;
protected StreamCipher mEncryptCipher = null;
protected StreamCipher mDecryptCipher = null;
protected byte[] mEncryptIV;
protected byte[] mDecryptIV;
// One SSCrypto could only do one decrypt/encrypt at the same time.
protected ByteArrayOutputStream mData;
private byte [] mLock = new byte[0];
protected abstract StreamCipher createCipher(byte[] iv, boolean encrypt);
protected abstract void process(byte[] in, ByteArrayOutputStream out, boolean encrypt);
public BaseStreamCrypto(String name, String password) throws CryptoException
{
mName = name.toLowerCase();
mIVLength = getIVLength();
mKeyLength = getKeyLength();
mKey = Utils.getKey(password, mKeyLength, mIVLength);
mData = new ByteArrayOutputStream();
}
public byte [] getKey(){
return mKey;
}
public byte [] getIV(boolean encrypt){
if (encrypt){
if (mEncryptIV == null){
mEncryptIV = Utils.randomBytes(mIVLength);
}
return mEncryptIV;
}else
return mDecryptIV;
}
private byte [] encryptLocked(byte[] in)
{
mData.reset();
if (mEncryptCipher == null) {
mEncryptIV = getIV(true);
mEncryptCipher = createCipher(mEncryptIV, true);
mData.write(mEncryptIV, 0, getIVLength());
}
process(in, mData, true);
return mData.toByteArray();
}
@Override
public byte [] encrypt(byte[] in)
{
synchronized(mLock) {
return encryptLocked(in);
}
}
private byte[] decryptLocked(byte[] in)
{
byte[] data;
mData.reset();
if (mDecryptCipher == null) {
mDecryptCipher = createCipher(in, false);
mDecryptIV = new byte[mIVLength];
data = new byte[in.length - mIVLength];
System.arraycopy(in, 0, mDecryptIV, 0, mIVLength);
System.arraycopy(in, mIVLength, data, 0, in.length - mIVLength);
} else {
data = in;
}
process(data, mData, false);
return mData.toByteArray();
}
@Override
public byte [][] decrypt(byte[] in)
{
byte result[][] = new byte[2][];
result[1] = null;
synchronized(mLock) {
result[0] = decryptLocked(in);
}
return result;
}
public int getLastDecryptState()
{
return DecryptState.SUCCESS;
}
}
| {
"content_hash": "5674aec40862bea0bd314b7b917b25a2",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 91,
"avg_line_length": 26.5625,
"alnum_prop": 0.6100840336134454,
"repo_name": "bestoa/shadowsocks-java",
"id": "14322e0f42edbaee22035fa1ab002e52a3a35ba8",
"size": "3608",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/shadowsocks/crypto/BaseStreamCrypto.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "64907"
}
],
"symlink_target": ""
} |
package com.miicard.consumers.service.v1.claims.impl;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@SuppressWarnings("restriction")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"snapshotId"
})
@XmlRootElement(name = "GetIdentitySnapshotPdf", namespace = "http://tempuri.org/")
class GetIdentitySnapshotPdf {
@XmlElement(namespace = "http://tempuri.org/", nillable = true)
protected String snapshotId;
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*
*/
public final String getSnapshotId() {
return snapshotId;
}
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*
*/
public final void setSnapshotId(
final String value) {
this.snapshotId = value;
}
}
| {
"content_hash": "079b7361ce2d5fbacea1ae4b53df0749",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 83,
"avg_line_length": 25.558139534883722,
"alnum_prop": 0.6624203821656051,
"repo_name": "miiCard/api-wrappers-java",
"id": "5c3dd97428240b535af8b43423d5ea297ade17dc",
"size": "1099",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "miicard-consumers/src/main/java/com/miicard/consumers/service/v1/claims/impl/GetIdentitySnapshotPdf.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "505"
},
{
"name": "Java",
"bytes": "304774"
}
],
"symlink_target": ""
} |
function demoBrowserSpecific() {
$demo.append(
BrowserSpecific.create({
"webkit": "You are using WebKit.",
"msie": "You are using Internet Explorer.",
"mozilla": "You are using Firefox.",
"default": "You are using some unknown browser."
})
);
}
| {
"content_hash": "85a894bd0dd2fc21213c4b3c0e08c95b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 23.916666666666668,
"alnum_prop": 0.6027874564459931,
"repo_name": "JanMiksovsky/quickui-catalog",
"id": "56416d04109991c2c43031d21483908d0f1b2bf5",
"size": "287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/BrowserSpecific/demo.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "208394"
},
{
"name": "JavaScript",
"bytes": "40898"
}
],
"symlink_target": ""
} |
const fs = require('fs')
const et = require('elementtree')
const appPaths = require('../app-paths')
const { log, warn } = require('../helpers/logger')
const ensureConsistency = require('./ensure-consistency')
const filePath = appPaths.resolve.cordova('config.xml')
function setFields (root, cfg) {
Object.keys(cfg).forEach(key => {
const el = root.find(key)
const values = cfg[key]
const isObject = Object(values) === values
if (!el) {
if (isObject) {
et.SubElement(root, key, values)
}
else {
let entry = et.SubElement(root, key)
entry.text = values
}
}
else {
if (isObject) {
Object.keys(values).forEach(key => {
el.set(key, values[key])
})
}
else {
el.text = values
}
}
})
}
class CordovaConfig {
prepare (cfg) {
ensureConsistency()
const doc = et.parse(fs.readFileSync(filePath, 'utf-8'))
this.pkg = require(appPaths.resolve.app('package.json'))
this.APP_URL = cfg.build.APP_URL
this.tamperedFiles = []
const root = doc.getroot()
root.set('version', cfg.cordova.version || this.pkg.version)
if (cfg.cordova.androidVersionCode) {
root.set('android-versionCode', cfg.cordova.androidVersionCode)
}
setFields(root, {
content: { src: this.APP_URL },
description: cfg.cordova.description || this.pkg.description
})
if (this.APP_URL !== 'index.html' && !root.find(`allow-navigation[@href='${this.APP_URL}']`)) {
et.SubElement(root, 'allow-navigation', { href: this.APP_URL })
if (cfg.devServer.server.type === 'https' && cfg.ctx.targetName === 'ios') {
const node = root.find('name')
if (node) {
this.__prepareAppDelegate(node)
this.__prepareWkWebEngine(node)
}
}
}
// needed for QResizeObserver until ResizeObserver Web API is supported by all platforms
if (!root.find(`allow-navigation[@href='about:*']`)) {
et.SubElement(root, 'allow-navigation', { href: 'about:*' })
}
this.__save(doc)
}
reset () {
if (!this.APP_URL || this.APP_URL === 'index.html') {
return
}
const doc = et.parse(fs.readFileSync(filePath, 'utf-8'))
const root = doc.getroot()
root.find('content').set('src', 'index.html')
const nav = root.find(`allow-navigation[@href='${this.APP_URL}']`)
if (nav) {
root.remove(nav)
}
this.tamperedFiles.forEach(file => {
file.content = file.originalContent
})
this.__save(doc)
this.tamperedFiles = []
}
__save (doc) {
const content = doc.write({ indent: 4 })
fs.writeFileSync(filePath, content, 'utf8')
log('Updated Cordova config.xml')
this.tamperedFiles.forEach(file => {
fs.writeFileSync(file.path, file.content, 'utf8')
log(`Updated ${file.name}`)
})
}
__prepareAppDelegate (node) {
const appDelegatePath = appPaths.resolve.cordova(
`platforms/ios/${node.text}/Classes/AppDelegate.m`
)
if (!fs.existsSync(appDelegatePath)) {
warn()
warn()
warn()
warn()
warn(`AppDelegate.m not found. Your App will revoke the devserver's SSL certificate.`)
warn(`Please report the cordova CLI version and cordova-ios package that you are using.`)
warn(`Also, disable HTTPS from quasar.config.js > devServer > server > type: 'https'`)
warn()
warn()
warn()
warn()
}
else {
const tamperedFile = {
name: 'AppDelegate.m',
path: appDelegatePath
}
tamperedFile.originalContent = fs.readFileSync(appDelegatePath, 'utf-8')
// required for allowing devserver's SSL certificate on iOS
if (tamperedFile.originalContent.indexOf('allowsAnyHTTPSCertificateForHost') === -1) {
tamperedFile.content = tamperedFile.originalContent + `
@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES;
}
@end
`
this.tamperedFiles.push(tamperedFile)
}
}
}
__prepareWkWebEngine (node) {
[
'cordova-plugin-ionic-webview',
'cordova-plugin-wkwebview-engine'
].forEach(plugin => {
const wkWebViewEnginePath = appPaths.resolve.cordova(
`platforms/ios/${node.text}/Plugins/${plugin}/CDVWKWebViewEngine.m`
)
if (fs.existsSync(wkWebViewEnginePath)) {
const tamperedFile = {
name: `${plugin} > CDVWKWebViewEngine.m`,
path: wkWebViewEnginePath
}
tamperedFile.originalContent = fs.readFileSync(wkWebViewEnginePath, 'utf-8')
// Credit: https://gist.github.com/PeterStegnar/63cb8c9a39a13265c3a855e24a33ca37#file-cdvwkwebviewengine-m-L68-L74
// Enables untrusted SSL connection
if (tamperedFile.originalContent.indexOf('SecTrustRef serverTrust = challenge.protectionSpace.serverTrust') === -1) {
const lookupString = '@implementation CDVWKWebViewEngine'
const insertIndex = tamperedFile.originalContent.indexOf(lookupString) + lookupString.length
tamperedFile.content = tamperedFile.originalContent.substring(0, insertIndex) + `
- (void)webView:(WKWebView *)webView
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:serverTrust]);
}
` + tamperedFile.originalContent.substring(insertIndex)
this.tamperedFiles.push(tamperedFile)
}
}
})
}
}
module.exports = CordovaConfig
| {
"content_hash": "efef538ad7867c8213c81dccc94fa435",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 128,
"avg_line_length": 29.370558375634516,
"alnum_prop": 0.6436225371586588,
"repo_name": "quasarframework/quasar",
"id": "99401ca0e9acd544ed6dc9170644f9b824f622b8",
"size": "5786",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "app-webpack/lib/cordova/cordova-config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2006590"
},
{
"name": "HTML",
"bytes": "26041"
},
{
"name": "JavaScript",
"bytes": "27008546"
},
{
"name": "SCSS",
"bytes": "4830"
},
{
"name": "Sass",
"bytes": "217157"
},
{
"name": "Shell",
"bytes": "9511"
},
{
"name": "Stylus",
"bytes": "1516"
},
{
"name": "TypeScript",
"bytes": "54448"
},
{
"name": "Vue",
"bytes": "1521880"
}
],
"symlink_target": ""
} |
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_s3::config::retry::RetryConfig;
use aws_sdk_s3::{config, Client, Error, Region, PKG_VERSION};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The AWS Region.
#[structopt(short, long)]
region: Option<String>,
/// The number of (re)tries.
#[structopt(short, long, default_value = "2")]
tries: u32,
/// Whether to display additional information.
#[structopt(short, long)]
verbose: bool,
}
// Shows your buckets.
async fn show_num_buckets(client: &Client) -> Result<(), Error> {
let resp = client.list_buckets().send().await?;
let buckets = resp.buckets().unwrap_or_default();
println!("Found {} buckets in all regions.", buckets.len());
Ok(())
}
/// Displays how many Amazon S3 buckets you have.
/// # Arguments
///
/// * `[-r REGION]` - The Region in which the client is created.
/// If not supplied, uses the value of the **AWS_REGION** environment variable.
/// If the environment variable is not set, defaults to **us-west-2**.
/// * `[-t TRIES]` - The number of times to (re)try the request.
/// * `[-v]` - Whether to display additional information.
#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
let Opt {
region,
tries,
verbose,
} = Opt::from_args();
let region_provider = RegionProviderChain::first_try(region.map(Region::new))
.or_default_provider()
.or_else(Region::new("us-west-2"));
println!();
if verbose {
println!("S3 client version: {}", PKG_VERSION);
println!(
"Region: {}",
region_provider.region().await.unwrap().as_ref()
);
println!("Retries: {}", &tries);
println!();
}
assert_ne!(tries, 0, "You cannot set zero retries.");
// snippet-start:[custom_retries.rust.set_retries]
let shared_config = aws_config::from_env().region(region_provider).load().await;
// Construct an S3 client with customized retry configuration.
let client = Client::from_conf(
// Start with the shared environment configuration.
config::Builder::from(&shared_config)
// Set max attempts.
// If tries is 1, there are no retries.
.retry_config(RetryConfig::standard().with_max_attempts(tries))
.build(),
);
// snippet-end:[custom_retries.rust.set_retries]
show_num_buckets(&client).await
}
| {
"content_hash": "eb8250855a4524d1457d98ad29f57385",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 84,
"avg_line_length": 30.44578313253012,
"alnum_prop": 0.6074396517609814,
"repo_name": "awsdocs/aws-doc-sdk-examples",
"id": "70475f56ce0b472399947c6c698a69d9ee01c943",
"size": "2643",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "rust_dev_preview/sdk-config/src/bin/set_retries.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ABAP",
"bytes": "476653"
},
{
"name": "Batchfile",
"bytes": "900"
},
{
"name": "C",
"bytes": "3852"
},
{
"name": "C#",
"bytes": "2051923"
},
{
"name": "C++",
"bytes": "943634"
},
{
"name": "CMake",
"bytes": "82068"
},
{
"name": "CSS",
"bytes": "33378"
},
{
"name": "Dockerfile",
"bytes": "2243"
},
{
"name": "Go",
"bytes": "1764292"
},
{
"name": "HTML",
"bytes": "319090"
},
{
"name": "Java",
"bytes": "4966853"
},
{
"name": "JavaScript",
"bytes": "1655476"
},
{
"name": "Jupyter Notebook",
"bytes": "9749"
},
{
"name": "Kotlin",
"bytes": "1099902"
},
{
"name": "Makefile",
"bytes": "4922"
},
{
"name": "PHP",
"bytes": "1220594"
},
{
"name": "Python",
"bytes": "2507509"
},
{
"name": "Ruby",
"bytes": "500331"
},
{
"name": "Rust",
"bytes": "558811"
},
{
"name": "Shell",
"bytes": "63776"
},
{
"name": "Swift",
"bytes": "267325"
},
{
"name": "TypeScript",
"bytes": "119632"
}
],
"symlink_target": ""
} |
String.prototype.lpad = function (length) {
return ("0000" + this.toString()).slice(length * -1);
};
////////////////////////////////////////////////
var asmparser = require('./asmparser');
var CPU = require('./CPU');
var cpu = new CPU({
output: document.getElementById('output')
});
window.cpu = cpu;
var Keyboard = require('./Devices/Keyboard');
// Install keyboard with buffer on 0xF5E1 and 256 bytes of buffer
cpu.installDevice(Keyboard, 0xF5E0, 256);
// Install sys interrupts
var sysInts = require('./SysInts');
cpu.assignInterrupt(0x1, sysInts)
// Bind labels to clock
cpu.clock.on('tick', function () {
document.getElementById('meta-PC').innerHTML = cpu.PC.toString(16).lpad(4);
document.getElementById('meta-SP').innerHTML = cpu.SP.toString(16).lpad(4);
document.getElementById('meta-A').innerHTML = cpu.memory.readReg(0).toString(16).lpad(2);
document.getElementById('meta-B').innerHTML = cpu.memory.readReg(1).toString(16).lpad(2);
document.getElementById('meta-C').innerHTML = cpu.memory.readReg(2).toString(16).lpad(2);
document.getElementById('meta-D').innerHTML = cpu.memory.readReg(3).toString(16).lpad(2);
document.getElementById('meta-XL').innerHTML = cpu.memory.readReg(4).toString(16).lpad(2);
document.getElementById('meta-XH').innerHTML = cpu.memory.readReg(5).toString(16).lpad(2);
document.getElementById('meta-YL').innerHTML = cpu.memory.readReg(6).toString(16).lpad(2);
document.getElementById('meta-YH').innerHTML = cpu.memory.readReg(7).toString(16).lpad(2);
document.getElementById('meta-X').innerHTML = cpu.memory.readReg(20).toString(16).lpad(4);
document.getElementById('meta-Y').innerHTML = cpu.memory.readReg(22).toString(16).lpad(4);
document.getElementById('flag-C').innerHTML = (cpu.flags.carry) ? '1' : '0';
document.getElementById('flag-P').innerHTML = (cpu.flags.parity) ? '1' : '0';
document.getElementById('flag-Z').innerHTML = (cpu.flags.zero) ? '1' : '0';
document.getElementById('flag-S').innerHTML = (cpu.flags.sign) ? '1' : '0';
document.getElementById('flag-O').innerHTML = (cpu.flags.overflow) ? '1' : '0';
});
// Replace log
cpu.log = function () {
if (this.debug) {
var args = Array.prototype.slice.call(arguments);
doLog(args.map(function (e) { return (typeof e === 'string') ? e : JSON.stringify(e) }).join("\t"));
}
};
// Instantiate memviewer
var MemViewer = require('./MemViewer');
var mv = new MemViewer(document.getElementById('memMap'), cpu.memory._raw, 0);
mv.clock.on('tick', function () {
document.getElementById('memMap-from').innerHTML = mv.offset.toString(16).lpad(4);
document.getElementById('memMap-to').innerHTML = (mv.offset + mv.viewportLength).toString(16).lpad(4);
});
mv.start();
window.mv = mv;
// Bind some UI buttons
document.getElementById('ctrl-speed-up').addEventListener('click', function () {
cpu.clock.speed += 10;
doLog('Set speed to', cpu.clock.speed);
});
document.getElementById('ctrl-speed-down').addEventListener('click', function () {
cpu.clock.speed -= 10;
doLog('Set speed to', cpu.clock.speed);
});
document.getElementById('ctrl-speed-set').addEventListener('click', function () {
cpu.clock.speed = parseInt(prompt('Set new clock speed:', '1000'), 10);
doLog('Set speed to', cpu.clock.speed);
});
document.getElementById('ctrl-mv-up').addEventListener('click', function () {
try {
var off = mv.offset, newOffset = off + mv.viewportLength;
mv.offset = newOffset;
doLog('Set memviewer to', mv.offset.toString(16).lpad(4));
} catch (e) {
doLog('Memory limit reached in memviewer');
}
});
document.getElementById('ctrl-mv-down').addEventListener('click', function () {
try {
var off = mv.offset, newOffset = off - mv.viewportLength;
mv.offset = newOffset;
doLog('Set memviewer to', mv.offset.toString(16).lpad(4));
} catch (e) {
doLog('Memory limit reached in memviewer');
}
});
document.getElementById('ctrl-mv-set').addEventListener('click', function () {
var newOffset = parseInt(prompt('Set new memview offset (hex): 0x', 'F5E0'), 16);
if (isNaN(newOffset)) {
doLog('Error! Offset', newOffset, 'is not a number');
return;
}
mv.offset = newOffset;
doLog('Set offset to', mv.offset);
});
// Bind hotkeys
window.addEventListener('keydown', function (e) {
//console.log(e.which);
// Ctrl C Compile
if (e.ctrlKey && e.which === 67) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
cpu.halt();
try {
cpu.reset();
var r = asmparser(document.getElementById('code-txt').value);
cpu.loadProgram(Uint8Array.from(r.bytecode));
} catch (e) {
console.error(e);
return;
}
}
// Ctrl R to reset
if (e.ctrlKey && e.which === 82) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
cpu.reset();
}
// Ctrl P to Pause/resume
if (e.ctrlKey && e.which === 80) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
if (cpu.clock.timer !== null) {
cpu.halt();
} else {
cpu.run();
}
e.preventDefault();
return false;
}
// Ctrl D to debug
if (e.ctrlKey && e.which === 68) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
cpu.toggleDebug();
doLog('Set debug to:', cpu.debug);
return false;
}
});
| {
"content_hash": "0ddcbfb9b86c1cc690502b2b38fc17e4",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 104,
"avg_line_length": 35.47682119205298,
"alnum_prop": 0.6585775620683219,
"repo_name": "yagarasu/nanofeather",
"id": "78f0a908ac7c7c9a29e7eb842c247835617aba37",
"size": "5374",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "33332"
}
],
"symlink_target": ""
} |
/*
* File: Transformation.h
* Author: Matt
*
* Created on 26 March 2014, 18:48
*/
#ifndef TRANSFORMATION_H
#define TRANSFORMATION_H
#include "include/vertex.h"
#include "include/vector.h"
#include "include/ray.h"
#include "include/hit.h"
class Transformation{
public:
float A, B, C, D,
E, F, G, H,
I, J, K, L;
Transformation* t_next;
Transformation();
void link(Transformation *obj);
Transformation *next(void);
void set(float a, float b, float c, float d,
float e, float f, float g, float h,
float i, float j, float k, float l);
void rotationx(float alpha);
void rotationy(float alpha);
void rotationz(float alpha);
void translation(float x, float y, float z);
void scale(float x, float y, float z);
void identity();
Vertex transform(Vertex v);
Vector transform(Vector v);
Ray transform(Ray r);
Hit transform(Hit h);
Transformation composeWith(const Transformation t);
Transformation inverse();
};
#endif /* TRANSFORMATION_H */
| {
"content_hash": "4f6f75d4019014ce6870f952279fc654",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 55,
"avg_line_length": 24.711111111111112,
"alnum_prop": 0.6088129496402878,
"repo_name": "mrudelle/ray-tracer",
"id": "90352a9ef5e21885e05d49a93164c54beddeacc9",
"size": "1112",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/transformation.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "497"
},
{
"name": "C++",
"bytes": "60297"
},
{
"name": "Makefile",
"bytes": "2283"
},
{
"name": "Shell",
"bytes": "968"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "f3ccd668f96d9ee0c0289f4a715bd5cb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "bd65b81cb197933e0caf7d1a8b8b09c1b6a1d74f",
"size": "194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Menispermaceae/Cissampelos/Cissampelos torulosa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.kritikal.fabric.core;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;
import java.util.function.BiConsumer;
/**
* Created by ben on 10/30/16.
*/
public final class Role {
public Role(String[] depends, String roleName, BiConsumer<Future, JsonArray> startRoleVerticle) {
this.depends = depends;
this.roleName = roleName;
this.startRoleVerticle = startRoleVerticle;
}
public String[] depends;
public String roleName;
public BiConsumer<Future, JsonArray> startRoleVerticle;
}
| {
"content_hash": "845bf1bb8448b653de87b352bfd252a9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 101,
"avg_line_length": 25.136363636363637,
"alnum_prop": 0.7142857142857143,
"repo_name": "KritikalFabric/corefabric.io",
"id": "d3bfbc9799a8c31b6e5f1383381f8d7222adfcb2",
"size": "553",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/kritikal/fabric/core/Role.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "475506"
},
{
"name": "Dockerfile",
"bytes": "134"
},
{
"name": "HTML",
"bytes": "1576582"
},
{
"name": "Java",
"bytes": "2550812"
},
{
"name": "JavaScript",
"bytes": "597751"
},
{
"name": "Shell",
"bytes": "15278"
},
{
"name": "TypeScript",
"bytes": "63079"
}
],
"symlink_target": ""
} |
using System;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Security.Profile;
using DotNetNuke.Security.Membership;
using DotNetNuke.Security.Roles;
using DotNetNuke.Entities.Users;
using System.Collections.Generic;
using DotNetNuke.Common.Utilities;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.EntityClient;
using System.Data.Entity;
using System.Linq;
using System.Collections;
using System.Web.UI.WebControls;
using Aspose.Email.Google;
using Aspose.Email.Mail;
using System.IO;
using System.Net;
using System.Net.Security;
using Aspose.Email.Services.Google;
using Aspose.DNN.GmailSync.Components;
using Aspose.DNN.GmailSync.Data;
using DotNetNuke.Entities.Profile;
namespace Aspose.DNN.GmailSync
{
public partial class View : GmailSyncModuleBase, IActionable
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (UserId > 0)
{
LoggedInErrorDiv.Visible = false;
moduleMainDiv.Visible = true;
}
else
{
LoggedInErrorDiv.Visible = true;
moduleMainDiv.Visible = false;
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
public ModuleActionCollection ModuleActions
{
get
{
var actions = new ModuleActionCollection
{
{
GetNextActionID(), Localization.GetString("EditModule", LocalResourceFile), "", "", "",
EditUrl(), false, SecurityAccessLevel.Edit, true, false
}
};
return actions;
}
}
private bool GmailSettingsExist
{
get
{
Aspose_GmailSync_ServerDetails gmailDetailsList = DatabaseHelper.CheckGmailDetails(UserId);
if (gmailDetailsList != null)
{
return true;
}
else
{
return false;
}
}
}
private void ResetControls()
{
GmailToDnnSync.Visible = false;
DnnToGmailSync.Visible = false;
GmailSettings.Visible = false;
}
protected void GmailToDnnHyperLink_Click(object sender, EventArgs e)
{
ResetControls();
if (GmailSettingsExist)
{
GmailToDnnSync.ResetControls();
GmailToDnnSync.Visible = true;
}
else
{
GmailSettings.Visible = true;
GmailToDnnClickedHiddenField.Value = "true";
}
}
protected void DnnToGmailHyperLink_Click(object sender, EventArgs e)
{
ResetControls();
if (GmailSettingsExist)
{
DnnToGmailSync.ResetControls();
DnnToGmailSync.Visible = true;
}
else
{
GmailSettings.Visible = true;
DnnToGmailClickedHiddenField.Value = "true";
}
}
protected void GmailSettingsHyperLink_Click(object sender, EventArgs e)
{
Aspose_GmailSync_ServerDetails gmailDetailsList = DatabaseHelper.CheckGmailDetails(UserId);
if (gmailDetailsList != null)
{
EmailAddressTextBox.Text = gmailDetailsList.Email;
ClientIDTextBox.Text = gmailDetailsList.ClientID;
PasswordTextBox.Text = gmailDetailsList.Password;
ClientSecretTextBox.Text = gmailDetailsList.ClientSecret.ToString();
}
ResetControls();
GmailSettings.Visible = true;
}
protected void SaveButton_Click(object sender, EventArgs e)
{
GmailCredsErrorDiv.Visible = false;
Aspose_GmailSync_ServerDetails serverDetails = new Aspose_GmailSync_ServerDetails();
serverDetails.Email = EmailAddressTextBox.Text.Trim();
if (serverDetails.Email.Contains("@"))
{
serverDetails.Username = serverDetails.Email.Split('@')[0];
}
serverDetails.Password = PasswordTextBox.Text.Trim();
serverDetails.ClientID = ClientIDTextBox.Text.Trim();
serverDetails.ClientSecret = ClientSecretTextBox.Text.Trim();
serverDetails.DNNUserID = UserId;
try
{
string refresh_token = string.Empty;
//Code segment - START
//This segment of code is used to get the refresh_token. In general, you do not have to refresh refresh_token every time, you need to do it once, and then use it to retrieve access-token.
//Thus, use it once to retrieve the refresh_token and then use the refresh_token value each time.
string access_token; string token_type; int expires_in;
GoogleTestUser user = new GoogleTestUser(serverDetails.Username, serverDetails.Email, serverDetails.Password, serverDetails.ClientID, serverDetails.ClientSecret);
GoogleOAuthHelper.GetAccessToken(user, out access_token, out refresh_token, out token_type, out expires_in);
serverDetails.RefreshToken = refresh_token;
//Code segment - END
using (IGmailClient client = Aspose.Email.Google.GmailClient.GetInstance(serverDetails.ClientID, serverDetails.ClientSecret, serverDetails.RefreshToken))
{
FeedEntryCollection groups = client.FetchAllGroups();
}
}
catch (Exception)
{
GmailCredsErrorDiv.Visible = true;
return;
}
serverDetails.Password = Crypto.Encrypt(serverDetails.Password);
serverDetails.ClientID = Crypto.Encrypt(serverDetails.ClientID);
serverDetails.ClientSecret = Crypto.Encrypt(serverDetails.ClientSecret);
serverDetails.RefreshToken = Crypto.Encrypt(serverDetails.RefreshToken);
DatabaseHelper.AddUpdateServerDetails(serverDetails);
ResetControls();
if (GmailToDnnClickedHiddenField.Value.Equals("true"))
{
GmailToDnnSync.Visible = true;
GmailToDnnClickedHiddenField.Value = "false";
}
else if (DnnToGmailClickedHiddenField.Value.Equals("true"))
{
DnnToGmailSync.Visible = true;
DnnToGmailClickedHiddenField.Value = "false";
}
}
protected void CancelButton_Click(object sender, EventArgs e)
{
ResetControls();
}
}
} | {
"content_hash": "0ea7ba2f78ffa4bb489dd10c2d8b996e",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 203,
"avg_line_length": 35.07981220657277,
"alnum_prop": 0.5570128479657388,
"repo_name": "asposemarketplace/Aspose_for_DNN",
"id": "8ad8871d5c180e0aeac19ddf672eb397aa44bc28",
"size": "8025",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Aspose.DNN/Aspose.DNN.GmailSync/View.ascx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "81807"
},
{
"name": "C#",
"bytes": "338054"
},
{
"name": "CSS",
"bytes": "21851"
},
{
"name": "PowerShell",
"bytes": "46739"
},
{
"name": "Visual Basic",
"bytes": "82474"
}
],
"symlink_target": ""
} |
static suic::Mulstr VSTEMPLATENAME = "MPFTemplate";
void VSManager::UnzipTo(const suic::String& strZipPath, const suic::String& strDir, const suic::String& name)
{
XRUnzip xrZip;
//suic::Byte* prjData = new suic::Byte[data.Length()];
//memcpy(prjData, data.c_str(), data.Length());
//suic::Mulstr data;
//Utils::ReadResFromFile(suic::Mulstr(strZipPath.c_str()).c_str(), "rb", data);
if (xrZip.OpenFromFile(strZipPath.c_str()))
{
int index = 0;
for (;;)
{
suic::String shortFile;
suic::ByteStream unzipData;
int iSize = xrZip.GetZipItemData(index, unzipData, shortFile);
if (iSize < 0)
{
break;
}
FileWriter fs;
suic::String strPath;
if (!name.Empty())
{
shortFile.Replace(VSTEMPLATENAME.c_str(), name);
strPath.Format(_U("%s\\%s\\%s"), strDir.c_str(), name.c_str(), shortFile.c_str());
}
else
{
strPath.Format(_U("%s\\%s"), strDir.c_str(), shortFile.c_str());
}
if (0 == iSize)
{
strPath += _U("\\");
}
FileDir::DupCreateDir(strPath);
if (iSize > 0 && fs.Open(strPath))
{
fs.WriteByte(unzipData.GetBuffer(), unzipData.GetSize());
fs.Close();
}
index++;
}
}
}
bool VSManager::CreateVSProject(const suic::String& strVer, const suic::String& name, const suic::String& strDir)
{
// 获取对应的VS工程数据
suic::String strPath;
suic::String strDll;
suic::String strCommon;
FileReader fReader;
strCommon = FileDir::CalculatePath(String().Format(_U("resource\\uidesign\\VSTemplate\\common\\common.zip")));
strPath = FileDir::CalculatePath(String().Format(_U("resource\\uidesign\\VSTemplate\\%s\\trunk.zip"), strVer.c_str()));
if (!FileDir::FileExist(strPath) || !FileDir::FileExist(strPath))
{
return false;
}
// 解压到指定目录
UnzipTo(strPath, strDir, name);
// 用name替换模板的工程项目名称
ReplacePrjName(name, strDir + name);
// 解压到指定目录
UnzipTo(strCommon, strDir, name);
strPath.Format(_U("%s\\%s\\bin\\suicoreu.dll"), strDir.c_str(), name.c_str());
FileDir::CopyFileTo(FileDir::CalculatePath(_U("suicoreu.dll")), strPath, true);
strPath.Format(_U("%s\\%s\\bin\\suicoreud.dll"), strDir.c_str(), name.c_str());
FileDir::CopyFileTo(FileDir::CalculatePath(_U("suicoreud.dll")), strPath, true);
strPath.Format(_U("%s\\%s\\bin\\suiwgxu.dll"), strDir.c_str(), name.c_str());
FileDir::CopyFileTo(FileDir::CalculatePath(_U("suiwgxu.dll")), strPath, true);
strPath.Format(_U("%s\\%s\\bin\\suiwgxud.dll"), strDir.c_str(), name.c_str());
FileDir::CopyFileTo(FileDir::CalculatePath(_U("suiwgxud.dll")), strPath, true);
return true;
}
void VSManager::ReplacePrjName(const suic::String& name, const suic::String& strDir)
{
FileFinder fileFinder;
if (!fileFinder.Open(strDir, _U("*.*")))
{
return;
}
bool bSearch = true;
while (bSearch)
{
if (fileFinder.FindNext())
{
if (fileFinder.IsDot())
{
continue;
}
suic::String strPath = fileFinder.GetFilePath();
// 目录
if (fileFinder.IsDir())
{
ReplacePrjName(name, strPath);
}
else
{
FileWriter fWriter;
suic::Mulstr data;
Utils::ReadResFromFile(suic::Mulstr(strPath.c_str()).c_str(), "rb", data);
FileDir::RemoveFile(strPath);
data.Replace(VSTEMPLATENAME.c_str(), name.c_str());
fWriter.Open(strPath);
fWriter.WriteByte((suic::Byte*)data.c_str(), data.Length());
}
}
else
{
break;
}
}
}
| {
"content_hash": "59b1932acb8b50d91f3784cc38302510",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 123,
"avg_line_length": 27.428571428571427,
"alnum_prop": 0.5583333333333333,
"repo_name": "china20/MPFUI",
"id": "1ea1592018335961ed58fdd54b2adf72361fe856",
"size": "4081",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trunk/uidesigner/uidframe/src/Main/VSManager.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "5746"
},
{
"name": "C",
"bytes": "462785"
},
{
"name": "C++",
"bytes": "10311198"
},
{
"name": "Makefile",
"bytes": "907"
},
{
"name": "Objective-C",
"bytes": "107281"
}
],
"symlink_target": ""
} |
package com.parse.starter;
import android.app.Application;
import android.net.ParseException;
import android.util.Log;
import android.widget.Toast;
import com.parse.FunctionCallback;
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseCloud;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.ParseInstallation;
import java.util.HashMap;
import java.util.Map;
public class StarterApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
Parse.initialize(this, "i7qyeUIKYi1KT3rhTq9QOmTYaVAsuFxq44wRVYnW", "CWzNEsy1pp5acFxVVq2m9YEvTugNKEvxhE2ZUkCe");
ParseInstallation.getCurrentInstallation().saveInBackground();
//ParseObject testObject = new ParseObject("TestObject");
//testObject.put("test", "hi friends");
//testObject.saveInBackground();
Log.d("omg android", "test");
HashMap<String, Object> dict = new HashMap<String, Object>();
//Toast.makeText(State.mainContext, "contacting...", Toast.LENGTH_SHORT).show();
ParseCloud.callFunctionInBackground(
"getCampuses",
dict,
new FunctionCallback<Object>() {
@Override
public void done(Object object, com.parse.ParseException e) {
if (e == null){
//HashMap<String, Object> campuses = (HashMap) object;
Log.d("omg android", "it worked I think");
/*for (String key : object.keySet()) {
Log.d("omg android", key + " " + object.get(key));
}*/
}
else {
e.printStackTrace();
Log.d("omg android", "function failed");
}
}
});
/*ParseCloud.callFunctionInBackground("getCampuses", dict, new FunctionCallback< Map<String, Object> >() {
@Override
public void done(Map<String, Object> object, com.parse.ParseException e) {
if (e == null){
for (String key : object.keySet()) {
Log.d("omg android", key + " " + object.get(key));
}
}
else {
e.printStackTrace();
Log.d("omg android", "function failed");
}
}
});*/
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
| {
"content_hash": "7e24ac4adfcac363bc1eeed0b543b5a6",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 115,
"avg_line_length": 33.21951219512195,
"alnum_prop": 0.566813509544787,
"repo_name": "nwrolson/android_gopher",
"id": "34982d85668d8217417ec0b509cecab22331a760",
"size": "3028",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ParseStarterProject/src/main/java/com/parse/starter/StarterApplication.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "442242"
}
],
"symlink_target": ""
} |
<?php
namespace PHPExiftool\Driver\Tag\Olympus;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class RawDevColorSpace extends AbstractTag
{
protected $Id = 'mixed';
protected $Name = 'RawDevColorSpace';
protected $FullName = 'mixed';
protected $GroupName = 'Olympus';
protected $g0 = 'MakerNotes';
protected $g1 = 'Olympus';
protected $g2 = 'Camera';
protected $Type = 'int16u';
protected $Writable = true;
protected $Description = 'Raw Dev Color Space';
protected $flag_Permanent = true;
protected $Values = array(
0 => array(
'Id' => 0,
'Label' => 'sRGB',
),
1 => array(
'Id' => 1,
'Label' => 'Adobe RGB',
),
2 => array(
'Id' => 2,
'Label' => 'Pro Photo RGB',
),
);
}
| {
"content_hash": "cfb6f7f6b3f9dd6ee739f25c43e763ae",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 51,
"avg_line_length": 17.884615384615383,
"alnum_prop": 0.5408602150537635,
"repo_name": "romainneutron/PHPExiftool",
"id": "d87ddc14fc096fece276b12d7941c6d4a0cd91dd",
"size": "1152",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/Olympus/RawDevColorSpace.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22042446"
}
],
"symlink_target": ""
} |
'use strict';
goog.provide('Blockly.Playground');
goog.require('Blockly');
/**
* in full compilation mode, these get built out into separate packages
* (e.g., blocks_compressed.js / javascript_compressed.js)
* for the test and playground no-build-required scenario,
* require all example blocks
*/
goog.require('Blockly.Blocks.colour');
goog.require('Blockly.Blocks.functionalExamples');
goog.require('Blockly.Blocks.functionalParameters');
goog.require('Blockly.Blocks.functionalProcedures');
goog.require('Blockly.Blocks.lists');
goog.require('Blockly.Blocks.logic');
goog.require('Blockly.Blocks.loops');
goog.require('Blockly.Blocks.math');
goog.require('Blockly.Blocks.procedures');
goog.require('Blockly.Blocks.text');
goog.require('Blockly.Blocks.variables');
goog.require('Blockly.JavaScript');
goog.require('Blockly.JavaScript.colour');
goog.require('Blockly.JavaScript.functionalExamples');
goog.require('Blockly.JavaScript.functionalParameters');
goog.require('Blockly.JavaScript.functionalProcedures');
goog.require('Blockly.JavaScript.lists');
goog.require('Blockly.JavaScript.logic');
goog.require('Blockly.JavaScript.loops');
goog.require('Blockly.JavaScript.math');
goog.require('Blockly.JavaScript.procedures');
goog.require('Blockly.JavaScript.text');
goog.require('Blockly.JavaScript.variables');
goog.require('goog.ui.Dialog');
goog.require('goog.ui.Dialog.ButtonSet');
/**
* @param {DialogOptions} dialogOptions
*/
Blockly.Playground.customSimpleDialog = function (dialogOptions) {
var dialog = new goog.ui.Dialog();
dialog.setTitle(dialogOptions.headerText);
dialog.setContent(dialogOptions.bodyText);
var buttons = new goog.ui.Dialog.ButtonSet();
buttons.set(goog.ui.Dialog.DefaultButtonKeys.CANCEL,
dialogOptions.cancelText,
false,
true);
buttons.set(goog.ui.Dialog.DefaultButtonKeys.OK,
dialogOptions.confirmText,
true);
goog.events.listen(dialog, goog.ui.Dialog.EventType.SELECT, function (e) {
switch (e.key) {
case goog.ui.Dialog.DefaultButtonKeys.CANCEL:
if (dialogOptions.onCancel) {
dialogOptions.onCancel();
}
break;
case goog.ui.Dialog.DefaultButtonKeys.OK:
if (dialogOptions.onConfirm) {
dialogOptions.onConfirm();
}
break;
}
});
dialog.setButtonSet(buttons);
dialog.setVisible(true);
};
| {
"content_hash": "89101c3e86d003ef1191dcdc28323b8f",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 76,
"avg_line_length": 33.871428571428574,
"alnum_prop": 0.7347110923660902,
"repo_name": "pickettd/code-dot-org",
"id": "4e987cebea0d754d77f990208ca6a0b21bf81422",
"size": "2371",
"binary": false,
"copies": "3",
"ref": "refs/heads/staging",
"path": "blockly-core/tests/playground_requires.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "93"
},
{
"name": "C++",
"bytes": "4844"
},
{
"name": "CSS",
"bytes": "2288664"
},
{
"name": "Cucumber",
"bytes": "155352"
},
{
"name": "Emacs Lisp",
"bytes": "2410"
},
{
"name": "HTML",
"bytes": "11485133"
},
{
"name": "JavaScript",
"bytes": "46048350"
},
{
"name": "PHP",
"bytes": "2303483"
},
{
"name": "POV-Ray SDL",
"bytes": "4775"
},
{
"name": "Perl",
"bytes": "7641"
},
{
"name": "Processing",
"bytes": "11068"
},
{
"name": "Prolog",
"bytes": "679"
},
{
"name": "Python",
"bytes": "124866"
},
{
"name": "Racket",
"bytes": "131852"
},
{
"name": "Ruby",
"bytes": "2598756"
},
{
"name": "Shell",
"bytes": "53351"
},
{
"name": "SourcePawn",
"bytes": "74109"
}
],
"symlink_target": ""
} |
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill.settings;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Bitmap;
import android.text.SpannableString;
import android.view.View;
import android.widget.TextView;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.robolectric.Robolectric;
import org.robolectric.Shadows;
import org.robolectric.shadows.ShadowActivity;
import org.chromium.base.Callback;
import org.chromium.base.test.BaseRobolectricTestRunner;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.autofill.LegalMessageLine;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.ui.modaldialog.ModalDialogProperties;
import org.chromium.ui.text.NoUnderlineClickableSpan;
import java.util.ArrayList;
import java.util.List;
/** Unit tests for {@link AutofillVirtualCardEnrollmentDialog}. */
@RunWith(BaseRobolectricTestRunner.class)
public class AutofillVirtualCardEnrollmentDialogTest {
@Rule
public MockitoRule mMockitoRule = MockitoJUnit.rule();
@Mock
private Callback<Boolean> mCallbackMock;
private FakeModalDialogManager mModalDialogManager;
private AutofillVirtualCardEnrollmentDialog mDialog;
private VirtualCardEnrollmentFields mVirtualCardEnrollmentFields;
@Before
public void setUp() {
mModalDialogManager = new FakeModalDialogManager();
mVirtualCardEnrollmentFields = VirtualCardEnrollmentFields.create(
"card label", Bitmap.createBitmap(100, 100, Bitmap.Config.ALPHA_8));
mVirtualCardEnrollmentFields.mGoogleLegalMessages.add(createLegalMessageLine("google"));
mVirtualCardEnrollmentFields.mIssuerLegalMessages.add(createLegalMessageLine("issuer"));
mDialog =
new AutofillVirtualCardEnrollmentDialog(ApplicationProvider.getApplicationContext(),
mModalDialogManager, mVirtualCardEnrollmentFields, mCallbackMock);
mDialog.show();
}
@Test
@SmallTest
public void dialogShown() {
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
// The callback should not have been called yet.
verify(mCallbackMock, never()).onResult(any());
}
@Test
@SmallTest
public void positiveButtonPressed() {
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
mModalDialogManager.clickPositiveButton();
assertThat(mModalDialogManager.getShownDialogModel()).isNull();
// Check that callback was called with true.
verify(mCallbackMock).onResult(true);
}
@Test
@SmallTest
public void negativeButtonPressed() {
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
mModalDialogManager.clickNegativeButton();
assertThat(mModalDialogManager.getShownDialogModel()).isNull();
// Check that callback was called with false;
verify(mCallbackMock).onResult(false);
}
@Test
@SmallTest
public void learnMoreTextClicked() {
// Create activity and its shadow to see if CustomTabActivity is launched.
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
// Create a new AutofillVirtualCardEnrollmentDialog with Activity as the context instead.
mDialog = new AutofillVirtualCardEnrollmentDialog(
activity, mModalDialogManager, mVirtualCardEnrollmentFields, mCallbackMock);
mDialog.show();
// Make sure that the dialog was shown properly.
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
// Get the clickable span.
SpannableString virtualCardEducationText =
getSpannableStringForViewFromCurrentDialog(R.id.virtual_card_education);
// Assert that the message is not empty.
assertThat(virtualCardEducationText.length()).isGreaterThan(0);
// Assert that the text of this span is correct.
NoUnderlineClickableSpan learnMoreSpan =
getOnlyClickableSpanFromString(virtualCardEducationText);
assertThat(getHighlightedTextFromSpannableString(virtualCardEducationText, learnMoreSpan))
.isEqualTo("Learn more about virtual cards");
// Click on the link. The callback doesn't use the view so it can be null.
learnMoreSpan.onClick(null);
// Check that the CustomTabActivity was started as expected.
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertThat(startedIntent.getComponent())
.isEqualTo(new ComponentName(activity, CustomTabActivity.class));
}
@Test
@SmallTest
public void googleLegalMessageClicked() {
// Create activity and its shadow to see if CustomTabActivity is launched.
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
// Create a new AutofillVirtualCardEnrollmentDialog with Activity as the context instead.
mDialog = new AutofillVirtualCardEnrollmentDialog(
activity, mModalDialogManager, mVirtualCardEnrollmentFields, mCallbackMock);
mDialog.show();
// Make sure that the dialog was shown properly.
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
// Get the clickable span.
SpannableString googleLegalMessageText =
getSpannableStringForViewFromCurrentDialog(R.id.google_legal_message);
// Assert that the message is not empty.
assertThat(googleLegalMessageText.length()).isGreaterThan(0);
// Assert that the text of this span is correct.
NoUnderlineClickableSpan googleSpan =
getOnlyClickableSpanFromString(googleLegalMessageText);
assertThat(getHighlightedTextFromSpannableString(googleLegalMessageText, googleSpan))
.isEqualTo("oo");
// Click on the link. The callback doesn't use the view so it can be null.
googleSpan.onClick(null);
// Check that the CustomTabActivity was started as expected.
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertThat(startedIntent.getComponent())
.isEqualTo(new ComponentName(activity, CustomTabActivity.class));
}
@Test
@SmallTest
public void issuerLegalMessageClicked() {
// Create activity and its shadow to see if CustomTabActivity is launched.
Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
// Create a new AutofillVirtualCardEnrollmentDialog with Activity as the context instead.
mDialog = new AutofillVirtualCardEnrollmentDialog(
activity, mModalDialogManager, mVirtualCardEnrollmentFields, mCallbackMock);
mDialog.show();
// Make sure that the dialog was shown properly.
assertThat(mModalDialogManager.getShownDialogModel()).isNotNull();
// Get the clickable span.
SpannableString issuerLegalMessageText =
getSpannableStringForViewFromCurrentDialog(R.id.issuer_legal_message);
// Assert that the message is not empty.
assertThat(issuerLegalMessageText.length()).isGreaterThan(0);
// Assert that the text of this span is correct.
NoUnderlineClickableSpan issuerSpan =
getOnlyClickableSpanFromString(issuerLegalMessageText);
assertThat(getHighlightedTextFromSpannableString(issuerLegalMessageText, issuerSpan))
.isEqualTo("ss");
// Click on the link. The callback doesn't use the view so it can be null.
issuerSpan.onClick(null);
// Check that the CustomTabActivity was started as expected.
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertThat(startedIntent.getComponent())
.isEqualTo(new ComponentName(activity, CustomTabActivity.class));
}
private SpannableString getSpannableStringForViewFromCurrentDialog(int textViewId) {
View customView =
mModalDialogManager.getShownDialogModel().get(ModalDialogProperties.CUSTOM_VIEW);
return (SpannableString) ((TextView) customView.findViewById(textViewId)).getText();
}
private NoUnderlineClickableSpan getOnlyClickableSpanFromString(SpannableString string) {
NoUnderlineClickableSpan[] spans =
string.getSpans(0, string.length(), NoUnderlineClickableSpan.class);
// Assert that there is only one NoUnderlineClickableSpan.
assertThat(spans.length).isEqualTo(1);
return spans[0];
}
private String getHighlightedTextFromSpannableString(
SpannableString spannableString, NoUnderlineClickableSpan clickableSpan) {
int start = spannableString.getSpanStart(clickableSpan);
int end = spannableString.getSpanEnd(clickableSpan);
return spannableString.subSequence(start, end).toString();
}
private static LegalMessageLine createLegalMessageLine(String text) {
List<LegalMessageLine.Link> links = new ArrayList<>();
links.add(new LegalMessageLine.Link(1, 3, "http://www.google.com"));
LegalMessageLine legalMessageLine = new LegalMessageLine(text);
legalMessageLine.links.addAll(links);
return legalMessageLine;
}
}
| {
"content_hash": "57bcfe7cd7e827c875404be13a0b5664",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 100,
"avg_line_length": 46.25909090909091,
"alnum_prop": 0.7277193672005503,
"repo_name": "scheib/chromium",
"id": "1d9ea9a6a7e92b2eb413e9586fca759898adff21",
"size": "10177",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "chrome/android/junit/src/org/chromium/chrome/browser/autofill/settings/AutofillVirtualCardEnrollmentDialogTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
cd mod-users
mvn install | {
"content_hash": "5739b42b9e7bdfe07f4ce862d79963e3",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 12,
"avg_line_length": 12,
"alnum_prop": 0.8333333333333334,
"repo_name": "alvetm/folio-valatechcamp17",
"id": "d68a202d078e7409dc83c7e8f5cf80ce3cb77c84",
"size": "36",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "folio-tutorial-working-files/33-MvnInstallModUsers.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "56"
},
{
"name": "Shell",
"bytes": "4794"
}
],
"symlink_target": ""
} |
package org.onosproject.dhcprelay;
import org.onlab.packet.Ethernet;
import org.onosproject.net.ConnectPoint;
/**
* Container for Ethernet packet and destination port.
*/
final class InternalPacket {
private Ethernet packet;
private ConnectPoint destLocation;
private InternalPacket(Ethernet newPacket, ConnectPoint newLocation) {
packet = newPacket;
destLocation = newLocation;
}
public Ethernet getPacket() {
return packet;
}
public ConnectPoint getDestLocation() {
return destLocation;
}
/**
* Build {@link InternalPacket} object instance.
*
* @param newPacket {@link Ethernet} packet to be sent
* @param newLocation {@link ConnectPoint} packet destination
* @return new instance of {@link InternalPacket} class
*/
public static InternalPacket internalPacket(Ethernet newPacket, ConnectPoint newLocation) {
return new InternalPacket(newPacket, newLocation);
}
}
| {
"content_hash": "5b0fd6697848bb32c1271ea5e67c5a66",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 95,
"avg_line_length": 26.7027027027027,
"alnum_prop": 0.6973684210526315,
"repo_name": "opennetworkinglab/onos",
"id": "70d4ae28fdb43269069cc14a9a351e71c9c755ba",
"size": "1608",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/InternalPacket.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "367433"
},
{
"name": "Dockerfile",
"bytes": "3187"
},
{
"name": "HTML",
"bytes": "332756"
},
{
"name": "Java",
"bytes": "38791946"
},
{
"name": "JavaScript",
"bytes": "3999775"
},
{
"name": "Jinja",
"bytes": "2272195"
},
{
"name": "Makefile",
"bytes": "1852"
},
{
"name": "P4",
"bytes": "197536"
},
{
"name": "Python",
"bytes": "489477"
},
{
"name": "SCSS",
"bytes": "3578"
},
{
"name": "Shell",
"bytes": "342726"
},
{
"name": "Starlark",
"bytes": "495306"
},
{
"name": "TypeScript",
"bytes": "959357"
}
],
"symlink_target": ""
} |
package alluxio.worker.block.evictor;
import alluxio.Configuration;
import alluxio.PropertyKey;
import alluxio.collections.Pair;
import alluxio.worker.block.BlockMetadataManagerView;
import alluxio.worker.block.BlockStoreLocation;
import alluxio.worker.block.allocator.Allocator;
import alluxio.worker.block.meta.BlockMeta;
import alluxio.worker.block.meta.StorageDirView;
import alluxio.worker.block.meta.StorageTierView;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterators;
import io.netty.util.internal.chmv8.ConcurrentHashMapV8;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.concurrent.NotThreadSafe;
/**
* This class is used to evict blocks by LRFU. LRFU evict blocks with minimum CRF, where CRF of a
* block is the sum of F(t) = pow(1.0 / {@link #mAttenuationFactor}, t * {@link #mStepFactor}).
* Each access to a block has a F(t) value and t is the time interval since that access to current.
* As the formula of F(t) shows, when (1.0 / {@link #mStepFactor}) time units passed, F(t) will
* cut to the (1.0 / {@link #mAttenuationFactor}) of the old value. So {@link #mStepFactor}
* controls the step and {@link #mAttenuationFactor} controls the attenuation. Actually, LRFU
* combines LRU and LFU, it evicts blocks with small frequency or large recency. When
* {@link #mStepFactor} is close to 0, LRFU is close to LFU. Conversely, LRFU is close to LRU
* when {@link #mStepFactor} is close to 1.
*/
@NotThreadSafe
public final class LRFUEvictor extends AbstractEvictor {
// Map from block id to the last updated logic time count
private final Map<Long, Long> mBlockIdToLastUpdateTime = new ConcurrentHashMapV8<>();
// Map from block id to the CRF value of the block
private final Map<Long, Double> mBlockIdToCRFValue = new ConcurrentHashMapV8<>();
// In the range of [0, 1]. Closer to 0, LRFU closer to LFU. Closer to 1, LRFU closer to LRU
private final double mStepFactor;
// In the range of [2, INF]
private final double mAttenuationFactor;
//logic time count
private AtomicLong mLogicTimeCount = new AtomicLong(0L);
/**
* Creates a new instance of {@link LRFUEvictor}.
*
* @param view a view of block metadata information
* @param allocator an allocation policy
*/
public LRFUEvictor(BlockMetadataManagerView view, Allocator allocator) {
super(view, allocator);
mStepFactor = Configuration.getDouble(PropertyKey.WORKER_EVICTOR_LRFU_STEP_FACTOR);
mAttenuationFactor =
Configuration.getDouble(PropertyKey.WORKER_EVICTOR_LRFU_ATTENUATION_FACTOR);
Preconditions.checkArgument(mStepFactor >= 0.0 && mStepFactor <= 1.0,
"Step factor should be in the range of [0.0, 1.0]");
Preconditions.checkArgument(mAttenuationFactor >= 2.0,
"Attenuation factor should be no less than 2.0");
// Preloading blocks
for (StorageTierView tier : mManagerView.getTierViews()) {
for (StorageDirView dir : tier.getDirViews()) {
for (BlockMeta block : dir.getEvictableBlocks()) {
mBlockIdToLastUpdateTime.put(block.getBlockId(), 0L);
mBlockIdToCRFValue.put(block.getBlockId(), 0.0);
}
}
}
}
/**
* Calculates weight of an access, which is the function value of
* F(t) = pow (1.0 / {@link #mAttenuationFactor}, t * {@link #mStepFactor}).
*
* @param logicTimeInterval time interval since that access to current
* @return Function value of F(t)
*/
private double calculateAccessWeight(long logicTimeInterval) {
return Math.pow(1.0 / mAttenuationFactor, logicTimeInterval * mStepFactor);
}
@Override
public EvictionPlan freeSpaceWithView(long bytesToBeAvailable, BlockStoreLocation location,
BlockMetadataManagerView view) {
synchronized (mBlockIdToLastUpdateTime) {
updateCRFValue();
mManagerView = view;
List<BlockTransferInfo> toMove = new ArrayList<>();
List<Pair<Long, BlockStoreLocation>> toEvict = new ArrayList<>();
EvictionPlan plan = new EvictionPlan(toMove, toEvict);
StorageDirView candidateDir = cascadingEvict(bytesToBeAvailable, location, plan);
mManagerView.clearBlockMarks();
if (candidateDir == null) {
return null;
}
return plan;
}
}
@Override
protected Iterator<Long> getBlockIterator() {
return Iterators.transform(getSortedCRF().iterator(),
new Function<Map.Entry<Long, Double>, Long>() {
@Override
public Long apply(Entry<Long, Double> input) {
return input.getKey();
}
});
}
/**
* Sorts all blocks in ascending order of CRF.
*
* @return the sorted CRF of all blocks
*/
private List<Map.Entry<Long, Double>> getSortedCRF() {
List<Map.Entry<Long, Double>> sortedCRF = new ArrayList<>(mBlockIdToCRFValue.entrySet());
Collections.sort(sortedCRF, new Comparator<Map.Entry<Long, Double>>() {
@Override
public int compare(Entry<Long, Double> o1, Entry<Long, Double> o2) {
return Double.compare(o1.getValue(), o2.getValue());
}
});
return sortedCRF;
}
@Override
public void onAccessBlock(long userId, long blockId) {
updateOnAccessAndCommit(blockId);
}
@Override
public void onCommitBlock(long userId, long blockId, BlockStoreLocation location) {
updateOnAccessAndCommit(blockId);
}
@Override
public void onRemoveBlockByClient(long userId, long blockId) {
updateOnRemoveBlock(blockId);
}
@Override
public void onRemoveBlockByWorker(long userId, long blockId) {
updateOnRemoveBlock(blockId);
}
@Override
protected void onRemoveBlockFromIterator(long blockId) {
mBlockIdToLastUpdateTime.remove(blockId);
mBlockIdToCRFValue.remove(blockId);
}
/**
* This function is used to update CRF of all the blocks according to current logic time. When
* some block is accessed in some time, only CRF of that block itself will be updated to current
* time, other blocks who are not accessed recently will only be updated until
* {@link #freeSpaceWithView(long, BlockStoreLocation, BlockMetadataManagerView)} is called
* because blocks need to be sorted in the increasing order of CRF. When this function is called,
* {@link #mBlockIdToLastUpdateTime} and {@link #mBlockIdToCRFValue} need to be locked in case
* of the changing of values.
*/
private void updateCRFValue() {
long currentLogicTime = mLogicTimeCount.get();
for (Entry<Long, Double> entry : mBlockIdToCRFValue.entrySet()) {
long blockId = entry.getKey();
double crfValue = entry.getValue();
mBlockIdToCRFValue.put(blockId, crfValue
* calculateAccessWeight(currentLogicTime - mBlockIdToLastUpdateTime.get(blockId)));
mBlockIdToLastUpdateTime.put(blockId, currentLogicTime);
}
}
/**
* Updates {@link #mBlockIdToLastUpdateTime} and {@link #mBlockIdToCRFValue} when block is
* accessed or committed. Only CRF of the accessed or committed block will be updated, CRF
* of other blocks will be lazily updated (only when {@link #updateCRFValue()} is called).
* If the block is updated at the first time, CRF of the block will be set to 1.0, otherwise
* the CRF of the block will be set to {1.0 + old CRF * F(current time - last update time)}.
*
* @param blockId id of the block to be accessed or committed
*/
private void updateOnAccessAndCommit(long blockId) {
synchronized (mBlockIdToLastUpdateTime) {
long currentLogicTime = mLogicTimeCount.incrementAndGet();
// update CRF value
// CRF(currentLogicTime)=CRF(lastUpdateTime)*F(currentLogicTime-lastUpdateTime)+F(0)
if (mBlockIdToCRFValue.containsKey(blockId)) {
mBlockIdToCRFValue.put(blockId, mBlockIdToCRFValue.get(blockId)
* calculateAccessWeight(currentLogicTime - mBlockIdToLastUpdateTime.get(blockId))
+ 1.0);
} else {
mBlockIdToCRFValue.put(blockId, 1.0);
}
// update currentLogicTime to lastUpdateTime
mBlockIdToLastUpdateTime.put(blockId, currentLogicTime);
}
}
/**
* Updates {@link #mBlockIdToLastUpdateTime} and {@link #mBlockIdToCRFValue} when block is
* removed.
*
* @param blockId id of the block to be removed
*/
private void updateOnRemoveBlock(long blockId) {
synchronized (mBlockIdToLastUpdateTime) {
mLogicTimeCount.incrementAndGet();
mBlockIdToCRFValue.remove(blockId);
mBlockIdToLastUpdateTime.remove(blockId);
}
}
}
| {
"content_hash": "6536d009938c65c602db8fd8e13d9a3e",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 99,
"avg_line_length": 38.47577092511013,
"alnum_prop": 0.7146782688344401,
"repo_name": "bit-zyl/Alluxio-Nvdimm",
"id": "ad98d8556caf92bca01cd6b4c75dbd0897306709",
"size": "9246",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/server/src/main/java/alluxio/worker/block/evictor/LRFUEvictor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1166"
},
{
"name": "Java",
"bytes": "4952054"
},
{
"name": "JavaScript",
"bytes": "1091"
},
{
"name": "Protocol Buffer",
"bytes": "6314"
},
{
"name": "Python",
"bytes": "11471"
},
{
"name": "Roff",
"bytes": "5796"
},
{
"name": "Ruby",
"bytes": "22857"
},
{
"name": "Shell",
"bytes": "104086"
},
{
"name": "Thrift",
"bytes": "24618"
}
],
"symlink_target": ""
} |
import requests, simplejson, urlparse
from BeautifulSoup import BeautifulSoup
def get_stream_info(url):
resp = requests.get(url)
html = resp.content
bs = BeautifulSoup(html)
data_node = bs.find("meta", attrs={'name': 'broadcast-data'})
content = data_node.get("content")
data = simplejson.loads(content)
token_node = bs.find("meta", attrs={'name': 'token-id'})
token_id = token_node.get("content")
return {
'data': data,
'token_id': token_id
}
def get_periscope_url_from_tweet(status):
entities = status._json.get('entities')
if not entities: return
urls = entities.get('urls', [])
for url in urls:
expanded_url = url['expanded_url']
parsed = urlparse.urlparse(expanded_url)
if parsed.netloc == 'www.periscope.tv':
return expanded_url
| {
"content_hash": "7fec839a01ce881e0162bd4bb82c5540",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.6312056737588653,
"repo_name": "agermanidis/PeriscopeFirehose",
"id": "9e4184186e7ee7c2ff76e454bcbbd649af712573",
"size": "846",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "periscope_firehose/utils.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "5478"
}
],
"symlink_target": ""
} |
// Teleport Disable On Controller Obscured|Locomotion|20050
namespace VRTK
{
using UnityEngine;
using System.Collections;
/// <summary>
/// The purpose of the Teleport Disable On Controller Obscured script is to detect when the headset does not have a line of sight to the controllers and prevent teleportation from working. This is to ensure that if a user is clipping their controllers through a wall then they cannot teleport to an area beyond the wall.
/// </summary>
[RequireComponent(typeof(VRTK_HeadsetControllerAware))]
public class VRTK_TeleportDisableOnControllerObscured : MonoBehaviour
{
private VRTK_BasicTeleport basicTeleport;
private VRTK_HeadsetControllerAware headset;
protected virtual void OnEnable()
{
basicTeleport = GetComponent<VRTK_BasicTeleport>();
StartCoroutine(EnableAtEndOfFrame());
}
protected virtual void OnDisable()
{
if (basicTeleport == null)
{
return;
}
if (headset)
{
headset.ControllerObscured -= new HeadsetControllerAwareEventHandler(DisableTeleport);
headset.ControllerUnobscured -= new HeadsetControllerAwareEventHandler(EnableTeleport);
}
}
private IEnumerator EnableAtEndOfFrame()
{
if (basicTeleport == null)
{
yield break;
}
yield return new WaitForEndOfFrame();
headset = VRTK_ObjectCache.registeredHeadsetControllerAwareness;
if (headset)
{
headset.ControllerObscured += new HeadsetControllerAwareEventHandler(DisableTeleport);
headset.ControllerUnobscured += new HeadsetControllerAwareEventHandler(EnableTeleport);
}
}
private void DisableTeleport(object sender, HeadsetControllerAwareEventArgs e)
{
basicTeleport.ToggleTeleportEnabled(false);
}
private void EnableTeleport(object sender, HeadsetControllerAwareEventArgs e)
{
basicTeleport.ToggleTeleportEnabled(true);
}
}
} | {
"content_hash": "cfaa815607deccdcf6e358108ca66ff4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 324,
"avg_line_length": 36.74193548387097,
"alnum_prop": 0.6215978928884986,
"repo_name": "jonathanrlouie/unity-vr-livestream",
"id": "1b8eec45ab99bc9b0881c0918cbabc84e2dfc0dd",
"size": "2280",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "PhysicsWorld/Physics World/Assets/VRTK/Scripts/Locomotion/VRTK_TeleportDisableOnControllerObscured.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2833842"
},
{
"name": "GLSL",
"bytes": "33248"
}
],
"symlink_target": ""
} |
#pragma once
#ifndef ACCRE_APPEND_PRINTF_H_INCLUDED
#define ACCRE_APPEND_PRINTF_H_INCLUDED
#include <tbx/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
// Functions
TBX_API int tbx_append_printf(char *buffer, int *used, int nbytes, const char *fmt, ...);
TBX_API int tbx_alloc_append_printf(char **buffer, int *used, int *nbytes, const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif
| {
"content_hash": "70a507e2fe7daea760f20b3b69701e92",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 97,
"avg_line_length": 19.095238095238095,
"alnum_prop": 0.7057356608478803,
"repo_name": "accre/lstore",
"id": "a10de3d78d20581637738d352d70f1c7ba721c56",
"size": "998",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/toolbox/tbx/append_printf.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "4063120"
},
{
"name": "C++",
"bytes": "54751"
},
{
"name": "CMake",
"bytes": "154685"
},
{
"name": "Objective-C",
"bytes": "2380"
},
{
"name": "Python",
"bytes": "2884"
},
{
"name": "Shell",
"bytes": "65872"
}
],
"symlink_target": ""
} |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "txdb.h"
#include "walletdb.h"
#include "bitcoinrpc.h"
#include "net.h"
#include "init.h"
#include "util.h"
#include "ui_interface.h"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <openssl/crypto.h>
#ifndef WIN32
#include <signal.h>
#endif
#if defined(USE_SSE2)
#if !defined(MAC_OSX) && (defined(_M_IX86) || defined(__i386__) || defined(__i386))
#ifdef _MSC_VER
// MSVC 64bit is unable to use inline asm
#include <intrin.h>
#else
// GCC Linux or i686-w64-mingw32
#include <cpuid.h>
#endif
#endif
#endif
using namespace std;
using namespace boost;
CWallet* pwalletMain;
CClientUIInterface uiInterface;
#ifdef WIN32
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
// accessing block files, don't count towards to fd_set size limit
// anyway.
#define MIN_CORE_FILEDESCRIPTORS 0
#else
#define MIN_CORE_FILEDESCRIPTORS 150
#endif
// Used to pass flags to the Bind() function
enum BindFlags {
BF_NONE = 0,
BF_EXPLICIT = (1U << 0),
BF_REPORT_ERROR = (1U << 1)
};
//////////////////////////////////////////////////////////////////////////////
//
// Shutdown
//
//
// Thread management and startup/shutdown:
//
// The network-processing threads are all part of a thread group
// created by AppInit() or the Qt main() function.
//
// A clean exit happens when StartShutdown() or the SIGTERM
// signal handler sets fRequestShutdown, which triggers
// the DetectShutdownThread(), which interrupts the main thread group.
// DetectShutdownThread() then exits, which causes AppInit() to
// continue (it .joins the shutdown thread).
// Shutdown() is then
// called to clean up database connections, and stop other
// threads that should only be stopped after the main network-processing
// threads have exited.
//
// Note that if running -daemon the parent process returns from AppInit2
// before adding any threads to the threadGroup, so .join_all() returns
// immediately and the parent exits from main().
//
// Shutdown for Qt is very similar, only it uses a QTimer to detect
// fRequestShutdown getting set, and then does the normal Qt
// shutdown thing.
//
volatile bool fRequestShutdown = false;
void StartShutdown()
{
fRequestShutdown = true;
}
bool ShutdownRequested()
{
return fRequestShutdown;
}
static CCoinsViewDB *pcoinsdbview;
void Shutdown()
{
printf("Shutdown : In progress...\n");
static CCriticalSection cs_Shutdown;
TRY_LOCK(cs_Shutdown, lockShutdown);
if (!lockShutdown) return;
RenameThread("bitcoin-shutoff");
nTransactionsUpdated++;
StopRPCThreads();
ShutdownRPCMining();
if (pwalletMain)
bitdb.Flush(false);
GenerateBitcoins(false, NULL);
StopNode();
{
LOCK(cs_main);
if (pwalletMain)
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
if (pblocktree)
pblocktree->Flush();
if (pcoinsTip)
pcoinsTip->Flush();
delete pcoinsTip; pcoinsTip = NULL;
delete pcoinsdbview; pcoinsdbview = NULL;
delete pblocktree; pblocktree = NULL;
}
if (pwalletMain)
bitdb.Flush(true);
boost::filesystem::remove(GetPidFile());
UnregisterWallet(pwalletMain);
if (pwalletMain)
delete pwalletMain;
printf("Shutdown : done\n");
}
//
// Signal handlers are very limited in what they are allowed to do, so:
//
void DetectShutdownThread(boost::thread_group* threadGroup)
{
// Tell the main threads to shutdown.
while (!fRequestShutdown)
{
MilliSleep(200);
if (fRequestShutdown)
threadGroup->interrupt_all();
}
}
void HandleSIGTERM(int)
{
fRequestShutdown = true;
}
void HandleSIGHUP(int)
{
fReopenDebugLog = true;
}
//////////////////////////////////////////////////////////////////////////////
//
// Start
//
#if !defined(QT_GUI)
bool AppInit(int argc, char* argv[])
{
boost::thread_group threadGroup;
boost::thread* detectShutdownThread = NULL;
bool fRet = false;
try
{
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
ParseParameters(argc, argv);
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified directory does not exist\n");
Shutdown();
}
ReadConfigFile(mapArgs, mapMultiArgs);
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
// First part of help message is specific to bitcoind / RPC client
std::string strUsage = _("PiecesofEight version") + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" piecesofeightd [options] " + "\n" +
" piecesofeightd [options] <command> [params] " + _("Send command to -server or piecesofeightd") + "\n" +
" piecesofeightd [options] help " + _("List commands") + "\n" +
" piecesofeightd [options] help <command> " + _("Get help for a command") + "\n";
strUsage += "\n" + HelpMessage();
fprintf(stdout, "%s", strUsage.c_str());
return false;
}
// Command-line RPC
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "piecesofeight:"))
fCommandLine = true;
if (fCommandLine)
{
int ret = CommandLineRPC(argc, argv);
exit(ret);
}
#if !defined(WIN32)
fDaemon = GetBoolArg("-daemon");
if (fDaemon)
{
// Daemonize
pid_t pid = fork();
if (pid < 0)
{
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
return false;
}
if (pid > 0) // Parent process, pid is child process id
{
CreatePidFile(GetPidFile(), pid);
return true;
}
// Child process falls through to rest of initialization
pid_t sid = setsid();
if (sid < 0)
fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
}
#endif
detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));
fRet = AppInit2(threadGroup);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
} catch (...) {
PrintExceptionContinue(NULL, "AppInit()");
}
if (!fRet) {
if (detectShutdownThread)
detectShutdownThread->interrupt();
threadGroup.interrupt_all();
}
if (detectShutdownThread)
{
detectShutdownThread->join();
delete detectShutdownThread;
detectShutdownThread = NULL;
}
Shutdown();
return fRet;
}
extern void noui_connect();
int main(int argc, char* argv[])
{
bool fRet = false;
// Connect bitcoind signal handlers
noui_connect();
fRet = AppInit(argc, argv);
if (fRet && fDaemon)
return 0;
return (fRet ? 0 : 1);
}
#endif
bool static InitError(const std::string &str)
{
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR);
return false;
}
bool static InitWarning(const std::string &str)
{
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
return true;
}
bool static Bind(const CService &addr, unsigned int flags) {
if (!(flags & BF_EXPLICIT) && IsLimited(addr))
return false;
std::string strError;
if (!BindListenPort(addr, strError)) {
if (flags & BF_REPORT_ERROR)
return InitError(strError);
return false;
}
return true;
}
// Core-specific options shared between UI and daemon
std::string HelpMessage()
{
string strUsage = _("Options:") + "\n" +
" -? " + _("This help message") + "\n" +
" -conf=<file> " + _("Specify configuration file (default: piecesofeight.conf)") + "\n" +
" -pid=<file> " + _("Specify pid file (default: piecesofeightd.pid)") + "\n" +
" -gen " + _("Generate coins (default: 0)") + "\n" +
" -datadir=<dir> " + _("Specify data directory") + "\n" +
" -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n" +
" -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n" +
" -proxy=<ip:port> " + _("Connect through socks proxy") + "\n" +
" -socks=<n> " + _("Select the version of socks proxy to use (4-5, default: 5)") + "\n" +
" -tor=<ip:port> " + _("Use proxy to reach tor hidden services (default: same as -proxy)") + "\n"
" -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" +
" -port=<port> " + _("Listen for connections on <port> (default: 8888 or testnet: 18888)") + "\n" +
" -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n" +
" -addnode=<ip> " + _("Add a node to connect to and attempt to keep the connection open") + "\n" +
" -connect=<ip> " + _("Connect only to the specified node(s)") + "\n" +
" -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
" -externalip=<ip> " + _("Specify your own public address") + "\n" +
" -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n" +
" -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n" +
" -checkpoints " + _("Only accept block chain matching built-in checkpoints (default: 1)") + "\n" +
" -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n" +
" -bind=<addr> " + _("Bind to given address and always listen on it. Use [host]:port notation for IPv6") + "\n" +
" -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n" +
" -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
" -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n" +
" -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n" +
" -bloomfilters " + _("Allow peers to set bloom filters (default: 1)") + "\n" +
#ifdef USE_UPNP
#if USE_UPNP
" -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n" +
#else
" -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n" +
#endif
#endif
" -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n" +
" -mininput=<amt> " + _("When creating transactions, ignore inputs with value less than this (default: 0.0001)") + "\n" +
#ifdef QT_GUI
" -server " + _("Accept command line and JSON-RPC commands") + "\n" +
#endif
#if !defined(WIN32) && !defined(QT_GUI)
" -daemon " + _("Run in the background as a daemon and accept commands") + "\n" +
#endif
" -testnet " + _("Use the test network") + "\n" +
" -debug " + _("Output extra debugging information. Implies all other -debug* options") + "\n" +
" -debugnet " + _("Output extra network debugging information") + "\n" +
" -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n" +
" -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n" +
" -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n" +
#ifdef WIN32
" -printtodebugger " + _("Send trace/debug info to debugger") + "\n" +
#endif
" -rpcuser=<user> " + _("Username for JSON-RPC connections") + "\n" +
" -rpcpassword=<pw> " + _("Password for JSON-RPC connections") + "\n" +
" -rpcport=<port> " + _("Listen for JSON-RPC connections on <port> (default: 8887 or testnet: 18887)") + "\n" +
" -rpcallowip=<ip> " + _("Allow JSON-RPC connections from specified IP address") + "\n" +
#ifndef QT_GUI
" -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" +
#endif
" -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n" +
" -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
" -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" +
" -alertnotify=<cmd> " + _("Execute command when a relevant alert is received (%s in cmd is replaced by message)") + "\n" +
" -upgradewallet " + _("Upgrade wallet to latest format") + "\n" +
" -keypool=<n> " + _("Set key pool size to <n> (default: 100)") + "\n" +
" -rescan " + _("Rescan the block chain for missing wallet transactions") + "\n" +
" -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + "\n" +
" -checkblocks=<n> " + _("How many blocks to check at startup (default: 288, 0 = all)") + "\n" +
" -checklevel=<n> " + _("How thorough the block verification is (0-4, default: 3)") + "\n" +
" -txindex " + _("Maintain a full transaction index (default: 0)") + "\n" +
" -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + "\n" +
" -reindex " + _("Rebuild block chain index from current blk000??.dat files") + "\n" +
" -par=<n> " + _("Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)") + "\n" +
"\n" + _("Block creation options:") + "\n" +
" -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n" +
" -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n" +
" -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n" +
"\n" + _("SSL options: (see the PiecesofEight Wiki for SSL setup instructions)") + "\n" +
" -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" +
" -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n" +
" -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n" +
" -rpcsslciphers=<ciphers> " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") + "\n";
return strUsage;
}
struct CImportingNow
{
CImportingNow() {
assert(fImporting == false);
fImporting = true;
}
~CImportingNow() {
assert(fImporting == true);
fImporting = false;
}
};
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
{
RenameThread("bitcoin-loadblk");
// -reindex
if (fReindex) {
CImportingNow imp;
int nFile = 0;
while (true) {
CDiskBlockPos pos(nFile, 0);
FILE *file = OpenBlockFile(pos, true);
if (!file)
break;
printf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
LoadExternalBlockFile(file, &pos);
nFile++;
}
pblocktree->WriteReindexing(false);
fReindex = false;
printf("Reindexing finished\n");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
InitBlockIndex();
}
// hardcoded $DATADIR/bootstrap.dat
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
if (filesystem::exists(pathBootstrap)) {
FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
if (file) {
CImportingNow imp;
filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
printf("Importing bootstrap.dat...\n");
LoadExternalBlockFile(file);
RenameOver(pathBootstrap, pathBootstrapOld);
}
}
// -loadblock=
BOOST_FOREACH(boost::filesystem::path &path, vImportFiles) {
FILE *file = fopen(path.string().c_str(), "rb");
if (file) {
CImportingNow imp;
printf("Importing %s...\n", path.string().c_str());
LoadExternalBlockFile(file);
}
}
}
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
bool AppInit2(boost::thread_group& threadGroup)
{
// ********************************************************* Step 1: setup
#ifdef _MSC_VER
// Turn off Microsoft heap dump noise
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
#endif
#if _MSC_VER >= 1400
// Disable confusing "helpful" text message on abort, Ctrl-C
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#ifdef WIN32
// Enable Data Execution Prevention (DEP)
// Minimum supported OS versions: WinXP SP3, WinVista >= SP1, Win Server 2008
// A failure is non-critical and needs no further attention!
#ifndef PROCESS_DEP_ENABLE
// We define this here, because GCCs winbase.h limits this to _WIN32_WINNT >= 0x0601 (Windows 7),
// which is not correct. Can be removed, when GCCs winbase.h is fixed!
#define PROCESS_DEP_ENABLE 0x00000001
#endif
typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy");
if (setProcDEPPol != NULL) setProcDEPPol(PROCESS_DEP_ENABLE);
// Initialize Windows Sockets
WSADATA wsadata;
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
if (ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
{
return InitError(strprintf("Error: Winsock library failed to start (WSAStartup returned error %d)", ret));
}
#endif
#ifndef WIN32
umask(077);
// Clean shutdown on SIGTERM
struct sigaction sa;
sa.sa_handler = HandleSIGTERM;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
// Reopen debug.log on SIGHUP
struct sigaction sa_hup;
sa_hup.sa_handler = HandleSIGHUP;
sigemptyset(&sa_hup.sa_mask);
sa_hup.sa_flags = 0;
sigaction(SIGHUP, &sa_hup, NULL);
#endif
#if defined(USE_SSE2)
unsigned int cpuid_edx=0;
#if !defined(MAC_OSX) && (defined(_M_IX86) || defined(__i386__) || defined(__i386))
// 32bit x86 Linux or Windows, detect cpuid features
#if defined(_MSC_VER)
// MSVC
int x86cpuid[4];
__cpuid(x86cpuid, 1);
cpuid_edx = (unsigned int)buffer[3];
#else
// Linux or i686-w64-mingw32 (gcc-4.6.3)
unsigned int eax, ebx, ecx;
__get_cpuid(1, &eax, &ebx, &ecx, &cpuid_edx);
#endif
#endif
#endif
// ********************************************************* Step 2: parameter interactions
fTestNet = GetBoolArg("-testnet");
fBloomFilters = GetBoolArg("-bloomfilters", true);
if (fBloomFilters)
nLocalServices |= NODE_BLOOM;
if (mapArgs.count("-bind")) {
// when specifying an explicit binding address, you want to listen on it
// even when -connect or -proxy is specified
SoftSetBoolArg("-listen", true);
}
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
SoftSetBoolArg("-dnsseed", false);
SoftSetBoolArg("-listen", false);
}
if (mapArgs.count("-proxy")) {
// to protect privacy, do not listen by default if a proxy server is specified
SoftSetBoolArg("-listen", false);
}
if (!GetBoolArg("-listen", true)) {
// do not map ports or try to retrieve public IP when not listening (pointless)
SoftSetBoolArg("-upnp", false);
SoftSetBoolArg("-discover", false);
}
if (mapArgs.count("-externalip")) {
// if an explicit public IP is specified, do not try to find others
SoftSetBoolArg("-discover", false);
}
if (GetBoolArg("-salvagewallet")) {
// Rewrite just private keys: rescan to find transactions
SoftSetBoolArg("-rescan", true);
}
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind"), 1);
nMaxConnections = GetArg("-maxconnections", 125);
nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0);
int nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS);
if (nFD < MIN_CORE_FILEDESCRIPTORS)
return InitError(_("Not enough file descriptors available."));
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections)
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
// ********************************************************* Step 3: parameter-to-internal-flags
fDebug = GetBoolArg("-debug");
fBenchmark = GetBoolArg("-benchmark");
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
nScriptCheckThreads = GetArg("-par", 0);
if (nScriptCheckThreads <= 0)
nScriptCheckThreads += boost::thread::hardware_concurrency();
if (nScriptCheckThreads <= 1)
nScriptCheckThreads = 0;
else if (nScriptCheckThreads > MAX_SCRIPTCHECK_THREADS)
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;
// -debug implies fDebug*
if (fDebug)
fDebugNet = true;
else
fDebugNet = GetBoolArg("-debugnet");
if (fDaemon)
fServer = true;
else
fServer = GetBoolArg("-server");
/* force fServer when running without GUI */
#if !defined(QT_GUI)
fServer = true;
#endif
fPrintToConsole = GetBoolArg("-printtoconsole");
fPrintToDebugger = GetBoolArg("-printtodebugger");
fLogTimestamps = GetBoolArg("-logtimestamps", true);
bool fDisableWallet = GetBoolArg("-disablewallet", false);
if (mapArgs.count("-timeout"))
{
int nNewTimeout = GetArg("-timeout", 5000);
if (nNewTimeout > 0 && nNewTimeout < 600000)
nConnectTimeout = nNewTimeout;
}
// Continue to put "/P2SH/" in the coinbase to monitor
// BIP16 support.
// This can be removed eventually...
const char* pszP2SH = "/P2SH/";
COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));
// Fee-per-kilobyte amount considered the same as "free"
// If you are mining, be careful setting this:
// if you set it to zero then
// a transaction spammer can cheaply fill blocks using
// 1-satoshi-fee transactions. It should be set above the real
// cost to you of processing a transaction.
if (mapArgs.count("-mintxfee"))
{
int64 n = 0;
if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0)
CTransaction::nMinTxFee = n;
else
return InitError(strprintf(_("Invalid amount for -mintxfee=<amount>: '%s'"), mapArgs["-mintxfee"].c_str()));
}
if (mapArgs.count("-minrelaytxfee"))
{
int64 n = 0;
if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0)
CTransaction::nMinRelayTxFee = n;
else
return InitError(strprintf(_("Invalid amount for -minrelaytxfee=<amount>: '%s'"), mapArgs["-minrelaytxfee"].c_str()));
}
if (mapArgs.count("-paytxfee"))
{
if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"].c_str()));
if (nTransactionFee > 0.25 * COIN)
InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
}
if (mapArgs.count("-mininput"))
{
if (!ParseMoney(mapArgs["-mininput"], nMinimumInputValue))
return InitError(strprintf(_("Invalid amount for -mininput=<amount>: '%s'"), mapArgs["-mininput"].c_str()));
}
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
std::string strDataDir = GetDataDir().string();
// Make sure only a single Bitcoin process is using the data directory.
boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
if (file) fclose(file);
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
if (!lock.try_lock())
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. PiecesofEight is probably already running."), strDataDir.c_str()));
if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("PiecesofEight version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str());
printf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
if (!fLogTimestamps)
printf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
printf("Default data directory %s\n", GetDefaultDataDir().string().c_str());
printf("Using data directory %s\n", strDataDir.c_str());
printf("Using at most %i connections (%i file descriptors available)\n", nMaxConnections, nFD);
std::ostringstream strErrors;
if (fDaemon)
fprintf(stdout, "PiecesofEight server starting\n");
if (nScriptCheckThreads) {
printf("Using %u threads for script verification\n", nScriptCheckThreads);
for (int i=0; i<nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
}
int64 nStart;
// ********************************************************* Step 5: verify wallet database integrity
if (!fDisableWallet) {
uiInterface.InitMessage(_("Verifying wallet..."));
if (!bitdb.Open(GetDataDir()))
{
// try moving the database env out of the way
boost::filesystem::path pathDatabase = GetDataDir() / "database";
boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRI64d".bak", GetTime());
try {
boost::filesystem::rename(pathDatabase, pathDatabaseBak);
printf("Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str());
} catch(boost::filesystem::filesystem_error &error) {
// failure is ok (well, not really, but it's not worse than what we started with)
}
// try again
if (!bitdb.Open(GetDataDir())) {
// if it still fails, it probably means we can't even create the database env
string msg = strprintf(_("Error initializing wallet database environment %s!"), strDataDir.c_str());
return InitError(msg);
}
}
if (GetBoolArg("-salvagewallet"))
{
// Recover readable keypairs:
if (!CWalletDB::Recover(bitdb, "wallet.dat", true))
return false;
}
if (filesystem::exists(GetDataDir() / "wallet.dat"))
{
CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover);
if (r == CDBEnv::RECOVER_OK)
{
string msg = strprintf(_("Warning: wallet.dat corrupt, data salvaged!"
" Original wallet.dat saved as wallet.{timestamp}.bak in %s; if"
" your balance or transactions are incorrect you should"
" restore from a backup."), strDataDir.c_str());
InitWarning(msg);
}
if (r == CDBEnv::RECOVER_FAIL)
return InitError(_("wallet.dat corrupt, salvage failed"));
}
} // (!fDisableWallet)
// ********************************************************* Step 6: network initialization
int nSocksVersion = GetArg("-socks", 5);
if (nSocksVersion != 4 && nSocksVersion != 5)
return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion));
if (mapArgs.count("-onlynet")) {
std::set<enum Network> nets;
BOOST_FOREACH(std::string snet, mapMultiArgs["-onlynet"]) {
enum Network net = ParseNetwork(snet);
if (net == NET_UNROUTABLE)
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet.c_str()));
nets.insert(net);
}
for (int n = 0; n < NET_MAX; n++) {
enum Network net = (enum Network)n;
if (!nets.count(net))
SetLimited(net);
}
}
#if defined(USE_IPV6)
#if ! USE_IPV6
else
SetLimited(NET_IPV6);
#endif
#endif
CService addrProxy;
bool fProxy = false;
if (mapArgs.count("-proxy")) {
addrProxy = CService(mapArgs["-proxy"], 9050);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address: '%s'"), mapArgs["-proxy"].c_str()));
if (!IsLimited(NET_IPV4))
SetProxy(NET_IPV4, addrProxy, nSocksVersion);
if (nSocksVersion > 4) {
#ifdef USE_IPV6
if (!IsLimited(NET_IPV6))
SetProxy(NET_IPV6, addrProxy, nSocksVersion);
#endif
SetNameProxy(addrProxy, nSocksVersion);
}
fProxy = true;
}
// -tor can override normal proxy, -notor disables tor entirely
if (!(mapArgs.count("-tor") && mapArgs["-tor"] == "0") && (fProxy || mapArgs.count("-tor"))) {
CService addrOnion;
if (!mapArgs.count("-tor"))
addrOnion = addrProxy;
else
addrOnion = CService(mapArgs["-tor"], 9050);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -tor address: '%s'"), mapArgs["-tor"].c_str()));
SetProxy(NET_TOR, addrOnion, 5);
SetReachable(NET_TOR);
}
// see Step 2: parameter interactions for more information about these
fNoListen = !GetBoolArg("-listen", true);
fDiscover = GetBoolArg("-discover", true);
fNameLookup = GetBoolArg("-dns", true);
bool fBound = false;
if (!fNoListen) {
if (mapArgs.count("-bind")) {
BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
CService addrBind;
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
return InitError(strprintf(_("Cannot resolve -bind address: '%s'"), strBind.c_str()));
fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
}
}
else {
struct in_addr inaddr_any;
inaddr_any.s_addr = INADDR_ANY;
#ifdef USE_IPV6
fBound |= Bind(CService(in6addr_any, GetListenPort()), BF_NONE);
#endif
fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE);
}
if (!fBound)
return InitError(_("Failed to listen on any port. Use -listen=0 if you want this."));
}
if (mapArgs.count("-externalip")) {
BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"]) {
CService addrLocal(strAddr, GetListenPort(), fNameLookup);
if (!addrLocal.IsValid())
return InitError(strprintf(_("Cannot resolve -externalip address: '%s'"), strAddr.c_str()));
AddLocal(CService(strAddr, GetListenPort(), fNameLookup), LOCAL_MANUAL);
}
}
BOOST_FOREACH(string strDest, mapMultiArgs["-seednode"])
AddOneShot(strDest);
// ********************************************************* Step 7: load block chain
#if defined(USE_SSE2)
scrypt_detect_sse2(cpuid_edx);
#endif
fReindex = GetBoolArg("-reindex");
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
filesystem::path blocksDir = GetDataDir() / "blocks";
if (!filesystem::exists(blocksDir))
{
filesystem::create_directories(blocksDir);
bool linked = false;
for (unsigned int i = 1; i < 10000; i++) {
filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
if (!filesystem::exists(source)) break;
filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
try {
filesystem::create_hard_link(source, dest);
printf("Hardlinked %s -> %s\n", source.string().c_str(), dest.string().c_str());
linked = true;
} catch (filesystem::filesystem_error & e) {
// Note: hardlink creation failing is not a disaster, it just means
// blocks will get re-downloaded from peers.
printf("Error hardlinking blk%04u.dat : %s\n", i, e.what());
break;
}
}
if (linked)
{
fReindex = true;
}
}
// cache size calculations
size_t nTotalCache = GetArg("-dbcache", 25) << 20;
if (nTotalCache < (1 << 22))
nTotalCache = (1 << 22); // total cache cannot be less than 4 MiB
size_t nBlockTreeDBCache = nTotalCache / 8;
if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", false))
nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
nTotalCache -= nBlockTreeDBCache;
size_t nCoinDBCache = nTotalCache / 2; // use half of the remaining cache for coindb cache
nTotalCache -= nCoinDBCache;
nCoinCacheSize = nTotalCache / 300; // coins in memory require around 300 bytes
bool fLoaded = false;
while (!fLoaded) {
bool fReset = fReindex;
std::string strLoadError;
uiInterface.InitMessage(_("Loading block index..."));
nStart = GetTimeMillis();
do {
try {
UnloadBlockIndex();
delete pcoinsTip;
delete pcoinsdbview;
delete pblocktree;
pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReindex);
pcoinsdbview = new CCoinsViewDB(nCoinDBCache, false, fReindex);
pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
if (fReindex)
pblocktree->WriteReindexing(true);
if (!LoadBlockIndex()) {
strLoadError = _("Error loading block database");
break;
}
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
if (!mapBlockIndex.empty() && pindexGenesisBlock == NULL)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
// Initialize the block index (no-op if non-empty database was already loaded)
if (!InitBlockIndex()) {
strLoadError = _("Error initializing block database");
break;
}
// Check for changed -txindex state
if (fTxIndex != GetBoolArg("-txindex", false)) {
strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
break;
}
uiInterface.InitMessage(_("Verifying blocks..."));
if (!VerifyDB(GetArg("-checklevel", 3),
GetArg( "-checkblocks", 288))) {
strLoadError = _("Corrupted block database detected");
break;
}
} catch(std::exception &e) {
strLoadError = _("Error opening block database");
break;
}
fLoaded = true;
} while(false);
if (!fLoaded) {
// first suggest a reindex
if (!fReset) {
bool fRet = uiInterface.ThreadSafeMessageBox(
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
if (fRet) {
fReindex = true;
fRequestShutdown = false;
} else {
return false;
}
} else {
return InitError(strLoadError);
}
}
}
// as LoadBlockIndex can take several minutes, it's possible the user
// requested to kill bitcoin-qt during the last operation. If so, exit.
// As the program has not fully started yet, Shutdown() is possibly overkill.
if (fRequestShutdown)
{
printf("Shutdown requested. Exiting.\n");
return false;
}
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
{
PrintBlockTree();
return false;
}
if (mapArgs.count("-printblock"))
{
string strMatch = mapArgs["-printblock"];
int nFound = 0;
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
{
uint256 hash = (*mi).first;
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
{
CBlockIndex* pindex = (*mi).second;
CBlock block;
block.ReadFromDisk(pindex);
block.BuildMerkleTree();
block.print();
printf("\n");
nFound++;
}
}
if (nFound == 0)
printf("No blocks matching %s were found\n", strMatch.c_str());
return false;
}
// ********************************************************* Step 8: load wallet
if (fDisableWallet) {
printf("Wallet disabled!\n");
pwalletMain = NULL;
} else {
uiInterface.InitMessage(_("Loading wallet..."));
nStart = GetTimeMillis();
bool fFirstRun = true;
pwalletMain = new CWallet("wallet.dat");
DBErrors nLoadWalletRet = pwalletMain->LoadWallet(fFirstRun);
if (nLoadWalletRet != DB_LOAD_OK)
{
if (nLoadWalletRet == DB_CORRUPT)
strErrors << _("Error loading wallet.dat: Wallet corrupted") << "\n";
else if (nLoadWalletRet == DB_NONCRITICAL_ERROR)
{
string msg(_("Warning: error reading wallet.dat! All keys read correctly, but transaction data"
" or address book entries might be missing or incorrect."));
InitWarning(msg);
}
else if (nLoadWalletRet == DB_TOO_NEW)
strErrors << _("Error loading wallet.dat: Wallet requires newer version of PiecesofEight") << "\n";
else if (nLoadWalletRet == DB_NEED_REWRITE)
{
strErrors << _("Wallet needed to be rewritten: restart PiecesofEight to complete") << "\n";
printf("%s", strErrors.str().c_str());
return InitError(strErrors.str());
}
else
strErrors << _("Error loading wallet.dat") << "\n";
}
if (GetBoolArg("-upgradewallet", fFirstRun))
{
int nMaxVersion = GetArg("-upgradewallet", 0);
if (nMaxVersion == 0) // the -upgradewallet without argument case
{
printf("Performing wallet upgrade to %i\n", FEATURE_LATEST);
nMaxVersion = CLIENT_VERSION;
pwalletMain->SetMinVersion(FEATURE_LATEST); // permanently upgrade the wallet immediately
}
else
printf("Allowing wallet upgrade up to %i\n", nMaxVersion);
if (nMaxVersion < pwalletMain->GetVersion())
strErrors << _("Cannot downgrade wallet") << "\n";
pwalletMain->SetMaxVersion(nMaxVersion);
}
if (fFirstRun)
{
// Create new keyUser and set as default key
RandAddSeedPerfmon();
CPubKey newDefaultKey;
if (pwalletMain->GetKeyFromPool(newDefaultKey, false)) {
pwalletMain->SetDefaultKey(newDefaultKey);
if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), ""))
strErrors << _("Cannot write default address") << "\n";
}
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
}
printf("%s", strErrors.str().c_str());
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
RegisterWallet(pwalletMain);
CBlockIndex *pindexRescan = pindexBest;
if (GetBoolArg("-rescan"))
pindexRescan = pindexGenesisBlock;
else
{
CWalletDB walletdb("wallet.dat");
CBlockLocator locator;
if (walletdb.ReadBestBlock(locator))
pindexRescan = locator.GetBlockIndex();
else
pindexRescan = pindexGenesisBlock;
}
if (pindexBest && pindexBest != pindexRescan)
{
uiInterface.InitMessage(_("Rescanning..."));
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
nWalletDBUpdated++;
}
} // (!fDisableWallet)
// ********************************************************* Step 9: import blocks
// scan for better chains in the block chain database, that are not yet connected in the active best chain
CValidationState state;
if (!ConnectBestBlock(state))
strErrors << "Failed to connect best block";
std::vector<boost::filesystem::path> vImportFiles;
if (mapArgs.count("-loadblock"))
{
BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"])
vImportFiles.push_back(strFile);
}
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
// ********************************************************* Step 10: load peers
uiInterface.InitMessage(_("Loading addresses..."));
nStart = GetTimeMillis();
{
CAddrDB adb;
if (!adb.Read(addrman))
printf("Invalid or missing peers.dat; recreating\n");
}
printf("Loaded %i addresses from peers.dat %"PRI64d"ms\n",
addrman.size(), GetTimeMillis() - nStart);
// ********************************************************* Step 11: start node
if (!CheckDiskSpace())
return false;
if (!strErrors.str().empty())
return InitError(strErrors.str());
RandAddSeedPerfmon();
//// debug print
printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size());
printf("nBestHeight = %d\n", nBestHeight);
printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0);
printf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0);
printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
StartNode(threadGroup);
// InitRPCMining is needed here so getwork/getblocktemplate in the GUI debug console works properly.
InitRPCMining();
if (fServer)
StartRPCThreads();
// Generate coins in the background
if (pwalletMain)
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain);
// ********************************************************* Step 12: finished
uiInterface.InitMessage(_("Done loading"));
if (pwalletMain) {
// Add wallet transactions that aren't already in a block to mapTransactions
pwalletMain->ReacceptWalletTransactions();
// Run a thread to flush wallet periodically
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
}
return !fRequestShutdown;
}
| {
"content_hash": "5aa17f5199e8b464f32e87931711307e",
"timestamp": "",
"source": "github",
"line_count": 1174,
"max_line_length": 163,
"avg_line_length": 39.19676320272573,
"alnum_prop": 0.5685507529825934,
"repo_name": "piecesofeight/Po8",
"id": "cad28d473d0dc2bf33831a9465cd6051c2d984b7",
"size": "46017",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/init.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "102799"
},
{
"name": "C++",
"bytes": "2524020"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "IDL",
"bytes": "14696"
},
{
"name": "Objective-C",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69709"
},
{
"name": "Shell",
"bytes": "9702"
},
{
"name": "TypeScript",
"bytes": "5236293"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>Email</title>
<meta about="Search Email content."/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script src="js/d3.min.js"></script>
<script src="js/CoveoJsSearch.WithDependencies.js"></script>
<link rel="stylesheet" href="css/CoveoFullSearch.css"/>
<script type="text/javascript">
$(function () {
Coveo.Rest.SearchEndpoint.configureSampleEndpoint();
/*
// Use this code to use a cloud index
Coveo.Rest.SearchEndpoint.configureCloudEndpoint('OrganizationName');
// Use this code to use an on-premise index
Coveo.Rest.SearchEndpoint.configureOnPremiseEndpoint('http://server:8080/Coveo/Rest');
// Use this code to use a custom endpoint
Coveo.Rest.SearchEndpoint.endpoints["default"] = new Coveo.Rest.SearchEndpoint({
restUri: 'http://server:8080/Coveo/Rest'
});
*/
$('#search').coveo('init');
});
</script>
</head>
<body id="search" class='CoveoSearchInterface' data-enable-history="true">
<div class="CoveoFolding"
data-field="@sysconversationsubject"
data-tab="Email"
data-parent-field="@syscontainsattachment"
data-child-field="@sysisattachment"
data-range="0"></div>
<div class="coveo-tab-section">
<a class="CoveoTab"
data-id="Email"
data-caption="Email"
data-icon="coveo-sprites-tab-email"
data-expression="@sysmailbox"
data-sort="date descending"></a>
</div>
<div class="coveo-search-section">
<div class="coveo-logo-column">
<div class="coveo-logo"></div>
</div>
<div class="coveo-searchBox-column">
<div class="coveo-search-section-wrapper">
<div class="CoveoSettings" data-include-in-menu=".CoveoShareQuery,.CoveoPreferencesPanel"></div>
<div class="CoveoSearchBox" data-activate-omnibox="true"></div>
</div>
</div>
</div>
<div class="coveo-results-section">
<div class="coveo-facet-column">
<div data-tab="Email">
<div class="CoveoFacetRange"
data-title="Relative date distribution"
data-field="@sysdate"
data-date-field="true"
data-range-slider="true"
data-slider-graph-steps="20"
data-slider-start="2007/12/31"
data-slider-end="2014/12/31"></div>
<div class="CoveoFacet"
data-title="Mailbox"
data-field="@sysmailbox"></div>
<div class="CoveoFacet"
data-title="From"
data-field="@sysfrom"></div>
<div class="CoveoFacet"
data-title="To"
data-field="@systo"></div>
<div class="CoveoFacet"
data-title="File Type"
data-field="@sysfiletype"></div>
<div class="CoveoFacet"
data-title="Concepts"
data-field="@sysconcepts"
data-is-multi-value-field="true"></div>
</div>
</div>
<div class="coveo-results-column">
<div class="CoveoShareQuery"></div>
<div class="CoveoPreferencesPanel">
<div class="CoveoResultsPreferences"></div>
<div class="CoveoResultsFiltersPreferences"></div>
</div>
<div class="CoveoBreadcrumb"></div>
<div class="coveo-results-header">
<div class="coveo-summary-section">
<span class="CoveoQuerySummary"></span>
<span class="CoveoQueryDuration"></span>
</div>
<div class="coveo-sort-section">
<span class="CoveoSort" data-sort-criteria="relevancy">Relevance</span>
<span class="CoveoSort" data-sort-criteria="date descending,date ascending">Date</span>
</div>
<div class="coveo-clear"></div>
</div>
<div class="CoveoHiddenQuery"></div>
<div class="CoveoDidYouMean"></div>
<div class="CoveoErrorReport" data-pop-up="false"></div>
<div class="CoveoResultList" data-wait-animation="fade">
<script id="EmailThread" type="text/x-underscore-template">
<div class="coveo-email-result">
<div class="coveo-email-result-top-result">
<%= fromFileTypeToIcon() %>
<div class="coveo-date"><%-dateTime(raw.sysdate)%></div>
<div class="coveo-email-header">
<span class="coveo-email-from">
From: <%= email(raw.sysfrom) %>
</span>
<span class="coveo-email-to">
To: <%= email(raw.sysrecipients)%>
</span>
</div>
<div class="coveo-title">
<a class="CoveoResultLink"><%=title?highlight(title, titleHighlights):clickUri%></a>
<%= loadTemplate("EmailQuickView") %>
</div>
<div class="coveo-excerpt">
<%= highlight(excerpt, excerptHighlights)%>
</div>
<div class="CoveoResultAttachments" data-result-template-id="EmailResultAttachment"></div>
</div>
<div class="CoveoResultFolding"
data-result-template-id="EmailChildResult"
data-more-caption="ShowAllReplies"
data-less-caption="ShowOnlyMostRelevantReplies"></div>
</div>
</script>
<script id="EmailChildResult" type="text/x-underscore-template">
<div class="coveo-date"><%-dateTime(raw.sysdate)%></div>
<div class="coveo-email-header">
<span class="coveo-email-from">
<%= email(raw.sysfrom, undefined, undefined, undefined, true) %>
</span>
<%= loadTemplate("EmailQuickView") %>
</div>
<div class="coveo-excerpt">
<a class="CoveoResultLink">
<%= highlight(firstSentences, firstSentencesHighlights)%>
</a>
</div>
<div class="CoveoResultAttachments" data-result-template-id="EmailResultAttachment"></div>
</script>
<script id="EmailResultAttachment" type="text/x-underscore-template">
<div class="coveo-attachment-container">
<%= fromFileTypeToIcon() %>
<a class="CoveoResultLink"><%= title || clickUri %></a>
<% if(Coveo.QueryUtils.hasThumbnail(obj)){ %> <span class="coveo-thumbnail-icon"><%= thumbnail() %></span><% }
%>
<%= loadTemplate("EmailQuickView") %>
</div>
</script>
<script id="EmailQuickView" type="text/x-underscore-template">
<div class="CoveoQuickView" data-title="<%= attrEncode(fromFileTypeToIcon(obj) + title) %>" data-fixed="true" data-template-id="EmailQuickViewContent">
</div>
</script>
<script id="EmailQuickViewContent" type="text/x-underscore-template">
<div class="coveo-quick-view-header">
<table class="CoveoFieldTable">
<tr data-field="@sysdate" data-caption="Date" data-helper="dateTime"></tr>
<tr data-field="@objecttype" data-caption="Type"></tr>
</table>
</div>
<div class="CoveoQuickViewDocument"></div>
</script>
<script class="result-template" type="text/x-underscore-template">
<%=
loadTemplates({
'EmailThread' : raw.sysmailbox != undefined
})
%>
</script>
</div>
<div class="CoveoPager"></div>
</div>
</div>
</body>
</html> | {
"content_hash": "39449ec2cee575ef4a29c451fdbc20ee",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 159,
"avg_line_length": 34.30909090909091,
"alnum_prop": 0.5802861685214626,
"repo_name": "wnijmeijer/jsui-custom-components",
"id": "b3c60933f12dee313d5910b8a35b425d5f93ab3d",
"size": "7548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CoveoJsSearch/Email.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1046534"
},
{
"name": "HTML",
"bytes": "902447"
},
{
"name": "JavaScript",
"bytes": "11957397"
},
{
"name": "Visual Basic",
"bytes": "4773"
}
],
"symlink_target": ""
} |
require 'redis-namespace'
module Runlimited
# This class is an implementation of a limiter which stores its
# limit information in a Redis database
class Redis < Base
# The Redis key in which to store our last request info
attr_reader :redis_key
# When instanciating a new Redis limiter the user must provide a few pieces of information
#
# @param options [Redis] :redis (Redis.new) An instance of the Redis client
# @param options [Integer] :interval (5) The minimum wait time between requests
# @param options [String] :key (lastrequest) The Redis key in which to store the last request info (namespaced to 'runlimited')
def initialize( options = {} )
super(options)
redis = options[:redis] || ::Redis.new
@redis = ::Redis::Namespace.new(:runlimited, :redis => redis)
@redis_key = options[:key] || 'lastrequest'
end
# Fetch the last request Time
def last_run
stamp = @redis.get( redis_key )
Time.at(stamp.to_i)
end
# Update the last request in Redis and return the Time
def update
stamp = Time.new
@redis.multi do
@redis.set( redis_key, stamp.to_i )
end
return stamp
end
end
end
| {
"content_hash": "03daad05bdd6393185da8fee374f1242",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 129,
"avg_line_length": 30.36842105263158,
"alnum_prop": 0.7001733102253033,
"repo_name": "coderjoe/runlimited",
"id": "0e17750d8768a94521997dab79b64f4e586743c5",
"size": "1154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/runlimited/redis.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "8241"
}
],
"symlink_target": ""
} |
"""Kubeflow Covertype Pipeline."""
import os
from google_cloud_pipeline_components.aiplatform import (
AutoMLTabularTrainingJobRunOp,
EndpointCreateOp,
ModelDeployOp,
TabularDatasetCreateOp,
)
from kfp.v2 import dsl
PIPELINE_ROOT = os.getenv("PIPELINE_ROOT")
PROJECT = os.getenv("PROJECT")
DATASET_SOURCE = os.getenv("DATASET_SOURCE")
PIPELINE_NAME = os.getenv("PIPELINE_NAME", "covertype")
DISPLAY_NAME = os.getenv("MODEL_DISPLAY_NAME", PIPELINE_NAME)
TARGET_COLUMN = os.getenv("TARGET_COLUMN", "Cover_Type")
SERVING_MACHINE_TYPE = os.getenv("SERVING_MACHINE_TYPE", "n1-standard-16")
@dsl.pipeline(
name=f"{PIPELINE_NAME}-vertex-automl-pipeline",
description=f"AutoML Vertex Pipeline for {PIPELINE_NAME}",
pipeline_root=PIPELINE_ROOT,
)
def create_pipeline():
dataset_create_task = TabularDatasetCreateOp(
display_name=DISPLAY_NAME,
bq_source=DATASET_SOURCE,
project=PROJECT,
)
automl_training_task = AutoMLTabularTrainingJobRunOp(
project=PROJECT,
display_name=DISPLAY_NAME,
optimization_prediction_type="classification",
dataset=dataset_create_task.outputs["dataset"],
target_column=TARGET_COLUMN,
)
endpoint_create_task = EndpointCreateOp(
project=PROJECT,
display_name=DISPLAY_NAME,
)
model_deploy_task = ModelDeployOp( # pylint: disable=unused-variable
model=automl_training_task.outputs["model"],
endpoint=endpoint_create_task.outputs["endpoint"],
deployed_model_display_name=DISPLAY_NAME,
dedicated_resources_machine_type=SERVING_MACHINE_TYPE,
dedicated_resources_min_replica_count=1,
dedicated_resources_max_replica_count=1,
)
| {
"content_hash": "0d1cf9157c3b0f39b9cd8d76a85c8f5d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 74,
"avg_line_length": 31.527272727272727,
"alnum_prop": 0.7041522491349481,
"repo_name": "GoogleCloudPlatform/asl-ml-immersion",
"id": "3edb4e4b8a62e2dbd4656736eb36d8dd889f7f64",
"size": "2303",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "notebooks/kubeflow_pipelines/pipelines/solutions/pipeline_vertex/pipeline_vertex_automl.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2934"
},
{
"name": "JavaScript",
"bytes": "1347"
},
{
"name": "Jupyter Notebook",
"bytes": "31135165"
},
{
"name": "Makefile",
"bytes": "3768"
},
{
"name": "Python",
"bytes": "219062"
},
{
"name": "Shell",
"bytes": "11616"
}
],
"symlink_target": ""
} |
package bapi
import (
"errors"
"fmt"
"github.com/PuerkitoBio/goquery"
"golang.org/x/text/encoding/charmap"
"strings"
"time"
"unicode"
)
type Card struct {
}
type Skipass struct {
Plan string
CardNumber string
TicketNumber string
PurchaseDate time.Time
}
func (c *Client) CardNumber(ticketNumber string) (string, error) {
url := fmt.Sprintf("%s?NumTicket=%s", c.base, ticketNumber)
res, err := c.http.Get(url)
if err != nil {
return "", err
}
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return "", err
}
return parseCardNumber(doc)
}
func (c *Client) Skipass(ticketNumber string) (Skipass, error) {
cardNumber, err := c.CardNumber(ticketNumber)
if err != nil {
return Skipass{}, err
}
url := fmt.Sprintf("%s?NumTicket=%s&Card=%s", c.base, ticketNumber, cardNumber)
res, err := c.http.Get(url)
if err != nil {
return Skipass{}, err
}
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return Skipass{}, err
}
s := Skipass{
TicketNumber: ticketNumber,
}
err = parseSkipass(doc, &s)
if err != nil {
return Skipass{}, err
}
return s, nil
}
func parseCardNumber(doc *goquery.Document) (string, error) {
s := doc.Find("#result tr:first-child strong").Text()
return stripCardNumber(s), nil
}
func stripCardNumber(s string) string {
result := strings.TrimSpace(s)
if len(result) == 0 {
return result
}
// card number format
// XX-XXXX XXXX XXXX XXXX XXXX-X
startIndex := strings.IndexFunc(result, isHyphen) + 1
endIndex := strings.LastIndexFunc(result, isHyphen)
result = result[startIndex:endIndex]
return strings.Map(func(r rune) rune {
if unicode.IsSpace(r) {
return -1
}
if unicode.Is(unicode.Hyphen, r) {
return -1
}
return r
}, result)
}
func isHyphen(r rune) bool {
return unicode.Is(unicode.Hyphen, r)
}
func parseSkipass(doc *goquery.Document, s *Skipass) error {
if doc == nil {
return errors.New("parseSkipass no goquery.Document provided (doc == nil)")
}
res := doc.Find("#result")
if res.Length() == 0 {
return errors.New("parseSkipass no #result table where found")
}
if res.Length() != 2 {
return errors.New(fmt.Sprintf("parseSkipass expecting 2 #result table, got %d", res.Length()))
}
fillSkipassHead(res.Eq(0), s)
return nil
}
func fillSkipassHead (s *goquery.Selection, skipass *Skipass) {
s.Find("tr").Each(func (i int, s *goquery.Selection) {
columns := s.Find("td")
key, _ := decodeWindows1251(columns.Eq(0).Text())
value, _ := decodeWindows1251(columns.Eq(1).Text())
switch strings.TrimSpace(key) {
case "№ картки":
skipass.CardNumber = strings.TrimSpace(value)
case "Квиток":
skipass.Plan = stripCardPlan(value)
case "Дата продажу":
skipass.PurchaseDate, _ = parseCardTime(value)
}
})
}
func parseCardTime (s string) (time.Time, error) {
var date time.Time
loc, err := time.LoadLocation("Europe/Kiev")
if err != nil {
return date, err
}
date, err = time.ParseInLocation("02.01.2006 15:04", s, loc)
if err != nil {
return date, err
}
return date.UTC(), nil
}
func stripCardPlan (s string) string {
var result []rune
hadSpace := false
for _, val := range s {
// skip duplicated space
if hadSpace && unicode.IsSpace(val) {
continue
}
// no spaces before closing parenthesis
if hadSpace && val == ')' {
result = result[:len(result) - 1]
}
result = append(result, val)
hadSpace = unicode.IsSpace(val)
}
return string(result)
}
func decodeWindows1251(s string) (string, error) {
ba := []byte(s)
dec := charmap.Windows1251.NewDecoder()
out, err := dec.Bytes(ba)
if err != nil {
return "", err
}
return string(out), nil
}
| {
"content_hash": "ae78d54dbf677315b8a910007e61e602",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 96,
"avg_line_length": 18.95897435897436,
"alnum_prop": 0.6624289964836354,
"repo_name": "blobor/skipass-api",
"id": "fd26fecc0ebb434d1bf3c458d9a3dfb27fe9b3b6",
"size": "3722",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "functions/graphql/bapi/skipass.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "12447"
},
{
"name": "JavaScript",
"bytes": "269"
},
{
"name": "Makefile",
"bytes": "1621"
}
],
"symlink_target": ""
} |
package org.apache.lucene.search.exposed;
import com.ibm.icu.text.Collator;
import junit.framework.TestCase;
import org.apache.lucene.index.*;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.search.exposed.compare.NamedCollatorComparator;
import org.apache.lucene.search.exposed.compare.NamedComparator;
import org.apache.lucene.search.exposed.compare.NamedNaturalComparator;
import org.apache.lucene.search.exposed.facet.FacetMap;
import org.apache.lucene.search.exposed.facet.FacetMapFactory;
import org.apache.lucene.search.exposed.facet.FacetMapMulti;
import org.apache.lucene.util.BytesRef;
import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.IOException;
import java.util.*;
// TODO: Change this to LuceneTestCase but ensure Flex
public class TestGroupTermProvider extends TestCase {
public static final int DOCCOUNT = 10;
private ExposedHelper helper;
@Override
public void setUp() throws Exception {
super.setUp();
helper = new ExposedHelper();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
helper.close();
}
public void testIndexGeneration() throws Exception {
helper.createIndex( DOCCOUNT, Arrays.asList("a", "b"), 20, 2);
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
long termCount = 0;
TermsEnum terms = MultiFields.getFields(reader).terms(ExposedHelper.ID).iterator(null);
while (terms.next() != null) {
assertEquals("The ID-term #" + termCount + " should be correct",
ExposedHelper.ID_FORMAT.format(termCount), terms.term().utf8ToString());
termCount++;
}
assertEquals("There should be the right number of terms",
DOCCOUNT, termCount);
reader.close();
}
public void testOrdinalAccess() throws IOException {
String[] fieldNames = new String[]{"a"};
helper.createIndex( DOCCOUNT, Arrays.asList(fieldNames), 20, 2);
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
ArrayList<String> plainExtraction = new ArrayList<String>(DOCCOUNT);
for (String fieldName: fieldNames) {
// FIXME: The ordinals are not comparable to the exposed ones!
TermsEnum terms = MultiFields.getFields(reader).terms(fieldName).iterator(null);
while (terms.next() != null) {
plainExtraction.add(terms.term().utf8ToString());
}
}
TermProvider groupProvider = ExposedFactory.createProvider(
reader, "TestGroup", Arrays.asList(fieldNames), new NamedNaturalComparator());
ArrayList<String> exposedOrdinals = new ArrayList<String>(DOCCOUNT);
for (int i = 0 ; i < groupProvider.getOrdinalTermCount() ; i++) {
exposedOrdinals.add(groupProvider.getTerm(i).utf8ToString());
}
assertEquals("The two lists of terms should be of equal length",
plainExtraction.size(), exposedOrdinals.size());
// We sort as the order of the terms is not significant here
Collections.sort(plainExtraction);
Collections.sort(exposedOrdinals);
for (int i = 0 ; i < plainExtraction.size() ; i++) {
assertEquals("The term at index " + i + " should be correct",
plainExtraction.get(i), exposedOrdinals.get(i));
}
reader.close();
}
public void testTermSortAllDefined() throws IOException {
helper.createIndex( DOCCOUNT, Arrays.asList("a", "b"), 20, 2);
IndexReader reader =
ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
testTermSort(reader, Arrays.asList("a"));
reader.close();
}
public void testBuildPerformance() throws IOException {
final String FIELD = "a";
final int DOCS = 1000;
ExposedSettings.debug = true;
helper.createIndex(DOCCOUNT, Arrays.asList(FIELD), DOCS, 2);
IndexReader reader = ExposedIOFactory.getReader(
ExposedHelper.INDEX_LOCATION);
Collator sorter = Collator.getInstance(new Locale("da"));
long extractTime = -System.currentTimeMillis();
TermProvider groupProvider = ExposedFactory.createProvider(
reader, "a-group", Arrays.asList(FIELD),
new NamedCollatorComparator(sorter));
extractTime += System.currentTimeMillis();
System.out.println("Extracted and sorted " + 20 + " terms in "
+ extractTime/1000 + " seconds");
reader.close();
}
public void testTermSortAllScarce() throws IOException {
helper.createIndex( DOCCOUNT, Arrays.asList("a", "b"), 20, 2);
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
testTermSort(reader, Arrays.asList("even"));
reader.close();
}
private void testTermSort(IndexReader index, List<String> fieldNames) throws IOException {
Collator sorter = Collator.getInstance(new Locale("da"));
ArrayList<String> plainExtraction = new ArrayList<String>(DOCCOUNT);
// TODO: Make this handle multiple field names
TermsEnum terms = MultiFields.getFields(index).terms(fieldNames.get(0)).iterator(null);
while (terms.next() != null) {
String next = terms.term().utf8ToString();
plainExtraction.add(next);
// System.out.println("Default order term #"
// + (plainExtraction.size() - 1) + ": " + next);
}
Collections.sort(plainExtraction, sorter);
TermProvider groupProvider = ExposedFactory.createProvider(
index, "a-group", fieldNames, new NamedCollatorComparator(sorter));
ArrayList<String> exposedExtraction = new ArrayList<String>(DOCCOUNT);
Iterator<ExposedTuple> ei = groupProvider.getIterator(false);
int count = 0;
while (ei.hasNext()) {
String next = ei.next().term.utf8ToString();
exposedExtraction.add(next);
// System.out.println("Exposed sorted term #" + count++ + ": " + next);
}
assertEquals("The two lists of terms should be of equal length",
plainExtraction.size(), exposedExtraction.size());
for (int i = 0 ; i < plainExtraction.size() ; i++) {
assertEquals("The term at index " + i + " should be correct",
plainExtraction.get(i), exposedExtraction.get(i));
}
}
public void testDocIDMapping() throws IOException {
helper.createIndex( DOCCOUNT, Arrays.asList("a", "b"), 20, 2);
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
Collator sorter = Collator.getInstance(new Locale("da"));
ArrayList<ExposedHelper.Pair> plain =
new ArrayList<ExposedHelper.Pair>(DOCCOUNT);
for (int docID = 0 ; docID < reader.maxDoc() ; docID++) {
plain.add(new ExposedHelper.Pair(docID, reader.document(docID).get("a"), sorter));
// System.out.println("Plain access added " + plain.get(plain.size()-1));
}
Collections.sort(plain);
TermProvider index = ExposedFactory.createProvider(
reader, "docIDGroup", Arrays.asList("a"), new NamedCollatorComparator(sorter));
ArrayList<ExposedHelper.Pair> exposed = new ArrayList<ExposedHelper.Pair>(DOCCOUNT);
Iterator<ExposedTuple> ei = index.getIterator(true);
while (ei.hasNext()) {
final ExposedTuple tuple = ei.next();
if (tuple.docIDs != null) {
int doc;
// TODO: Test if bulk reading (which includes freqs) is faster
while ((doc = tuple.docIDs.nextDoc()) != DocsEnum.NO_MORE_DOCS) {
exposed.add(new ExposedHelper.Pair(doc + tuple.docIDBase, tuple.term.utf8ToString(), sorter));
}
}
}
Collections.sort(exposed);
assertEquals("The two docID->term maps should be of equal length",
plain.size(), exposed.size());
for (int i = 0 ; i < plain.size() ; i++) {
// System.out.println("Sorted docID, term #" + i + ". Plain=" + plain.get(i)
// + ", Exposed=" + exposed.get(i));
assertEquals("Mapping #" + i + " should be equal",
plain.get(i), exposed.get(i));
}
reader.close();
}
public void testMultiField() throws IOException {
final int DOCCOUNT = 5;
ExposedHelper helper = new ExposedHelper();
File location = helper.buildMultiFieldIndex(DOCCOUNT);
IndexReader reader = ExposedIOFactory.getReader(location);
Collator sorter = Collator.getInstance(new Locale("da"));
TermProvider index =
ExposedFactory.createProvider(
reader, "multiGroup", Arrays.asList("a", "b"),
new NamedCollatorComparator(sorter));
ArrayList<ExposedHelper.Pair> exposed =
new ArrayList<ExposedHelper.Pair>(DOCCOUNT);
Iterator<ExposedTuple> ei = index.getIterator(true);
long maxID = 0;
while (ei.hasNext()) {
final ExposedTuple tuple = ei.next();
if (tuple.docIDs != null) {
int doc;
// TODO: Test if bulk reading (which includes freqs) is faster
while ((doc = tuple.docIDs.nextDoc()) != DocsEnum.NO_MORE_DOCS) {
exposed.add(new ExposedHelper.Pair(
doc + tuple.docIDBase, tuple.term.utf8ToString(), sorter));
maxID = Math.max(maxID, doc + tuple.docIDBase);
}
}
}
Collections.sort(exposed);
for (int i = 0 ; i < exposed.size() && i < 10 ; i++) {
System.out.println("Sorted docID, term #" + i + ". Exposed=" + exposed.get(i));
}
reader.close();
assertEquals("The maximum docID in tuples should be equal to the maximum from the reader",
reader.maxDoc() - 1, maxID);
}
public void testTermCount() throws IOException {
helper.createIndex(100, Arrays.asList("a"), 20, 2);
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
NamedComparator comp = new NamedNaturalComparator();
ExposedRequest.Field fieldRequest = new ExposedRequest.Field(ExposedHelper.MULTI, comp);
ExposedRequest.Group groupRequest = new ExposedRequest.Group("TestGroup", Arrays.asList(fieldRequest), comp);
TermProvider provider = ExposedCache.getInstance().getProvider(reader, groupRequest);
assertEquals("The number of unique terms for multi should match",
25, provider.getUniqueTermCount());
}
public void testVerifyCorrectCountWithMap() throws IOException, XMLStreamException, ParseException {
String[] FIELDS = new String[]{"recordBase", "lsubject"};
IndexWriter w = ExposedHelper.getWriter();
ExposedHelper.addDocument(w,
ExposedHelper.ID + ":1",
ExposedHelper.ALL + ":" + ExposedHelper.ALL,
"recordBase:foo",
"lsubject:bar",
"lsubject:zoo"
);
w.commit();
w.close();
verifyGroupElements("Empty term present", FIELDS, 3);
verifyMapElements("All terms with content", FIELDS, 3);
}
public void testMiscountEmptyWithMap()
throws IOException, XMLStreamException, ParseException {
String[] FIELDS = new String[]{"recordBase", "lsubject"};
IndexWriter w = ExposedHelper.getWriter();
ExposedHelper.addDocument(w,
ExposedHelper.ID + ":1",
ExposedHelper.ALL + ":" + ExposedHelper.ALL,
"recordBase:foo",
"lsubject:bar",
"lsubject:"
);
w.commit();
w.close();
verifyGroupElements("Empty term present", FIELDS, 3);
verifyMapElements("Empty term present", FIELDS, 3);
}
public void testMiscountEmptyGroupProvider()
throws IOException, XMLStreamException, ParseException {
String[] FIELDS = new String[]{"lsubject"};
IndexWriter w = ExposedHelper.getWriter();
ExposedHelper.addDocument(w,
ExposedHelper.ID + ":1",
ExposedHelper.ALL + ":" + ExposedHelper.ALL,
"lsubject:"
);
w.commit();
w.close();
verifyGroupElements("Single group with empty term", FIELDS, 1);
}
private void verifyGroupElements(String message, String[] fields, int termCount) throws IOException {
IndexReader reader = ExposedIOFactory.getReader(ExposedHelper.INDEX_LOCATION);
List<TermProvider> providers = createGroupProviders(message, fields, reader);
long uniques = 0;
for (TermProvider provider: providers) {
uniques += provider.getUniqueTermCount();
}
assertEquals(message + ". The unique count should be as expected",
termCount, uniques);
reader.close();
}
private void verifyMapElements(String message, String[] fields, int termCount) throws IOException {
IndexReader reader = ExposedIOFactory.getReader(
ExposedHelper.INDEX_LOCATION);
List<TermProvider> providers = createGroupProviders(message, fields, reader);
FacetMap map = FacetMapFactory.createMap(1, providers);
assertEquals(message + ". There should be the correct number of terms for the single document in the map",
termCount, map.getTermsForDocID(0).length);
assertEquals(message + ". There should be the correct number of indirects",
termCount, map.getIndirectStarts()[map.getIndirectStarts().length-1]);
BytesRef last = null;
for (int i = 0 ; i < 3 ; i++) {
if (i != 0) {
assertFalse(message + ". The term '" + last.utf8ToString() + "' at " +
"order index #" + i + " should not be equal to the previous term",
last.utf8ToString().equals(map.getOrderedTerm(i).utf8ToString()));
}
last = map.getOrderedTerm(i);
}
reader.close();
}
private List<TermProvider> createGroupProviders(
String message, String[] fields, IndexReader reader) throws IOException {
List<TermProvider> providers = new ArrayList<TermProvider>(fields.length);
NamedComparator comp = new NamedNaturalComparator();
for (String field: fields) {
List<ExposedRequest.Field> fieldRequests = new ArrayList<ExposedRequest.Field>(fields.length);
fieldRequests.add(new ExposedRequest.Field(field, comp));
ExposedRequest.Group groupRequest = new ExposedRequest.Group("TestGroup", fieldRequests, comp);
TermProvider provider = ExposedCache.getInstance().getProvider(reader, groupRequest);
assertTrue(message + ". The provider for " + field + " should be a " +
"GroupTermProvider but was a " + provider.getClass().getSimpleName(),
provider instanceof GroupTermProvider);
providers.add(provider);
}
return providers;
}
} | {
"content_hash": "60280331ce3ef4e6b411a3880736af87",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 113,
"avg_line_length": 40.5243553008596,
"alnum_prop": 0.6783567842749063,
"repo_name": "statsbiblioteket/summa",
"id": "4aa2ea51dc1a9c6dbc050c1b193cf8a4b5303acc",
"size": "14143",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Exposed/src/test/java/org/apache/lucene/search/exposed/TestGroupTermProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7987"
},
{
"name": "CSS",
"bytes": "26332"
},
{
"name": "HTML",
"bytes": "18963"
},
{
"name": "Java",
"bytes": "8345964"
},
{
"name": "JavaScript",
"bytes": "81483"
},
{
"name": "Shell",
"bytes": "136136"
},
{
"name": "Tcl",
"bytes": "12029"
},
{
"name": "XSLT",
"bytes": "3770667"
}
],
"symlink_target": ""
} |
'use strict';var constants_1 = require('./constants');
/**
* Controls change detection.
*
* {@link ChangeDetectorRef} allows requesting checks for detectors that rely on observables. It
* also allows detaching and attaching change detector subtrees.
*/
var ChangeDetectorRef = (function () {
/**
* @private
*/
function ChangeDetectorRef(_cd) {
this._cd = _cd;
}
/**
* Request to check all OnPush ancestors.
*/
ChangeDetectorRef.prototype.markForCheck = function () { this._cd.markPathToRootAsCheckOnce(); };
/**
* Detaches the change detector from the change detector tree.
*
* The detached change detector will not be checked until it is reattached.
*/
ChangeDetectorRef.prototype.detach = function () { this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; };
/**
* Reattach the change detector to the change detector tree.
*
* This also requests a check of this change detector. This reattached change detector will be
* checked during the next change detection run.
*/
ChangeDetectorRef.prototype.reattach = function () {
this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways;
this.markForCheck();
};
return ChangeDetectorRef;
})();
exports.ChangeDetectorRef = ChangeDetectorRef;
//# sourceMappingURL=change_detector_ref.js.map | {
"content_hash": "d56740915bc36bd7c39b07907ff22ec9",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 119,
"avg_line_length": 37.473684210526315,
"alnum_prop": 0.6657303370786517,
"repo_name": "rehnen/potato",
"id": "519e37c60e0c99f59e0d4a357e16f99f7e923aed",
"size": "1424",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/angular2/src/core/change_detection/change_detector_ref.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "575"
},
{
"name": "JavaScript",
"bytes": "3314"
},
{
"name": "TypeScript",
"bytes": "1112"
}
],
"symlink_target": ""
} |
package org.fsola.test.datastructures.hashtable;
import org.fsola.datastructures.hashtable.DoubleHashingHashTable;
import org.fsola.test.utils.Utils;
import org.junit.Assert;
import org.junit.Test;
public class DoubleHashingHashTableTest {
private static final int MAX = 2048;
@Test
public void testHashTable1() {
DoubleHashingHashTable<String, String> table =
new DoubleHashingHashTable<>();
for (int i = 0; i < Utils.STRINGS_KV.length; ++i) {
table.put(Utils.STRINGS_KV[i][0], Utils.STRINGS_KV[i][1]);
}
for (int i = 0; i < Utils.STRINGS_KV.length; ++i) {
Assert.assertEquals(Utils.STRINGS_KV[i][1],
table.get(Utils.STRINGS_KV[i][0]));
}
}
@Test
public void testHashTable2() {
DoubleHashingHashTable<String, String> table =
new DoubleHashingHashTable<>();
for (int i = 0; i < Utils.STRINGS_KV.length; ++i) {
table.put(Utils.STRINGS_KV[i][0], Utils.STRINGS_KV[i][1]);
}
table.put(Utils.STRINGS_KV[0][0], "a");
Assert.assertEquals("a", table.get(Utils.STRINGS_KV[0][0]));
}
@Test
public void testHashTable3() {
DoubleHashingHashTable<String, String> table =
new DoubleHashingHashTable<>();
for (int i = 0; i < Utils.STRINGS_KV.length; ++i) {
table.put(Utils.STRINGS_KV[i][0], Utils.STRINGS_KV[i][1]);
}
Assert.assertEquals(Utils.STRINGS_KV[0][1],
table.delete(Utils.STRINGS_KV[0][0]));
Assert.assertNull(table.get(Utils.STRINGS_KV[0][0]));
}
@Test
public void testHashTable4() {
String[][] kv = Utils.generateRandomKV(MAX);
DoubleHashingHashTable<String, String> table =
new DoubleHashingHashTable<>();
for (int i = 0; i < kv.length; ++i) {
table.put(kv[i][0], kv[i][1]);
}
for (int i = 0; i < kv.length; ++i) {
Assert.assertEquals(kv[i][1], table.get(kv[i][0]));
}
}
}
| {
"content_hash": "d7f8b4a43b6b3c375a1406c7cece12d8",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 70,
"avg_line_length": 29.7,
"alnum_prop": 0.56998556998557,
"repo_name": "dzhemriza/fsola",
"id": "abe6f68d6264da8f774ca310dbeaac63c3dcc435",
"size": "2738",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/fsola/test/datastructures/hashtable/DoubleHashingHashTableTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "760831"
}
],
"symlink_target": ""
} |
package com.dev4free.devbuy.mapper;
import java.util.ArrayList;
import com.dev4free.devbuy.po.Banner;
public interface BannerMapper {
/**
* 查询banner上面需要显示的图片
* @return
*/
public ArrayList<Banner> bannerQuery();
/**
* 添加banner上需要显示的图片的详情
* @param banner
*/
public void insertBannerDetail(Banner banner);
/**
* 更新banner上需要显示的图片的详情
* @param banner
*/
public void updateBannerDetail(Banner banner);
}
| {
"content_hash": "77aece622f7de019de159bf077de74dc",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 47,
"avg_line_length": 15.962962962962964,
"alnum_prop": 0.7099767981438515,
"repo_name": "siyadong1/DevBuy_Server_JAVA",
"id": "f38a6f39b0c38d939c62967f9b7a414d48caac62",
"size": "505",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/dev4free/devbuy/mapper/BannerMapper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "153536"
}
],
"symlink_target": ""
} |
/**
* The simplest possible example of
* Using Hibernate Query Language.
* @author Peter Hendler 3/29/2008
*/
package org.hl7.demo;
import org.hibernate.classic.Session;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hl7.hibernate.Persistence;
import org.hl7.rim.*;
import org.hl7.rim.impl.*;
import org.hibernate.Query;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import org.hl7.rim.*;
import org.hl7.types.*;
public class HibernateQueryDemo {
/**
* @param args
*/
HibernateQueryDemo(){}
public static void main(String[] args) {
// TODO Auto-generated method stub
HibernateQueryDemo hqd = new HibernateQueryDemo();
if(args.length == 0){
hqd.query("select new list( obs.value, role, player ) from ObservationImpl as obs inner join obs.participation as part inner join part.role as role inner join role.player as player" +
"where obs.classCode like 'OBS' " );
}else{
hqd.query(args[0]);
}
}
public void query(String query){
Session session = Persistence.getSessionFactory().openSession();
Iterator resit = session.iterate(query);
showIt(resit);
}
public void showIt(Iterator resit){
while(resit.hasNext()){
List list = (List)resit.next();
System.out.print("value " + list.get(0) + " : ");
System.out.print("root " + list.get(1) + " : ");
System.out.print("ext " + list.get(2) + "\n" );
}
}
}
| {
"content_hash": "513a7c0a648ad7c8bbb3ac9a51bc4755",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 193,
"avg_line_length": 26.517241379310345,
"alnum_prop": 0.6339401820546163,
"repo_name": "markusgumbel/dshl7",
"id": "386f0b7d7045f346fee6167f055e1e4b64fbc411",
"size": "1538",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hl7-javasig/demo/org/hl7/demo/HibernateQueryDemo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "25055"
},
{
"name": "Java",
"bytes": "3897443"
},
{
"name": "Perl",
"bytes": "9821"
},
{
"name": "Python",
"bytes": "3285"
},
{
"name": "Scala",
"bytes": "100505"
},
{
"name": "Shell",
"bytes": "974"
}
],
"symlink_target": ""
} |
import google from './auth.google';
import facebook from './auth.facebook';
var auths = {
google:google,
facebook:facebook
}
export default function(req,res,done){
auths[req.params.social](req,res,done);
};
| {
"content_hash": "57e55ab645bb3d4c298064f0bd7e1de8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 43,
"avg_line_length": 18.166666666666668,
"alnum_prop": 0.7018348623853211,
"repo_name": "tedqiao/ng2-admin",
"id": "bcc485ff689d31d5ece92b098f624b464a778162",
"size": "219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/app/modules/social/auths.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "113178"
},
{
"name": "HTML",
"bytes": "87973"
},
{
"name": "JavaScript",
"bytes": "34983"
},
{
"name": "Shell",
"bytes": "153"
},
{
"name": "TypeScript",
"bytes": "252333"
}
],
"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_181-google-v7) on Tue Apr 16 11:16:22 PDT 2019 -->
<title>QualifiedContent.ScopeType (Android Gradle API)</title>
<meta name="date" content="2019-04-16">
<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="QualifiedContent.ScopeType (Android Gradle API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</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 class="navBarCell1Rev">Class</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><a href="../../../../../com/android/build/api/transform/QualifiedContent.Scope.html" title="enum in com.android.build.api.transform"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../com/android/build/api/transform/SecondaryFile.html" title="class in com.android.build.api.transform"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/android/build/api/transform/QualifiedContent.ScopeType.html" target="_top">Frames</a></li>
<li><a href="QualifiedContent.ScopeType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.android.build.api.transform</div>
<h2 title="Interface QualifiedContent.ScopeType" class="title">Interface QualifiedContent.ScopeType</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../com/android/build/api/transform/QualifiedContent.Scope.html" title="enum in com.android.build.api.transform">QualifiedContent.Scope</a></dd>
</dl>
<dl>
<dt>Enclosing interface:</dt>
<dd><a href="../../../../../com/android/build/api/transform/QualifiedContent.html" title="interface in com.android.build.api.transform">QualifiedContent</a></dd>
</dl>
<hr>
<br>
<pre>public static interface <span class="typeNameLabel">QualifiedContent.ScopeType</span></pre>
<div class="block">Definition of a scope.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/android/build/api/transform/QualifiedContent.ScopeType.html#getValue--">getValue</a></span>()</code>
<div class="block">A scope binary flag that will be used to encode directory names.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/android/build/api/transform/QualifiedContent.ScopeType.html#name--">name</a></span>()</code>
<div class="block">Scope name, readable by humans.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="name--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>name</h4>
<pre>java.lang.String name()</pre>
<div class="block">Scope name, readable by humans.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a scope name.</dd>
</dl>
</li>
</ul>
<a name="getValue--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getValue</h4>
<pre>int getValue()</pre>
<div class="block">A scope binary flag that will be used to encode directory names. Must be unique.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a scope binary flag.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= 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 class="navBarCell1Rev">Class</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><a href="../../../../../com/android/build/api/transform/QualifiedContent.Scope.html" title="enum in com.android.build.api.transform"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../com/android/build/api/transform/SecondaryFile.html" title="class in com.android.build.api.transform"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/android/build/api/transform/QualifiedContent.ScopeType.html" target="_top">Frames</a></li>
<li><a href="QualifiedContent.ScopeType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "928e3daa4f229792cba38cdaf2cb277b",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 391,
"avg_line_length": 35.568627450980394,
"alnum_prop": 0.6343991179713341,
"repo_name": "google/android-gradle-dsl",
"id": "5badece6720be52ab47733d2f36a916678168f39",
"size": "9070",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "javadoc/3.4/com/android/build/api/transform/QualifiedContent.ScopeType.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "324207"
},
{
"name": "HTML",
"bytes": "10803017"
}
],
"symlink_target": ""
} |
<?php
header('Access-Control-Allow-Origin: *');
include_once('../login/checkUser.php');
if(!$user_ok || $userType != 'network'){
exit();
}
/*------------------------------------------/
* Day Fetch
*
* Check to make sure the network is logged in. Search the "socials" table for entries that have the userID corresponding
* to either our "userId" and store each in a variable. Example:
* $facebook = 'trapnation';
* $instagram = null;
*
* Access the POST information "month" number and "day" number.
* Sanitize the data.
*
* Fetch the "submissionEvents" table and find all events in the proper month and day that corrispond to our networkId.
* Fetch the following information for each record:
* trackId ---> new SELECT command for the "submissions" table to get track information
* coverArt
* trackName
* artist
* mp3
* buyLink
*
* soundcloud (If TRUE, set as soundcloud social variable)
* youtube (If TRUE, set as youtube social variable)
* website (If TRUE, set as website social variable)
* instagram (If TRUE, set as instagram social variable)
*
*
*
* Return an array of objects with this event information.
*
*------------------------------------------*/
class trackInfo {
public $submission_id;
public $track_id;
public $cover_art;
public $track_name;
public $artist;
public $mp3;
public $buy_link;
public $soundcloud;
public $youtube;
public $website;
public $instagram;
}
$month = preg_replace('#[^0-9]#i', '', $_POST['month']);
$day = preg_replace('#[^0-9]#i', '', $_POST['day']);
$dayInfo=[];
$sql = "SELECT DISTINCT `submissions`.`id`,
`submissions`.`trackID`,
`tracks`.`coverArt`,
`tracks`.`title`,
`tracks`.`artist`,
`tracks`.`mp3Location`,
`tracks`.`buyLink`,
`submission-events`.`soundcloud`,
`submission-events`.`youtube`,
`submission-events`.`website`,
`submission-events`.`instagram`
FROM `submissions`, `tracks`, `submission-events`
WHERE EXTRACT(month FROM `submissions`.`promoteDate`) = $month
AND EXTRACT(day FROM `submissions`.`promoteDate`) = $day
AND `submissions`.`networkID` = $userID
AND `submissions`.`trackID` = `tracks`.`id`
AND `submissions`.`eventID` = `submission-events`.`id`";
$query = mysqli_query($db_connect, $sql);
$numberOfRows = mysqli_num_rows($query);
if($numberOfRows>0){
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$trackInfo = new trackInfo;
$submissionID = $row["id"];
$trackID = $row["trackID"];
$coverArt = $row["coverArt"];
$trackName = $row["title"];
$artist = $row["artist"];
$mp3 = $row["mp3Location"];
$buyLink = $row["buyLink"];
$soundcloud = $row["soundcloud"];
$youtube = $row["youtube"];
$website = $row["website"];
$instagram = $row["instagram"];
if($soundcloud == 1){
$sql = "SELECT `socials`.`soundcloud`
FROM `submissions`,
`networks`,
`network-social`,
`socials`
WHERE `submissions`.`networkID` = $userID
AND `submissions`.`networkID` = `networks`.`id`
AND `networks`.`id` = `network-social`.`networkID`
AND `network-social`.`socialID` = `socials`.`id`";
$query2 = mysqli_query($db_connect, $sql);
$numberOfRows = mysqli_num_rows($query2);
if($numberOfRows>0){
while($row = mysqli_fetch_array($query2, MYSQLI_ASSOC)) {
$soundcloud = $row["soundcloud"];
}
}
}
if($youtube == 1){
$sql = "SELECT `socials`.`youtube`
FROM `submissions`,
`networks`,
`network-social`,
`socials`
WHERE `submissions`.`networkID` = $userID
AND `submissions`.`networkID` = `networks`.`id`
AND `networks`.`id` = `network-social`.`networkID`
AND `network-social`.`socialID` = `socials`.`id`";
$query2 = mysqli_query($db_connect, $sql);
$numberOfRows = mysqli_num_rows($query2);
if($numberOfRows>0){
while($row = mysqli_fetch_array($query2, MYSQLI_ASSOC)) {
$youtube = $row["youtube"];
}
}
}
if($website == 1){
$sql = "SELECT `socials`.`website`
FROM `submissions`,
`networks`,
`network-social`,
`socials`
WHERE `submissions`.`networkID` = $userID
AND `submissions`.`networkID` = `networks`.`id`
AND `networks`.`id` = `network-social`.`networkID`
AND `network-social`.`socialID` = `socials`.`id`";
$query2 = mysqli_query($db_connect, $sql);
$numberOfRows = mysqli_num_rows($query2);
if($numberOfRows>0){
while($row = mysqli_fetch_array($query2, MYSQLI_ASSOC)) {
$website = $row["website"];
}
}
}
if($instagram == 1){
$sql = "SELECT `socials`.`instagram`
FROM `submissions`,
`networks`,
`network-social`,
`socials`
WHERE `submissions`.`networkID` = $userID
AND `submissions`.`networkID` = `networks`.`id`
AND `networks`.`id` = `network-social`.`networkID`
AND `network-social`.`socialID` = `socials`.`id`";
$query2 = mysqli_query($db_connect, $sql);
$numberOfRows = mysqli_num_rows($query2);
if($numberOfRows>0){
while($row = mysqli_fetch_array($query2, MYSQLI_ASSOC)) {
$instagram = $row["instagram"];
}
}
}
$trackInfo -> submission_id=$submissionID;
$trackInfo -> track_id=$trackID;
$trackInfo -> cover_art=$coverArt;
$trackInfo -> track_name=$trackName;
$trackInfo -> artist=$artist;
$trackInfo -> mp3=$mp3;
$trackInfo -> buy_link=$buyLink;
$trackInfo -> soundcloud=$soundcloud;
$trackInfo -> youtube=$youtube;
$trackInfo -> website=$website;
$trackInfo -> instagram=$instagram;
array_push($dayInfo, $trackInfo);
}
}
$response = json_encode($dayInfo);
echo($response);
exit();
?> | {
"content_hash": "f7cacb010fb62b1c532ce1476b64bbfd",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 120,
"avg_line_length": 31.92896174863388,
"alnum_prop": 0.5971247646756803,
"repo_name": "brandon-bowslaugh/bitsubmit",
"id": "b9c5340ae35b1f9082dee91146b27ee8a9f05e31",
"size": "5843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bitsubmit/includes/fetch/dayEvent.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3245"
},
{
"name": "PHP",
"bytes": "385669"
}
],
"symlink_target": ""
} |
package annis.visualizers.component.tree.backends.staticimg;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
public class GraphicsItemGroup extends AbstractImageGraphicsItem {
@Override
public Rectangle2D getBounds() {
Rectangle2D r = new Rectangle2D.Double();
for (AbstractImageGraphicsItem c: getChildren()) {
Rectangle2D childBounds = c.getBounds();
if (childBounds != null) {
r.add(childBounds);
}
}
return r;
}
@Override
public void draw(Graphics2D canvas) {
}
}
| {
"content_hash": "9c6ec8821fadf28405216fcc810b1f4a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 20.64,
"alnum_prop": 0.7344961240310077,
"repo_name": "thomaskrause/ANNIS",
"id": "3c0a7415bc3c166a7d57c120d597f78823c97ea9",
"size": "1141",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "annis-visualizers/src/main/java/annis/visualizers/component/tree/backends/staticimg/GraphicsItemGroup.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "1491"
},
{
"name": "CSS",
"bytes": "64790"
},
{
"name": "Java",
"bytes": "2121465"
},
{
"name": "JavaScript",
"bytes": "292049"
},
{
"name": "PHP",
"bytes": "771685"
},
{
"name": "Python",
"bytes": "920"
},
{
"name": "Shell",
"bytes": "6468"
}
],
"symlink_target": ""
} |
package org.oulipo.browser.api;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
@Target(TYPE)
public @interface Scheme {
String value();
}
| {
"content_hash": "2a1d628a07e31c3a60c1df06a6f78e4c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 21.714285714285715,
"alnum_prop": 0.8026315789473685,
"repo_name": "sisbell/oulipo",
"id": "9888ed2bb8e62429175d74433c595c51e00086fc",
"size": "1166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oulipo-machine-browser/src/main/java/org/oulipo/browser/api/Scheme.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3107"
},
{
"name": "Java",
"bytes": "684651"
},
{
"name": "Kotlin",
"bytes": "18423"
}
],
"symlink_target": ""
} |
/*
* File: RefineGame.h
* Author: jan
*
* Created on December 10, 2013, 4:58 PM
*/
#ifndef REFINEGAME_H
#define REFINEGAME_H
#include "Configuracao.h"
#include "Arena.h"
#include "Componente.h"
#include "Formula.h"
typedef struct {
Configuracao *origem;
Configuracao::TransicaoConfig *destino;
bool isDuplicated;
} TestemunhaDeFalha;
typedef list< list<TestemunhaDeFalha>::iterator > listItTestFail;
typedef struct {
mutable list<Configuracao*> confLiterais;
mutable listItTestFail testemunhasFalhasRelacionadas;
} FalhasLiteral;
typedef struct {
int numEstado;
mutable list<Configuracao::TransicaoConfig*> transicoes;
mutable listItTestFail testemunhasTransicoesRelacionadas;
} FalhasTransicoes;
typedef struct {
set<FalhasLiteral, bool(*)(FalhasLiteral, FalhasLiteral) > literaisDeFalha;
set <FalhasTransicoes, bool(*)(FalhasTransicoes, FalhasTransicoes) > transicoesDeFalha;
} TabelaConfigsDeFalhaRelacionadas;
using namespace ConstantConectivo;
typedef enum {
OP_REMOVE_MAYG, OP_MAY_TO_MUST, OP_DEFN_LIT, OP_NULL
} Operation;
typedef struct {
Operation operation;
int from;
int to;
literalNegativo literal;
void init(int x, int y, literalNegativo lit, Operation opX) {
operation = opX;
from = x;
to = y;
literal = lit;
}
void print() {
if (operation == OP_DEFN_LIT) {
cout << "DF _LIT " << ( (literal.valorLogico) ? " " : " not ") <<
literal.literal << endl;
cout << to << endl;
} else if (operation == OP_MAY_TO_MUST) {
cout << "MAY_TO_MUST " << literal.literal << endl;
cout << from << " " << to << endl;
} else if (operation == OP_REMOVE_MAYG) {
cout << "REMOVE_MAY_G " << literal.literal << endl;
cout << from << " " << to << endl;
}
}
} OperationStruct;
typedef struct SetOperations {
list<OperationStruct> removedMays;
list<OperationStruct> transMaysToMus;
list<OperationStruct> definedLiterals;
void init() {
this->removedMays = *(new list<OperationStruct>);
this->transMaysToMus = *(new list<OperationStruct>);
this->definedLiterals = *(new list<OperationStruct>);
}
void add(OperationStruct ops) {
if (ops.operation == OP_DEFN_LIT) {
this->definedLiterals.push_back(ops);
} else if (ops.operation == OP_MAY_TO_MUST) {
this->transMaysToMus.push_back(ops);
} else if (ops.operation == OP_REMOVE_MAYG) {
this->removedMays.push_back(ops);
}
}
SetOperations copy() {
SetOperations setOp = *(new SetOperations);
setOp.init();
for (list<OperationStruct>::iterator it = this->removedMays.begin();
it != this->removedMays.end(); it++) {
setOp.removedMays.push_back(*it);
}
for (list<OperationStruct>::iterator it = this->definedLiterals.begin();
it != this->definedLiterals.end(); it++) {
setOp.definedLiterals.push_back(*it);
}
for (list<OperationStruct>::iterator it = this->transMaysToMus.begin();
it != this->transMaysToMus.end(); it++) {
setOp.transMaysToMus.push_back(*it);
}
return setOp;
}
void print() {
//cout <<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
for (list<OperationStruct>::iterator it = this->removedMays.begin();
it != this->removedMays.end(); it++) {
it->print();
}
for (list<OperationStruct>::iterator it = this->definedLiterals.begin();
it != this->definedLiterals.end(); it++) {
it->print();
}
for (list<OperationStruct>::iterator it = this->transMaysToMus.begin();
it != this->transMaysToMus.end(); it++) {
it->print();
}
}
} SetOperations;
class RefineGame {
public:
RefineGame(Arena *arena, int numEstadosModelo);
virtual ~RefineGame();
bool static compConfigsFalhaRelacionadas(FalhasTransicoes t1,
FalhasTransicoes t2) {
return t1.numEstado < t2.numEstado;
}
bool static comFalhasLiteral(FalhasLiteral ft1, FalhasLiteral ft2) {
string str1, str2;
str1 = (*(ft1.confLiterais.begin()))->getLiteralNegativo().literal;
str2 = (*(ft2.confLiterais.begin()))->getLiteralNegativo().literal;
return str1.compare(str2) < 0;
}
private:
Arena *arena;
list<TestemunhaDeFalha> testemunhasDeFalha;
vector< TabelaConfigsDeFalhaRelacionadas> tabelaFalhasRelacionadas;
list<Estado*> modelo;
list<SetOperations> modificationsList;
list<TestemunhaDeFalha> getFailWitness(Arena *arena);
void insertIntoRelatedFailTable(list<TestemunhaDeFalha>::iterator tf);
void printRelatedFailTable(list<TestemunhaDeFalha> testemunhas);
void startRefine();
void applyOperation(list<Estado*> modelo, OperationStruct operation);
void undoOperation(list<Estado*> modelo, OperationStruct operation);
void refineGame(list<TestemunhaDeFalha> testemunhas, SetOperations setOperations);
OperationStruct refinePLay(TestemunhaDeFalha testemunha);
list<Estado> prepareModelToArena();
};
#endif /* REFINEGAME_H */
| {
"content_hash": "c4de01dc32e7873d3f7bd117a599d646",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 91,
"avg_line_length": 27.911917098445596,
"alnum_prop": 0.6187117133840727,
"repo_name": "pedmarq/kmts-repair",
"id": "bbf90b8f1a6fb3d2a478c9990440ea5d49fb7ed5",
"size": "5387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/RefineGame.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Bison",
"bytes": "5451"
},
{
"name": "C",
"bytes": "109186"
},
{
"name": "C++",
"bytes": "93808"
},
{
"name": "Shell",
"bytes": "762"
},
{
"name": "TeX",
"bytes": "549402"
}
],
"symlink_target": ""
} |
/*******************************************************************************
* @file battery.c
* @author fgk
* @version V3.4.0
* @date 08/04/12
********************************************************************************
* @version history Description
* ---------------- -----------
* v2.5.0 LSI Clock Enable for RTC (deprecated with 2.7 release)
* v2.6.0 LSI Clock Calibration (deprecated with 2.7 release)
* v2.7.0 LSE Clock Enable for RTC
* v2.8.0 (1) Tag Version, (2) Last Packet Reserved
* v3.0.0 Tamper Switch Debounce Handler
* v3.1.0 Tamper Switch Debounce Handler WITHOUT Timer2
* v3.2.0 Battery Low Voltage History is Updated when Timer is on only
* v3.3.0 on/off
* v3.4.0 Corrected command handling for Factory Reset,
* Corrected interrupt handling for Band tamper,
* Added check for I2C writes,
* Added check for RTC configuration/reads
*******************************************************************************/
#include "battery.h"
#include "stm8l15x.h"
/*
*******************************************************************************
* Battery_Init()
*
* Description : Initialize battery monitoring hardware.
*
* Return(s) : none.
*******************************************************************************
*/
void Battery_Init (void)
{
PWR_PVDCmd(ENABLE);
PWR_PVDITConfig(ENABLE);
}
/*
*******************************************************************************
* Battery_HasLowLevel()
*
* Description : Get current battery low level.
*
* Return(s) : TRUE, if battery in low level.
*
* FALSE, otherwise.
*******************************************************************************
*/
bool Battery_HasLowLevel (void)
{
if (PWR_GetFlagStatus(PWR_FLAG_PVDOF) != RESET) {
return (TRUE);
} else {
return (FALSE);
}
}
| {
"content_hash": "090069a12a6b004c76fb68a5374b04b7",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 32.79365079365079,
"alnum_prop": 0.4022265246853824,
"repo_name": "tourajghaffari/tigerfid",
"id": "db00aaa8264357130b130d63d5b082af73967a4f",
"size": "2066",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sealtag/software/seal-tag-firmware/old/Fabiano-340_LSE_BS/BLocker/battery.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "121810"
},
{
"name": "ASP",
"bytes": "321"
},
{
"name": "Batchfile",
"bytes": "21500"
},
{
"name": "C",
"bytes": "28570012"
},
{
"name": "C#",
"bytes": "2339607"
},
{
"name": "C++",
"bytes": "12078429"
},
{
"name": "CSS",
"bytes": "4925"
},
{
"name": "HTML",
"bytes": "5614206"
},
{
"name": "JavaScript",
"bytes": "122727"
},
{
"name": "Objective-C",
"bytes": "169816"
},
{
"name": "Pascal",
"bytes": "5446380"
},
{
"name": "PureBasic",
"bytes": "75608"
},
{
"name": "Visual Basic",
"bytes": "77006"
}
],
"symlink_target": ""
} |
package org.appng.api;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.appng.api.model.Application;
import org.appng.api.model.Resources;
import org.appng.api.support.ApplicationConfigProviderImpl;
import org.appng.api.support.ApplicationResourceHolder;
import org.appng.api.support.ConfigValidationError;
import org.appng.api.support.ConfigValidator;
import org.appng.xml.MarshallService;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
public class ConfigValidatorTest {
@Mock
private Application application;
@Test
public void test() throws Exception {
MockitoAnnotations.initMocks(this);
Mockito.when(application.isFileBased()).thenReturn(true);
File targetFolder = new File("target/temp");
ClassLoader classLoader = getClass().getClassLoader();
File applicationFolder = new File(classLoader.getResource("application").toURI());
Resources applicationResources = new ApplicationResourceHolder(application,
MarshallService.getApplicationMarshallService(), applicationFolder, targetFolder);
MarshallService marshallService = MarshallService.getMarshallService();
ApplicationConfigProvider applicationConfigProvider = new ApplicationConfigProviderImpl(marshallService,
"application", applicationResources, false);
ConfigValidator configValidator = new ConfigValidator(applicationConfigProvider, false, false);
configValidator.setWithDetailedErrors(true);
configValidator.validate("application");
configValidator.validateMetaData(new URLClassLoader(new URL[0]));
Collection<String> errors = configValidator.getErrors();
List<String> sorted = new ArrayList<>(errors);
Collections.sort(sorted);
// System.out.println("");
// for (String e : sorted) {
// System.out.println(e);
// }
InputStream expected = classLoader.getResourceAsStream("configvalidator.txt");
List<String> expectedErrors = IOUtils.readLines(expected, Charset.defaultCharset());
Assert.assertEquals(70, expectedErrors.size());
for (int i = 0; i < expectedErrors.size(); i++) {
Assert.assertEquals("error in line " + (i + 1), expectedErrors.get(i), sorted.get(i));
}
List<ConfigValidationError> detaildErrors = configValidator.getDetaildErrors();
sorted = new ArrayList<>();
for (ConfigValidationError error : detaildErrors) {
Assert.assertNotNull(error.getLine());
sorted.add(error.toString());
}
Collections.sort(sorted);
// System.out.println("");
// for (String e : sorted) {
// System.out.println(e);
// }
Assert.assertEquals(51, detaildErrors.size());
InputStream expectedDetails = classLoader.getResourceAsStream("configvalidatorDetails.txt");
List<String> expectedDetailErrors = IOUtils.readLines(expectedDetails, Charset.defaultCharset());
for (int i = 0; i < expectedDetailErrors.size(); i++) {
Assert.assertEquals("error in line " + (i + 1), expectedDetailErrors.get(i), sorted.get(i));
}
}
}
| {
"content_hash": "796691a80b41b7c2542aee9a1408a5e4",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 106,
"avg_line_length": 38.66265060240964,
"alnum_prop": 0.770645060766594,
"repo_name": "appNG/appng",
"id": "ea4a67478d5b95ba6ca678f1cfaef6e2f7af2f9c",
"size": "3828",
"binary": false,
"copies": "1",
"ref": "refs/heads/appng-1.25.x",
"path": "appng-api/src/test/java/org/appng/api/ConfigValidatorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1448"
},
{
"name": "CSS",
"bytes": "58943"
},
{
"name": "Dockerfile",
"bytes": "2107"
},
{
"name": "FreeMarker",
"bytes": "790"
},
{
"name": "HTML",
"bytes": "30413"
},
{
"name": "Java",
"bytes": "4204904"
},
{
"name": "Mustache",
"bytes": "8550"
},
{
"name": "Shell",
"bytes": "6527"
},
{
"name": "Standard ML",
"bytes": "256"
},
{
"name": "TSQL",
"bytes": "12467"
},
{
"name": "XSLT",
"bytes": "8278"
}
],
"symlink_target": ""
} |
"""
Unit tests for the Hyper-V utils factory.
"""
import mock
from oslo_config import cfg
from neutron.plugins.hyperv.agent import utils
from neutron.plugins.hyperv.agent import utilsfactory
from neutron.plugins.hyperv.agent import utilsv2
from neutron.tests import base
CONF = cfg.CONF
class TestHyperVUtilsFactory(base.BaseTestCase):
def test_get_hypervutils_v2_r2(self):
self._test_returned_class(utilsv2.HyperVUtilsV2R2, True, '6.3.0')
def test_get_hypervutils_v2(self):
self._test_returned_class(utilsv2.HyperVUtilsV2, False, '6.2.0')
def test_get_hypervutils_v1_old_version(self):
self._test_returned_class(utils.HyperVUtils, False, '6.1.0')
def test_get_hypervutils_v1_forced(self):
self._test_returned_class(utils.HyperVUtils, True, '6.2.0')
def _test_returned_class(self, expected_class, force_v1, os_version):
CONF.hyperv.force_hyperv_utils_v1 = force_v1
utilsfactory._get_windows_version = mock.MagicMock(
return_value=os_version)
actual_class = type(utilsfactory.get_hypervutils())
self.assertEqual(actual_class, expected_class)
| {
"content_hash": "e6f0b58c38244776521d2149acd41967",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 31.88888888888889,
"alnum_prop": 0.7134146341463414,
"repo_name": "rdo-management/neutron",
"id": "5ded54d11472cfed171988250221a77df71d59db",
"size": "1787",
"binary": false,
"copies": "2",
"ref": "refs/heads/mgt-master",
"path": "neutron/tests/unit/hyperv/test_hyperv_utilsfactory.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "24047"
},
{
"name": "Gettext Catalog",
"bytes": "575107"
},
{
"name": "Mako",
"bytes": "1043"
},
{
"name": "Python",
"bytes": "6918375"
},
{
"name": "Shell",
"bytes": "12287"
}
],
"symlink_target": ""
} |
'use strict';
var Promise = require('bluebird/js/release/promise')();
Promise.config({
cancellation: true,
/*warnings: true,
monitoring: true,
longStackTraces: true*/
});
module.exports = Promise;
| {
"content_hash": "310887bcff0fa383aad1e33c6e366992",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 18,
"alnum_prop": 0.6666666666666666,
"repo_name": "oleksiyk/kafka",
"id": "00807f5c952a8a6a0f80054ed1b0e3ae5622e31e",
"size": "216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/bluebird-configured.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "203894"
}
],
"symlink_target": ""
} |
/* Home */
#home-content {
padding: 0;
}
#article-pagination {
padding: 25px 0 0 0;
}
/* Article */
#article-post-options {
padding: 25px 10px;
}
#submission-buttons a {
width: 100%;
color: #fff;
display: block;
padding: 12px 0;
margin: 1rem 0;
font-weight: 600;
text-transform: uppercase;
}
.retraction {
padding: 15px 10px;
margin-top: 20px;
}
.retraction h3 {
font-weight: 600;
font-family: Arial, sans-serif;
margin-top: 0;
display: inline;
}
.retraction p {
padding-top: 20px;
}
.retraction span {
padding-top: 20px;
}
.retraction ol {
margin: 1em 0;
padding: 0 0 0 45px;
}
.retraction li {
padding: 0 0 20px 0;
}
.correction-alert {
background-position: 0 2px;
margin-top: 15px;
}
.article-tags {
margin-top: 15px;
}
.article-tags .article-tag {
float: left;
margin-left: 15px;
}
.article-tags .article-tag:first-child {
margin-left: 0;
}
.article-tags .peer-reviewed {
width: 123px;
height: 15px;
}
.article-tags .open-access {
width: 155px;
height: 15px;
}
.main-accordion {
margin-top: 30px;
}
.article-buttons {
margin-top: 25px;
}
.article-buttons li {
margin: 1em -1em;
}
.article-buttons li:last-child {
margin-bottom: 0;
}
.article-buttons li a {
line-height: 44px;
padding: 0 20px;
text-align: left;
font-family: Arial, sans-serif;
}
.article-buttons li a .arrow {
overflow: hidden;
text-indent: -1000px;
display: block;
background-position: -275px -10px;
width: 6px;
height: 9px;
background-repeat: no-repeat;
background-image: url('../img/sprites/structure.png');
background-size: 300px 75px;
float: right;
margin-top: 17px;
}
.article-save-options {
padding: 25px;
margin: 0 auto;
width: 300px;
}
.rounded {
font-weight: 600;
padding: 1em;
text-align: center;
text-transform: uppercase;
}
.article-save-options a.rounded.full {
width: 100%;
}
.article-save-options .button-row + .button-row {
margin-top: 1em;
}
.article-save-options .button-row + .button-row:last-child {
/*
* If there are two or more button-rows, add some extra spacing to separate the article space from the footer.
* If there is only one button-row, it should appear vertically centered between adjacent elements.
*/
margin-bottom: 30px;
}
.equation img {
display: block;
margin: 0 auto;
}
.inline-formula img,
.figure-description .inline-formula img {
display: inline-block;
vertical-align: middle;
}
.article-menu-bottom.small {
padding: 0;
margin-top: 0;
}
.article-menu-bottom.small a.btn-lg:first-child {
margin-top: 0;
}
.article-menu-bottom.small a.btn-lg {
padding: 10px 0;
}
.article-menu-bottom.small .btn-top-container {
margin: 20px 0;
}
#author-content dt {
font-weight: 600;
}
#author-content dd {
margin-bottom: 1em;
}
#author-content .type {
color: #666;
font-size: 80%;
text-transform: uppercase;
letter-spacing: 1px;
}
/* Results */
#page-results .filter-box {
position: absolute;
top: 50px;
display: none;
}
#page-results .filter-box.active {
display: block;
}
#page-results .filter-container {
border-bottom: 1px solid #d3d3d3;
padding: 2%;
text-align: center;
}
#page-results .filter-container .filter-button,
#display-options {
margin: 2rem auto;
width: 96%;
}
#page-results .article-item {
border-bottom: 1px solid #eee;
padding-bottom: 1rem;
margin-bottom: 1rem;
}
#page-results #article-items.title-only .article-item .author-list,
#page-results #article-items.title-only .article-item .citation {
display: none;
}
#page-results #article-items.full-citation .article-item .author-list,
#page-results #article-items.full-citation .article-item .citation {
display: block;
}
#page-results #article-items.title-and-author .article-item .citation {
display: none;
}
/* Browse */
#page-browse .content {
padding: 0;
}
#page-browse #browse-container {
overflow: hidden;
padding: 10px;
}
#page-browse .browse-level {
position: relative;
display: none;
}
#page-browse .browse-level.active {
display: block;
}
#page-browse .back-header {
display: none;
}
/* Saved Items */
#page-saved-items .section-header {
font-style: italic;
}
#saved-list-options {
font-weight: 600;
}
#saved-list-options.inactive .optionitem {
background: #d3d3d3;
color: #fff;
}
#page-saved-items table {
border-spacing: 10px;
}
#page-saved-items table td {
padding: 10px 15px;
}
#article-items {
margin: 25px 0;
}
.save-article.circular {
display: none;
}
.article-item {
margin-bottom: 25px;
}
.save-article.circular {
display: block;
}
#page-saved-items .modal-content {
font-weight: 600;
}
#page-saved-items .modal-content .confirm-text {
margin: 18px 0 25px 0;
}
.article-menu-bottom.small {
padding: 10px;
}
/* Recent History */
#recent-searches {
padding: 20px 10px;
border-bottom: 1px solid #d3d3d3;
}
.history-title {
margin-bottom: 20px;
}
#page-recent-history .recent-search-list > li {
margin-top: 25px;
}
#page-recent-history .recent-search-list > li:first-child {
margin-top: 0;
}
#article-items {
margin-bottom: 35px;
}
/* Journals */
.lead-in.journal {
font-family: Arial, sans-serif;
text-transform: none;
margin-top: 10px;
}
/* Table of Contents */
.article-menu-bottom {
margin-top: 35px;
}
.article-intro {
padding: 0 10px;
}
.toc-image figure,
.toc-image figcaption {
margin-top: 20px;
}
.main-accordion {
margin-top: 30px;
}
/* Journal Archive by Month */
#journal-months-container {
margin: 20px 0 20px -20px;
}
.journal-month-container {
width: 84px;
float: left;
margin-left: 20px;
}
.journal-photo {
display: block;
width: 84px;
}
.journal-photo img {
max-width: 100%;
}
/* Journal Archive By Year */
#journal-years-container {
margin: 20px 0 20px -10px;
}
.journal-year {
width: 92px;
height: 53px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-topleft: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
border-top-left-radius: 5px;
-moz-background-clip: padding-box;
-webkit-background-clip: padding-box;
background-clip: padding-box;
display: block;
background: #333333;
color: #fff;
text-align: center;
line-height: 53px;
font-weight: 600;
float: left;
margin-left: 10px;
margin-bottom: 15px;
}
/* Featured Collection */
#page-featured-collection h2 {
margin-top: 10px;
}
#page-featured-collection .article-body {
margin: 15px 0;
}
#page-featured-collection .article-body .collection-link {
margin-top: 10px;
display: block;
}
#page-featured-collection .collection-image {
margin-top: 15px;
}
#page-featured-collection .main-accordion > li.accordion-item > a {
height: 50px;
}
#page-featured-collection .main-accordion > li.accordion-item .accordion-logo {
overflow: hidden;
text-indent: -1000px;
display: block;
}
#page-featured-collection .main-accordion > li.accordion-item .arrow {
margin-top: 10px;
}
#page-featured-collection .main-accordion {
margin-bottom: 40px;
}
#page-featured-collection .accordion-content {
padding: 20px 10px;
}
#page-featured-collection .accordion-content ul {
list-style: disc;
list-style-position: inside;
}
.collection-list > li {
font-weight: 600;
margin-bottom: 10px;
}
.figure-small figcaption {
margin-bottom: 2rem;
}
.figure-small figcaption a {
font-weight: 400;
color: #369;
}
.figure-small .figure-expand {
position: absolute;
top: -10px;
right: -10px;
background-position: -150px 0;
width: 33px;
height: 33px;
background-repeat: no-repeat;
background-image: url('../img/sprites/structure.png');
background-size: 300px 75px;
overflow: hidden;
text-indent: -1000px;
display: block;
}
.figure-small {
margin: 1rem auto;
}
/* Figure */
#figure-content {
padding: 0;
}
.figure-link {
position: relative;
display: inline-block;
}
#page-figure #site-header-container {
position: fixed;
width: 100%;
top: 0;
left: 0;
}
/* Figures */
.accordion-content figure {
background: #f9f9f9;
margin: 30px -10px;
padding: 2rem 1rem;
}
html:not(.positionfixed) .modal-info-window.tab,
html:not(.positionfixed) #page-figure #site-header-container {
display: none;
}
.figure-img {
max-width: none;
margin-top: 50px;
}
.figure-title {
display: block;
}
#figure-info-window .modal-tab {
position: absolute;
right: 10px;
top: -35px;
background: #333333;
color: #fff;
padding: 10px 13px 10px 25px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 0;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-topleft: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-top-left-radius: 5px;
-moz-background-clip: padding-box;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
#figure-info-window .modal-tab .arrow {
overflow: hidden;
text-indent: -1000px;
display: block;
background-position: -275px 0;
width: 9px;
height: 6px;
background-repeat: no-repeat;
background-image: url('../img/sprites/structure.png');
background-size: 300px 75px;
display: inline-block;
margin-left: 30px;
}
/* Comments */
.comments {
margin-top: 10px;
margin-bottom: 40px;
}
.comment .context {
padding: 10px;
background: #efefef;
}
.context a.expand {
font-weight: 600;
text-decoration: underline;
}
.details {
margin-top: 2px;
}
.member {
color: #369;
font-weight: 600;
}
.responses {
height: 35px;
margin-bottom: 15px;
border-bottom: 1px solid #d3d3d3;
padding: 12px;
}
.responses:last-child {
margin-bottom: 0;
}
#comment-content {
padding: 0;
}
.comments {
margin-top: 25px;
}
.comment {
border-top-width: 3px;
border-top-style: solid;
}
.expand {
text-decoration: none;
}
.response {
padding: 12px;
}
.response-menu {
height: 20px;
text-align: right;
margin-top: 15px;
}
.response-menu > a {
height: 20px;
line-height: 20px;
color: #369;
display: inline-block;
text-align: left;
font-weight: 600;
}
.respond-link {
border-left: 1px solid #d3d3d3;
padding-left: 15px;
}
.flag-link {
margin-right: 15px;
overflow: hidden;
text-indent: -1000px;
display: block;
background-position: -274px -37px;
width: 14px;
height: 15px;
background-repeat: no-repeat;
background-image: url('../img/sprites/structure.png');
background-size: 300px 75px;
}
.comment.primary {
border-top-width: 3px;
border-top-style: solid;
}
.thread-level {
margin-left: 5px;
border-left: 1px solid #d3d3d3;
}
#comments-related {
margin-top: 15px;
}
#response-subject {
margin-bottom: 3px;
}
.radio-option {
margin-bottom: 10px;
}
#competing-interest {
height: 45px;
margin-bottom: 20px;
}
/* line 525, sass/pages/_article.scss */
#orcid-id-logo {
float: left;
padding-right: 4px;
}
.comment-markup {
margin-bottom: 20px;
}
.comment-markup em,
.comment-markup strong {
font-weight: 600;
color: #fff;
}
.submission-button-container .button {
float: right;
font-weight: 600;
margin-left: 5px;
}
/* taxonomy hierarchy colors */
.grey-on-gold {
background: #4A1010;
color: #fff;
}
/* References */
.references {
margin: 1em 0;
padding: 0 0 0 1rem;
}
.references li {
list-style-type: none;
position: relative;
margin-bottom: 1em;
line-height: 1em;
}
.references .label {
width: 2.75rem;
text-align: right;
position: absolute;
left: -3em;
}
.find-nolinks {
margin: 0;
padding: 0;
height: 0;
}
.find {
margin: 0;
padding: 0;
min-height: 1em;
}
.find li {
float: left;
margin: 0 4px 0 20px;
list-style-type: disc;
}
.find li:first-child {
margin-left: 0;
list-style-type: none;
}
.amendment {
padding: 15px 10px;
margin-top: 20px;
}
| {
"content_hash": "8c3873541411648f125f519f504eb4db",
"timestamp": "",
"source": "github",
"line_count": 752,
"max_line_length": 112,
"avg_line_length": 16.227393617021278,
"alnum_prop": 0.6727853806441039,
"repo_name": "PLOS/wombat",
"id": "4c2d1e15317b2aafd98d9b28ade55fc4e688b542",
"size": "12203",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main/webapp/WEB-INF/themes/mobile/resource/css/mobile.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "306497"
},
{
"name": "FreeMarker",
"bytes": "453880"
},
{
"name": "Java",
"bytes": "1297525"
},
{
"name": "JavaScript",
"bytes": "365946"
},
{
"name": "Ruby",
"bytes": "2533"
},
{
"name": "Shell",
"bytes": "4602"
},
{
"name": "XSLT",
"bytes": "365621"
}
],
"symlink_target": ""
} |
package server
import (
"context"
"crypto/tls"
"fmt"
"net"
"net/http"
"time"
"golang.org/x/net/http2"
"k8s.io/klog"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apiserver/pkg/server/dynamiccertificates"
)
const (
defaultKeepAlivePeriod = 3 * time.Minute
)
// tlsConfig produces the tls.Config to serve with.
func (s *SecureServingInfo) tlsConfig(stopCh <-chan struct{}) (*tls.Config, error) {
tlsConfig := &tls.Config{
// Can't use SSLv3 because of POODLE and BEAST
// Can't use TLSv1.0 because of POODLE and BEAST using CBC cipher
// Can't use TLSv1.1 because of RC4 cipher usage
MinVersion: tls.VersionTLS12,
// enable HTTP2 for go's 1.7 HTTP Server
NextProtos: []string{"h2", "http/1.1"},
}
// these are static aspects of the tls.Config
if s.DisableHTTP2 {
klog.Info("Forcing use of http/1.1 only")
tlsConfig.NextProtos = []string{"http/1.1"}
}
if s.MinTLSVersion > 0 {
tlsConfig.MinVersion = s.MinTLSVersion
}
if len(s.CipherSuites) > 0 {
tlsConfig.CipherSuites = s.CipherSuites
}
if s.ClientCA != nil {
// Populate PeerCertificates in requests, but don't reject connections without certificates
// This allows certificates to be validated by authenticators, while still allowing other auth types
tlsConfig.ClientAuth = tls.RequestClientCert
}
if s.ClientCA != nil || s.Cert != nil || len(s.SNICerts) > 0 {
dynamicCertificateController := dynamiccertificates.NewDynamicServingCertificateController(
tlsConfig,
s.ClientCA,
s.Cert,
s.SNICerts,
nil, // TODO see how to plumb an event recorder down in here. For now this results in simply klog messages.
)
// register if possible
if notifier, ok := s.ClientCA.(dynamiccertificates.Notifier); ok {
notifier.AddListener(dynamicCertificateController)
}
if notifier, ok := s.Cert.(dynamiccertificates.Notifier); ok {
notifier.AddListener(dynamicCertificateController)
}
// start controllers if possible
if controller, ok := s.ClientCA.(dynamiccertificates.ControllerRunner); ok {
// runonce to try to prime data. If this fails, it's ok because we fail closed.
// Files are required to be populated already, so this is for convenience.
if err := controller.RunOnce(); err != nil {
klog.Warningf("Initial population of client CA failed: %v", err)
}
go controller.Run(1, stopCh)
}
if controller, ok := s.Cert.(dynamiccertificates.ControllerRunner); ok {
// runonce to try to prime data. If this fails, it's ok because we fail closed.
// Files are required to be populated already, so this is for convenience.
if err := controller.RunOnce(); err != nil {
klog.Warningf("Initial population of default serving certificate failed: %v", err)
}
go controller.Run(1, stopCh)
}
for _, sniCert := range s.SNICerts {
if notifier, ok := sniCert.(dynamiccertificates.Notifier); ok {
notifier.AddListener(dynamicCertificateController)
}
if controller, ok := sniCert.(dynamiccertificates.ControllerRunner); ok {
// runonce to try to prime data. If this fails, it's ok because we fail closed.
// Files are required to be populated already, so this is for convenience.
if err := controller.RunOnce(); err != nil {
klog.Warningf("Initial population of SNI serving certificate failed: %v", err)
}
go controller.Run(1, stopCh)
}
}
// runonce to try to prime data. If this fails, it's ok because we fail closed.
// Files are required to be populated already, so this is for convenience.
if err := dynamicCertificateController.RunOnce(); err != nil {
klog.Warningf("Initial population of dynamic certificates failed: %v", err)
}
go dynamicCertificateController.Run(1, stopCh)
tlsConfig.GetConfigForClient = dynamicCertificateController.GetConfigForClient
}
return tlsConfig, nil
}
// Serve runs the secure http server. It fails only if certificates cannot be loaded or the initial listen call fails.
// The actual server loop (stoppable by closing stopCh) runs in a go routine, i.e. Serve does not block.
// It returns a stoppedCh that is closed when all non-hijacked active requests have been processed.
func (s *SecureServingInfo) Serve(handler http.Handler, shutdownTimeout time.Duration, stopCh <-chan struct{}) (<-chan struct{}, error) {
if s.Listener == nil {
return nil, fmt.Errorf("listener must not be nil")
}
tlsConfig, err := s.tlsConfig(stopCh)
if err != nil {
return nil, err
}
secureServer := &http.Server{
Addr: s.Listener.Addr().String(),
Handler: handler,
MaxHeaderBytes: 1 << 20,
TLSConfig: tlsConfig,
}
// At least 99% of serialized resources in surveyed clusters were smaller than 256kb.
// This should be big enough to accommodate most API POST requests in a single frame,
// and small enough to allow a per connection buffer of this size multiplied by `MaxConcurrentStreams`.
const resourceBody99Percentile = 256 * 1024
http2Options := &http2.Server{}
// shrink the per-stream buffer and max framesize from the 1MB default while still accommodating most API POST requests in a single frame
http2Options.MaxUploadBufferPerStream = resourceBody99Percentile
http2Options.MaxReadFrameSize = resourceBody99Percentile
// use the overridden concurrent streams setting or make the default of 250 explicit so we can size MaxUploadBufferPerConnection appropriately
if s.HTTP2MaxStreamsPerConnection > 0 {
http2Options.MaxConcurrentStreams = uint32(s.HTTP2MaxStreamsPerConnection)
} else {
http2Options.MaxConcurrentStreams = 250
}
// increase the connection buffer size from the 1MB default to handle the specified number of concurrent streams
http2Options.MaxUploadBufferPerConnection = http2Options.MaxUploadBufferPerStream * int32(http2Options.MaxConcurrentStreams)
if !s.DisableHTTP2 {
// apply settings to the server
if err := http2.ConfigureServer(secureServer, http2Options); err != nil {
return nil, fmt.Errorf("error configuring http2: %v", err)
}
}
klog.Infof("Serving securely on %s", secureServer.Addr)
return RunServer(secureServer, s.Listener, shutdownTimeout, stopCh)
}
// RunServer spawns a go-routine continuously serving until the stopCh is
// closed.
// It returns a stoppedCh that is closed when all non-hijacked active requests
// have been processed.
// This function does not block
// TODO: make private when insecure serving is gone from the kube-apiserver
func RunServer(
server *http.Server,
ln net.Listener,
shutDownTimeout time.Duration,
stopCh <-chan struct{},
) (<-chan struct{}, error) {
if ln == nil {
return nil, fmt.Errorf("listener must not be nil")
}
// Shutdown server gracefully.
stoppedCh := make(chan struct{})
go func() {
defer close(stoppedCh)
<-stopCh
ctx, cancel := context.WithTimeout(context.Background(), shutDownTimeout)
server.Shutdown(ctx)
cancel()
}()
go func() {
defer utilruntime.HandleCrash()
var listener net.Listener
listener = tcpKeepAliveListener{ln}
if server.TLSConfig != nil {
listener = tls.NewListener(listener, server.TLSConfig)
}
err := server.Serve(listener)
msg := fmt.Sprintf("Stopped listening on %s", ln.Addr().String())
select {
case <-stopCh:
klog.Info(msg)
default:
panic(fmt.Sprintf("%s due to error: %v", msg, err))
}
}()
return stoppedCh, nil
}
// tcpKeepAliveListener sets TCP keep-alive timeouts on accepted
// connections. It's used by ListenAndServe and ListenAndServeTLS so
// dead TCP connections (e.g. closing laptop mid-download) eventually
// go away.
//
// Copied from Go 1.7.2 net/http/server.go
type tcpKeepAliveListener struct {
net.Listener
}
func (ln tcpKeepAliveListener) Accept() (net.Conn, error) {
c, err := ln.Listener.Accept()
if err != nil {
return nil, err
}
if tc, ok := c.(*net.TCPConn); ok {
tc.SetKeepAlive(true)
tc.SetKeepAlivePeriod(defaultKeepAlivePeriod)
}
return c, nil
}
| {
"content_hash": "2edbb2b5048c2f1dbcf159c402a7b7bc",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 143,
"avg_line_length": 33.345991561181435,
"alnum_prop": 0.7259268632165,
"repo_name": "mkumatag/origin",
"id": "262f3ad90fcc780529123a4c8ed02616f530aea3",
"size": "8472",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/k8s.io/kubernetes/staging/src/k8s.io/apiserver/pkg/server/secure_serving.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "921"
},
{
"name": "Dockerfile",
"bytes": "2240"
},
{
"name": "Go",
"bytes": "2298920"
},
{
"name": "Makefile",
"bytes": "6395"
},
{
"name": "Python",
"bytes": "14593"
},
{
"name": "Shell",
"bytes": "310275"
}
],
"symlink_target": ""
} |
<?php
namespace Magento\Setup\Test\Unit\Controller;
use \Magento\Setup\Controller\SystemConfig;
class SystemConfigTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers \Magento\Setup\Controller\SystemConfig::indexAction
*/
public function testIndexAction()
{
/** @var $controller SystemConfig */
$controller = new SystemConfig();
$viewModel = $controller->indexAction();
$this->assertInstanceOf('Zend\View\Model\ViewModel', $viewModel);
$this->assertTrue($viewModel->terminate());
}
}
| {
"content_hash": "4553137d4e12169551e82315a08031c5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 26.571428571428573,
"alnum_prop": 0.6702508960573477,
"repo_name": "florentinaa/magento",
"id": "94404e2e70fedf794db50b5460f3ce25a542d805",
"size": "656",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "store/setup/src/Magento/Setup/Test/Unit/Controller/SystemConfigTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "23874"
},
{
"name": "CSS",
"bytes": "3779785"
},
{
"name": "HTML",
"bytes": "6149486"
},
{
"name": "JavaScript",
"bytes": "4396691"
},
{
"name": "PHP",
"bytes": "22079463"
},
{
"name": "Shell",
"bytes": "6072"
},
{
"name": "XSLT",
"bytes": "19889"
}
],
"symlink_target": ""
} |
@interface GADFBBannerRenderer () <GADMediationBannerAd, FBAdViewDelegate>
@end
@implementation GADFBBannerRenderer {
// The completion handler to call when the ad loading succeeds or fails.
GADMediationBannerLoadCompletionHandler _adLoadCompletionHandler;
// Ad Configuration for the ad to be rendered.
GADMediationAdConfiguration *_adConfig;
// The Meta Audience Network banner ad.
FBAdView *_adView;
// An ad event delegate to invoke when ad rendering events occur.
__weak id<GADMediationBannerAdEventDelegate> _adEventDelegate;
// Meta Audience Network banner views can have flexible width. Set this property to the
// desired banner view's size. Set to CGSizeZero if resizing is not desired.
CGSize _finalBannerSize;
}
- (void)renderBannerForAdConfiguration:(nonnull GADMediationBannerAdConfiguration *)adConfiguration
completionHandler:
(nonnull GADMediationBannerLoadCompletionHandler)completionHandler {
_adConfig = adConfiguration;
__block atomic_flag completionHandlerCalled = ATOMIC_FLAG_INIT;
__block GADMediationBannerLoadCompletionHandler originalCompletionHandler =
[completionHandler copy];
_adLoadCompletionHandler = ^id<GADMediationBannerAdEventDelegate>(
_Nullable id<GADMediationBannerAd> ad, NSError *_Nullable error) {
if (atomic_flag_test_and_set(&completionHandlerCalled)) {
return nil;
}
id<GADMediationBannerAdEventDelegate> delegate = nil;
if (originalCompletionHandler) {
delegate = originalCompletionHandler(ad, error);
}
originalCompletionHandler = nil;
return delegate;
};
_finalBannerSize = adConfiguration.adSize.size;
// -[FBAdView initWithPlacementID:adSize:rootViewController:] throws an NSInvalidArgumentException
// if the placement ID is nil.
NSString *placementID = adConfiguration.credentials.settings[GADMAdapterFacebookBiddingPubID];
if (!placementID) {
NSError *error =
GADFBErrorWithCodeAndDescription(GADFBErrorInvalidRequest, @"Placement ID cannot be nil.");
_adLoadCompletionHandler(nil, error);
return;
}
// -[FBAdView initWithPlacementID:adSize:rootViewController:] throws an NSInvalidArgumentException
// if the root view controller is nil.
UIViewController *rootViewController = adConfiguration.topViewController;
if (!rootViewController) {
NSError *error = GADFBErrorWithCodeAndDescription(GADFBErrorRootViewControllerNil,
@"Root view controller cannot be nil.");
_adLoadCompletionHandler(nil, error);
return;
}
// Create the Meta Audience Network banner view.
NSError *error = nil;
_adView = [[FBAdView alloc] initWithPlacementID:placementID
bidPayload:adConfiguration.bidResponse
rootViewController:adConfiguration.topViewController
error:&error];
if (error) {
_adLoadCompletionHandler(nil, error);
return;
}
// Adds a watermark to the ad.
FBAdExtraHint *watermarkHint = [[FBAdExtraHint alloc] init];
watermarkHint.mediationData = [adConfiguration.watermark base64EncodedStringWithOptions:0];
_adView.extraHint = watermarkHint;
// Load ad.
_adView.delegate = self;
[_adView loadAdWithBidPayload:adConfiguration.bidResponse];
}
#pragma mark FBAdViewDelegate
- (void)adViewDidLoad:(FBAdView *)adView {
if (!CGSizeEqualToSize(_finalBannerSize, CGSizeZero)) {
CGRect frame = adView.frame;
frame.size = _finalBannerSize;
adView.frame = frame;
_finalBannerSize = CGSizeZero;
}
_adEventDelegate = _adLoadCompletionHandler(self, nil);
}
- (void)adView:(FBAdView *)adView didFailWithError:(NSError *)error {
_adLoadCompletionHandler(nil, error);
}
- (void)adViewDidClick:(FBAdView *)adView {
id<GADMediationBannerAdEventDelegate> strongDelegate = _adEventDelegate;
if (strongDelegate) {
[strongDelegate reportClick];
[strongDelegate willBackgroundApplication];
}
}
- (void)adViewWillLogImpression:(FBAdView *)adView {
[_adEventDelegate reportImpression];
}
- (void)adViewDidFinishHandlingClick:(FBAdView *)adView {
// Do nothing
}
- (UIViewController *)viewControllerForPresentingModalView {
return _adConfig.topViewController;
}
#pragma mark GADMediationBannerAd
// Rendered banner ad. Called after the adapter has successfully loaded and ad invoked
// the GADBannerRenderCompletionHandler.
- (UIView *)view {
return _adView;
}
@end
| {
"content_hash": "7ad8eaf3940fb5e5cb09de0fd6b5a340",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 100,
"avg_line_length": 34.61068702290076,
"alnum_prop": 0.7298191442434936,
"repo_name": "googleads/googleads-mobile-ios-mediation",
"id": "854280265e5c8cc9e7c5fae626506cb047493aac",
"size": "5363",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "adapters/Meta/MetaAdapter/Bidding/GADFBBannerRenderer.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "12877"
},
{
"name": "Objective-C",
"bytes": "1082880"
},
{
"name": "Ruby",
"bytes": "390"
},
{
"name": "Shell",
"bytes": "41467"
},
{
"name": "Swift",
"bytes": "17196"
}
],
"symlink_target": ""
} |
title: I applied to the SGF last year, but was not accepted. Will my application be given special consideration?
published: True
tags: [small_grants_fund]
categories: [faqs]
layout: post
---
<div class="content">
<p>
No. All applications will be reviewed against the same criteria. However,
we encourage previous applicants to apply.
</p>
</div>
| {
"content_hash": "9cba6cfc1db10b1aae3877c0f0b6fcca",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 112,
"avg_line_length": 29.75,
"alnum_prop": 0.7338935574229691,
"repo_name": "Vizzuality/gfw-howto",
"id": "dd5a2627fe2d2ce41eb71612b367a32a7f75f447",
"size": "361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/01-01-01-faq-sgf-will-my-application-be-given-special-consideration.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "96914"
},
{
"name": "HTML",
"bytes": "73918"
},
{
"name": "JavaScript",
"bytes": "84091"
},
{
"name": "Ruby",
"bytes": "5903"
}
],
"symlink_target": ""
} |
package fixio.fixprotocol;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a sequence of {@link Group}s prepended with tag of type {@link DataType#NUMINGROUP}.
*/
public class GroupField implements FixMessageFragment<List<Group>> {
private static final int DEFAULT_SIZE = 2;
private final List<Group> groups;
private final int tagNum;
protected GroupField(int tagNum, int expectedSize) {
this.tagNum = tagNum;
groups = new ArrayList<>(expectedSize);
}
public GroupField(int tagNum) {
this(tagNum, DEFAULT_SIZE);
}
@Override
public List<Group> getValue() {
return groups;
}
@Override
public int getTagNum() {
return tagNum;
}
public void add(Group group) {
groups.add(group);
}
public int getGroupCount() {
return groups.size();
}
@Override
public String toString() {
int tagNum = getTagNum();
StringBuilder sb = new StringBuilder().append(FieldType.forTag(tagNum)).append("(").append(tagNum).append(")=").append(getGroupCount());
sb.append("[");
groups.forEach(sb::append);
sb.append("]");
return sb.toString();
}
}
| {
"content_hash": "e4d7e16bb9a2a209b69bf59173fd1879",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 144,
"avg_line_length": 23.28301886792453,
"alnum_prop": 0.6231766612641815,
"repo_name": "loriopatrick/fixio",
"id": "e10415aae7ae26ff2049544adb48123e8f88b319",
"size": "1870",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/fixio/fixprotocol/GroupField.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "886"
},
{
"name": "Java",
"bytes": "292133"
},
{
"name": "Shell",
"bytes": "53"
},
{
"name": "XSLT",
"bytes": "3612"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "72de4cf8b25a4cd4b71b8781c866e102",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "5e61064cd0241933f201bfeadaa4bf3b18a729e0",
"size": "176",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Polygalaceae/Monnina/Monnina mucronata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<h1>
Обработка ошибок
</h1>
<hr />
<p>
Обработка ошибок в Yii отличается от обработки ошибок в простом PHP. Прежде всего, Yii будет преобразовывать все не фатальные ошибки в исключения. Поступая таким образом, вы можете корректно обрабатывать их с помощью try-catch. Во-вторых, даже фатальные ошибки в Yii показываются хорошим способом. Это означает, что в режиме отладки, вы можете проследить причины фатальных ошибок для того, чтобы быстрее определить причину проблемы.
</p>
<h2>
Обработка ошибок в выделенном действия контроллера
</h2>
<hr />
<p>
Страница ошибки в Yii по умолчанию является хорошим помощником при разработке сайта, и приемлема для продакшн, если YII_DEBUG выключен в вашем загрузочном файле index.php. Но, вы можете настроить страницу ошибки по умолчанию, чтобы сделать ее более подходящей для вашего проекта.
</p>
<p>
Самый простой способ создать собственную страницу ошибки это использовать выделенное действие контроллера для показа ошибок. Во-первых, вам нужно настроить компонент ErrorHandler в конфигурации приложения:<br />
<?php
highlight_string("<?php
return [
// ...
'components' => [
// ...
'errorHandler' => [
'errorAction' => 'site/error',
],
?>");
?>
</p>
<p>
При такой настройке, всякий раз, когда возникает ошибка, Yii будет выполнять действие "error" контроллера "Site". Это действие следует искать во время исключений, и если есть исключение, то показывать соответствующий файл представления с исключением:<br />
<?php
highlight_string("<?php
public function actionError()
{
if (\\Yii::\$app->exception !== null) {
return \$this->render('error', ['exception' => \\Yii::\$app->exception]);
}
}
?>");
?>
</p>
<p>
Далее, вы должны создать файл views/site/error.php, который будет использовать исключение. Объект исключение имеет следующие свойства:
</p>
<ul>
<li>statusCode: код состояния HTTP (например 403, 500). Доступно только для исключений HTTP.</li>
<li>code: код исключения.</li>
<li>type: тип ошибки (например HttpException, PHP Ошибка).</li>
<li>message: сообщение об ошибке.</li>
<li>file: имя файла PHP скрипта, где произошла ошибка.</li>
<li>line: номер строки кода, где произошла ошибка.</li>
<li>trace: стек вызовов ошибки.</li>
<li>source: исходный код контекста, где произошла ошибка.</li>
</ul>
<h2>
Обработка ошибок без выделенного действия контроллера
</h2>
<hr />
<p>
Вместо того чтобы создавать выделенное действие в контроллере Site, вы можете просто указать Yii, какой класс следует использовать для обработки ошибок:<br />
<?php
highlight_string("<?php
public function actions()
{
return [
'error' => [
'class' => 'yii\\web\\ErrorAction',
],
];
}
?>");
?>
</p>
<p>
После связывания класса с ошибкой, как описано выше, определяют файл views/site/error.php, который будет автоматически использоваться. Представлению будут переданы три переменные:
</p>
<ul>
<li>$name: имя ошибке</li>
<li>$message: сообщение об ошибке</li>
<li>$exception: исключение, которое обрабатывается</li>
</ul>
<p>
Объект $exception будет иметь те же свойства, описанные выше.
</p> | {
"content_hash": "8c4a55921028f0d5dc85425c2a5db3eb",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 436,
"avg_line_length": 38.44047619047619,
"alnum_prop": 0.6971198513471663,
"repo_name": "Zhanat1987/yii2advanced",
"id": "35be005fcdd17abf362a3623c7058413ba00c49e",
"size": "4922",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frontend/views/guide/error-handling.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2591"
},
{
"name": "JavaScript",
"bytes": "727"
},
{
"name": "PHP",
"bytes": "917097"
},
{
"name": "Shell",
"bytes": "5176"
}
],
"symlink_target": ""
} |
package org.gradle.test.performance.mediummonolithicjavaproject.p478;
public class Production9573 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | {
"content_hash": "e39e386d28c550d47f79ed70671baf11",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 69,
"avg_line_length": 18.00952380952381,
"alnum_prop": 0.6171337916446324,
"repo_name": "oehme/analysing-gradle-performance",
"id": "d866f8340065801d307042917eafe2ab3500a939",
"size": "1891",
"binary": false,
"copies": "1",
"ref": "refs/heads/before",
"path": "my-app/src/main/java/org/gradle/test/performance/mediummonolithicjavaproject/p478/Production9573.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "40770723"
}
],
"symlink_target": ""
} |
$(function() {
var videoPlayer = $('video');
videoPlayer.on("loadstart", function() {
//after load append the cross origin header. This is required since the subtitles are from a different domain.
videoPlayer.attr("crossorigin", "anonymous");
videoPlayer.attr("crossOrigin", "anonymous");
var track1 = '<track kind="captions" label="English" src="http://dotsub.com/media/282fbb24-0022-4954-b512-714ab31409df/c/eng/vtt" default/>';
var track2 = '<track kind="subtitles" label="Spanish" src="http://dotsub.com/media/282fbb24-0022-4954-b512-714ab31409df/c/spa/vtt"/>';
videoPlayer.append(track1);
videoPlayer.append(track2);
});
}); | {
"content_hash": "3123495cd07e7f74bcff7d666e7c1067",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 149,
"avg_line_length": 58.083333333333336,
"alnum_prop": 0.6685796269727403,
"repo_name": "dotsub/api-samples",
"id": "88fc267c0f2b12e75ce474b4b70d94cf89284ee0",
"size": "697",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "html5-webvtt/example.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "470"
},
{
"name": "CSS",
"bytes": "369"
},
{
"name": "HTML",
"bytes": "1165"
},
{
"name": "JavaScript",
"bytes": "4412"
},
{
"name": "Python",
"bytes": "3902"
},
{
"name": "Ruby",
"bytes": "3728"
}
],
"symlink_target": ""
} |
<head>
<title>ATMOS 2013 | BITS Pilani Hyderabad Campus</title>
<link href="./css/style.css" type="text/css" rel="Stylesheet">
<link rel="Stylesheet" type="text/css" href="css/evoslider.css" />
<link rel="Stylesheet" type="text/css" href="css/default/default.css" />
<link href="easyaula.css" media="screen" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<!--<link rel="stylesheet" type="text/css" href="css/modal.css">-->
<!--styles related to login-home-->
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Home page</title>
<link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css">
<!--styles related to login-home-->
<style>td{padding: 2px 10px; } body{font-size: 1.4em;color: black;}
.container{
position:relative;
width:auto;
margin:0 auto;
padding:0
}
</style>
</head>
<body>
<center>
<div style="background-image:url('atmos_logoCrop2.png');background-repeat:no-repeat;background-position:center center;width:100%;height:100%;">
<div style="background-color:black;width:100%;height:100%;opacity:0.95;">
<div style="
">
<div style="opacity:0.9;background-color:white;border-radius:20px;background-image:url('atmos_logoCrop2.png');background-repeat:no-repeat;background-position:center center;float:left;width:400px;max-height:600px; position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin:auto;">
<div style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;background-color:#87BE99;max-height:500px;width:320px;border-radius:10px;">
<?php
require_once("./include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
?>
</head>
<body>
<div id='fg_membersite_content'>
<br/>
<h2>Home Page</h2>
<br/>
Welcome back <?php echo $fgmembersite->UserFullName(); ?>!
<br/>
<p><a href='change-pwd.php'>Change password</a></p>
<p><a href='access-controlled.php'>A sample 'members-only' page</a></p>
<br><br>
<p><a href='logout.php'>Logout</a></p>
</div>
<!--login-home.php-->
</div>
</div>
</div>
</div>
</div>
</center>
</body> | {
"content_hash": "827a21bdc28a5aee096dc6c54e77c158",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 235,
"avg_line_length": 29.69333333333333,
"alnum_prop": 0.6852267624607095,
"repo_name": "nilayanahmed/atmos2013",
"id": "4f936b5a2308b730108d955e382e41c4745befba",
"size": "2227",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "login-home.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "40252"
},
{
"name": "JavaScript",
"bytes": "111906"
},
{
"name": "PHP",
"bytes": "226615"
}
],
"symlink_target": ""
} |
export const ADD_HISTORY = 'ADD_HISTORY';
| {
"content_hash": "ba453ae2591057bcd31257be5192be5d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 41,
"avg_line_length": 42,
"alnum_prop": 0.7380952380952381,
"repo_name": "lyrictenor/nwjs-emoji-app",
"id": "19fd3514d55cf0992453361805e6400c2dd74e85",
"size": "42",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/constants/ActionTypes.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "498"
},
{
"name": "HTML",
"bytes": "452"
},
{
"name": "JavaScript",
"bytes": "18612"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="zsnapper">
<service name="site/zsnapper" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<method_context>
</method_context>
<exec_method type="method" name="start" exec="/opt/local/zsnapper/zsnapper %{config_file}" timeout_seconds="60"/>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="child"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<property_group name="application" type="application">
<propval name="config_file" type="astring" value="/opt/local/etc/zsnapper.ini"/>
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">zsnapper service</loctext>
</common_name>
</template>
</service>
</service_bundle>
| {
"content_hash": "4a82df6c61bac3ca70f33c3d08aba032",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 115,
"avg_line_length": 34.6,
"alnum_prop": 0.6952931461601982,
"repo_name": "calmh/zsnapper.old",
"id": "3d7d99e770c25c34ff7fa5d591978d3cf4fbb4e9",
"size": "1211",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "zsnapper.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7026"
},
{
"name": "Makefile",
"bytes": "725"
},
{
"name": "Shell",
"bytes": "988"
}
],
"symlink_target": ""
} |
#ifndef INCLUDED_Main
#define INCLUDED_Main
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#include <openfl/_v2/display/Sprite.h>
HX_DECLARE_CLASS0(CategoryChoose)
HX_DECLARE_CLASS0(CategoryOne)
HX_DECLARE_CLASS0(Main)
HX_DECLARE_CLASS0(StartScreen)
HX_DECLARE_CLASS3(openfl,_v2,display,DisplayObject)
HX_DECLARE_CLASS3(openfl,_v2,display,DisplayObjectContainer)
HX_DECLARE_CLASS3(openfl,_v2,display,IBitmapDrawable)
HX_DECLARE_CLASS3(openfl,_v2,display,InteractiveObject)
HX_DECLARE_CLASS3(openfl,_v2,display,Sprite)
HX_DECLARE_CLASS3(openfl,_v2,events,Event)
HX_DECLARE_CLASS3(openfl,_v2,events,EventDispatcher)
HX_DECLARE_CLASS3(openfl,_v2,events,IEventDispatcher)
HX_DECLARE_CLASS3(openfl,_v2,sensors,Accelerometer)
HX_DECLARE_CLASS2(openfl,events,AccelerometerEvent)
class HXCPP_CLASS_ATTRIBUTES Main_obj : public ::openfl::_v2::display::Sprite_obj{
public:
typedef ::openfl::_v2::display::Sprite_obj super;
typedef Main_obj OBJ_;
Main_obj();
Void __construct();
public:
inline void *operator new( size_t inSize, bool inContainer=true)
{ return hx::Object::operator new(inSize,inContainer); }
static hx::ObjectPtr< Main_obj > __new();
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~Main_obj();
HX_DO_RTTI;
static void __boot();
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
::String __ToString() const { return HX_CSTRING("Main"); }
bool inited;
::StartScreen startScreen;
::CategoryChoose categoryChoose;
::CategoryOne categoryOne;
::openfl::_v2::sensors::Accelerometer _acc;
virtual Void resize( Dynamic e);
Dynamic resize_dyn();
virtual Void init( );
Dynamic init_dyn();
virtual Void updateAcc( ::openfl::events::AccelerometerEvent Event);
Dynamic updateAcc_dyn();
virtual Void onStart( ::openfl::_v2::events::Event e);
Dynamic onStart_dyn();
virtual Void startCategoryOne( ::openfl::_v2::events::Event e);
Dynamic startCategoryOne_dyn();
virtual Void added( Dynamic e);
Dynamic added_dyn();
static int points;
static Float zAcc;
static Void main( );
static Dynamic main_dyn();
};
#endif /* INCLUDED_Main */
| {
"content_hash": "8b0c11f7807ce9b979d8c5b2d2a98981",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 83,
"avg_line_length": 28,
"alnum_prop": 0.7284798534798534,
"repo_name": "Mattue/MathSpin",
"id": "8fcb7a7ca74628bd9391dd8178c7aa661013ca6a",
"size": "2184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bin/mac64/cpp/obj/include/Main.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "6264963"
},
{
"name": "Haxe",
"bytes": "100372"
},
{
"name": "Java",
"bytes": "53283"
},
{
"name": "Makefile",
"bytes": "10883"
}
],
"symlink_target": ""
} |
class Cms::Page < ActiveRecord::Base
belongs_to :user
belongs_to :layout
has_one :template
has_and_belongs_to_many :sections, :class_name => 'Cms::Section'
# TODO: class_name shouldn't be required above
# It is since migration to rails 4.1.1 ? Investigate this.
end
| {
"content_hash": "aecd3fd4f0b264153cbad4b8678cb296",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 66,
"avg_line_length": 34.75,
"alnum_prop": 0.7122302158273381,
"repo_name": "arek2k/seleya",
"id": "90f89db1204ee9033d4f79d33c48518ef4c5360b",
"size": "278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/cms/page.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19984"
},
{
"name": "CoffeeScript",
"bytes": "1891"
},
{
"name": "JavaScript",
"bytes": "24782"
},
{
"name": "Ruby",
"bytes": "48766"
}
],
"symlink_target": ""
} |
Meteor._MethodInvocation = function (options) {
var self = this;
// true if we're running not the actual method, but a stub (that is,
// if we're on a client (which may be a browser, or in the future a
// server connecting to another server) and presently running a
// simulation of a server-side method for latency compensation
// purposes). not currently true except in a client such as a browser,
// since there's usually no point in running stubs unless you have a
// zero-latency connection to the user.
this.isSimulation = options.isSimulation;
// XXX Backwards compatibility only. Remove this before 1.0.
this.is_simulation = this.isSimulation;
// call this function to allow other method invocations (from the
// same client) to continue running without waiting for this one to
// complete.
this.unblock = options.unblock || function () {};
// current user id
this.userId = options.userId;
// sets current user id in all appropriate server contexts and
// reruns subscriptions
this._setUserId = options.setUserId || function () {};
// Scratch data scoped to this connection (livedata_connection on the
// client, livedata_session on the server). This is only used
// internally, but we should have real and documented API for this
// sort of thing someday.
this._sessionData = options.sessionData;
};
_.extend(Meteor._MethodInvocation.prototype, {
setUserId: function(userId) {
this.userId = userId;
this._setUserId(userId);
}
});
Meteor._CurrentInvocation = new Meteor.EnvironmentVariable;
Meteor.Error = function (error, reason, details) {
var self = this;
// Currently, a numeric code, likely similar to a HTTP code (eg,
// 404, 500). That is likely to change though.
self.error = error;
// Optional: A short human-readable summary of the error. Not
// intended to be shown to end users, just developers. ("Not Found",
// "Internal Server Error")
self.reason = reason;
// Optional: Additional information about the error, say for
// debugging. It might be a (textual) stack trace if the server is
// willing to provide one. The corresponding thing in HTTP would be
// the body of a 404 or 500 response. (The difference is that we
// never expect this to be shown to end users, only developers, so
// it doesn't need to be pretty.)
self.details = details;
};
Meteor.Error.prototype = new Error;
| {
"content_hash": "47ae7d3fa3566c18c55e88b56b3c7641",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 37.07692307692308,
"alnum_prop": 0.7145228215767635,
"repo_name": "vokal/pad",
"id": "323dda5baf68a00fb3c13b7aeac1e161ca5d538a",
"size": "2430",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/packages/livedata/livedata_common.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1138"
},
{
"name": "JavaScript",
"bytes": "259809"
}
],
"symlink_target": ""
} |
typedef enum {
TTNavigationModeNone,
TTNavigationModeCreate, // a new view controller is created each time
TTNavigationModeShare, // a new view controller is created, cached and re-used
TTNavigationModeModal, // a new view controller is created and presented modally
TTNavigationModePopover, // a new view controller is created and presented in a popover
TTNavigationModeExternal, // an external app will be opened
} TTNavigationMode;
| {
"content_hash": "26100b9d70222b8926310e2915799fa6",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 93,
"avg_line_length": 59.125,
"alnum_prop": 0.7505285412262156,
"repo_name": "Lede-Inc/LDBusBundle_IOS",
"id": "23fa497df395b391a9d9aa57043d2861a112919b",
"size": "567",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LDBus/LDUIBus/NavigatorCore/URL Map/TTNavigationMode.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "669"
},
{
"name": "Objective-C",
"bytes": "271098"
},
{
"name": "Ruby",
"bytes": "1732"
},
{
"name": "Shell",
"bytes": "2179"
}
],
"symlink_target": ""
} |
layout: model
title: Arabic ElectraForQuestionAnswering model (from wissamantoun)
author: John Snow Labs
name: electra_qa_ara_base_artydiqa
date: 2022-06-22
tags: [ar, open_source, electra, question_answering]
task: Question Answering
language: ar
edition: Spark NLP 4.0.0
spark_version: 3.0
supported: true
annotator: BertForQuestionAnswering
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---
## Description
Pretrained Question Answering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. `araelectra-base-artydiqa` is a Arabic model originally trained by `wissamantoun`.
{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/electra_qa_ara_base_artydiqa_ar_4.0.0_3.0_1655920272375.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
## How to use
<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
documentAssembler = MultiDocumentAssembler() \
.setInputCols(["question", "context"]) \
.setOutputCols(["document_question", "document_context"])
spanClassifier = BertForQuestionAnswering.pretrained("electra_qa_ara_base_artydiqa","ar") \
.setInputCols(["document_question", "document_context"]) \
.setOutputCol("answer")\
.setCaseSensitive(True)
pipeline = Pipeline(stages=[documentAssembler, spanClassifier])
data = spark.createDataFrame([["ما هو اسمي؟", "اسمي كلارا وأنا أعيش في بيركلي."]]).toDF("question", "context")
result = pipeline.fit(data).transform(data)
```
```scala
val documentAssembler = new MultiDocumentAssembler()
.setInputCols(Array("question", "context"))
.setOutputCols(Array("document_question", "document_context"))
val spanClassifer = BertForQuestionAnswering.pretrained("electra_qa_ara_base_artydiqa","ar")
.setInputCols(Array("document", "token"))
.setOutputCol("answer")
.setCaseSensitive(true)
val pipeline = new Pipeline().setStages(Array(documentAssembler, spanClassifier))
val data = Seq("ما هو اسمي؟", "اسمي كلارا وأنا أعيش في بيركلي.").toDF("question", "context")
val result = pipeline.fit(data).transform(data)
```
{:.nlu-block}
```python
import nlu
nlu.load("ar.answer_question.tydiqa.electra.base").predict("""ما هو اسمي؟|||"اسمي كلارا وأنا أعيش في بيركلي.""")
```
</div>
{:.model-param}
## Model Information
{:.table-model}
|---|---|
|Model Name:|electra_qa_ara_base_artydiqa|
|Compatibility:|Spark NLP 4.0.0+|
|License:|Open Source|
|Edition:|Official|
|Input Labels:|[document_question, document_context]|
|Output Labels:|[answer]|
|Language:|ar|
|Size:|504.8 MB|
|Case sensitive:|true|
|Max sentence length:|512|
## References
- https://huggingface.co/wissamantoun/araelectra-base-artydiqa | {
"content_hash": "da986e3b7a8eaa4d6acf87a16141da81",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 222,
"avg_line_length": 30.881720430107528,
"alnum_prop": 0.7534818941504178,
"repo_name": "JohnSnowLabs/spark-nlp",
"id": "a5c9f4d78af97f0f9d5f150e2c65867321285ff3",
"size": "2978",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_posts/murat-gunay/2022-06-22-electra_qa_ara_base_artydiqa_ar_3_0.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "14452"
},
{
"name": "Java",
"bytes": "223289"
},
{
"name": "Makefile",
"bytes": "819"
},
{
"name": "Python",
"bytes": "1694517"
},
{
"name": "Scala",
"bytes": "4116435"
},
{
"name": "Shell",
"bytes": "5286"
}
],
"symlink_target": ""
} |
package com.intellij.java.codeInsight.completion;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.completion.LightCompletionTestCase;
import org.jetbrains.annotations.NotNull;
public class DotCompletionTest extends LightCompletionTestCase {
@NotNull
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/completion/dot/";
}
public void testInstance() {
configureByFile("Dot1.java");
assertEquals("", myPrefix);
assertContainsItems("a", "foo");
}
public void testClass() {
configureByFile("Dot2.java");
assertEquals("", myPrefix);
assertContainsItems("a", "foo");
}
public void testAnonymous() {
configureByFile("Dot3.java");
assertEquals("", myPrefix);
assertContainsItems("a", "foo");
}
public void testShowStatic() {
configureByFile("Dot4.java");
assertEquals("", myPrefix);
assertContainsItems("foo");
assertNotContainItems("a");
}
public void testImports() {
configureByFile("Dot5.java");
assertContainsItems("util", "lang");
}
public void testArrayElement() {
configureByFile("Dot6.java");
assertContainsItems("toString", "substring");
}
public void testArray() {
configureByFile("Dot7.java");
assertContainsItems("clone", "length");
}
public void testDuplicatesFromInheritance() {
configureByFile("Dot8.java");
assertContainsItems("toString");
}
public void testConstructorExclusion() {
configureByFile("Dot9.java");
assertContainsItems("foo");
assertNotContainItems("A");
}
public void testPrimitiveArray() {
configureByFile("Dot10.java");
assertContainsItems("clone", "length");
}
public void testThisExpression() {
configureByFile("Dot11.java");
assertContainsItems("foo", "foo1");
}
public void testSuperExpression() {
configureByFile("Dot12.java");
assertContainsItems("foo");
assertNotContainItems("foo1");
}
public void testMultiCatch() {
configureByFile("MultiCatch.java");
assertContainsItems("i", "addSuppressed", "getMessage", "printStackTrace");
}
}
| {
"content_hash": "f3ca160d96d58cd0f997688158d3ddcd",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 25.270588235294117,
"alnum_prop": 0.6959962756052142,
"repo_name": "leafclick/intellij-community",
"id": "cca40c45672f06cf37dc78557087ebe983440427",
"size": "2289",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/java-tests/testSrc/com/intellij/java/codeInsight/completion/DotCompletionTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "8149e7e3652f004664088ce4ba1f5e21",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "968eadf57d41965ba7f2ecbb3a05dfb43e4642bc",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Oxalidales/Oxalidaceae/Hypseocharis/Hypseocharis pedicularifolia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
class UpdatePivotalWorker
include Sidekiq::Worker
def perform(story_id)
story = Story.find(story_id)
Pivotal.new(id: story.pid, project_id: story.board.project_id).update_remote
end
end
| {
"content_hash": "e024dbc86f42beb2b7a84f206334357d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 80,
"avg_line_length": 25.125,
"alnum_prop": 0.736318407960199,
"repo_name": "JohnBernas/flow",
"id": "2b4c03ae1d6bf2f7628ce62c529edb400c483e02",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/workers/update_pivotal_worker.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "11978"
},
{
"name": "Ruby",
"bytes": "52803"
}
],
"symlink_target": ""
} |
namespace content {
// This is a singleton class, used to get Audio/Video devices, it must be
// called in UI thread.
class CONTENT_EXPORT MediaCaptureDevices {
public:
// Get signleton instance of MediaCaptureDevices.
static MediaCaptureDevices* GetInstance();
// Return all Audio/Video devices.
virtual const blink::MediaStreamDevices& GetAudioCaptureDevices() = 0;
virtual const blink::MediaStreamDevices& GetVideoCaptureDevices() = 0;
virtual void AddVideoCaptureObserver(
media::VideoCaptureObserver* observer) = 0;
virtual void RemoveAllVideoCaptureObservers() = 0;
private:
// This interface should only be implemented inside content.
friend class MediaCaptureDevicesImpl;
MediaCaptureDevices() {}
virtual ~MediaCaptureDevices() {}
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_
| {
"content_hash": "773974b22aa55f51239f1b6ba895ee88",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 31.925925925925927,
"alnum_prop": 0.759860788863109,
"repo_name": "nwjs/chromium.src",
"id": "525d1cdc2a9e619335e1dd2a4c2f4803a6137f97",
"size": "1278",
"binary": false,
"copies": "6",
"ref": "refs/heads/nw70",
"path": "content/public/browser/media_capture_devices.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.apache.giraph.aggregators.matrix;
import org.apache.giraph.aggregators.AggregatorUsage;
import org.apache.giraph.master.MasterAggregatorUsage;
import org.apache.giraph.worker.WorkerAggregatorUsage;
/**
* The int matrix aggregator is used to register and aggregate int matrices.
*/
public class IntMatrixSumAggregator extends MatrixSumAggregator {
/** sparse vector with single entry */
private IntVector singletonVector = new IntVector();
/**
* Create a new matrix aggregator with the given prefix name for the vector
* aggregators.
*
* @param name the prefix for the row vector aggregators
*/
public IntMatrixSumAggregator(String name) {
super(name);
}
/**
* Register the int vector aggregators, one for each row of the matrix.
*
* @param numRows the number of rows
* @param master the master to register the aggregators
*/
public void register(int numRows, MasterAggregatorUsage master)
throws InstantiationException, IllegalAccessException {
for (int i = 0; i < numRows; ++i) {
master.registerAggregator(getRowAggregatorName(i),
IntVectorSumAggregator.class);
}
}
/**
* Add the given value to the entry specified.
*
* @param i the row
* @param j the column
* @param v the value
* @param worker the worker to aggregate
*/
public void aggregate(int i, int j, int v, WorkerAggregatorUsage worker) {
singletonVector.clear();
singletonVector.set(j, v);
worker.aggregate(getRowAggregatorName(i), singletonVector);
}
/**
* Set the values of the matrix to the master specified. This is typically
* used in the master, to build an external IntMatrix and only set it at
* the end.
*
* @param matrix the matrix to set the values
* @param master the master
*/
public void setMatrix(IntMatrix matrix, MasterAggregatorUsage master) {
int numRows = matrix.getNumRows();
for (int i = 0; i < numRows; ++i) {
master.setAggregatedValue(getRowAggregatorName(i), matrix.getRow(i));
}
}
/**
* Read the aggregated values of the matrix.
*
* @param numRows the number of rows
* @param aggUser the master or worker
* @return the int matrix
*/
public IntMatrix getMatrix(int numRows, AggregatorUsage aggUser) {
IntMatrix matrix = new IntMatrix(numRows);
for (int i = 0; i < numRows; ++i) {
IntVector vec = aggUser.getAggregatedValue(getRowAggregatorName(i));
matrix.setRow(i, vec);
}
return matrix;
}
}
| {
"content_hash": "8f99a6660c5444f827f74dece46b91c2",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 77,
"avg_line_length": 29.952380952380953,
"alnum_prop": 0.6939586645468998,
"repo_name": "renato2099/giraph-gora",
"id": "b7afa60655071bec9cd963259632d6b54d6ff06b",
"size": "3321",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "giraph-core/src/main/java/org/apache/giraph/aggregators/matrix/IntMatrixSumAggregator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "966"
},
{
"name": "Java",
"bytes": "3600925"
},
{
"name": "Python",
"bytes": "8324"
},
{
"name": "Ruby",
"bytes": "1411"
},
{
"name": "Shell",
"bytes": "41034"
}
],
"symlink_target": ""
} |
#pragma strict
public var points : int = 5;
public var pickedUpBy : String = "Player";
function OnTriggerEnter2D(other : Collider2D)
{
if ( other.CompareTag(pickedUpBy) )
{
Debug.Log("Coins! Worth " + points + " points!");
Destroy(gameObject);
}
} | {
"content_hash": "8f893f1c42d4918f93eba23052466d63",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 51,
"avg_line_length": 15.352941176470589,
"alnum_prop": 0.6704980842911877,
"repo_name": "mcgeehancoding/Bounce_Game",
"id": "c3f27f0c9ede21bc9c2118c9e2459fe12813c027",
"size": "263",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Bouncey Bouncers/Assets/Scripts/CoinStuff.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1029"
}
],
"symlink_target": ""
} |
"""Utilities for saving and loading program state in a federated program."""
import abc
from typing import Any, Optional
class ProgramStateManagerStateAlreadyExistsError(Exception):
pass
class ProgramStateManagerStateNotFoundError(Exception):
pass
class ProgramStateManagerStructureError(Exception):
pass
class ProgramStateManager(metaclass=abc.ABCMeta):
"""An interface for saving and loading program state in a federated program.
A `tff.program.ProgramStateManager` is used to implement fault tolerance in a
federated program. The structure or type of the program state that is saved is
unknown at construction time and can change as the program runs.
"""
@abc.abstractmethod
async def get_versions(self) -> Optional[list[int]]:
"""Returns a list of saved versions or `None`.
Returns:
A list of saved versions or `None` if there is no saved program state.
"""
raise NotImplementedError
@abc.abstractmethod
async def load(self, version: int, structure: Any) -> Any:
"""Returns the saved program state for the given `version`.
Args:
version: A integer representing the version of a saved program state.
structure: The nested structure of the saved program state for the given
`version` used to support serialization and deserailization of
user-defined classes in the structure.
Raises:
ProgramStateManagerStateNotFoundError: If there is no program state for
the given `version`.
ProgramStateManagerStructureError: If `structure` does not match the value
loaded for the given `version`.
"""
raise NotImplementedError
async def load_latest(self, structure: Any) -> tuple[Any, int]:
"""Returns the latest saved program state and version or (`None`, 0).
Args:
structure: The nested structure of the saved program state for the given
`version` used to support serialization and deserailization of
user-defined classes in the structure.
Returns:
A tuple of the latest saved (program state, version) or (`None`, 0) if
there is no latest saved program state.
"""
versions = await self.get_versions()
if versions is None:
return None, 0
latest_version = max(versions)
try:
return await self.load(latest_version, structure), latest_version
except ProgramStateManagerStateNotFoundError:
return None, 0
@abc.abstractmethod
async def save(self, program_state: Any, version: int) -> None:
"""Saves `program_state` for the given `version`.
Args:
program_state: A materialized value, a value reference, or a structure of
materialized values and value references representing the program state
to save.
version: A strictly increasing integer representing the version of a saved
`program_state`.
Raises:
ProgramStateManagerStateAlreadyExistsError: If there is already program
state for the given `version`.
"""
raise NotImplementedError
| {
"content_hash": "8a32e382a082bd883ce0ae763c357b5b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 80,
"avg_line_length": 33.62222222222222,
"alnum_prop": 0.716787838730998,
"repo_name": "tensorflow/federated",
"id": "baad4bd53427df40e2fdb80a2457e51fdbcff3b7",
"size": "3625",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "tensorflow_federated/python/program/program_state_manager.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "729470"
},
{
"name": "Dockerfile",
"bytes": "1983"
},
{
"name": "Python",
"bytes": "6700736"
},
{
"name": "Shell",
"bytes": "7123"
},
{
"name": "Starlark",
"bytes": "387382"
}
],
"symlink_target": ""
} |
var pick = require('object.pick');
/**
* Sanitize the parameter into a more reusable object.
*
* @param {Object} parameter
* @return {Object}
*/
var sanitizeParameter = function (parameter) {
var obj = pick(parameter, [
'displayName',
'type',
'enum',
'pattern',
'minLength',
'maxLength',
'minimum',
'maximum',
'example',
'repeat',
'required',
'default'
]);
obj.description = (parameter.description || '').trim();
// Automatically set the default parameter from the enum value.
if (obj.default == null && Array.isArray(obj.enum)) {
obj.default = obj.enum[0];
}
return obj;
};
/**
* Sanitize parameters into something more consumable.
*
* @param {Object} parameters
* @return {Object}
*/
module.exports = function (parameters) {
var obj = {};
if (!parameters) {
return obj;
}
// Iterate over every parameter and generate a new parameters object.
Object.keys(parameters).forEach(function (key) {
obj[key] = sanitizeParameter(parameters[key]);
});
return obj;
};
| {
"content_hash": "316c6a9e498dd60a860993c5ab473b44",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 71,
"avg_line_length": 19.75925925925926,
"alnum_prop": 0.6251171508903468,
"repo_name": "M3lkior/gravitee-management-webui",
"id": "35e046da8b2a7a4d6adfe98eb2af45be78899c5d",
"size": "1067",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bower_components/raml-client-generator/lib/context/parameters.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "18660"
},
{
"name": "HTML",
"bytes": "155903"
},
{
"name": "JavaScript",
"bytes": "183996"
}
],
"symlink_target": ""
} |
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>>
where T : struct
{
}
public class SettingsSlider<T, U> : SettingsItem<T>
where T : struct
where U : SliderBar<T>, new()
{
protected override Drawable CreateControl() => new U()
{
Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X
};
}
}
| {
"content_hash": "0e5e871b4b3a5de9cf7ba65fc19db006",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 92,
"avg_line_length": 30.36,
"alnum_prop": 0.6231884057971014,
"repo_name": "nyaamara/osu",
"id": "beb2bdf6452eef978eb73618542805a63e974453",
"size": "761",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "osu.Game/Overlays/Settings/SettingsSlider.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1595072"
}
],
"symlink_target": ""
} |
title: Pelatihan FrontLine SMS untuk Website ALDP
date: 2012-02-28
categories:
- laporan
- Aldepe.com- Advokasi Hak Asasi Manusia (HAM) di Papua Via Media Online, Mobile Phone dan Social Media
---
{: .img-responsive .center-block }
**Tujuan** : Pelatihan FrontLine SMS untuk Website ALDP
**Lokasi** : Sekretariat Yayasan Air Putih Jakarta
**Alamat** : Pejaten
**Jam** : 10.00 s/d 19.00 WIB
**Hadir** :
* Nanang Syaifudin (Air Putih
* Yusman (ALDP)
**Ringkasan** :
* Penjelasan tentang apa itu Frontline SMS
* Praktek Frontline SMS dan cara memasukkannya kedalam Website
| {
"content_hash": "182383630bb02e77059e2e3b4ffab74b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 158,
"avg_line_length": 30.565217391304348,
"alnum_prop": 0.7439544807965861,
"repo_name": "RioSatria/ciptamedia",
"id": "4c9149e84f06ca0a97c7828231b338f34dba98bc",
"size": "707",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2012-02-28-pelatihan-frontline-sms-untuk-website-aldp.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "370918"
},
{
"name": "HTML",
"bytes": "518190"
},
{
"name": "JavaScript",
"bytes": "32414"
},
{
"name": "Shell",
"bytes": "794"
}
],
"symlink_target": ""
} |
package com.netflix.governator.guice.concurrent;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import junit.framework.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.inject.AbstractModule;
import com.google.inject.ImplementedBy;
import com.google.inject.Injector;
import com.netflix.governator.annotations.NonConcurrent;
import com.netflix.governator.guice.BootstrapBinder;
import com.netflix.governator.guice.BootstrapModule;
import com.netflix.governator.guice.LifecycleInjector;
import com.netflix.governator.guice.LifecycleInjectorMode;
import com.netflix.governator.guice.actions.BindingReport;
import com.netflix.governator.guice.lazy.FineGrainedLazySingleton;
import com.netflix.governator.lifecycle.LoggingLifecycleListener;
public class TestConcurrentSingleton {
private static Logger LOG = LoggerFactory.getLogger(TestConcurrentSingleton.class);
public static interface IParent {
}
@FineGrainedLazySingleton
public static class Parent implements IParent {
@Inject
Parent(@NonConcurrent NonConcurrentSingleton nonConcurrent,
SlowChild1 child1,
SlowChild2 child2,
Provider<SlowChild3> child3,
NonSingletonChild child4,
NonSingletonChild child5) {
LOG.info("Parent start");
LOG.info("Parent end");
}
@PostConstruct
public void init() {
LOG.info("PostConstruct");
}
}
@Singleton
public static class NonConcurrentSingleton {
@Inject
public NonConcurrentSingleton(Recorder recorder) throws InterruptedException {
recorder.record(getClass());
LOG.info("NonConcurrentSingleton start");
TimeUnit.SECONDS.sleep(1);
LOG.info("NonConcurrentSingleton end");
}
}
@FineGrainedLazySingleton
public static class SlowChild1 {
@Inject
public SlowChild1(Recorder recorder) throws InterruptedException {
recorder.record(getClass());
LOG.info("Child1 start");
TimeUnit.SECONDS.sleep(1);
LOG.info("Child1 end");
}
}
@FineGrainedLazySingleton
public static class SlowChild2 {
@Inject
public SlowChild2(Recorder recorder) throws InterruptedException {
recorder.record(getClass());
LOG.info("Child2 start");
TimeUnit.SECONDS.sleep(1);
LOG.info("Child2 end");
}
}
@ImplementedBy(SlowChild3Impl.class)
public static interface SlowChild3 {
}
@FineGrainedLazySingleton
public static class SlowChild3Impl implements SlowChild3 {
@Inject
public SlowChild3Impl(Recorder recorder) throws InterruptedException {
recorder.record(getClass());
LOG.info("Child3 start");
TimeUnit.SECONDS.sleep(1);
LOG.info("Child3 end");
}
}
public static class NonSingletonChild {
private static AtomicInteger counter = new AtomicInteger();
@Inject
public NonSingletonChild(Recorder recorder) throws InterruptedException {
recorder.record(getClass());
int count = counter.incrementAndGet();
LOG.info("NonSingletonChild start " + count);
TimeUnit.SECONDS.sleep(1);
LOG.info("NonSingletonChild end " + count);
}
}
@FineGrainedLazySingleton
public static class Recorder {
Map<Class<?>, Integer> counts = Maps.newHashMap();
Map<Class<?>, Long> threadIds = Maps.newHashMap();
Set<Long> uniqueThreadIds = Sets.newHashSet();
public synchronized void record(Class<?> type) {
threadIds.put(type, Thread.currentThread().getId());
uniqueThreadIds.add(Thread.currentThread().getId());
if (!counts.containsKey(type)) {
counts.put(type, 1);
}
else {
counts.put(type, counts.get(type)+1);
}
}
public int getUniqueThreadCount() {
return uniqueThreadIds.size();
}
public int getTypeCount(Class<?> type) {
Integer count = counts.get(type);
return count == null ? 0 : count;
}
public long getThreadId(Class<?> type) {
return threadIds.get(type);
}
}
@Test
public void shouldInitInterfaceInParallel() {
Injector injector = LifecycleInjector.builder()
.withPostInjectorAction(new BindingReport("Report"))
.withMode(LifecycleInjectorMode.SIMULATED_CHILD_INJECTORS)
.withAdditionalBootstrapModules(new BootstrapModule() {
@Override
public void configure(BootstrapBinder binder) {
binder.bindLifecycleListener().to(LoggingLifecycleListener.class);
}
})
.withModules(new AbstractModule() {
@Override
protected void configure() {
bind(IParent.class).to(Parent.class);
bind(Parent.class).toProvider(ConcurrentProviders.of(Parent.class));
}
})
.build().createInjector();
// This confirms that the Provider is called via the interface binding
injector.getInstance(IParent.class);
Recorder recorder = injector.getInstance(Recorder.class);
long getMainThreadId = Thread.currentThread().getId();
Assert.assertEquals(5, recorder.getUniqueThreadCount());
Assert.assertEquals(1, recorder.getTypeCount(SlowChild1.class));
Assert.assertEquals(1, recorder.getTypeCount(SlowChild2.class));
Assert.assertEquals(0, recorder.getTypeCount(SlowChild3.class)); // Only the provider was injected
Assert.assertEquals(2, recorder.getTypeCount(NonSingletonChild.class));
Assert.assertEquals(getMainThreadId, recorder.getThreadId(NonConcurrentSingleton.class));
}
}
| {
"content_hash": "7dffe0b6af19c51e2439df8ab331616a",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 113,
"avg_line_length": 35.64324324324324,
"alnum_prop": 0.6282984531392175,
"repo_name": "skinzer/governator",
"id": "6051450c975357d38a691ef8c31e99d3f2f59968",
"size": "6594",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "governator-legacy/src/test/java/com/netflix/governator/guice/concurrent/TestConcurrentSingleton.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "497"
},
{
"name": "Java",
"bytes": "792395"
}
],
"symlink_target": ""
} |
git clone https://github.com/swagger-api/swagger-ui.git
| {
"content_hash": "2be973f83565f5c71cdf015fc5a91ba4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 55,
"avg_line_length": 56,
"alnum_prop": 0.7857142857142857,
"repo_name": "obdobriel/gab-php",
"id": "ae19635dc1f4eeb0a68252d813cca2295cd48fe1",
"size": "191",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/install.sh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "216"
},
{
"name": "HTML",
"bytes": "226"
},
{
"name": "JavaScript",
"bytes": "3499"
},
{
"name": "PHP",
"bytes": "108671"
},
{
"name": "Shell",
"bytes": "3923"
},
{
"name": "Vue",
"bytes": "13583"
}
],
"symlink_target": ""
} |
export function mget(...keys: Array<string>) {
return keys.map(key => (this.data.has(key) ? this.data.get(key) : null));
}
| {
"content_hash": "2b692489076f468e7e1d9d769335bf42",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 75,
"avg_line_length": 41.666666666666664,
"alnum_prop": 0.648,
"repo_name": "nileshmali/ioredis-in-memory",
"id": "7a5e02c23eebb51b54a8de73a9bc5b20e325d44a",
"size": "125",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/commands/mget.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "TypeScript",
"bytes": "109007"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "c440dcde0efc5dff4d5689bf63b3a1c3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "911f40ddd7e3a9dc8e4a5cfdecdb3299888e9743",
"size": "185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Tanacetum/Tanacetum cinerariifolium/ Syn. Chrysanthemum turreanum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
(function() {
JsBarcode = function(image, content, options) {
var merge = function(m1, m2) {
var newMerge = {};
for (var k in m1) {
newMerge[k] = m1[k];
}
for (var k in m2) {
newMerge[k] = m2[k];
}
return newMerge;
};
//Merge the user options with the default
options = merge(JsBarcode.defaults, options);
//Create the canvas where the barcode will be drawn on
var canvas = document.createElement('canvas');
//Abort if the browser does not support HTML5canvas
if (!canvas.getContext) {
return image;
}
var encoder = new window[options.format](content);
//Abort if the barcode format does not support the content
if (!encoder.valid()) {
return this;
}
//Encode the content
var binary = encoder.encoded();
var _drawBarcodeText = function(text) {
var x,
y;
y = options.height;
ctx.font = options.fontSize + "px " + options.font;
ctx.textBaseline = "bottom";
ctx.textBaseline = 'top';
if (options.textAlign == "left") {
x = options.quite;
ctx.textAlign = 'left';
} else if (options.textAlign == "right") {
x = canvas.width - options.quite;
ctx.textAlign = 'right';
} else {//All other center
x = canvas.width / 2;
ctx.textAlign = 'center';
}
ctx.fillText(text, x, y);
};
//Get the canvas context
var ctx = canvas.getContext("2d");
//Set the width and height of the barcode
canvas.width = binary.length * options.width + 2 * options.quite;
canvas.height = options.height + (options.displayValue ? options.fontSize : 0);
//Paint the canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
if (options.backgroundColor) {
ctx.fillStyle = options.backgroundColor;
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
//Creates the barcode out of the encoded binary
ctx.fillStyle = options.lineColor;
for (var i = 0; i < binary.length; i++) {
var x = i * options.width + options.quite;
if (binary[i] == "1") {
ctx.fillRect(x, 0, options.width, options.height);
}
}
if (options.displayValue) {
_drawBarcodeText(content);
}
//Grab the dataUri from the canvas
uri = canvas.toDataURL('image/png');
//Put the data uri into the image
if (image.attr) {//If element has attr function (jQuery element)
return image.attr("src", uri);
} else {//DOM element
image.setAttribute("src", uri);
}
};
JsBarcode.defaults = {
width : 2,
height : 100,
quite : 10,
format : "CODE128",
displayValue : false,
font : "Monospaced",
textAlign : "center",
fontSize : 12,
backgroundColor : "",
lineColor : "#000"
};
$.fn.JsBarcode = function(content, options) {
JsBarcode(this, content, options);
return this;
};
})(jQuery); | {
"content_hash": "e8df10ea8aa07cf759fe8de410bc2e4b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 81,
"avg_line_length": 28.54736842105263,
"alnum_prop": 0.6423303834808259,
"repo_name": "DavidHe1127/VisitorValidation",
"id": "fc4146a54b434cb78eac9953ad3db218d8fe1cc9",
"size": "2712",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/widgets/com.logisapp.bc/lib/barcode_generator.js",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1276"
},
{
"name": "JavaScript",
"bytes": "243808"
},
{
"name": "Perl",
"bytes": "4072"
},
{
"name": "Python",
"bytes": "5251"
}
],
"symlink_target": ""
} |
<?php
/**
* PHP version 7.1
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
namespace ComPHPPuebla\Fixtures;
trait ProvidesConnections
{
function databaseConnections(): array
{
return [
'SQLite' => [new SQLiteConnectionFactory()],
'MySQL' => [new MySQLConnectionFactory()],
];
}
}
| {
"content_hash": "58a1c12ffb880a1656baa2d88ad47997",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 100,
"avg_line_length": 21.944444444444443,
"alnum_prop": 0.6253164556962025,
"repo_name": "ComPHPPuebla/dbal-fixtures",
"id": "95b7bdb10992ea756d6c9cace41f0318764aa3ec",
"size": "395",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/src/ProvidesConnections.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "173"
},
{
"name": "PHP",
"bytes": "62014"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-parent</artifactId>
<version>5.0.15-SNAPSHOT</version>
</parent>
<artifactId>xchange-yobit</artifactId>
<name>XChange YoBit</name>
<description>YoBit.Net - Ethereum (ETH) Exchange</description>
<url>http://knowm.org/open-source/xchange/</url>
<inceptionYear>2012</inceptionYear>
<organization>
<name>Knowm Inc.</name>
<url>http://knowm.org/open-source/xchange/</url>
</organization>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- For Joining Strings -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
</project>
| {
"content_hash": "f0c787ef1166a5d190bf18b11f067e95",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 204,
"avg_line_length": 34.25714285714286,
"alnum_prop": 0.6296914095079232,
"repo_name": "stachon/XChange",
"id": "94952af1a05d11246966d2ef7d48743cdbb9b504",
"size": "1199",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "xchange-yobit/pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "11344390"
}
],
"symlink_target": ""
} |
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.example_status_persistence_file_path = "spec/examples.txt"
config.disable_monkey_patching!
# config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
# config.order = :random
Kernel.srand config.seed
end
| {
"content_hash": "ce2397e9116eb8b4019e4b6690219ddc",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 77,
"avg_line_length": 28.346153846153847,
"alnum_prop": 0.7327001356852103,
"repo_name": "GHolmes04/rails_api_testing",
"id": "1924ada04e3914b7a970d46bf16cec891906f173",
"size": "737",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "4588"
},
{
"name": "Ruby",
"bytes": "26343"
}
],
"symlink_target": ""
} |
CREATE FUNCTION get_articulo_detalle(bigint) RETURNS SETOF refcursor
LANGUAGE plpgsql
AS $_$
BEGIN
DECLARE cur_articulos refcursor;
DECLARE cur_categoria refcursor;
DECLARE cur_comentarios refcursor;
BEGIN
OPEN cur_articulos FOR
SELECT * FROM articulos WHERE artid = $1;
RETURN NEXT cur_articulos;
OPEN cur_categoria FOR
SELECT nombre FROM categorias
WHERE catid = (SELECT catid FROM articulos WHERE artid = $1);
RETURN NEXT cur_categoria;
OPEN cur_comentarios FOR SELECT * FROM comentarios WHERE artid = $1;
RETURN NEXT cur_comentarios;
END;
END
$_$;
| {
"content_hash": "57ee8d7770647dd7cf4ec694d64f894f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 69,
"avg_line_length": 21.555555555555557,
"alnum_prop": 0.7525773195876289,
"repo_name": "Jesus-Gonzalez/jeecommerce",
"id": "d54f760f450dbf6e519693cb4b54c2ece8da3d18",
"size": "709",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "etc/db.proc.get-articulo-detalle.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9353"
},
{
"name": "HTML",
"bytes": "95941"
},
{
"name": "Java",
"bytes": "94943"
},
{
"name": "JavaScript",
"bytes": "151077"
},
{
"name": "PLpgSQL",
"bytes": "17568"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/CropMaster.iml" filepath="$PROJECT_DIR$/CropMaster.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/base/base.iml" filepath="$PROJECT_DIR$/base/base.iml" />
</modules>
</component>
</project> | {
"content_hash": "e6e680b08a68ac3fe740c785d47a4475",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 102,
"avg_line_length": 45.8,
"alnum_prop": 0.6615720524017468,
"repo_name": "doomchocolate/crop-master",
"id": "9d738380e3ce26670ce8fca83db558f1c56f0cdd",
"size": "458",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CropMaster/.idea/modules.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "185142"
}
],
"symlink_target": ""
} |
var gulp = require('gulp'),
gutil = require('gulp-util'),
clean = require('gulp-clean'),
header = require('gulp-header'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
stylus = require('gulp-stylus'),
autoprefixer = require('gulp-autoprefixer'),
csso = require('gulp-csso'),
jade = require('gulp-jade'),
connect = require('gulp-connect'),
plumber = require('gulp-plumber'),
opn = require('opn'),
pkg = require('./package.json'),
browserify = require('gulp-browserify'),
through = require('through'),
path = require('path'),
ghpages = require('gh-pages'),
template = require('lodash').template,
isDemo = process.argv.indexOf('demo') > 0;
gulp.task('default', ['clean', 'compile']);
gulp.task('demo', ['compile', 'watch', 'connect']);
gulp.task('compile', ['compile:lib', 'compile:demo']);
gulp.task('compile:lib', ['stylus', 'browserify:lib']);
gulp.task('compile:demo', ['jade', 'browserify:demo']);
gulp.task('watch', function() {
gulp.watch('lib/*', ['compile:lib', 'browserify:demo']);
gulp.watch('demo/src/*.jade', ['jade']);
gulp.watch('demo/src/**/*.js', ['browserify:demo']);
});
gulp.task('clean', ['clean:browserify', 'clean:stylus', 'clean:jade']);
gulp.task('clean:browserify', ['clean:browserify:lib', 'clean:browserify:demo']);
gulp.task('clean:browserify:lib', function() {
return gulp.src(['dist'], { read: false })
.pipe(clean());
});
gulp.task('clean:browserify:demo', function() {
return gulp.src(['demo/dist/build'], { read: false })
.pipe(clean());
});
gulp.task('clean:stylus', function() {
return gulp.src(['lib/tmp'], { read: false })
.pipe(clean());
});
gulp.task('clean:jade', function() {
return gulp.src(['demo/dist/index.html'], { read: false })
.pipe(clean());
});
gulp.task('stylus', ['clean:stylus'], function() {
return gulp.src('lib/theme.styl')
.pipe(isDemo ? plumber() : through())
.pipe(stylus({ pretty: true }))
.pipe(autoprefixer('last 2 versions'))
.pipe(csso())
.pipe(gulp.dest('lib/tmp'));
});
gulp.task('browserify', ['browserify:lib', 'browserify:demo']);
gulp.task('browserify:lib', ['clean:browserify:lib', 'stylus'], function() {
return gulp.src('lib/bespoke-theme-greeny.js')
.pipe(isDemo ? plumber() : through())
.pipe(browserify({ transform: ['brfs'], standalone: 'bespoke.themes.greeny' }))
.pipe(header(template([
'/*!',
' * <%= name %> v<%= version %>',
' *',
' * Copyright <%= new Date().getFullYear() %>, <%= author.name %>',
' * This content is released under the <%= licenses[0].type %> license',
' * <%= licenses[0].url %>',
' */\n\n'
].join('\n'), pkg)))
.pipe(gulp.dest('dist'))
.pipe(rename('bespoke-theme-greeny.min.js'))
.pipe(uglify())
.pipe(header(template([
'/*! <%= name %> v<%= version %> ',
'© <%= new Date().getFullYear() %> <%= author.name %>, ',
'<%= licenses[0].type %> License */\n'
].join(''), pkg)))
.pipe(gulp.dest('dist'));
});
gulp.task('browserify:demo', ['clean:browserify:demo'], function() {
return gulp.src('demo/src/scripts/main.js')
.pipe(isDemo ? plumber() : through())
.pipe(browserify({ transform: ['brfs'] }))
.pipe(rename('build.js'))
.pipe(gulp.dest('demo/dist/build'))
.pipe(connect.reload());
});
gulp.task('jade', ['clean:jade'], function() {
return gulp.src('demo/src/index.jade')
.pipe(isDemo ? plumber() : through())
.pipe(jade())
.pipe(gulp.dest('demo/dist'))
.pipe(connect.reload());
});
gulp.task('connect', ['compile'], function(done) {
connect.server({
root: 'demo/dist',
livereload: true
});
opn('http://localhost:8080', done);
});
gulp.task('deploy', ['compile:demo'], function(done) {
ghpages.publish(path.join(__dirname, 'demo/dist'), { logger: gutil.log }, done);
});
| {
"content_hash": "848e3bee8ab41f36b98e422383c1ce52",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 83,
"avg_line_length": 32.15,
"alnum_prop": 0.5977190254017626,
"repo_name": "cedced19/bespoke-theme-greeny",
"id": "3d97b81e0e7c943622fdae12bbbf50e7b0e91f9a",
"size": "3859",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "gulpfile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4489"
},
{
"name": "JavaScript",
"bytes": "31937"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mathcomp-multinomials: Not compatible</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / extra-dev</a></li>
<li class="active"><a href="">8.11.dev / mathcomp-multinomials - 1.3</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
mathcomp-multinomials
<small>
1.3
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-07-24 01:10:59 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-07-24 01:10:59 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.11.dev Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "pierre-yves@strub.nu"
homepage: "https://github.com/math-comp/multinomials-ssr"
bug-reports: "https://github.com/math-comp/multinomials-ssr/issues"
dev-repo: "git+https://github.com/math-comp/multinomials.git"
license: "CeCILL-B"
authors: ["Pierre-Yves Strub"]
build: [
[make "INSTMODE=global" "config"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
depends: [
"coq" {>= "8.7" & < "8.12~"}
"coq-mathcomp-algebra" {>= "1.8.0" & < "1.10~"}
"coq-mathcomp-bigenough" {>= "1.0.0" & < "1.1~"}
"coq-mathcomp-finmap" {>= "1.2.1" & < "1.3~"}
]
tags: [
"keyword:multinomials"
"keyword:monoid algebra"
"category:Mathematics/Algebra"
"date:2019-06-04"
"logpath:SsrMultinomials"
]
synopsis: "A multivariate polynomial library for the Mathematical Components Library"
url {
src: "https://github.com/math-comp/multinomials/archive/1.3.tar.gz"
checksum: "sha256=dd07b00ca5ed8b46d3a635d4ca1261948020f615bddfc4d9ac7bdc2842e83604"
}
</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-mathcomp-multinomials.1.3 coq.8.11.dev</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.11.dev).
The following dependencies couldn't be met:
- coq-mathcomp-multinomials -> coq-mathcomp-finmap < 1.3~ -> coq-mathcomp-ssreflect < 1.8~ -> coq < 8.10~ -> ocaml < 4.05.0
base of this switch (use `--unlock-base' to force)
- coq-mathcomp-multinomials -> coq-mathcomp-finmap < 1.3~ -> coq < 8.11.1 -> ocaml < 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-mathcomp-multinomials.1.3</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<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": "a5744d790cf9ee8c2c819c5722aa1700",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 157,
"avg_line_length": 42.18181818181818,
"alnum_prop": 0.5505118534482759,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "76c3b9ba3473bcf10dc262f1b4dd70eef82601ef",
"size": "7426",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.6/extra-dev/8.11.dev/mathcomp-multinomials/1.3.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
JSON.stringify({
"name": document.querySelector("#sidebar_content h2 bdi").textContent,
"point": document.querySelector(".details.geo a").textContent.split(", ").map(function(value){
return Number(value);
})
})
| {
"content_hash": "c180fe1b91e6f83c1ce78cc16a382f29",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 98,
"avg_line_length": 38.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "FirstDraftGIS/firstdraftgis-chrome-extension",
"id": "966ef8b7caf532dd5f2cdf279360bfc464184b64",
"size": "231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "content_scripts/osm_node.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "159"
},
{
"name": "HTML",
"bytes": "3846"
},
{
"name": "JavaScript",
"bytes": "21727"
}
],
"symlink_target": ""
} |
FactoryBot.define do
factory :user do
sequence(:email) { |n| "john+#{ n }@doe.com" }
sequence(:username, 'a') { |n| "john_#{ n }" }
trait :activated do
after(:create) do |user|
user.activate!
end
end
trait :inactive do
# nothing on purpose
end
trait :password_reseted do
after(:create, &:generate_reset_password_token!)
end
trait :not_accepted_tos do
terms_of_service { nil }
end
end
end
| {
"content_hash": "e2896567175605ca5ea712cc475c3c9c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 54,
"avg_line_length": 19.75,
"alnum_prop": 0.5759493670886076,
"repo_name": "marienfressinaud/lessy",
"id": "c2c4e8b772de7380a752cf1329e5e20cfbc444a2",
"size": "474",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "spec/factories/user.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5767"
},
{
"name": "HTML",
"bytes": "901"
},
{
"name": "JavaScript",
"bytes": "72360"
},
{
"name": "Makefile",
"bytes": "971"
},
{
"name": "Ruby",
"bytes": "164304"
},
{
"name": "Vue",
"bytes": "130430"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define do
create_table :aliases, force: true do |t|
t.text :source_path, limit: 2.kilobytes # Max IE url length
t.text :target_path, limit: 2.kilobytes
t.references :source, polymorphic: true, index: true
t.references :target, polymorphic: true, index: true
t.string :handler
t.references :creator, index: true
t.timestamps null: false
end
add_index :aliases, :source_path, length: 3.kilobytes / 3
add_index :aliases, :handler
end
| {
"content_hash": "df0f637cdf607f0ae2248a8dd16c5d6e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 63,
"avg_line_length": 34.92857142857143,
"alnum_prop": 0.7014314928425358,
"repo_name": "combinaut/director",
"id": "e2328a1d1668a8cff3c1c9508cbe64016b954475",
"size": "489",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/internal/db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "40442"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>TextArea - ScalaTest 2.1.1 - org.scalatest.selenium.WebBrowser.TextArea</title>
<meta name="description" content="TextArea - ScalaTest 2.1.1 - org.scalatest.selenium.WebBrowser.TextArea" />
<meta name="keywords" content="TextArea ScalaTest 2.1.1 org.scalatest.selenium.WebBrowser.TextArea" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />
<script type="text/javascript" src="../../../lib/jquery.js" id="jquery-js"></script>
<script type="text/javascript" src="../../../lib/jquery-ui.js"></script>
<script type="text/javascript" src="../../../lib/template.js"></script>
<script type="text/javascript" src="../../../lib/tools.tooltip.js"></script>
<script type="text/javascript">
if(top === self) {
var url = '../../../index.html';
var hash = 'org.scalatest.selenium.WebBrowser$TextArea';
var anchor = window.location.hash;
var anchor_opt = '';
if (anchor.length >= 1)
anchor_opt = '@' + anchor.substring(1);
window.location.href = url + '#' + hash + anchor_opt;
}
</script>
<!-- gtag [javascript] -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-71294502-1"></script>
<script defer>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-71294502-1');
</script>
</head>
<body class="type">
<!-- Top of doc.scalatest.org [javascript] -->
<script type="text/javascript">
var rnd = window.rnd || Math.floor(Math.random()*10e6);
var pid204546 = window.pid204546 || rnd;
var plc204546 = window.plc204546 || 0;
var abkw = window.abkw || '';
var absrc = 'http://ab167933.adbutler-ikon.com/adserve/;ID=167933;size=468x60;setID=204546;type=js;sw='+screen.width+';sh='+screen.height+';spr='+window.devicePixelRatio+';kw='+abkw+';pid='+pid204546+';place='+(plc204546++)+';rnd='+rnd+';click=CLICK_MACRO_PLACEHOLDER';
document.write('<scr'+'ipt src="'+absrc+'" type="text/javascript"></scr'+'ipt>');
</script>
<div id="definition">
<img src="../../../lib/class_big.png" />
<p id="owner"><a href="../../package.html" class="extype" name="org">org</a>.<a href="../package.html" class="extype" name="org.scalatest">scalatest</a>.<a href="package.html" class="extype" name="org.scalatest.selenium">selenium</a>.<a href="WebBrowser.html" class="extype" name="org.scalatest.selenium.WebBrowser">WebBrowser</a></p>
<h1>TextArea</h1>
</div>
<h4 id="signature" class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">class</span>
</span>
<span class="symbol">
<span class="name">TextArea</span><span class="result"> extends <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></span>
</span>
</h4>
<div id="comment" class="fullcommenttop"><div class="comment cmt"><p>This class is part of ScalaTest's Selenium DSL. Please see the documentation for
<a href="WebBrowser.html"><code>WebBrowser</code></a> for an overview of the Selenium DSL.</p><p>This class enables syntax such as the following:</p><p><pre class="stHighlighted">
textArea(<span class="stQuotedString">"q"</span>).value should be (<span class="stQuotedString">"Cheese!"</span>)
</pre>
</p></div><dl class="attributes block"> <dt>Source</dt><dd><a href="https://github.com/scalatest/scalatest/tree/release-2.1.1-for-scala-2.10/src/main/scala/org/scalatest/selenium/WebBrowser.scala" target="_blank">WebBrowser.scala</a></dd><dt>Exceptions thrown</dt><dd><span class="cmt">TestFailedExeption<p>if the passed <code>WebElement</code> does not represent a text area
</p></span></dd></dl><div class="toggleContainer block">
<span class="toggle">Linear Supertypes</span>
<div class="superTypes hiddenContent"><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a>, <span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div>
</div></div>
<div id="mbrsel">
<div id="textfilter"><span class="pre"></span><span class="input"><input id="mbrsel-input" type="text" accesskey="/" /></span><span class="post"></span></div>
<div id="order">
<span class="filtertype">Ordering</span>
<ol>
<li class="alpha in"><span>Alphabetic</span></li>
<li class="inherit out"><span>By inheritance</span></li>
</ol>
</div>
<div id="ancestors">
<span class="filtertype">Inherited<br />
</span>
<ol id="linearization">
<li class="in" name="org.scalatest.selenium.WebBrowser.TextArea"><span>TextArea</span></li><li class="in" name="org.scalatest.selenium.WebBrowser.Element"><span>Element</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li>
</ol>
</div><div id="ancestors">
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
<li class="showall in"><span>Show all</span></li>
</ol>
<a href="http://docs.scala-lang.org/overviews/scaladoc/usage.html#members" target="_blank">Learn more about member selection</a>
</div>
<div id="visbl">
<span class="filtertype">Visibility</span>
<ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol>
</div>
</div>
<div id="template">
<div id="allMembers">
<div id="constructors" class="members">
<h3>Instance Constructors</h3>
<ol><li name="org.scalatest.selenium.WebBrowser.TextArea#<init>" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="<init>(underlying:org.openqa.selenium.WebElement):WebBrowser.this.TextArea"></a>
<a id="<init>:TextArea"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">new</span>
</span>
<span class="symbol">
<span class="name">TextArea</span><span class="params">(<span name="underlying">underlying: <span class="extype" name="org.openqa.selenium.WebElement">WebElement</span></span>)</span>
</span>
</h4>
<p class="shortcomment cmt"></p><div class="fullcomment"><div class="comment cmt"></div><dl class="paramcmts block"><dt class="param">underlying</dt><dd class="cmt"><p>the <code>WebElement</code> representing a text area</p></dd></dl><dl class="attributes block"> <dt>Exceptions thrown</dt><dd><span class="cmt">TestFailedExeption<p>if the passed <code>WebElement</code> does not represent a text area
</p></span></dd></dl></div>
</li></ol>
</div>
<div id="values" class="values members">
<h3>Value Members</h3>
<ol><li name="scala.AnyRef#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:AnyRef):Boolean"></a>
<a id="!=(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:Any):Boolean"></a>
<a id="!=(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef###" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="##():Int"></a>
<a id="##():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:AnyRef):Boolean"></a>
<a id="==(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.Any#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:Any):Boolean"></a>
<a id="==(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.Any#asInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="asInstanceOf[T0]:T0"></a>
<a id="asInstanceOf[T0]:T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#attribute" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="attribute(name:String):Option[String]"></a>
<a id="attribute(String):Option[String]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">attribute</span><span class="params">(<span name="name">name: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Option">Option</span>[<span class="extype" name="scala.Predef.String">String</span>]</span>
</span>
</h4>
<p class="shortcomment cmt">The attribute value of the given attribute name of this element, wrapped in a <code>Some</code>, or <code>None</code> if no
such attribute exists on this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The attribute value of the given attribute name of this element, wrapped in a <code>Some</code>, or <code>None</code> if no
such attribute exists on this <code>Element</code>.</p><p>This method invokes <code>getAttribute</code> on the underlying <code>WebElement</code>, passing in the
specified <code>name</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the attribute with the given name, wrapped in a <code>Some</code>, else <code>None</code>
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.TextArea#clear" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="clear():Unit"></a>
<a id="clear():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clear</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Clears this text area.</p>
</li><li name="scala.AnyRef#clone" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="clone():Object"></a>
<a id="clone():AnyRef"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<span class="extype" name="java.lang">java.lang</span>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">()</span>
</dd></dl></div>
</li><li name="scala.AnyRef#eq" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="eq(x$1:AnyRef):Boolean"></a>
<a id="eq(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#equals" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="equals(other:Any):Boolean"></a>
<a id="equals(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">equals</span><span class="params">(<span name="other">other: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the result of invoking <code>equals</code> on the underlying <code>Element</code>, passing
in the specified <code>other</code> object.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>equals</code> on the underlying <code>Element</code>, passing
in the specified <code>other</code> object.
</p></div><dl class="paramcmts block"><dt class="param">other</dt><dd class="cmt"><p>the object with which to compare for equality
</p></dd><dt>returns</dt><dd class="cmt"><p>true if the passed object is equal to this one
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#finalize" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="finalize():Unit"></a>
<a id="finalize():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<span class="extype" name="java.lang">java.lang</span>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">()</span>
</dd></dl></div>
</li><li name="scala.AnyRef#getClass" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getClass():Class[_]"></a>
<a id="getClass():Class[_]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<a id="hashCode():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the result of invoking <code>hashCode</code> on the underlying <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>hashCode</code> on the underlying <code>Element</code>.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>a hash code for this object
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isDisplayed" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isDisplayed:Boolean"></a>
<a id="isDisplayed:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isDisplayed</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is displayed.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is displayed.</p><p>This invokes <code>isDisplayed</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently displayed
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isEnabled" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isEnabled:Boolean"></a>
<a id="isEnabled:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isEnabled</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is enabled.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is enabled.</p><p>This invokes <code>isEnabled</code> on the underlying <code>WebElement</code>, which
will generally return <code>true</code> for everything but disabled input elements.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently enabled
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.Any#isInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isInstanceOf[T0]:Boolean"></a>
<a id="isInstanceOf[T0]:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#isSelected" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isSelected:Boolean"></a>
<a id="isSelected:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isSelected</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<p class="shortcomment cmt">Indicates whether this <code>Element</code> is selected.</p><div class="fullcomment"><div class="comment cmt"><p>Indicates whether this <code>Element</code> is selected.</p><p>This method, which invokes <code>isSelected</code> on the underlying <code>WebElement</code>,
is relevant only for input elements such as checkboxes, options in a single- or multiple-selection
list box, and radio buttons. For any other element it will simply return <code>false</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p><code>true</code> if the element is currently selected or checked
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#location" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="location:WebBrowser.this.Point"></a>
<a id="location:Point"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">location</span><span class="result">: <a href="WebBrowser$Point.html" class="extype" name="org.scalatest.selenium.WebBrowser.Point">Point</a></span>
</span>
</h4>
<p class="shortcomment cmt">The XY location of the top-left corner of this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The XY location of the top-left corner of this <code>Element</code>.</p><p>This invokes <code>getLocation</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the location of the top-left corner of this element on the page
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.AnyRef#ne" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ne(x$1:AnyRef):Boolean"></a>
<a id="ne(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notify" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notify():Unit"></a>
<a id="notify():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notifyAll" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notifyAll():Unit"></a>
<a id="notifyAll():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#size" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="size:WebBrowser.this.Dimension"></a>
<a id="size:Dimension"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">size</span><span class="result">: <a href="WebBrowser$Dimension.html" class="extype" name="org.scalatest.selenium.WebBrowser.Dimension">Dimension</a></span>
</span>
</h4>
<p class="shortcomment cmt">The width/height size of this <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>The width/height size of this <code>Element</code>.</p><p>This invokes <code>getSize</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the size of the element on the page
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="scala.AnyRef#synchronized" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="synchronized[T0](x$1:=>T0):T0"></a>
<a id="synchronized[T0](⇒T0):T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#tagName" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="tagName:String"></a>
<a id="tagName:String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">tagName</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4>
<p class="shortcomment cmt">The tag name of this element.</p><div class="fullcomment"><div class="comment cmt"><p>The tag name of this element.</p><p>This method invokes <code>getTagName</code> on the underlying <code>WebElement</code>.
Note it returns the name of the tag, not the value of the of the <code>name</code> attribute.
For example, it will return will return <code>"input"</code> for the element
<code><input name="city" /></code>, not <code>"city"</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the tag name of this element
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#text" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="text:String"></a>
<a id="text:String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">text</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the visible (<em>i.e.</em>, not hidden by CSS) text of this element, including sub-elements, without any leading or trailing whitespace.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the visible (<em>i.e.</em>, not hidden by CSS) text of this element, including sub-elements, without any leading or trailing whitespace.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the visible text enclosed by this element, or an empty string, if the element encloses no visible text
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.Element#toString" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="toString():String"></a>
<a id="toString():String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4>
<p class="shortcomment cmt">Returns the result of invoking <code>toString</code> on the underlying <code>Element</code>.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the result of invoking <code>toString</code> on the underlying <code>Element</code>.
</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>a string representation of this object
</p></dd></dl><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a> → AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.TextArea#underlying" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="underlying:org.openqa.selenium.WebElement"></a>
<a id="underlying:WebElement"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">val</span>
</span>
<span class="symbol">
<span class="name">underlying</span><span class="result">: <span class="extype" name="org.openqa.selenium.WebElement">WebElement</span></span>
</span>
</h4>
<p class="shortcomment cmt">the <code>WebElement</code> representing a text area</p><div class="fullcomment"><div class="comment cmt"><p>the <code>WebElement</code> representing a text area</p></div><dl class="attributes block"> <dt>Definition Classes</dt><dd><a href="" class="extype" name="org.scalatest.selenium.WebBrowser.TextArea">TextArea</a> → <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.TextArea#value" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="value:String"></a>
<a id="value:String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">value</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4>
<p class="shortcomment cmt">Gets this text area's value.</p><div class="fullcomment"><div class="comment cmt"><p>Gets this text area's value.</p><p>This method invokes <code>getAttribute("value")</code> on the underlying <code>WebElement</code>.</p></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the text area's value
</p></dd></dl></div>
</li><li name="org.scalatest.selenium.WebBrowser.TextArea#value_=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="value_=(value:String):Unit"></a>
<a id="value_=(String):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: value_$eq" class="name">value_=</span><span class="params">(<span name="value">value: <span class="extype" name="scala.Predef.String">String</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<p class="shortcomment cmt">Sets this text area's value.</p><div class="fullcomment"><div class="comment cmt"><p>Sets this text area's value.
</p></div><dl class="paramcmts block"><dt class="param">value</dt><dd class="cmt"><p>the new value
</p></dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait():Unit"></a>
<a id="wait():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">()</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long,x$2:Int):Unit"></a>
<a id="wait(Long,Int):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">()</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long):Unit"></a>
<a id="wait(Long):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">()</span>
</dd></dl></div>
</li></ol>
</div>
</div>
<div id="inheritedMembers">
<div class="parent" name="org.scalatest.selenium.WebBrowser.Element">
<h3>Inherited from <a href="WebBrowser$Element.html" class="extype" name="org.scalatest.selenium.WebBrowser.Element">Element</a></h3>
</div><div class="parent" name="scala.AnyRef">
<h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3>
</div><div class="parent" name="scala.Any">
<h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3>
</div>
</div>
<div id="groupedMembers">
<div class="group" name="Ungrouped">
<h3>Ungrouped</h3>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="footer"> </div>
</body>
</html> | {
"content_hash": "cfce96425830e83581d7383bc32107de",
"timestamp": "",
"source": "github",
"line_count": 658,
"max_line_length": 482,
"avg_line_length": 61.723404255319146,
"alnum_prop": 0.62490766730684,
"repo_name": "scalatest/scalatest-website",
"id": "0047549930ae14c53e33832426153066c64213f4",
"size": "40636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/scaladoc/2.1.1/org/scalatest/selenium/WebBrowser$TextArea.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "8401192"
},
{
"name": "HTML",
"bytes": "4508833233"
},
{
"name": "JavaScript",
"bytes": "12256885"
},
{
"name": "Procfile",
"bytes": "62"
},
{
"name": "Scala",
"bytes": "136544"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(version: 20160907133521) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "donut_ratings", force: :cascade do |t|
t.integer "user_id"
t.integer "donut_id"
t.integer "donut_shop_id"
t.integer "score"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "occasion"
end
create_table "donut_shops", force: :cascade do |t|
t.string "name"
t.text "description"
t.string "address"
t.string "phone"
t.string "website"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "picture"
end
create_table "donuts", force: :cascade do |t|
t.string "name"
t.string "description"
t.string "occasion"
t.string "type_of_donut"
t.integer "donut_shop_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "picture"
end
create_table "users", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.string "password_digest"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "authentication_token"
end
end
| {
"content_hash": "7aaa29d6da4eacd9fdacf2b5646152ff",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.6190476190476191,
"repo_name": "CorainChicago/DonutDatabase",
"id": "5381dbfed828b80ee1b5b505dfed93d64454fea4",
"size": "2127",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6353"
},
{
"name": "HTML",
"bytes": "19150"
},
{
"name": "JavaScript",
"bytes": "1685"
},
{
"name": "Ruby",
"bytes": "57697"
}
],
"symlink_target": ""
} |
package org.op4j.operators.intf.list;
import java.util.List;
import org.op4j.functions.IFunction;
import org.op4j.operators.qualities.ExecutableSelectedOperator;
import org.op4j.operators.qualities.ReplaceableOperator;
import org.op4j.operators.qualities.SelectedElementsOperator;
import org.op4j.operators.qualities.UniqOperator;
/**
*
* @since 1.0
*
* @author Daniel Fernández
*
*/
public interface ILevel1ListSelectedElementsSelectedOperator<I,T>
extends UniqOperator<List<T>>,
SelectedElementsOperator<T>,
ExecutableSelectedOperator<T>,
ReplaceableOperator<T> {
public ILevel1ListSelectedElementsOperator<I,T> endIf();
public ILevel1ListSelectedElementsSelectedOperator<I,T> replaceWith(final T replacement);
public ILevel1ListSelectedElementsSelectedOperator<I,T> exec(final IFunction<? super T,? extends T> function);
}
| {
"content_hash": "a7504edc400bedbb674d28c260025d6a",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 114,
"avg_line_length": 25.75,
"alnum_prop": 0.7464940668824164,
"repo_name": "op4j/op4j",
"id": "d712ce96f10202c2040c003b0356e9d7c6a71b2a",
"size": "1743",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/op4j/operators/intf/list/ILevel1ListSelectedElementsSelectedOperator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2778594"
}
],
"symlink_target": ""
} |
@interface PHNTransactionInterceptor ()
@property(nonatomic, strong) PHNMeasurementService *measurementService;
@property(nonatomic, strong) NSMutableDictionary<NSString *, SKProduct *> *products;
@end
@implementation PHNTransactionInterceptor
- (instancetype) initWithTransactionObserver:(id<SKPaymentTransactionObserver>)wrappedObserver
andMeasurementService:(PHNMeasurementService*)measurementService {
if (self = [super init]) {
_observer = wrappedObserver;
_measurementService = measurementService;
_products = [NSMutableDictionary dictionary];
}
return self;
}
- (void) registerProduct:(SKProduct *)product {
self.products[product.productIdentifier] = product;
}
#pragma mark - SKPaymentTransactionObserver
- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions
{
//filter to purchases, where the product has been registered.
for (SKPaymentTransaction *transaction in [transactions filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nonnull evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
SKPaymentTransaction *transaction = (SKPaymentTransaction *) evaluatedObject;
return (transaction.transactionState == SKPaymentTransactionStatePurchased) &&
self.products[transaction.payment.productIdentifier];
}]]) {
//generate event, track.
[self.measurementService trackEvent:[PHNEvent eventWithProduct:self.products[transaction.payment.productIdentifier]
andQuantity:transaction.payment.quantity]];
}
//proxy
if ([self.observer respondsToSelector:@selector(paymentQueue:updatedTransactions:)]) {
[self.observer paymentQueue:queue updatedTransactions:transactions];
}
}
- (void) paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray<SKPaymentTransaction *> *)transactions
{
if ([self.observer respondsToSelector:@selector(paymentQueue:removedTransactions:)]) {
[self.observer paymentQueue:queue removedTransactions:transactions];
}
}
- (void) paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error
{
if ([self.observer respondsToSelector:@selector(paymentQueue:restoreCompletedTransactionsFailedWithError:)]) {
[self.observer paymentQueue:queue restoreCompletedTransactionsFailedWithError:error];
}
}
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
if ([self.observer respondsToSelector:@selector(paymentQueueRestoreCompletedTransactionsFinished:)]) {
[self.observer paymentQueueRestoreCompletedTransactionsFinished:queue];
}
}
- (void) paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray<SKDownload *> *)downloads {
if ([self.observer respondsToSelector:@selector(paymentQueue:updatedDownloads:)]) {
[self.observer paymentQueue:queue updatedDownloads:downloads];
}
}
@end
| {
"content_hash": "0c4c955255f45c95f4e7aa5ba2740478",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 207,
"avg_line_length": 40.12987012987013,
"alnum_prop": 0.7391585760517799,
"repo_name": "PerformanceHorizonGroup/measurementkit-cocoapod",
"id": "28a69f31e381f229122fa9333d73ee57267621f2",
"size": "3340",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "PHNTransactionInterceptor.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "146878"
},
{
"name": "Ruby",
"bytes": "915"
}
],
"symlink_target": ""
} |
#ifndef SVGElement_h
#define SVGElement_h
#include "core/CoreExport.h"
#include "core/SVGNames.h"
#include "core/dom/Element.h"
#include "core/svg/SVGParsingError.h"
#include "core/svg/properties/SVGPropertyInfo.h"
#include "platform/heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/OwnPtr.h"
namespace blink {
class AffineTransform;
class CSSCursorImageValue;
class Document;
class SVGAnimatedPropertyBase;
class SubtreeLayoutScope;
class SVGAnimatedString;
class SVGCursorElement;
class SVGDocumentExtensions;
class SVGElement;
class SVGElementRareData;
class SVGFitToViewBox;
class SVGLength;
class SVGSVGElement;
class SVGUseElement;
typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement>> SVGElementSet;
class CORE_EXPORT SVGElement : public Element {
DEFINE_WRAPPERTYPEINFO();
public:
~SVGElement() override;
void attach(const AttachContext&) override;
void detach(const AttachContext&) override;
short tabIndex() const override;
bool supportsFocus() const override { return false; }
bool isOutermostSVGSVGElement() const;
bool hasTagName(const SVGQualifiedName& name) const { return hasLocalName(name.localName()); }
String title() const override;
bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
static bool isAnimatableCSSProperty(const QualifiedName&);
enum CTMScope {
NearestViewportScope, // Used by SVGGraphicsElement::getCTM()
ScreenScope, // Used by SVGGraphicsElement::getScreenCTM()
AncestorScope // Used by SVGSVGElement::get{Enclosure|Intersection}List()
};
virtual AffineTransform localCoordinateSpaceTransform(CTMScope) const;
virtual bool needsPendingResourceHandling() const { return true; }
bool instanceUpdatesBlocked() const;
void setInstanceUpdatesBlocked(bool);
SVGSVGElement* ownerSVGElement() const;
SVGElement* viewportElement() const;
SVGDocumentExtensions& accessDocumentSVGExtensions();
virtual bool isSVGGeometryElement() const { return false; }
virtual bool isSVGGraphicsElement() const { return false; }
virtual bool isFilterEffect() const { return false; }
virtual bool isTextContent() const { return false; }
virtual bool isTextPositioning() const { return false; }
virtual bool isStructurallyExternal() const { return false; }
// For SVGTests
virtual bool isValid() const { return true; }
virtual void svgAttributeChanged(const QualifiedName&);
PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> propertyFromAttribute(const QualifiedName& attributeName);
static AnimatedPropertyType animatedPropertyTypeForCSSAttribute(const QualifiedName& attributeName);
void sendSVGLoadEventToSelfAndAncestorChainIfPossible();
bool sendSVGLoadEventIfPossible();
virtual AffineTransform* animateMotionTransform() { return nullptr; }
void invalidateSVGAttributes() { ensureUniqueElementData().m_animatedSVGAttributesAreDirty = true; }
void invalidateSVGPresentationAttributeStyle() { ensureUniqueElementData().m_presentationAttributeStyleIsDirty = true; }
void addSVGLengthPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPropertyID, SVGLength&);
const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& instancesForElement() const;
void mapInstanceToElement(SVGElement*);
void removeInstanceMapping(SVGElement*);
bool getBoundingBox(FloatRect&);
void setCursorElement(SVGCursorElement*);
void setCursorImageValue(CSSCursorImageValue*);
#if !ENABLE(OILPAN)
void cursorElementRemoved();
void cursorImageValueRemoved();
#endif
SVGElement* correspondingElement();
void setCorrespondingElement(SVGElement*);
SVGUseElement* correspondingUseElement() const;
void synchronizeAnimatedSVGAttribute(const QualifiedName&) const;
PassRefPtr<ComputedStyle> customStyleForLayoutObject() final;
#if ENABLE(ASSERT)
virtual bool isAnimatableAttribute(const QualifiedName&) const;
#endif
MutableStylePropertySet* animatedSMILStyleProperties() const;
MutableStylePropertySet* ensureAnimatedSMILStyleProperties();
void setUseOverrideComputedStyle(bool);
virtual bool haveLoadedRequiredResources();
bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false) final;
bool removeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture = false) final;
void invalidateRelativeLengthClients(SubtreeLayoutScope* = 0);
void addToPropertyMap(PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase>);
SVGAnimatedString* className() { return m_className.get(); }
bool inUseShadowTree() const;
SVGElementSet* setOfIncomingReferences() const;
void addReferenceTo(SVGElement*);
void rebuildAllIncomingReferences();
void removeAllIncomingReferences();
void removeAllOutgoingReferences();
class InvalidationGuard {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(InvalidationGuard);
public:
InvalidationGuard(SVGElement* element) : m_element(element) { }
~InvalidationGuard() { m_element->invalidateInstances(); }
private:
RawPtrWillBeMember<SVGElement> m_element;
};
class InstanceUpdateBlocker {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(InstanceUpdateBlocker);
public:
InstanceUpdateBlocker(SVGElement* targetElement);
~InstanceUpdateBlocker();
private:
RawPtrWillBeMember<SVGElement> m_targetElement;
};
void invalidateInstances();
DECLARE_VIRTUAL_TRACE();
static const AtomicString& eventParameterName();
bool isPresentationAttribute(const QualifiedName&) const override;
virtual bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const { return false; }
protected:
SVGElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement);
void parseAttribute(const QualifiedName&, const AtomicString&) override;
void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly) override;
void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) override;
InsertionNotificationRequest insertedInto(ContainerNode*) override;
void removedFrom(ContainerNode*) override;
void childrenChanged(const ChildrenChange&) override;
static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement*);
static void markForLayoutAndParentResourceInvalidation(LayoutObject*);
virtual bool selfHasRelativeLengths() const { return false; }
SVGElementRareData* ensureSVGRareData();
inline bool hasSVGRareData() const { return m_SVGRareData; }
inline SVGElementRareData* svgRareData() const
{
ASSERT(m_SVGRareData);
return m_SVGRareData.get();
}
// SVGFitToViewBox::parseAttribute uses reportAttributeParsingError.
friend class SVGFitToViewBox;
void reportAttributeParsingError(SVGParsingError, const QualifiedName&, const AtomicString&);
bool hasFocusEventListeners() const;
private:
bool isSVGElement() const = delete; // This will catch anyone doing an unnecessary check.
bool isStyledElement() const = delete; // This will catch anyone doing an unnecessary check.
const ComputedStyle* ensureComputedStyle(PseudoId = NOPSEUDO);
const ComputedStyle* virtualEnsureComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) final { return ensureComputedStyle(pseudoElementSpecifier); }
void willRecalcStyle(StyleRecalcChange) override;
void buildPendingResourcesIfNeeded();
WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>> m_elementsWithRelativeLengths;
typedef WillBeHeapHashMap<QualifiedName, RefPtrWillBeMember<SVGAnimatedPropertyBase>> AttributeToPropertyMap;
AttributeToPropertyMap m_attributeToPropertyMap;
#if ENABLE(ASSERT)
bool m_inRelativeLengthClientsInvalidation;
#endif
OwnPtrWillBeMember<SVGElementRareData> m_SVGRareData;
RefPtrWillBeMember<SVGAnimatedString> m_className;
};
struct SVGAttributeHashTranslator {
static unsigned hash(const QualifiedName& key)
{
if (key.hasPrefix()) {
QualifiedNameComponents components = { nullAtom.impl(), key.localName().impl(), key.namespaceURI().impl() };
return hashComponents(components);
}
return DefaultHash<QualifiedName>::Hash::hash(key);
}
static bool equal(const QualifiedName& a, const QualifiedName& b) { return a.matches(b); }
};
DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement());
template <typename T> bool isElementOfType(const SVGElement&);
template <> inline bool isElementOfType<const SVGElement>(const SVGElement&) { return true; }
inline bool Node::hasTagName(const SVGQualifiedName& name) const
{
return isSVGElement() && toSVGElement(*this).hasTagName(name);
}
// This requires isSVG*Element(const SVGElement&).
#define DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \
inline bool is##thisType(const thisType* element); \
inline bool is##thisType(const thisType& element); \
inline bool is##thisType(const SVGElement* element) { return element && is##thisType(*element); } \
inline bool is##thisType(const Node& node) { return node.isSVGElement() ? is##thisType(toSVGElement(node)) : false; } \
inline bool is##thisType(const Node* node) { return node && is##thisType(*node); } \
template<typename T> inline bool is##thisType(const PassRefPtrWillBeRawPtr<T>& node) { return is##thisType(node.get()); } \
template<typename T> inline bool is##thisType(const RefPtrWillBeMember<T>& node) { return is##thisType(node.get()); } \
template <> inline bool isElementOfType<const thisType>(const SVGElement& element) { return is##thisType(element); } \
DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType)
} // namespace blink
#include "core/SVGElementTypeHelpers.h"
#endif // SVGElement_h
| {
"content_hash": "4df7db8879bf6f1b1e2c2b9760923448",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 157,
"avg_line_length": 38.39473684210526,
"alnum_prop": 0.7626554391461863,
"repo_name": "zero-rp/miniblink49",
"id": "c21378c95f94a4a11f00e542286d3dc82f4f6e53",
"size": "11192",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "third_party/WebKit/Source/core/svg/SVGElement.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "11324414"
},
{
"name": "Batchfile",
"bytes": "52488"
},
{
"name": "C",
"bytes": "31014938"
},
{
"name": "C++",
"bytes": "281193388"
},
{
"name": "CMake",
"bytes": "88548"
},
{
"name": "CSS",
"bytes": "20839"
},
{
"name": "DIGITAL Command Language",
"bytes": "226954"
},
{
"name": "HTML",
"bytes": "202637"
},
{
"name": "JavaScript",
"bytes": "32544926"
},
{
"name": "Lua",
"bytes": "32432"
},
{
"name": "M4",
"bytes": "125191"
},
{
"name": "Makefile",
"bytes": "1517330"
},
{
"name": "Objective-C",
"bytes": "87691"
},
{
"name": "Objective-C++",
"bytes": "35037"
},
{
"name": "PHP",
"bytes": "307541"
},
{
"name": "Perl",
"bytes": "3283676"
},
{
"name": "Prolog",
"bytes": "29177"
},
{
"name": "Python",
"bytes": "4308928"
},
{
"name": "R",
"bytes": "10248"
},
{
"name": "Scheme",
"bytes": "25457"
},
{
"name": "Shell",
"bytes": "264021"
},
{
"name": "TypeScript",
"bytes": "162421"
},
{
"name": "Vim script",
"bytes": "11362"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "4383"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon(s) in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.7.1.min.js"></script>
<style>
body
{
overflow:auto;
}i
table,th,td
{
border:1px solid;
border-collapse:collapse;
}
th,td
{
padding:5px;
}
img.logo
{
padding:10px;
margin:0px;
}
img.button2
{
position:absolute;
top:20px;
right:200px;
}
img.disclamer
{
position:absolute;
top:20px;
right:250px;
}
img.button1
{
position:absolute;
top:20px;
right:500px;
}
ul.main
{
position:absolute;
visibility:visible;
list-style-type:none;
margin:auto;
font-weight:bold;
font-style:normal;
padding:15px;
width:100%;
background-color:#cccc00;
text-align:center;
font-color:#ffffff;
font-style:bold
}
li.list
{
text-align:center;
position:relative;
visibility:inherit;
overflow:hidden;
cursor:default;
color:#ffffff;
display:inline;
width:150px;
top:0px;
left:250px;
}
div.list
{
height:100%
width:150px
}
p.smalltext
{
position:relative
top:10px;
font-size:15px;
}
img.like
{
position:relative;
right:200px;
top:0px;
}
form.simple_bar
{
position:absolute;
right:500px;
top:120px;
}
button.account
{
position:absolute;
right:200px;
top:50px;
}
button.cart
{
position:absolute;
right:80px;
top:50px;
}
img.calltoaction
{ position:absolute;
right:500px;
top:0px;
width
}
h4.delta
{
position:absolute;
right:550px;
top:-20px;
}
</style>
</head>
<body>
<!--[if lt IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Add your site or application content here -->
<a href="#" target="blank"><img src="img/archery-logo.jpg"height="120"width="120"><img
src="img/arrow.jpg"height="40"width="100"></a><h2>Shaftin Archery Supplies</h2>
<img src="img/range.jpg" class="calltoaction">
<h4 class="delta" style=color:#9900FF> Come to our appolation location at <br> 44 inserthere way</h4>
<form name="simple_bar" method="get" class="simple_bar">
<table width="400" border="1" cellpadding="5">
<tr>
<td><input type="hidden" name="dff_view" value="grid"> Search:<input type="text" name="dff_keyword" size="30" maxlength="50"><input type="submit" value="Find">
enter key word or item.
</td>
</tr>
</table>
</form>
<button href="#" target=_"blank" class="account"><img src="img/archery-logo.jpg"height="20"width="20">Account</button>
<button href="#" target=_"blank" class="cart"><img src="img/target.jpg"height="20"width="20">View Cart</button>
<ul style="background-color:#cc6600;" class="main">
<a href="#" target=_"blank"><li class="list" style=float:left;>SHOPPING</li></a>
<a href="#" target=_"blank"><li class="list" style=float:left;>EVENTS</li></a>
<a href="#" target=_"blank"><li class="list" style=float:left;>PRACTICE LOCALS</li></a>
<a href="#" target=_"blank"><li class="list" style=float:left;>ABOUT US</li></a>
<a href="#" target=_"blank"><li class="list" style=float:left;>CLUBS and ORGANIZATIONS</li></a></ul>
<div class="call" style="clear:both;text-align:center;color:#cc6600;margin:90px;">
<h1>Call us now at 1-800-555-5555</h1><p class="smalltext">
we're dedcated to offering you top-notch archery equipment at rock-bottom prices</p><br>
<iframe width="560" height="345"
src="http://www.youtube.com/embed/7QMlwDphNME">
</iframe>
<h4>This month we're proud to feature the Indian Trail Archery Club on our front page archery-club-of-the-month. please see their contact
information at the end of the video, or find them and other great archery clubs in your area via the CLUBS and ORGANIZATIONS tab <h4>
<br>
<br>
<div class="products"; style="width:1300px; background-color:#CC9933;">
<img src="img/Likevertim.gif">
<a href="https://www.facebook.com/" target=tyle=""https://www.facebook.com/""><img src="img/likee this.gif" class="like">
</a>
<table style="width:1000px; height:486px;">
<tr style="background-color:#7f8c8d">
<h1>
<th style="color:#ffffff">bows</th>
<th style="color:#ffffff">gear</th>
<th style="color:#ffffff">clubs hosting events</th></h1>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><img src="img/product2.GIF" height="244" width="300"></td>
<td style="color:#919191"><img src="img/Archery Glove.JPG"height="244" width="300"><br>some Coolass-gloves<br>$199.99</td>
<td style="color:#919191"><img src="img/archers_02.jpeg" ><p>Larpers Anonamous' monthly<br> "Master Marksman" compettition</p></td>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><img src="img/product3.GIF" height="244" width="300"></td>
<td style="color:#919191"><img src="img/product1.GIF" height="244" width="300"></td>
<td style="color:#919191"><img src="img/logo2.jpg"height="244" width="300"><p>Rapter Archery's Summer<br>recrutement and brunch begins</p></td>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><img src="img/quiver.jpg" height="244" width="300"><br>$399</td>
<td style="color:#919191"><img src="img/hunter.jpg" height="244" width="300"><br>Wood Master<br> coniferous hunting gear<br>$599</td>
<td style="color:#919191"><img src="img/logo3.jpg"height="244" width="300"><p>Bow Hunters' biweekly<br>Pro-hunter event</p></td>
</tr>
<tr style="background-color:#f7f7f7">
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
<td style="color:#919191"><button href="#" target=_"blank">ADD TO CART</button></td>
</tr>
</table>
</div>
<div style="width:1300px; background-color:#FF6600;">
<br>
<br>
<br>
<br>
</div;>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.0.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X');ga('send','pageview');
</script>
</body>
</html>
| {
"content_hash": "c378684e244ac4725226cab57411cbf5",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 184,
"avg_line_length": 31.438524590163933,
"alnum_prop": 0.6535001955416504,
"repo_name": "conif1/pantson",
"id": "e63011aa42209a1974eed5bb798406592742dc88",
"size": "7671",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "archery.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "13230"
},
{
"name": "JavaScript",
"bytes": "734"
}
],
"symlink_target": ""
} |
<?php
namespace agentecho\datastructure;
/**
* @author Patrick van Bergen
*/
class RelationTemplate extends Relation
{
public function __toString()
{
return '{{ ' . $this->arguments[0] . ' }}';
}
}
| {
"content_hash": "d713424379e06c99b4ca573765a9fc1e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 45,
"avg_line_length": 14.785714285714286,
"alnum_prop": 0.6473429951690821,
"repo_name": "garfix/echo",
"id": "a982fdda689312babfdd37a0f306ce827833534c",
"size": "207",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "datastructure/RelationTemplate.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3449"
},
{
"name": "JavaScript",
"bytes": "12604"
},
{
"name": "PHP",
"bytes": "244657"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.