text
stringlengths
2
1.04M
meta
dict
This feature is universal but the values `Auto` are language-specific. It occurs with 1 different values: `Auto`. 251 tokens (1%) have a non-empty value of `Voice`. 168 types (3%) occur at least once with a non-empty value of `Voice`. 105 lemmas (3%) occur at least once with a non-empty value of `Voice`. The feature is used with 2 part-of-speech tags: [ga-pos/VERB]() (250; 1% instances), [ga-pos/X]() (1; 0% instances). ### `VERB` 250 [ga-pos/VERB]() tokens (11% of all `VERB` tokens) have a non-empty value of `Voice`. The most frequent other feature values with which `VERB` and `Voice` co-occurred: <tt><a href="VerbForm.html">VerbForm</a>=EMPTY</tt> (250; 100%), <tt><a href="Mood.html">Mood</a>=Ind</tt> (221; 88%), <tt><a href="Form.html">Form</a>=EMPTY</tt> (159; 64%). `VERB` tokens may have the following values of `Voice`: * `Auto` (250; 100% of non-empty `Voice`): <em>cuireadh, rinneadh, cuirtear, deonadh, dhéantar, dtagraítear, déanfar, déantar, faightear, shonraítear</em> * `EMPTY` (2051): <em>bhí, is, tá, raibh, atá, bhfuil, ba, gur, bheidh, beidh</em> `Voice` seems to be **lexical feature** of `VERB`. 100% lemmas (105) occur only with one value of `Voice`. ### `X` 1 [ga-pos/X]() tokens (0% of all `X` tokens) have a non-empty value of `Voice`. The most frequent other feature values with which `X` and `Voice` co-occurred: <tt><a href="PronType.html">PronType</a>=EMPTY</tt> (1; 100%), <tt><a href="Dialect.html">Dialect</a>=Munster</tt> (1; 100%). `X` tokens may have the following values of `Voice`: * `Auto` (1; 100% of non-empty `Voice`): <em>deineadh</em> * `EMPTY` (264): <em>san, (2), (a), (b), so, (1), (c), (3), (4), Co.</em> ## Relations with Agreement in `Voice` The 10 most frequent relations where parent and child node agree in `Voice`: <tt>VERB --[<a href="../dep/csubj:cleft.html">csubj:cleft</a>]--> VERB</tt> (1; 100%), <tt>X --[<a href="../dep/conj.html">conj</a>]--> VERB</tt> (1; 100%).
{ "content_hash": "eb2f1d39f57ba4cf09b84be871d00346", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 256, "avg_line_length": 51.26315789473684, "alnum_prop": 0.6545174537987679, "repo_name": "coltekin/docs", "id": "bbe7c6a0636b3cdb526b879679a6465843affb64", "size": "2075", "binary": false, "copies": "1", "ref": "refs/heads/pages-source", "path": "_includes/stats/ga/feat/Voice.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "62204" }, { "name": "HTML", "bytes": "410968" }, { "name": "JavaScript", "bytes": "174044" }, { "name": "Python", "bytes": "33119" }, { "name": "Ruby", "bytes": "578" }, { "name": "Shell", "bytes": "5759" } ], "symlink_target": "" }
<?php namespace nabu\data\medioteca; use \nabu\data\medioteca\base\CNabuMediotecaBase; use nabu\data\customer\CNabuCustomer; use nabu\data\medioteca\builtin\CNabuBuiltInMediotecaItem; /** * @author Rafael Gutierrez <rgutierrez@nabu-3.com> * @version 3.0.0 Surface * @package \nabu\data\medioteca */ class CNabuMedioteca extends CNabuMediotecaBase { /** * Medioteca Items collection * @var CNabuMediotecaItemList */ private $nb_medioteca_item_list = null; public function __construct($nb_medioteca = false) { parent::__construct($nb_medioteca); $this->nb_medioteca_item_list = new CNabuMediotecaItemList($this); } /** * Gets all items in the Medioteca. * @param bool $force If true, clears current items list and retrieves a new list. * @return CNabuMediotecaItemList Returns a list object with avaliable items. */ public function getItems($force = false) { if (!$this->isBuiltIn() && ($this->nb_medioteca_item_list->isEmpty() || $force)) { $this->nb_medioteca_item_list = CNabuMediotecaItem::getItemsForMedioteca($this); } return $this->nb_medioteca_item_list; } /** * Gets an item from the Medioteca by their ID. * @param mixed $nb_medioteca_item An instance descending from CNabuDataObject that contains a field named * nb_medioteca_item_id or an ID. * @return CNabuMediotecaItem If an Item exists, then returns their instance elsewhere returns null. */ public function getItem($nb_medioteca_item) { $nb_medioteca_item_id = nb_getMixedValue($nb_medioteca_item, 'nb_medioteca_item_id'); if (is_numeric($nb_medioteca_item_id) || nb_isValidGUID($nb_medioteca_item_id)) { return $this->nb_medioteca_item_list->getItem($nb_medioteca_item_id); } return null; } /** * Gets an item from the Medioteca using their key. * @param string $key A key idenfying a possible item in the Medioteca. * @return CNabuMediotecaItem If an Item exists, identified by $key, then returns it, elsewhere returns null. */ public function getItemByKey(string $key) { return $this->nb_medioteca_item_list->getItem($key, CNabuMediotecaItemList::INDEX_KEY); } /** * Create a new Item in the list. * @param string $key Optional key of the item to be assigned. * @return CNabuMediotecaItem Returns the created Item instance. */ public function newItem(string $key = null) { $nb_medioteca_item = $this->isBuiltIn() ? new CNabuBuiltInMediotecaItem() : new CNabuMediotecaItem() ; $nb_medioteca_item->setKey($key); return $this->addItemObject($nb_medioteca_item); } /** * Find a Item using their url. * @param string $url Slug of Product to find. * @param mixed|null $nb_language Language to search the Slug. * @return CNabuMediotecaItem|false Returns the Product instance if exists or false if not. */ public function findItemByURL(string $url, $nb_language = null) { $retval = false; $nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID); $this->getItems()->iterate( function ($key, CNabuMediotecaItem $nb_item) use (&$retval, $url, $nb_language_id) { if (is_numeric($nb_language_id) && ($nb_translation = $nb_item->getTranslation($nb_language_id)) instanceof CNabuMediotecaItemLanguage && $nb_translation->getURL() === $url ) { $retval = $nb_item; } else { $nb_item->getTranslations()->iterate( function ($key, CNabuMediotecaItemLanguage $nb_translation) use (&$retval, $nb_item, $url) { if ($nb_translation->getURL() === $url) { $retval = $nb_item; } return !$retval; } ); } return !$retval; } ); return $retval; } /** * Add an Item instance to the list. * @param CNabuMediotecaItem $nb_medioteca_item Item instance to be added. * @return CNabuMediotecaItem Returns the item added. */ public function addItemObject(CNabuMediotecaItem $nb_medioteca_item) { $nb_medioteca_item->setMedioteca($this); return $this->nb_medioteca_item_list->addItem($nb_medioteca_item); } /** * Forces to reindex entiry list by all available indexes. */ public function indexAll() { $this->nb_medioteca_item_list->sort(); } /** * Get an array of all keys in the Medioteca Collection. * @return array Returns an array of keys if some Medioteca have a key value, or null if none exists. */ public function getMediotecaItemKeysIndex() { return $this->nb_medioteca_item_list->getIndex(CNabuMediotecaItemList::INDEX_KEY); } /** * Overrides getTreeData method to add special branches. * If $nb_language have a valid value, also adds a translation object * with current translation pointed by it. * @param int|object $nb_language Instance or Id of the language to be used. * @param bool $dataonly Render only field values and ommit class control flags. * @return array Returns a multilevel associative array with all data. */ public function getTreeData($nb_language = null, $dataonly = false) { $trdata = parent::getTreeData($nb_language, $dataonly); $trdata['languages'] = $this->getLanguages(); $this->getItems(); $trdata['items'] = $this->nb_medioteca_item_list; $trdata['item_keys'] = $this->getMediotecaItemKeysIndex(); return $trdata; } /** * Get all Mediotecas of a Customer. * @param CNabuCustomer $nb_customer Customer instance that owns Mediotecas to be getted. * @return CNabuMediotecaList Returns a list of all instances. If no instances available the list object is empty. */ static public function getMediotecasForCustomer(CNabuCustomer $nb_customer) { $nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID); if (is_numeric($nb_customer_id)) { $retval = CNabuMedioteca::buildObjectListFromSQL( NABU_MEDIOTECA_FIELD_ID, 'select * ' . 'from ' . NABU_MEDIOTECA_TABLE . ' ' . 'where nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuMediotecaList($nb_customer); } return $retval; } /** * Overrides refresh method to add Medioteca subentities to be refreshed. * @param bool $force Forces to reload entities from the database storage. * @param bool $cascade Forces to reload child entities from the database storage. * @return bool Returns true if transations are empty or refreshed. */ public function refresh(bool $force = false, bool $cascade = false) : bool { return parent::refresh($force, $cascade) && (!$cascade || $this->getItems($force)); } }
{ "content_hash": "111ffe00852b48c616546b06c8394155", "timestamp": "", "source": "github", "line_count": 212, "max_line_length": 122, "avg_line_length": 35.594339622641506, "alnum_prop": 0.5980652001060164, "repo_name": "nabu-3/core", "id": "2a001f51f8b296a00eaf169f65d461b0c8438919", "size": "8319", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nabu/data/medioteca/CNabuMedioteca.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "3152564" }, { "name": "Shell", "bytes": "5287" } ], "symlink_target": "" }
package com.github.ccook.gtk.model; /** * Created by cam on 4/29/14. */ public class GtkWindowType { public static final int GTK_WINDOW_TOPLEVEL = 0; public static final int GTK_WINDOW_POPUP = 1; }
{ "content_hash": "a57834dd39668d6ec4cc421de7507a8d", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 52, "avg_line_length": 21, "alnum_prop": 0.6904761904761905, "repo_name": "Ccook/gtk-java-bindings", "id": "cfae92ce5e10d42a9e07e84d0e456656558e7e62", "size": "210", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/github/ccook/gtk/model/GtkWindowType.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "633836" } ], "symlink_target": "" }
package main import ( "database/sql" "flag" "fmt" "github.com/GoogleCloudPlatform/elcarro-oracle-operator/common/pkg/monitoring" _ "github.com/godror/godror" "github.com/prometheus/client_golang/prometheus" "k8s.io/klog/v2" ) type godrorFactory struct { dsn string } func (g godrorFactory) Open() (*sql.DB, error) { db, err := sql.Open("godror", g.dsn) if err != nil { err = fmt.Errorf("DB open failed: %w", err) } return db, err } func main() { klog.InitFlags(nil) flag.Parse() // Avoid adding unexpected metrics by using a custom registry. registry := prometheus.NewRegistry() log := klog.NewKlogr() db := godrorFactory{dsn: monitoring.GetDefaultDSN(log).String()} monitoring.StartExporting( log, registry, db, []string{"/oracle_metrics.yaml", "/oracle_unified_metrics.yaml"}, nil, ) log.Info("Shutting down") }
{ "content_hash": "d4506b1da5604a097c549d31072c0239", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 79, "avg_line_length": 19.906976744186046, "alnum_prop": 0.6915887850467289, "repo_name": "GoogleCloudPlatform/elcarro-oracle-operator", "id": "dac40900589f253a2c0590d85d7495284bf083b0", "size": "856", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "oracle/cmd/monitoring/oracle.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "3480" }, { "name": "Go", "bytes": "1553912" }, { "name": "Jsonnet", "bytes": "2370" }, { "name": "Makefile", "bytes": "12046" }, { "name": "Shell", "bytes": "97156" }, { "name": "Starlark", "bytes": "194750" } ], "symlink_target": "" }
namespace boost { namespace xpressive { namespace detail { /////////////////////////////////////////////////////////////////////////////// // read_attr // Placeholder that knows the slot number of an attribute as well as the type // of the object stored in it. template<typename Nbr, typename Matcher> struct read_attr { typedef Nbr nbr_type; typedef Matcher matcher_type; static Nbr nbr() { return Nbr(); } }; template<typename Nbr, typename Matcher> struct read_attr<Nbr, Matcher &> { typedef Nbr nbr_type; typedef Matcher matcher_type; }; }}} namespace boost { namespace xpressive { namespace grammar_detail { /////////////////////////////////////////////////////////////////////////////// // FindAttr // Look for patterns like (a1= terminal<RHS>) and return the type of the RHS. template<typename Nbr> struct FindAttr : or_< // Ignore nested actions, because attributes are scoped when< subscript<_, _>, _state > , when< terminal<_>, _state > , when< proto::assign<terminal<detail::attribute_placeholder<Nbr> >, _>, call<_value(_right)> > , otherwise< fold<_, _state, FindAttr<Nbr> > > > {}; /////////////////////////////////////////////////////////////////////////////// // as_read_attr // For patterns like (a1 = RHS)[ref(i) = a1], transform to // (a1 = RHS)[ref(i) = read_attr<1, RHS>] so that when reading the attribute // we know what type is stored in the attribute slot. struct as_read_attr : proto::transform<as_read_attr> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef typename impl::expr expr_type; typedef typename FindAttr<typename expr_type::proto_child0::nbr_type>::template impl< State , mpl::void_ , int >::result_type attr_type; typedef typename proto::terminal< detail::read_attr< typename expr_type::proto_child0::nbr_type , BOOST_PROTO_UNCVREF(attr_type) > >::type result_type; result_type operator ()(proto::ignore, proto::ignore, proto::ignore) const { result_type that = {{}}; return that; } }; }; /////////////////////////////////////////////////////////////////////////////// // DeepCopy // Turn all refs into values, and also bind all attribute placeholders with // the types from which they are being assigned. struct DeepCopy : or_< when< terminal<detail::attribute_placeholder<_> >, as_read_attr> , when< terminal<_>, proto::_deep_copy(_)> , otherwise< nary_expr<_, vararg<DeepCopy> > > > {}; /////////////////////////////////////////////////////////////////////////////// // attr_nbr // For an attribute placeholder, return the attribute's slot number. struct attr_nbr : proto::transform<attr_nbr> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef typename impl::expr expr_type; typedef typename expr_type::proto_child0::nbr_type::type result_type; }; }; struct max_attr; /////////////////////////////////////////////////////////////////////////////// // MaxAttr // In an action (rx)[act], find the largest attribute slot being used. struct MaxAttr : or_< when< terminal<detail::attribute_placeholder<_> >, attr_nbr> , when< terminal<_>, make<mpl::int_<0> > > // Ignore nested actions, because attributes are scoped: , when< subscript<_, _>, make<mpl::int_<0> > > , otherwise< fold<_, make<mpl::int_<0> >, max_attr> > > {}; /////////////////////////////////////////////////////////////////////////////// // max_attr // Take the maximum of the current attr slot number and the state. struct max_attr : proto::transform<max_attr> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef typename mpl::max< typename impl::state , typename MaxAttr::template impl<Expr, State, Data>::result_type >::type result_type; }; }; /////////////////////////////////////////////////////////////////////////////// // as_attr_matcher // turn a1=matcher into attr_matcher<Matcher>(1) struct as_attr_matcher : proto::transform<as_attr_matcher> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef typename impl::expr expr_type; typedef typename impl::data data_type; typedef detail::attr_matcher< typename proto::result_of::value<typename expr_type::proto_child1>::type , typename data_type::traits_type , typename data_type::icase_type > result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param , typename impl::data_param data ) const { return result_type( proto::value(proto::left(expr)).nbr() , proto::value(proto::right(expr)) , data.traits() ); } }; }; /////////////////////////////////////////////////////////////////////////////// // add_attrs // Wrap an expression in attr_begin_matcher/attr_end_matcher pair struct add_attrs : proto::transform<add_attrs> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef detail::attr_begin_matcher< typename MaxAttr::template impl<Expr, mpl::int_<0>, int>::result_type > begin_type; typedef typename impl::expr expr_type; typedef typename shift_right< typename terminal<begin_type>::type , typename shift_right< Expr , terminal<detail::attr_end_matcher>::type >::type >::type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param , typename impl::data_param ) const { begin_type begin; detail::attr_end_matcher end; result_type that = {{begin}, {expr, {end}}}; return that; } }; }; /////////////////////////////////////////////////////////////////////////////// // InsertAttrs struct InsertAttrs : if_<MaxAttr, add_attrs, _> {}; /////////////////////////////////////////////////////////////////////////////// // CheckAssertion struct CheckAssertion : proto::function<terminal<detail::check_tag>, _> {}; /////////////////////////////////////////////////////////////////////////////// // action_transform // Turn A[B] into (mark_begin(n) >> A >> mark_end(n) >> action_matcher<B>(n)) // If A and B use attributes, wrap the above expression in // a attr_begin_matcher<Count> / attr_end_matcher pair, where Count is // the number of attribute slots used by the pattern/action. struct as_action : proto::transform<as_action> { template<typename Expr, typename State, typename Data> struct impl : proto::transform_impl<Expr, State, Data> { typedef typename proto::result_of::left<Expr>::type expr_type; typedef typename proto::result_of::right<Expr>::type action_type; typedef typename DeepCopy::impl<action_type, expr_type, int>::result_type action_copy_type; typedef typename InsertMark::impl<expr_type, State, Data>::result_type marked_expr_type; typedef typename mpl::if_< proto::matches<action_type, CheckAssertion> , detail::predicate_matcher<action_copy_type> , detail::action_matcher<action_copy_type> >::type matcher_type; typedef typename proto::shift_right< marked_expr_type , typename proto::terminal<matcher_type>::type >::type no_attr_type; typedef typename InsertAttrs::impl<no_attr_type, State, Data>::result_type result_type; result_type operator ()( typename impl::expr_param expr , typename impl::state_param state , typename impl::data_param data ) const { int dummy = 0; marked_expr_type marked_expr = InsertMark::impl<expr_type, State, Data>()(proto::left(expr), state, data); no_attr_type that = { marked_expr , { matcher_type( DeepCopy::impl<action_type, expr_type, int>()( proto::right(expr) , proto::left(expr) , dummy ) , proto::value(proto::left(marked_expr)).mark_number_ ) } }; return InsertAttrs::impl<no_attr_type, State, Data>()(that, state, data); } }; }; }}} #endif
{ "content_hash": "d20a4eeddefe0d31c4d6d536eb609091", "timestamp": "", "source": "github", "line_count": 289, "max_line_length": 105, "avg_line_length": 36.25259515570934, "alnum_prop": 0.45871909897871527, "repo_name": "ruchiherself/MulRFRepo", "id": "b4a0addf485d189cf7ffe43c4a41a534fec32239", "size": "11707", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "MulRFSupertree/include/boost/xpressive/detail/static/transforms/as_action.hpp", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "161390" }, { "name": "C++", "bytes": "128802326" }, { "name": "CSS", "bytes": "8263" }, { "name": "D", "bytes": "159646" }, { "name": "Haskell", "bytes": "1061" }, { "name": "JavaScript", "bytes": "2772" }, { "name": "Perl", "bytes": "88751" }, { "name": "Scala", "bytes": "73524" }, { "name": "Shell", "bytes": "28350" } ], "symlink_target": "" }
// ----------------------------------------------------------------------------------------- // <copyright file="DynamicTableEntity.cs" company="Microsoft"> // Copyright 2013 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // ----------------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Storage.Table { using Microsoft.WindowsAzure.Storage.Core.Util; using System; using System.Collections.Generic; /// <summary> /// A <see cref="ITableEntity"/> type which allows callers direct access to the property map of the entity. /// This class eliminates the use of reflection for serialization and deserialization. /// </summary> public sealed class DynamicTableEntity : ITableEntity { /// <summary> /// Initializes a new instance of the <see cref="DynamicTableEntity"/> class. /// </summary> public DynamicTableEntity() { this.Properties = new Dictionary<string, EntityProperty>(); } /// <summary> /// Initializes a new instance of the <see cref="DynamicTableEntity"/> class with the specified partition key and row key. /// </summary> /// <param name="partitionKey">A string containing the partition key value for the entity.</param> /// <param name="rowKey">A string containing the row key value for the entity.</param> public DynamicTableEntity(string partitionKey, string rowKey) : this(partitionKey, rowKey, DateTimeOffset.MinValue, null /* timestamp */, new Dictionary<string, EntityProperty>()) { } /// <summary> /// Initializes a new instance of the <see cref="DynamicTableEntity"/> class with the entity's partition key, row key, ETag (if available/required), and properties. /// </summary> /// <param name="partitionKey">A string containing the partition key value for the entity.</param> /// <param name="rowKey">A string containing the row key value for the entity.</param> /// <param name="etag">A string containing the ETag for the entity.</param> /// <param name="properties">An <see cref="IDictionary{TKey,TValue}"/> object containing the entity's properties, indexed by property name.</param> public DynamicTableEntity(string partitionKey, string rowKey, string etag, IDictionary<string, EntityProperty> properties) : this(partitionKey, rowKey, DateTimeOffset.MinValue, etag, properties) { } /// <summary> /// Initializes a new instance of the <see cref="DynamicTableEntity"/> class with the entity's partition key, row key, timestamp, ETag (if available/required), and properties. /// </summary> /// <param name="partitionKey">A string containing the partition key value for the entity.</param> /// <param name="rowKey">A string containing the row key value for the entity.</param> /// <param name="timestamp">A <see cref="DateTimeOffset"/> value containing the timestamp for this entity.</param> /// <param name="etag">A string containing the ETag for the entity.</param> /// <param name="properties">An <see cref="IDictionary{TKey,TValue}"/> object containing the entity's properties, indexed by property name.</param> internal DynamicTableEntity(string partitionKey, string rowKey, DateTimeOffset timestamp, string etag, IDictionary<string, EntityProperty> properties) { CommonUtility.AssertNotNull("partitionKey", partitionKey); CommonUtility.AssertNotNull("rowKey", rowKey); CommonUtility.AssertNotNull("properties", properties); // Store the information about this entity. Make a copy of // the properties list, in case the caller decides to reuse // the list. this.PartitionKey = partitionKey; this.RowKey = rowKey; this.Timestamp = timestamp; this.ETag = etag; this.Properties = properties; } /// <summary> /// Gets or sets the properties in the table entity, indexed by property name. /// </summary> /// <value>An <see cref="IDictionary{TKey,TValue}"/> object containing the entity's properties.</value> public IDictionary<string, EntityProperty> Properties { get; set; } /// <summary> /// Gets or sets the entity's partition key. /// </summary> /// <value>A string containing the partition key value for the entity.</value> public string PartitionKey { get; set; } /// <summary> /// Gets or sets the entity's row key. /// </summary> /// <value>A string containing the row key value for the entity.</value> public string RowKey { get; set; } /// <summary> /// Gets or sets the entity's timestamp. /// </summary> /// <value>A <see cref="DateTimeOffset"/> containing the timestamp for the entity.</value> public DateTimeOffset Timestamp { get; set; } /// <summary> /// Gets or sets the entity's current ETag. /// </summary> /// <value>A string containing the ETag for the entity.</value> /// <remarks>Set this value to '*' to blindly overwrite an entity as part of an update operation.</remarks> public string ETag { get; set; } #if !(WINDOWS_RT || ASPNET_K || PORTABLE) /// <summary> /// Gets or sets the entity's property, given the name of the property. /// </summary> /// <param name="key">A string containing the name of the property.</param> /// <returns>An <see cref="EntityProperty"/> object.</returns> public EntityProperty this[string key] { get { return this.Properties[key]; } set { this.Properties[key] = value; } } #endif /// <summary> /// Deserializes this <see cref="DynamicTableEntity"/> instance using the specified <see cref="IDictionary{TKey,TValue}"/> of property names to values of type <see cref="EntityProperty"/>. /// </summary> /// <param name="properties">A collection containing the <see cref="IDictionary{TKey,TValue}"/> of string property names mapped to values of type <see cref="EntityProperty"/> to store in this <see cref="DynamicTableEntity"/> instance.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> public void ReadEntity(IDictionary<string, EntityProperty> properties, OperationContext operationContext) { this.Properties = properties; } /// <summary> /// Serializes the <see cref="IDictionary{TKey,TValue}"/> of property names mapped to values of type <see cref="EntityProperty"/> from this <see cref="DynamicTableEntity"/> instance. /// </summary> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>An <see cref="IDictionary{TKey,TValue}"/> object containing the map of string property names to values of type <see cref="EntityProperty"/> stored in this <see cref="DynamicTableEntity"/> instance.</returns> public IDictionary<string, EntityProperty> WriteEntity(OperationContext operationContext) { return this.Properties; } } }
{ "content_hash": "e1a913be9fe329cc1edccbdaa4678a31", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 250, "avg_line_length": 54.25503355704698, "alnum_prop": 0.6365660564077189, "repo_name": "Costo/azure-storage-net", "id": "87fff35a08cb200273a99e2362f5819a4cdead5f", "size": "8086", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Lib/Common/Table/DynamicTableEntity.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "408" }, { "name": "C#", "bytes": "13863774" } ], "symlink_target": "" }
package com.fwumdesoft.api.io; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; /** * Represents an INI file * @author Ryan Goldstein */ public class INI { /* * INI file format- * [Section] * Key = Value * Key = Value * [Section] * Key = Vale * * Sections may not be repeated * Keys may not be repeated within the same section */ Section[] sections; File file; String sepetator; /** * Creates an INI file reader * @param file The ini file to read * @throws IOException */ public INI(File file) throws IOException { parse(readText(file), "\n"); } /** * Creates an INI file reader * @param file The ini file to read * @param seperator The seperation between each key/value pair * @throws IOException */ public INI(File file, String seperator) throws IOException { parse(readText(file), seperator); } private String readText(File file) throws IOException { //Get a buffered reader for the ini file FileReader read = new FileReader(file); BufferedReader reader = new BufferedReader(read); String line, contents = ""; this.file = file; //Read all file lines while((line = reader.readLine()) != null) contents += line + "\n"; reader.close(); return contents; } private void parse(String contents, String seperator) { contents = contents.replace("]", ""); //Cut the contents into chunk String[] chunks = contents.split("\\["); sections = new Section[chunks.length - 1]; //Turn the chunks into section for(int i = 1; i < sections.length + 1; i++) { sections[i - 1] = new Section(); String title = chunks[i].split("\n")[0]; sections[i - 1].fromChunk(title, chunks[i].substring(title.length()).split(seperator)); } } /** * Gets the keys from a section of the INI file * @param section The section to get keys from * @return An array of keys paired with values * @throws SectionNotFoundException If the section does not exist */ public String[] getKeypairs(String section) throws SectionNotFoundException { String[] keys = getSection(section).keys; String[] values = getSection(section).values; String[] pairs = new String[keys.length]; for(int i = 0; i < pairs.length; i++) pairs[i] = keys[i] + "=" + values[i]; return pairs; } /** * Get an array of all the keys in the INI file * @param section The section to get keys from * @return The array of keys in the INI file */ public String[] getKeys(String section) throws SectionNotFoundException { Section sect = getSection(section); return sect.keys; } /** * Returns the titles of all sections * @return String array of all titles */ public String[] getTitle() { String[] titles = new String[sections.length]; for(int i = 0; i < titles.length; i++) titles[0] = sections[0].title; return titles; } /** * Reads a value from an ini file * @param section The section to look in * @param key The key to look for * @return The value from the key * @throws KeyNotFoundException */ public String getValue(String section, String key) throws SectionNotFoundException, KeyNotFoundException { String[] keys = getKeys(section); String[] values = getSection(section).values; String value; int keyValue = -1; assert keys != null; //Get key index boolean found = false; for(int i = 0; i < keys.length && !found; i++) { if(keys[i].replace("\n", "").equals(key)) { found = true; keyValue = i; } } try { value = values[keyValue]; } catch(ArrayIndexOutOfBoundsException e) { throw new KeyNotFoundException(); } return value; } private Section getSection(String title) throws SectionNotFoundException { Section match = null; try { for(int i = 0; i < sections.length && match == null; i++) if(sections[i].title.equals(title)) match = sections[i]; } catch(NullPointerException e) { throw new SectionNotFoundException(); } return match; } /** * Sets the value of a key in a section * @param section The section to set in * @param key The key to set * @param newValue The value to enter * @throws IOException The exception is from the buffered reader */ public void setValue(String section, String key, String newValue) throws IOException { boolean found = false; for(int i = 0; i < sections.length && !found; i++) { if(sections[i].title.equals(section)) { found = true; sections[i].setValue(key, newValue); } } if(!found) { sections = expand(sections, 1); int newsect = sections.length - 1; sections[newsect] = new Section(); sections[newsect].title = section; sections[newsect].setValue(key, newValue); } BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String fullFile = ""; for(int i = 0; i < sections.length; i++) { fullFile += "[" + sections[i].title + "]\n"; for(int n = 0; n < sections[i].keys.length; n++) fullFile += sections[i].keys[n] + "=" + sections[i].values[n] + "\n"; } writer.write(fullFile); writer.close(); } private Section[] expand(Section[] smaller, int amt) { Section[] expanded = new Section[smaller.length + amt]; for(int i = 0; i < smaller.length; i++) expanded[i] = smaller[i]; return expanded; } public class SectionNotFoundException extends Exception { private static final long serialVersionUID = 8704838582850351303L; } public class KeyNotFoundException extends Exception { private static final long serialVersionUID = 2398151861187672952L; } private class Section { public String title; public String[] keys; public String[] values; public Section() { this.title = null; this.keys = null; this.values = null; } public void fromChunk(String title, String[] keypairs) { this.title = title; this.title = this.title.replace("[", ""); this.title = this.title.replace("]", ""); int equalsIndex, numpairs; numpairs = keypairs.length; keys = new String[numpairs - 1]; values = new String[numpairs - 1]; for(int i = 1; i < keypairs.length; i++) { equalsIndex = keypairs[i].indexOf("="); if(equalsIndex != -1) { keys[i - 1] = keypairs[i].substring(0, equalsIndex).replace("\n", ""); values[i - 1] = keypairs[i].substring(equalsIndex + 1); } } } public void setValue(String key, String newValue) { boolean found = false; for(int i = 0; keys != null && i < keys.length && !found; i++) { if(keys[i].equals(key)) { found = true; values[i] = newValue; } } if(!found) { if(keys == null) { keys = new String[0]; values = new String[0]; } keys = expand(keys, 1); values = expand(values, 1); keys[keys.length - 1] = key; values[values.length - 1] = newValue; } } public String[] expand(String[] smaller, int amt) { String[] expanded = new String[smaller.length + amt]; for(int i = 0; i < smaller.length; i++) expanded[i] = smaller[i]; return expanded; } } }
{ "content_hash": "8862d5f031af3d738168759b12756786", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 107, "avg_line_length": 28.068702290076335, "alnum_prop": 0.6265977699211314, "repo_name": "fwumdesoft/FwumDeAPI", "id": "854d00cb84fce9f4ce78979aebfe0ba8ceaa2371", "size": "7354", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/fwumdesoft/api/io/INI.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "70738" } ], "symlink_target": "" }
using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.Compute.Models { public partial class VirtualMachineScaleSetUpdateNetworkProfile : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(HealthProbe)) { writer.WritePropertyName("healthProbe"); JsonSerializer.Serialize(writer, HealthProbe); } if (Optional.IsCollectionDefined(NetworkInterfaceConfigurations)) { writer.WritePropertyName("networkInterfaceConfigurations"); writer.WriteStartArray(); foreach (var item in NetworkInterfaceConfigurations) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } if (Optional.IsDefined(NetworkApiVersion)) { writer.WritePropertyName("networkApiVersion"); writer.WriteStringValue(NetworkApiVersion.Value.ToString()); } writer.WriteEndObject(); } } }
{ "content_hash": "9dcb1b257d48c996e1fffd4773ffe6a0", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 91, "avg_line_length": 35.23529411764706, "alnum_prop": 0.5876460767946577, "repo_name": "Azure/azure-sdk-for-net", "id": "ab95e203f58e4ccf237100bce429e40914ee3578", "size": "1336", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
/** * Contains the {@link com.hazelcast.ringbuffer.Ringbuffer} implementation classes. */ package com.hazelcast.ringbuffer.impl;
{ "content_hash": "43975157ebc03e6f0ed17df4eeaec8dc", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 83, "avg_line_length": 22.166666666666668, "alnum_prop": 0.7593984962406015, "repo_name": "emre-aydin/hazelcast", "id": "c16b747b47a93aaf1e73cb06cb704f32c3d5e0a1", "size": "758", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/package-info.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1261" }, { "name": "C", "bytes": "353" }, { "name": "Java", "bytes": "39634758" }, { "name": "Shell", "bytes": "29479" } ], "symlink_target": "" }
SYNONYM #### According to Index Fungorum #### Published in null #### Original name Opegrapha streblocarpa Bél. ### Remarks null
{ "content_hash": "35b58d9a68f23ac6aa27a1bce47477bf", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 27, "avg_line_length": 10.076923076923077, "alnum_prop": 0.7099236641221374, "repo_name": "mdoering/backbone", "id": "f96dff47929debc62cfac10774b0df03e4eddc0e", "size": "199", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Lecanoromycetes/Ostropales/Graphidaceae/Graphina/Graphina streblocarpa/ Syn. Leiorreuma streblocarpum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
 using System; using System.Collections.Generic; using System.Collections.Concurrent; using System.Linq; using System.Text; using System.IO; using ExcelDna.Integration; namespace ExcelDna.Utilities { public static partial class XLApp { private static bool _screenupdating = true; private static Lazy<string> _defaultDateFormat = new Lazy<string>(()=>GetDefaultDateFormat()); #region properties public static Workbook[] Workbooks { get { var list = new List<Workbook>(); object o = XlCall.Excel(XlCall.xlfDocuments); object[,] docs = o as object[,]; if (docs != null) for (int i = 0; i < docs.GetLength(1); i++) list.Add(new Workbook((string)docs.GetValue(0, i))); return list.ToArray(); } } public static string DefaultDateFormat { get { return _defaultDateFormat.Value; } } static string GetDefaultDateFormat() { var result = XlCall.Excel(XlCall.xlfGetWorkspace, 37) as object[,]; int i = 16; string date_seperator = (string)result[0, i++]; string time_seperator = (string)result[0, i++]; string year_symbol = (string)result[0, i++]; string month_symbol = (string)result[0, i++]; string day_symbol = (string)result[0, i++]; string hour_symbol = (string)result[0, i++]; string minute_symbol = (string)result[0, i++]; string second_symbol = (string)result[0, i++]; //32 Number indicating the date order //0 = Month-Day-Year //1 = Day-Month-Year //2 = Year-Month-Day double date_order = (double)result[0, 31]; day_symbol = day_symbol + day_symbol; month_symbol = month_symbol + month_symbol; year_symbol = string.Concat(year_symbol, year_symbol, year_symbol, year_symbol); if (date_order == 0) return month_symbol + date_seperator + day_symbol + date_seperator + year_symbol; else if (date_order == 1) return day_symbol + date_seperator + month_symbol + date_seperator + year_symbol; else return year_symbol + date_seperator + month_symbol + date_seperator + day_symbol; } #endregion #region Message bar /// <summary> /// Similar to excel pass an empty string to reset message bar /// </summary> /// <param name="message"></param> public static void MessageBar(string message) { bool display = !string.IsNullOrEmpty(message); XlCall.Excel(XlCall.xlcMessage, display, message); } public static void MessageBar(string message, params object[] obj) { MessageBar(string.Format(message,obj)); } #endregion #region calculation public static bool ScreenUpdating { set { XlCall.Excel(XlCall.xlcEcho, value); _screenupdating = value; } get { //return (bool)XlCall.Excel(XlCall.xlfGetWorkspace, 40);; return _screenupdating; } } public static xlCalculation Calcuation { get { var result = XlCall.Excel(XlCall.xlfGetDocument, 14); return (xlCalculation)(int)(double)result; } set { //get all calculation settings for the function call OPTIONS.CALCULATION object[,] result = XlCall.Excel(XlCall.xlfGetDocument, new object[,]{{14,15,16,17,18,19,20,33,43}}) as object[,]; object[] pars = result.ToVector<object>(); pars[0]=(int)value; var retval = XlCall.Excel(XlCall.xlcOptionsCalculation, pars); } } public static void CalculateNow() { XlCall.Excel(XlCall.xlcCalculateNow); } public static void CalculateDocument() { XlCall.Excel(XlCall.xlcCalculateDocument); } #endregion #region wrapping actions /// <summary> /// Wrapper for macro functions that need a selection; remembers old selection /// </summary> /// <param name="range"></param> /// <param name="action"></param> public static void ActionOnSelectedRange(this ExcelReference range, Action action) { bool updating = ScreenUpdating; try { if (updating) ScreenUpdating = false; //remember the current active cell object oldSelectionOnActiveSheet = XlCall.Excel(XlCall.xlfSelection); //select caller range AND workbook string rangeSheet = (string)XlCall.Excel(XlCall.xlSheetNm, range); XlCall.Excel(XlCall.xlcWorkbookSelect, new object[] { rangeSheet }); XlCall.Excel(XlCall.xlcSelect, range); action.Invoke(); //go back to old selection XlCall.Excel(XlCall.xlcFormulaGoto, oldSelectionOnActiveSheet); } finally { if (updating) XLApp.ScreenUpdating = true; } } public static void ReturnToSelection(Action action) { bool updating = ScreenUpdating; try { if (updating) ScreenUpdating = false; //remember the current active cell object oldSelectionOnActiveSheet = XlCall.Excel(XlCall.xlfSelection); action.Invoke(); //go back to old selection XlCall.Excel(XlCall.xlcFormulaGoto, oldSelectionOnActiveSheet); } finally { if (updating) XLApp.ScreenUpdating = true; } } public static void NoCalcAndUpdating(this Action action) { xlCalculation calcMode = Calcuation; bool updating = ScreenUpdating; try { if (updating) ScreenUpdating = false; if (calcMode != xlCalculation.Manual) Calcuation = xlCalculation.Manual; action.Invoke(); } finally { if (updating) XLApp.ScreenUpdating = true; if (calcMode != xlCalculation.Manual) XLApp.Calcuation = calcMode; } } #endregion #region copy paste public static void PasteSpecial(xlPasteType type = xlPasteType.PasteAll, xlPasteAction action = xlPasteAction.None, bool skip_blanks = false, bool transpose=false) { XlCall.Excel( XlCall.xlcPasteSpecial,(int)type,(int)action,skip_blanks,transpose); } public static void Copy() { XlCall.Excel(XlCall.xlcCopy, Type.Missing, Type.Missing); } #endregion public static void SelectRange(string rangeRef) { XlCall.Excel(XlCall.xlcSelect, rangeRef, Type.Missing); } } }
{ "content_hash": "e8cf8c8dc9371fea8e95eab79ad49e3b", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 171, "avg_line_length": 30.571428571428573, "alnum_prop": 0.5324432576769025, "repo_name": "smartquant/ExcelDna.Utilities", "id": "fd31c874e2312948ccb1454a374cc4005cfb7822", "size": "8577", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ExcelDna.Utilities/XLApp.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "86223" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using beRemote.Core.Definitions.Classes; using beRemote.Core.StorageSystem.StorageBase; using beRemote.GUI.Controls.Classes; using beRemote.Core; namespace beRemote.GUI.Controls { /// <summary> /// Interaction logic for ConnectionComboBox.xaml /// </summary> public partial class ConnectionComboBox : UserControl { #region Public EventHandler public event RoutedEventHandler SelectedValueChanged; //When the Value chagned public event RoutedEventHandler MenuExpanded; //When the menu is shown public event RoutedEventHandler MenuContract; //When the menu is hidden #endregion private bool _ShowHosts = false; //Should Hosts be shown? private bool _ShowProtocols = false; //Should Protocols be shown? private bool _MenuIsVisible = false; //Is the menu currently visible? private ImagedConnectionTreeViewItem _SelectedValue; //Contains the currently selected value private bool _DontHide = false; //Don't Hide the Dropdown, when the Mouse is over it private bool _AllowFolderSelection = true; //Is a folder a valid selection? private bool _AllowHostSelection = true; //Is a Host a valid selection? private bool _AllowProtocolSelection = true; //Is a Protocol a valid selection? private bool _HasValidSelection = false; //is the selection valid? private Brush _InvalidBackgroundColor = Brushes.Red; //The Backgroundcolor for btnCmb if selected value is invalid private Brush btnCmdDefaultBackground; //The Backgroundcolor for btnCmb if selected value is valid; is setted on loading private bool _HidePublicFolder = false; //Hide public folders? private int _MaxHeight = 200; //The maximum height of the popup public ConnectionComboBox() { InitializeComponent(); btnCmdDefaultBackground = btnCmb.Background; } private bool selectValue(ImagedConnectionTreeViewDatatype datatype, long id, ImagedConnectionTreeViewItem parent) { if (parent.Datatype == datatype && parent.ID == id) { parent.IsSelected = true; ValidateValue(parent); return (true); } bool valueChanged = false; foreach (ImagedConnectionTreeViewItem anItem in parent.Items) { valueChanged = selectValue(datatype, id, anItem); if (valueChanged == true) return (true); } return (valueChanged); } #region Properties /// <summary> /// Get/Set the currently selected value /// </summary> public ImagedConnectionTreeViewItem SelectedValue { get { return (_SelectedValue); } set { _SelectedValue = value; if (value == null) { //btnCmb.Content = ""; lblText.Content = ""; return; } string buttonContent = ""; switch (value.Datatype) { case ImagedConnectionTreeViewDatatype.Folder: Folder curFolder = StorageCore.Core.GetFolder(value.ID); if (curFolder != null) buttonContent = curFolder.getName(); break; case ImagedConnectionTreeViewDatatype.ConnectionHost: ConnectionHost conHost = StorageCore.Core.GetConnection(value.ID); if (conHost != null) buttonContent = conHost.Name; break; default: buttonContent = "Unable to get Name"; break; } lblText.Content = buttonContent; imgIcon.Source = value.Icon; //Check if the selected Value is a valid Datatype of selection if (tvTreeView.Items != null && tvTreeView.Items.Count > 0) { var theValue = value; //Set the new Value for Query bool valueChanged = false; foreach (ImagedConnectionTreeViewItem anItem in tvTreeView.Items) { valueChanged = selectValue(theValue.Datatype, theValue.ID, anItem); if (valueChanged) break; } } //Trigger the Event if (SelectedValueChanged != null) SelectedValueChanged(this, new RoutedEventArgs()); } } /// <summary> /// Should Hosts be shown? /// </summary> public bool ShowHosts { get { return (_ShowHosts); } set { _ShowHosts = value; } } /// <summary> /// Should Protocols be shown? /// </summary> public bool ShowProtocols { get { return (_ShowProtocols); } set { _ShowProtocols = value; } } /// <summary> /// Is a Folder a valid selection? /// </summary> public bool AllowFolderSelection { get { return (_AllowFolderSelection); } set { _AllowFolderSelection = value; } } /// <summary> /// Is a host a valid selection? /// </summary> public bool AllowHostSelection { get { return (_AllowHostSelection); } set { _AllowHostSelection = value; } } /// <summary> /// Is a selected Protocol a valid selection? Maybe you should set ShowProtocols to false, if not?! /// </summary> public bool AllowProtocolSelection { get { return (_AllowProtocolSelection); } set { _AllowProtocolSelection = value; } } /// <summary> /// Get if the selected Value is Allowed /// </summary> public bool HasValidSelection { get { return (_HasValidSelection); } } /// <summary> /// Defines the Backgroundcolor, if the selected Value is not allowed /// </summary> public Brush InvalidBackgroundColor { get { return (_InvalidBackgroundColor); } set { _InvalidBackgroundColor = value; } } /// <summary> /// Should public folders be hidden? /// </summary> public bool HidePublicFolder { get { return (_HidePublicFolder); } set { _HidePublicFolder = value; } } /// <summary> /// The maximum height of the Popup; default = 200; /// </summary> public int MaximumHeight { get { return (_MaxHeight); } set { _MaxHeight = value; } } #endregion private void button1_Click(object sender, RoutedEventArgs e) { //Configure Popup and load TreeView popUp.Placement = System.Windows.Controls.Primitives.PlacementMode.RelativePoint; popUp.VerticalOffset = btnCmb.Height; popUp.IsOpen = true; popUp.Width = btnCmb.Width; popUp.Height = MaximumHeight; tvTreeView.Items = loadFolderList(); } private List<ImagedConnectionTreeViewItem> loadFolderList() { //Variable to feed the TreeView with Data List<ImagedConnectionTreeViewItem> tvList = new List<ImagedConnectionTreeViewItem>(); //Folders in Root List<Folder> rootFolders = StorageCore.Core.GetSubfolders(0); //Fill the TreeView-Data-Variable foreach (Folder folder in rootFolders) { tvList.Add(getTreeViewFolderItems(folder.getId())); } return(tvList); } /// <summary> /// Get the content of a Folder /// </summary> /// <param name="folderId">id of the folder</param> /// <returns></returns> private ImagedConnectionTreeViewItem getTreeViewFolderItems(long folderId) { ImagedConnectionTreeViewItem ret = new ImagedConnectionTreeViewItem(ImagedConnectionTreeViewDatatype.Folder); ret.Datatype = ImagedConnectionTreeViewDatatype.Folder; //This is a Folder ret.ID = folderId; //The folderID of this folder is the folderId-Parameter //Get this Folderproperties Folder thisFolder = StorageCore.Core.GetFolder(folderId); ret.Header = thisFolder.getName(); //This Displayname of this folder #region Determinate the Rights of this Folder if (thisFolder.getIsPublic() == true) //If the Folder is a Public folder { if (thisFolder.getOwner() == StorageCore.Core.GetUserId()) //Is the User also the owner? { ret.IsPrivate = ImagedConnectionTreeViewRight.PublicAndOwner; } else //User is not the owner { ret.IsPrivate = ImagedConnectionTreeViewRight.Public; } } else { ret.IsPrivate = ImagedConnectionTreeViewRight.Private; } #endregion //Get Subfolders and its childs and add them to the subitems List<Folder> subFolders = StorageCore.Core.GetSubfolders(folderId); foreach (Folder folder in subFolders) { ret.Items.Add(getTreeViewFolderItems(folder.getId())); } if (_ShowHosts == true) { //Get Connections and its childs and add them to the subitems List<ConnectionHost> subHosts = StorageCore.Core.GetConnectionsInFolder(folderId); foreach (ConnectionHost conn in subHosts) { ret.Items.Add(getTreeViewConnectionItems(conn.ID)); } } return (ret); } /// <summary> /// Get the Content of a Connection /// </summary> /// <param name="connectionId">ID of the connection</param> /// <returns></returns> private ImagedConnectionTreeViewItem getTreeViewConnectionItems(long connectionId) { ImagedConnectionTreeViewItem ret = new ImagedConnectionTreeViewItem(ImagedConnectionTreeViewDatatype.ConnectionHost); ret.Datatype = ImagedConnectionTreeViewDatatype.ConnectionHost; //This is a ConnectionHost ret.ID = connectionId; //The connectionId of this folder is the connectionId-Parameter //Get this Connection ConnectionHost thisConn = StorageCore.Core.GetConnection(connectionId); ret.Header = thisConn.Name; //This Displayname of this folder #region Determinate the Rights of this Connection if (thisConn.IsPublic == true && HidePublicFolder == false) //If the Connections is public and public connections are shown { if (thisConn.Owner == StorageCore.Core.GetUserId()) //Is the User also the owner? { ret.IsPrivate = ImagedConnectionTreeViewRight.PublicAndOwner; } else //User is not the owner { ret.IsPrivate = ImagedConnectionTreeViewRight.Public; } } else { ret.IsPrivate = ImagedConnectionTreeViewRight.Private; } #endregion #region Get containing Protocols List<ConnectionProtocol> protocols = StorageCore.Core.GetConnectionSettings(connectionId); if (_ShowProtocols == true) { foreach (ConnectionProtocol prot in protocols) { if (Kernel.GetAvailableProtocols().ContainsKey(prot.Protocol)) { ImagedConnectionTreeViewItem newProt = new ImagedConnectionTreeViewItem(ImagedConnectionTreeViewDatatype.ConnectionProtocol); //Get the Icon From Protocol newProt.Icon = Kernel.GetAvailableProtocols()[prot.Protocol].GetProtocolIcon(Core.ProtocolSystem.ProtocolBase.Declaration.IconType.SMALL); newProt.Datatype = ImagedConnectionTreeViewDatatype.ConnectionProtocol; newProt.ID = prot.Id; //Get the Displayname from Protocol newProt.Header = Kernel.GetAvailableProtocols()[prot.Protocol].GetProtocolName(); ret.Items.Add(newProt); } else { } } } #endregion #region Set Icon of the protocol used by this connection User userSettings = StorageCore.Core.GetUserSettings(); bool foundDefaultProtocol = false; //Determinate the default Connection that is used at a doubleclick and set the icon foreach (ConnectionProtocol prot in protocols) { if (prot.Protocol == userSettings.DefaultProtocol) { ret.Icon = Kernel.GetAvailableProtocols()[prot.Protocol].GetProtocolIcon(Core.ProtocolSystem.ProtocolBase.Declaration.IconType.SMALL); foundDefaultProtocol = true; break; } } if (foundDefaultProtocol == false) { if (protocols.Count > 0 && Kernel.GetAvailableProtocols().ContainsKey(protocols[0].Protocol)) ret.Icon = Kernel.GetAvailableProtocols()[protocols[0].Protocol].GetProtocolIcon(Core.ProtocolSystem.ProtocolBase.Declaration.IconType.SMALL); else ret.Icon = new BitmapImage(new Uri("pack://application:,,,/beRemote.GUI;component/Images/screen16.png")); } #endregion return (ret); } #region Public Events /// <summary> /// Receive SelectedValueChanged Event from ImagedConnectionTreeView /// Redirect it to the own SelectedValueChanged-Event to forward the Event to the hosting control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ictv_SelectedValueChanged (object sender, RoutedEventArgs e) { ValidateValue(((ImagedConnectionTreeView)sender).SelectedValue); this.SelectedValue = ((ImagedConnectionTreeView)sender).SelectedValue; } /// <summary> /// Checks, if a value is valid and Sets the IsValidSelection-Value /// </summary> /// <param name="valiValue"></param> public void ValidateValue(ImagedConnectionTreeViewItem valiValue) { //Check, if the selected Value is an Allowed selection switch (valiValue.Datatype) { case ImagedConnectionTreeViewDatatype.Folder: if (_AllowFolderSelection == true) _HasValidSelection = true; else _HasValidSelection = false; break; case ImagedConnectionTreeViewDatatype.ConnectionHost: if (_AllowHostSelection == true) _HasValidSelection = true; else _HasValidSelection = false; break; case ImagedConnectionTreeViewDatatype.ConnectionProtocol: if (_AllowProtocolSelection == true) _HasValidSelection = true; else _HasValidSelection = false; break; } //If it is not allowed, Turn the Backcolor to alternative Color if (_HasValidSelection == false) { btnCmb.Background = _InvalidBackgroundColor; } else { if (btnCmdDefaultBackground != null) //Should never be null, but just to be sure btnCmb.Background = btnCmdDefaultBackground; } } #endregion private void UserControl_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { imgArrow.Visibility = (this.IsEnabled == true ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden); } private void UserControl_Loaded(object sender, RoutedEventArgs e) { this.SelectedValue = _SelectedValue; if (_SelectedValue != null) ValidateValue(_SelectedValue); } } }
{ "content_hash": "661d98f537b954ec562f3a832c5adb1b", "timestamp": "", "source": "github", "line_count": 456, "max_line_length": 162, "avg_line_length": 38.62719298245614, "alnum_prop": 0.5563756103099807, "repo_name": "Hunv/beRemote", "id": "453a75345802c68d4d80e0cf1eabcd4f0bc5d67e", "size": "17616", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "GUI/beRemote.GUI.Controls/Controls/ConnectionComboBox.xaml.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "961" }, { "name": "Batchfile", "bytes": "886" }, { "name": "C#", "bytes": "4891084" } ], "symlink_target": "" }
(function(window, document, undefined) { "use strict"; var msgbox = {}; var _slice = [].slice; var _processOptions = function() { var opts = _slice.apply(arguments, [0, 3]); if (typeof opts[0] === 'string') { var argu = { msg: opts[0] }; if (typeof opts[1] === 'function') argu.ok = opts[1]; if (typeof opts[2] === 'function') argu.cancel = opts[2]; return argu; } else { return opts[0]; } }; var dialog = Alertify.dialog; var notify = Alertify.log; var _makeHandler = function(context, func) { var handler = function() {}; if (typeof func == 'function') { //check the number of parameter of func, if it's 0, use simple handler; if (func.length > 0) { handler = function() { var param = _slice.apply(arguments, [0]); func.apply(context, param); }; } else { handler = function() { func.apply(context); }; } } return handler; }; msgbox.alert = function() { var opts = _processOptions.apply(null, arguments); var okHandler = _makeHandler(this, opts.ok); dialog.alert(opts.msg, okHandler); }; msgbox.confirm = function() { var opts = _processOptions.apply(null, arguments); var okHandler = _makeHandler(this, opts.ok), cancelHandler = _makeHandler(this, opts.cancel); dialog.confirm(opts.msg, okHandler, cancelHandler); }; msgbox.prompt = function() { var opts = _processOptions.apply(null, arguments); var that = this; var okHandler = _makeHandler(this, opts.ok), cancelHandler = _makeHandler(this, opts.cancel); dialog.prompt(opts.msg, okHandler, cancelHandler); }; msgbox.notify = function(opts) { var options = {}; if (typeof opts === 'string') { options.msg = opts; options.type = _slice.apply(arguments, [1, 2])[0]; } else { options = opts; } var typeList = ['info', 'success', 'error']; if ( !! options.type && typeList.indexOf(options.type) > -1) { notify[options.type](options.msg); } else { notify.info(options.msg); } }; window.msgbox = msgbox; })(window, document);
{ "content_hash": "039d4247bbfb585c48005e98c64c7afd", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 74, "avg_line_length": 26.160493827160494, "alnum_prop": 0.5998112317130722, "repo_name": "caoglish/msgbox", "id": "ab902f638760bb5c34f625b210911dc208b8dff4", "size": "2119", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "js/wrapper/msgbox_alertify.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "158167" }, { "name": "HTML", "bytes": "2217" }, { "name": "JavaScript", "bytes": "71611" } ], "symlink_target": "" }
<div class="project"> <div class="container-fluid"> <nav class="navbar navbar-default navbar-fixed-top mg-navbar mg-navbar-wide"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mg-navbar-target" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <span class="navbar-brand"> <a href="/"><img src="{{ site.baseurl }}public/mg-logo-horizontal.png" width=150/></a><span class="separator"> |</span><span class="subtitle"> {{ page.title }}</span> </span> </div> <div class="collapse navbar-collapse" id="mg-navbar-target"> <ul class="nav navbar-nav navbar-right"> <li><a href="/"><span class="fa fa-home flip"></span></a></li> </ul> </div> </div> </nav> </div> </div>
{ "content_hash": "9380349bb59d858b496f9058c54d7c0e", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 178, "avg_line_length": 42.76, "alnum_prop": 0.5612722170252572, "repo_name": "makergirl/makergirl.github.io", "id": "660cdc0b9ccde81486029a03282b32ce31f9fac5", "size": "1069", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "_includes/project/navbar-project-wide.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "63535" }, { "name": "HTML", "bytes": "129106" }, { "name": "JavaScript", "bytes": "45107" }, { "name": "Python", "bytes": "5725" } ], "symlink_target": "" }
package org.apache.asterix.external.provider; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.external.input.record.converter.CSVWithRecordConverterFactory; import org.apache.asterix.external.input.record.converter.DCPConverterFactory; import org.apache.asterix.external.input.record.converter.IRecordConverterFactory; import org.apache.asterix.external.util.ExternalDataConstants; @SuppressWarnings("rawtypes") public class RecordConverterFactoryProvider { public static IRecordConverterFactory getConverterFactory(String format, String recordFormat) throws AsterixException { switch (recordFormat) { case ExternalDataConstants.FORMAT_ADM: case ExternalDataConstants.FORMAT_JSON: // converter that produces records of adm/json type switch (format) { case ExternalDataConstants.FORMAT_CSV: case ExternalDataConstants.FORMAT_DELIMITED_TEXT: return new CSVWithRecordConverterFactory(); case ExternalDataConstants.FORMAT_DCP: return new DCPConverterFactory(); } } throw new AsterixException("Unknown Converter Factory that can convert from " + format + " to " + recordFormat); } }
{ "content_hash": "0fd899a37e83557db5b49f6d84737a1c", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 120, "avg_line_length": 46.41379310344828, "alnum_prop": 0.700594353640416, "repo_name": "heriram/incubator-asterixdb", "id": "77e634f6c20fd88bf8c9e4df662441fb6ba6935d", "size": "2153", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/RecordConverterFactoryProvider.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8721" }, { "name": "C", "bytes": "421" }, { "name": "CSS", "bytes": "8823" }, { "name": "Crystal", "bytes": "453" }, { "name": "Gnuplot", "bytes": "89" }, { "name": "HTML", "bytes": "127590" }, { "name": "Java", "bytes": "18878313" }, { "name": "JavaScript", "bytes": "274822" }, { "name": "Python", "bytes": "281315" }, { "name": "Ruby", "bytes": "3078" }, { "name": "Scheme", "bytes": "1105" }, { "name": "Shell", "bytes": "204981" }, { "name": "Smarty", "bytes": "31412" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in A. L. P. P. de Candolle & A. C. de Candolle, Monogr. phan. 6:119. 1889 #### Original name null ### Remarks null
{ "content_hash": "8ceb4e5a5f4503c56b0bb997c9e357f3", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 70, "avg_line_length": 15.384615384615385, "alnum_prop": 0.665, "repo_name": "mdoering/backbone", "id": "be5cd898384dfe19a03eae2887d3109361f54e8a", "size": "264", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Saccharum/Saccharum narenga/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
var tungus = require('tungus'); var mongoose = require('mongoose'); module.exports = mongoose.model('Member', {name: String, password: String, status: Number, createdAt:{ type: Date, default: Date.now } , lastLogin:{ type: Date, default: Date.now }});
{ "content_hash": "5cf76f999d01992066eef52d574b32cc", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 134, "avg_line_length": 50.8, "alnum_prop": 0.7007874015748031, "repo_name": "LivaniPillay/Ssnoc-TestLab", "id": "eaa41c8d05c5aed7e841606c2a06d6bf60b42bca", "size": "254", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/memberModel.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11135" }, { "name": "HTML", "bytes": "34362" }, { "name": "JavaScript", "bytes": "67244" } ], "symlink_target": "" }
<?php return [ /* * Set trusted proxy IP addresses. * * Both IPv4 and IPv6 addresses are * supported, along with CIDR notation. * * The "*" character is syntactic sugar * within TrustedProxy to trust any proxy; * a requirement when you cannot know the address * of your proxy (e.g. if using Rackspace balancers). */ 'proxies' => [ '192.168.1.10', ], /* * Or, to trust all proxies, uncomment this: */ # 'proxies' => '*', /* * Default Header Names * * Change these if the proxy does * not send the default header names. * * Note that headers such as X-Forwarded-For * are transformed to HTTP_X_FORWARDED_FOR format. * * The following are Symfony defaults, found in * \Symfony\Component\HttpFoundation\Request::$trustedHeaders */ 'headers' => [ \Illuminate\Http\Request::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', \Illuminate\Http\Request::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', \Illuminate\Http\Request::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', \Illuminate\Http\Request::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', ] ];
{ "content_hash": "b0621308966b5d5584213e5bb0daed70", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 77, "avg_line_length": 28.232558139534884, "alnum_prop": 0.5988467874794069, "repo_name": "HaonanXu/TrustedProxy", "id": "fbf89bfaf9374400676d9110d541857ac71227e4", "size": "1214", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "config/trustedproxy.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "10558" } ], "symlink_target": "" }
package edu.stanford.isis.atb.ui.view.widget.table.column; import javax.swing.JTable; import javax.swing.table.TableColumn; /** * @author Vitaliy Semeshko */ public abstract class GenericColumn<T, C> extends TableColumn { protected ColumnValue<T, C> columnValue; private boolean editable; public GenericColumn(ColumnValue<T, C> value, String caption, int width, boolean editable) { super(-1, width); this.columnValue = value; setHeaderValue(caption); this.editable = editable; } public C getValue(T source) { return columnValue.getValue(source); } public void setValue(T target, Object value) { columnValue.setValue(target, value); } public abstract Class<?> getColumnClass(); /** * Columns can access table after being added to it. * * @param table table that accepts column */ public void registerTableListeners(JTable table) {} public boolean isEditable() { return editable; } /** * Interface that provides ability for the column to get value. * * @author Vitaliy Semeshko */ public interface ColumnValue<T, C> { public C getValue(T source); public void setValue(T source, Object value); } }
{ "content_hash": "05922d333f3451633a900cb704b19662", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 93, "avg_line_length": 19.683333333333334, "alnum_prop": 0.707874682472481, "repo_name": "NCIP/annotation-and-image-markup", "id": "2949c008a3d322de75a9411c34a29f4bea93915f", "size": "1423", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ATB_1.1_src/src/main/java/edu/stanford/isis/atb/ui/view/widget/table/column/GenericColumn.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "31363450" }, { "name": "C#", "bytes": "5152916" }, { "name": "C++", "bytes": "148605530" }, { "name": "CSS", "bytes": "85406" }, { "name": "Java", "bytes": "2039090" }, { "name": "Objective-C", "bytes": "381107" }, { "name": "Perl", "bytes": "502054" }, { "name": "Shell", "bytes": "11832" }, { "name": "Tcl", "bytes": "30867" } ], "symlink_target": "" }
namespace extensions { namespace switches { extern const char kAllowHTTPBackgroundPage[]; extern const char kAllowLegacyExtensionManifests[]; extern const char kEmbeddedExtensionOptions[]; extern const char kEnableAppsShowOnFirstPaint[]; extern const char kEnableAppWindowControls[]; extern const char kEnableDesktopCaptureAudio[]; extern const char kEnableEmbeddedExtensionOptions[]; extern const char kEnableExperimentalExtensionApis[]; extern const char kEnableExtensionActionRedesign[]; extern const char kEnableMojoSerialService[]; extern const char kEnableOverrideBookmarksUI[]; extern const char kEnableBLEAdvertising[]; extern const char kEnableTabForDesktopShare[]; extern const char kErrorConsole[]; extern const char kExtensionActionRedesign[]; extern const char kExtensionProcess[]; extern const char kExtensionsOnChromeURLs[]; extern const char kForceDevModeHighlighting[]; extern const char kIsolateExtensions[]; extern const char kLoadApps[]; extern const char kScriptsRequireAction[]; extern const char kEnableScriptsRequireAction[]; #if defined(CHROMIUM_BUILD) extern const char kPromptForExternalExtensions[]; #endif extern const char kShowComponentExtensionOptions[]; extern const char kTraceAppSource[]; extern const char kWhitelistedExtensionID[]; extern const char kEnableCrxHashCheck[]; } // namespace switches } // namespace extensions #endif // EXTENSIONS_COMMON_SWITCHES_H_
{ "content_hash": "fb24599295e249f56055df2b0282beae", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 53, "avg_line_length": 36.1025641025641, "alnum_prop": 0.8316761363636364, "repo_name": "ds-hwang/chromium-crosswalk", "id": "af2a0f44600e17211fa87cad723e18ae85c06780", "size": "1785", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "extensions/common/switches.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<?php /* @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $installer->startSetup(); /** * Drop foreign keys */ $installer->getConnection()->dropForeignKey( $installer->getTable('checkout/agreement_store'), 'FK_CHECKOUT_AGREEMENT' ); $installer->getConnection()->dropForeignKey( $installer->getTable('checkout/agreement_store'), 'FK_CHECKOUT_AGREEMENT_STORE' ); /** * Drop indexes */ $installer->getConnection()->dropIndex( $installer->getTable('checkout/agreement_store'), 'AGREEMENT_ID' ); $installer->getConnection()->dropIndex( $installer->getTable('checkout/agreement_store'), 'FK_CHECKOUT_AGREEMENT_STORE' ); /* * Change columns */ $tables = array( $installer->getTable('checkout/agreement') => array( 'columns' => array( 'agreement_id' => array( 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, 'identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true, 'comment' => 'Agreement Id' ), 'name' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Name' ), 'content' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => '64K', 'comment' => 'Content' ), 'content_height' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => 25, 'comment' => 'Content Height' ), 'checkbox_text' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => '64K', 'comment' => 'Checkbox Text' ), 'is_active' => array( 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT, 'nullable' => false, 'default' => '0', 'comment' => 'Is Active' ), 'is_html' => array( 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT, 'nullable' => false, 'default' => '0', 'comment' => 'Is Html' ) ), 'comment' => 'Checkout Agreement' ), $installer->getTable('checkout/agreement_store') => array( 'columns' => array( 'agreement_id' => array( 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, 'unsigned' => true, 'nullable' => false, 'primary' => true, 'comment' => 'Agreement Id' ), 'store_id' => array( 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'primary' => true, 'comment' => 'Store Id' ) ), 'comment' => 'Checkout Agreement Store' ) ); $installer->getConnection()->modifyTables($tables); /** * Add indexes */ $installer->getConnection()->addIndex( $installer->getTable('checkout/agreement_store'), 'PRIMARY', array('agreement_id','store_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_PRIMARY ); /** * Add foreign keys */ $installer->getConnection()->addForeignKey( $installer->getFkName('checkout/agreement_store', 'agreement_id', 'checkout/agreement', 'agreement_id'), $installer->getTable('checkout/agreement_store'), 'agreement_id', $installer->getTable('checkout/agreement'), 'agreement_id' ); $installer->getConnection()->addForeignKey( $installer->getFkName('checkout/agreement_store', 'store_id', 'core/store', 'store_id'), $installer->getTable('checkout/agreement_store'), 'store_id', $installer->getTable('core/store'), 'store_id' ); $installer->endSetup();
{ "content_hash": "f1a56ee9a53ecd28a720af53e183f8f2", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 108, "avg_line_length": 28.863309352517987, "alnum_prop": 0.49601196410767695, "repo_name": "5452/durex", "id": "577f3c17d114e50663c13bf2e7718651ae9ae466", "size": "4969", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/code/core/Mage/Checkout/sql/checkout_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ActionScript", "bytes": "19946" }, { "name": "CSS", "bytes": "2190550" }, { "name": "JavaScript", "bytes": "1290492" }, { "name": "PHP", "bytes": "102689019" }, { "name": "Shell", "bytes": "642" }, { "name": "XSLT", "bytes": "2066" } ], "symlink_target": "" }
#include "vr/CCVRDistortionMesh.h" #include <vector> #include "vr/CCVRDistortion.h" #include "math/Vec2.h" #include "platform/CCGL.h" NS_CC_BEGIN DistortionMesh::DistortionMesh(Distortion *distortion, float screenWidth, float screenHeight, float xEyeOffsetScreen, float yEyeOffsetScreen, float textureWidth, float textureHeight, float xEyeOffsetTexture, float yEyeOffsetTexture, float viewportXTexture, float viewportYTexture, float viewportWidthTexture, float viewportHeightTexture, bool vignetteEnabled) : _indices(-1) , _arrayBufferID(-1) , _elementBufferID(-1) { const int rows = 40; const int cols = 40; GLfloat vertexData[rows * cols * 5]; int vertexOffset = 0; const float vignetteSizeTanAngle = 0.05f; const float maxDistance = sqrtf(textureWidth * textureWidth + textureHeight * textureHeight) / 4; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { const float uTexture = col / (cols-1.0f) * (viewportWidthTexture / textureWidth) + viewportXTexture / textureWidth; const float vTexture = row / (rows-1.0f) * (viewportHeightTexture / textureHeight) + viewportYTexture / textureHeight; const float xTexture = uTexture * textureWidth - xEyeOffsetTexture; const float yTexture = vTexture * textureHeight - yEyeOffsetTexture; const float rTexture = sqrtf(xTexture * xTexture + yTexture * yTexture) / maxDistance; const float textureToScreen = (rTexture > 0.0f) ? distortion->distortInverse(rTexture) / rTexture : 1.0f; const float xScreen = xTexture * textureToScreen; const float yScreen = yTexture * textureToScreen; const float uScreen = (xScreen + xEyeOffsetScreen) / screenWidth; const float vScreen = (yScreen + yEyeOffsetScreen) / screenHeight; const float vignetteSizeTexture = vignetteSizeTanAngle / textureToScreen; const float dxTexture = xTexture + xEyeOffsetTexture - clampf(xTexture + xEyeOffsetTexture, viewportXTexture + vignetteSizeTexture, viewportXTexture + viewportWidthTexture - vignetteSizeTexture); const float dyTexture = yTexture + yEyeOffsetTexture - clampf(yTexture + yEyeOffsetTexture, viewportYTexture + vignetteSizeTexture, viewportYTexture + viewportHeightTexture - vignetteSizeTexture); const float drTexture = sqrtf(dxTexture * dxTexture + dyTexture * dyTexture); float vignette = 1.0f; if (vignetteEnabled) vignette = 1.0f - clampf(drTexture / vignetteSizeTexture, 0.0f, 1.0f); // position x,y (vertices) vertexData[(vertexOffset + 0)] = 2.0f * uScreen - 1.0f; vertexData[(vertexOffset + 1)] = 2.0f * vScreen - 1.0f; // texture u,v vertexData[(vertexOffset + 2)] = uTexture; vertexData[(vertexOffset + 3)] = vTexture; // vignete vertexData[(vertexOffset + 4)] = vignette; vertexOffset += 5; } } _indices = (rows-1)*cols*2+rows-2; // GLshort indexData[_indices]; std::vector<GLshort> indexData(_indices); const int indexDataSize = _indices * sizeof(GLshort); int indexOffset = 0; vertexOffset = 0; for (int row = 0; row < rows-1; row++) { if (row > 0) { indexData[indexOffset] = indexData[(indexOffset - 1)]; indexOffset++; } for (int col = 0; col < cols; col++) { if (col > 0) { if (row % 2 == 0) vertexOffset++; else vertexOffset--; } indexData[(indexOffset++)] = vertexOffset; indexData[(indexOffset++)] = (vertexOffset + cols); } vertexOffset += rows; } GLuint bufferIDs[2] = { 0, 0 }; glGenBuffers(2, bufferIDs); _arrayBufferID = bufferIDs[0]; _elementBufferID = bufferIDs[1]; glBindBuffer(GL_ARRAY_BUFFER, _arrayBufferID); glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _elementBufferID); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexDataSize, &indexData[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // GLCheckForError(); } NS_CC_END
{ "content_hash": "75ce7de0bf840ad00bc3c062cc6efb49", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 137, "avg_line_length": 37.9, "alnum_prop": 0.5695149177998782, "repo_name": "Nethertech/Intellectus", "id": "1ff3d6c54c846f287a3ed747bd53a4e2c0255a2a", "size": "6227", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "cocos2d/cocos/vr/CCVRDistortionMesh.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "120" }, { "name": "C", "bytes": "1854423" }, { "name": "C++", "bytes": "14674295" }, { "name": "CMake", "bytes": "245725" }, { "name": "GLSL", "bytes": "61034" }, { "name": "Java", "bytes": "681126" }, { "name": "JavaScript", "bytes": "14719" }, { "name": "Lua", "bytes": "15057" }, { "name": "Makefile", "bytes": "35883" }, { "name": "Objective-C", "bytes": "2964931" }, { "name": "Objective-C++", "bytes": "480466" }, { "name": "Python", "bytes": "54464" }, { "name": "Shell", "bytes": "23775" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <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"> <parent> <artifactId>dashbuilder-shared</artifactId> <groupId>org.dashbuilder</groupId> <version>0.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>dashbuilder-hibernate-validator</artifactId> <packaging>jar</packaging> <name>Dashbuilder Hibernate Validator</name> <description>Hibernate validator 4.1.0.Final integration.</description> <dependencies> <!-- Compile time dependencies --> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>com.googlecode.jtype</groupId> <artifactId>jtype</artifactId> </dependency> <!-- Runtime dependencies --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <!-- Optional dependencies --> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <optional>true</optional> </dependency> </dependencies> <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> <resource> <directory>src/main/xsd</directory> <targetPath>META-INF</targetPath> </resource> </resources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <packageName>org.hibernate.validator.xml</packageName> <outputDirectory>${basedir}/target/generated-sources</outputDirectory> <extension>true</extension> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <includes> <include>com.googlecode.jtype:jtype</include> </includes> </artifactSet> <relocations> <relocation> <pattern>com.googlecode.jtype</pattern> <shadedPattern>org.hibernate.validator.jtype</shadedPattern> </relocation> </relocations> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" /> </transformers> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> <descriptor>${basedir}/src/main/assembly/dist.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>deploy</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
{ "content_hash": "11b81ec4912f3dc06853f763b1b9d613", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 121, "avg_line_length": 29.439393939393938, "alnum_prop": 0.5764282038085435, "repo_name": "psiroky/dashbuilder", "id": "688fb7adff33a4c9d6833eeb483d52a29ce98b23", "size": "3886", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dashbuilder-shared/dashbuilder-hibernate-validator/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "117" }, { "name": "HTML", "bytes": "21397" }, { "name": "Java", "bytes": "4535774" } ], "symlink_target": "" }
package org.apache.spark.internal.io import java.io.IOException import java.util.{Date, UUID} import scala.collection.mutable import scala.util.Try import org.apache.hadoop.conf.Configurable import org.apache.hadoop.fs.Path import org.apache.hadoop.mapreduce._ import org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl import org.apache.spark.internal.Logging import org.apache.spark.mapred.SparkHadoopMapRedUtil /** * An [[FileCommitProtocol]] implementation backed by an underlying Hadoop OutputCommitter * (from the newer mapreduce API, not the old mapred API). * * Unlike Hadoop's OutputCommitter, this implementation is serializable. * * @param jobId the job's or stage's id * @param path the job's output path, or null if committer acts as a noop * @param dynamicPartitionOverwrite If true, Spark will overwrite partition directories at runtime * dynamically. Suppose final path is /path/to/outputPath, output * path of [[FileOutputCommitter]] is an intermediate path, e.g. * /path/to/outputPath/.spark-staging-{jobId}, which is a staging * directory. Task attempts firstly write files under the * intermediate path, e.g. * /path/to/outputPath/.spark-staging-{jobId}/_temporary/ * {appAttemptId}/_temporary/{taskAttemptId}/a=1/b=1/xxx.parquet. * * 1. When [[FileOutputCommitter]] algorithm version set to 1, * we firstly move task attempt output files to * /path/to/outputPath/.spark-staging-{jobId}/_temporary/ * {appAttemptId}/{taskId}/a=1/b=1, * then move them to * /path/to/outputPath/.spark-staging-{jobId}/a=1/b=1. * 2. When [[FileOutputCommitter]] algorithm version set to 2, * committing tasks directly move task attempt output files to * /path/to/outputPath/.spark-staging-{jobId}/a=1/b=1. * * At the end of committing job, we move output files from * intermediate path to final path, e.g., move files from * /path/to/outputPath/.spark-staging-{jobId}/a=1/b=1 * to /path/to/outputPath/a=1/b=1 */ class HadoopMapReduceCommitProtocol( jobId: String, path: String, dynamicPartitionOverwrite: Boolean = false) extends FileCommitProtocol with Serializable with Logging { import FileCommitProtocol._ /** OutputCommitter from Hadoop is not serializable so marking it transient. */ @transient private var committer: OutputCommitter = _ /** * Checks whether there are files to be committed to a valid output location. * * As committing and aborting a job occurs on driver, where `addedAbsPathFiles` is always null, * it is necessary to check whether a valid output path is specified. * [[HadoopMapReduceCommitProtocol#path]] need not be a valid [[org.apache.hadoop.fs.Path]] for * committers not writing to distributed file systems. */ private val hasValidPath = Try { new Path(path) }.isSuccess /** * Tracks files staged by this task for absolute output paths. These outputs are not managed by * the Hadoop OutputCommitter, so we must move these to their final locations on job commit. * * The mapping is from the temp output path to the final desired output path of the file. */ @transient private var addedAbsPathFiles: mutable.Map[String, String] = null /** * Tracks partitions with default path that have new files written into them by this task, * e.g. a=1/b=2. Files under these partitions will be saved into staging directory and moved to * destination directory at the end, if `dynamicPartitionOverwrite` is true. */ @transient private var partitionPaths: mutable.Set[String] = null /** * The staging directory of this write job. Spark uses it to deal with files with absolute output * path, or writing data into partitioned directory with dynamicPartitionOverwrite=true. */ protected def stagingDir = getStagingDir(path, jobId) protected def setupCommitter(context: TaskAttemptContext): OutputCommitter = { val format = context.getOutputFormatClass.getConstructor().newInstance() // If OutputFormat is Configurable, we should set conf to it. format match { case c: Configurable => c.setConf(context.getConfiguration) case _ => () } format.getOutputCommitter(context) } override def newTaskTempFile( taskContext: TaskAttemptContext, dir: Option[String], ext: String): String = { newTaskTempFile(taskContext, dir, FileNameSpec("", ext)) } override def newTaskTempFile( taskContext: TaskAttemptContext, dir: Option[String], spec: FileNameSpec): String = { val filename = getFilename(taskContext, spec) val stagingDir: Path = committer match { // For FileOutputCommitter it has its own staging path called "work path". case f: FileOutputCommitter => if (dynamicPartitionOverwrite) { assert(dir.isDefined, "The dataset to be written must be partitioned when dynamicPartitionOverwrite is true.") partitionPaths += dir.get } new Path(Option(f.getWorkPath).map(_.toString).getOrElse(path)) case _ => new Path(path) } dir.map { d => new Path(new Path(stagingDir, d), filename).toString }.getOrElse { new Path(stagingDir, filename).toString } } override def newTaskTempFileAbsPath( taskContext: TaskAttemptContext, absoluteDir: String, ext: String): String = { newTaskTempFileAbsPath(taskContext, absoluteDir, FileNameSpec("", ext)) } override def newTaskTempFileAbsPath( taskContext: TaskAttemptContext, absoluteDir: String, spec: FileNameSpec): String = { val filename = getFilename(taskContext, spec) val absOutputPath = new Path(absoluteDir, filename).toString // Include a UUID here to prevent file collisions for one task writing to different dirs. // In principle we could include hash(absoluteDir) instead but this is simpler. val tmpOutputPath = new Path(stagingDir, UUID.randomUUID().toString() + "-" + filename).toString addedAbsPathFiles(tmpOutputPath) = absOutputPath tmpOutputPath } protected def getFilename(taskContext: TaskAttemptContext, spec: FileNameSpec): String = { // The file name looks like part-00000-2dd664f9-d2c4-4ffe-878f-c6c70c1fb0cb_00003-c000.parquet // Note that %05d does not truncate the split number, so if we have more than 100000 tasks, // the file name is fine and won't overflow. val split = taskContext.getTaskAttemptID.getTaskID.getId f"${spec.prefix}part-$split%05d-$jobId${spec.suffix}" } override def setupJob(jobContext: JobContext): Unit = { // Setup IDs val jobId = SparkHadoopWriterUtils.createJobID(new Date, 0) val taskId = new TaskID(jobId, TaskType.MAP, 0) val taskAttemptId = new TaskAttemptID(taskId, 0) // Set up the configuration object jobContext.getConfiguration.set("mapreduce.job.id", jobId.toString) jobContext.getConfiguration.set("mapreduce.task.id", taskAttemptId.getTaskID.toString) jobContext.getConfiguration.set("mapreduce.task.attempt.id", taskAttemptId.toString) jobContext.getConfiguration.setBoolean("mapreduce.task.ismap", true) jobContext.getConfiguration.setInt("mapreduce.task.partition", 0) val taskAttemptContext = new TaskAttemptContextImpl(jobContext.getConfiguration, taskAttemptId) committer = setupCommitter(taskAttemptContext) committer.setupJob(jobContext) } override def commitJob(jobContext: JobContext, taskCommits: Seq[TaskCommitMessage]): Unit = { committer.commitJob(jobContext) if (hasValidPath) { val (allAbsPathFiles, allPartitionPaths) = taskCommits.map(_.obj.asInstanceOf[(Map[String, String], Set[String])]).unzip val fs = stagingDir.getFileSystem(jobContext.getConfiguration) val filesToMove = allAbsPathFiles.foldLeft(Map[String, String]())(_ ++ _) logDebug(s"Committing files staged for absolute locations $filesToMove") val absParentPaths = filesToMove.values.map(new Path(_).getParent).toSet if (dynamicPartitionOverwrite) { logDebug(s"Clean up absolute partition directories for overwriting: $absParentPaths") absParentPaths.foreach(fs.delete(_, true)) } logDebug(s"Create absolute parent directories: $absParentPaths") absParentPaths.foreach(fs.mkdirs) for ((src, dst) <- filesToMove) { if (!fs.rename(new Path(src), new Path(dst))) { throw new IOException(s"Failed to rename $src to $dst when committing files staged for " + s"absolute locations") } } if (dynamicPartitionOverwrite) { val partitionPaths = allPartitionPaths.foldLeft(Set[String]())(_ ++ _) logDebug(s"Clean up default partition directories for overwriting: $partitionPaths") for (part <- partitionPaths) { val finalPartPath = new Path(path, part) if (!fs.delete(finalPartPath, true) && !fs.exists(finalPartPath.getParent)) { // According to the official hadoop FileSystem API spec, delete op should assume // the destination is no longer present regardless of return value, thus we do not // need to double check if finalPartPath exists before rename. // Also in our case, based on the spec, delete returns false only when finalPartPath // does not exist. When this happens, we need to take action if parent of finalPartPath // also does not exist(e.g. the scenario described on SPARK-23815), because // FileSystem API spec on rename op says the rename dest(finalPartPath) must have // a parent that exists, otherwise we may get unexpected result on the rename. fs.mkdirs(finalPartPath.getParent) } val stagingPartPath = new Path(stagingDir, part) if (!fs.rename(stagingPartPath, finalPartPath)) { throw new IOException(s"Failed to rename $stagingPartPath to $finalPartPath when " + s"committing files staged for overwriting dynamic partitions") } } } fs.delete(stagingDir, true) } } /** * Abort the job; log and ignore any IO exception thrown. * This is invariably invoked in an exception handler; raising * an exception here will lose the root cause of the failure. * * @param jobContext job context */ override def abortJob(jobContext: JobContext): Unit = { try { committer.abortJob(jobContext, JobStatus.State.FAILED) } catch { case e: IOException => logWarning(s"Exception while aborting ${jobContext.getJobID}", e) } try { if (hasValidPath) { val fs = stagingDir.getFileSystem(jobContext.getConfiguration) fs.delete(stagingDir, true) } } catch { case e: IOException => logWarning(s"Exception while aborting ${jobContext.getJobID}", e) } } override def setupTask(taskContext: TaskAttemptContext): Unit = { committer = setupCommitter(taskContext) committer.setupTask(taskContext) addedAbsPathFiles = mutable.Map[String, String]() partitionPaths = mutable.Set[String]() } override def commitTask(taskContext: TaskAttemptContext): TaskCommitMessage = { val attemptId = taskContext.getTaskAttemptID logTrace(s"Commit task ${attemptId}") SparkHadoopMapRedUtil.commitTask( committer, taskContext, attemptId.getJobID.getId, attemptId.getTaskID.getId) new TaskCommitMessage(addedAbsPathFiles.toMap -> partitionPaths.toSet) } /** * Abort the task; log and ignore any failure thrown. * This is invariably invoked in an exception handler; raising * an exception here will lose the root cause of the failure. * * @param taskContext context */ override def abortTask(taskContext: TaskAttemptContext): Unit = { try { committer.abortTask(taskContext) } catch { case e: IOException => logWarning(s"Exception while aborting ${taskContext.getTaskAttemptID}", e) } // best effort cleanup of other staged files try { for ((src, _) <- addedAbsPathFiles) { val tmp = new Path(src) tmp.getFileSystem(taskContext.getConfiguration).delete(tmp, false) } } catch { case e: IOException => logWarning(s"Exception while aborting ${taskContext.getTaskAttemptID}", e) } } }
{ "content_hash": "f9bdb5a4f18e1f8d006628613fc77e94", "timestamp": "", "source": "github", "line_count": 293, "max_line_length": 100, "avg_line_length": 44.28327645051195, "alnum_prop": 0.6733718689788054, "repo_name": "taroplus/spark", "id": "a39e9abd9bdc473aa11f5cc5a7aeb52e7c1fb133", "size": "13775", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "core/src/main/scala/org/apache/spark/internal/io/HadoopMapReduceCommitProtocol.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "33999" }, { "name": "Batchfile", "bytes": "25265" }, { "name": "C", "bytes": "1493" }, { "name": "CSS", "bytes": "23957" }, { "name": "HTML", "bytes": "10056" }, { "name": "Java", "bytes": "3112223" }, { "name": "JavaScript", "bytes": "141001" }, { "name": "Makefile", "bytes": "7774" }, { "name": "PLpgSQL", "bytes": "8788" }, { "name": "PowerShell", "bytes": "3756" }, { "name": "Python", "bytes": "2372206" }, { "name": "R", "bytes": "1082574" }, { "name": "Roff", "bytes": "14732" }, { "name": "SQLPL", "bytes": "6233" }, { "name": "Scala", "bytes": "23890203" }, { "name": "Shell", "bytes": "156436" }, { "name": "Thrift", "bytes": "33605" } ], "symlink_target": "" }
#import "PFOAuth1FlowDialog.h" #import <Parse/PFNetworkActivityIndicatorManager.h> @implementation PFOAuth1FlowDialog @synthesize dataSource = _dataSource; @synthesize completion = _completion; @synthesize queryParameters = _queryParameters; @synthesize redirectURLPrefix = _redirectURLPrefix; static NSString *const PFOAuth1FlowDialogDefaultTitle = @"Connect to Service"; static const CGFloat PFOAuth1FlowDialogBorderGreyColorComponents[4] = {0.3f, 0.3f, 0.3f, 0.8f}; static const CGFloat PFOAuth1FlowDialogBorderBlackColorComponents[4] = {0.3f, 0.3f, 0.3f, 1.0f}; static const NSTimeInterval PFOAuth1FlowDialogAnimationDuration = 0.3; static const UIEdgeInsets PFOAuth1FlowDialogContentInsets = { .top = 10.0f, .left = 10.0f, .bottom = 10.0f, .right = 10.0f, }; static const UIEdgeInsets PFOAuth1FlowDialogTitleInsets = {.top = 4.0f, .left = 8.0f, .bottom = 4.0f, .right = 8.0f}; static const CGFloat PFOAuth1FlowDialogScreenInset = 10.0f; static BOOL PFOAuth1FlowDialogScreenHasAutomaticRotation() { static BOOL automaticRotation; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ automaticRotation = [[UIScreen mainScreen] respondsToSelector:NSSelectorFromString(@"coordinateSpace")]; }); return automaticRotation; } static BOOL PFOAuth1FlowDialogIsDevicePad() { static BOOL isPad; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ isPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); }); return isPad; } static CGFloat PFTFloatRound(CGFloat value, NSRoundingMode mode) { switch (mode) { case NSRoundPlain: case NSRoundBankers: #if CGFLOAT_IS_DOUBLE value = round(value); #else value = roundf(value); #endif case NSRoundDown: #if CGFLOAT_IS_DOUBLE value = floor(value); #else value = floorf(value); #endif case NSRoundUp: #if CGFLOAT_IS_DOUBLE value = ceil(value); #else value = ceilf(value); #endif default: break; } return value; } #pragma mark - #pragma mark Class + (void)_fillRect:(CGRect)rect withColorComponents:(const CGFloat *)colorComponents radius:(CGFloat)radius { CGContextRef context = UIGraphicsGetCurrentContext(); if (colorComponents) { CGContextSaveGState(context); CGContextSetFillColor(context, colorComponents); if (radius != 0.0f) { UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius]; CGContextAddPath(context, [bezierPath CGPath]); CGContextFillPath(context); } else { CGContextFillRect(context, rect); } CGContextRestoreGState(context); } } + (void)_strokeRect:(CGRect)rect withColorComponents:(const CGFloat *)strokeColor { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); { CGContextSetStrokeColor(context, strokeColor); CGContextSetLineWidth(context, 1.0f); CGContextStrokeRect(context, rect); } CGContextRestoreGState(context); } + (NSURL *)_urlFromBaseURL:(NSURL *)baseURL queryParameters:(NSDictionary *)params { if ([params count] > 0) { NSMutableArray *parameterPairs = [NSMutableArray array]; [params enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { CFStringRef escapedString = CFURLCreateStringByAddingPercentEscapes( NULL, /* allocator */ (CFStringRef)obj, NULL, /* charactersToLeaveUnescaped */ (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8); [parameterPairs addObject:[NSString stringWithFormat:@"%@=%@", key, CFBridgingRelease(escapedString)]]; }]; NSString *query = [parameterPairs componentsJoinedByString:@"&"]; NSString *url = [NSString stringWithFormat:@"%@?%@", [baseURL absoluteString], query]; return [NSURL URLWithString:url]; } return baseURL; } + (UIImage *)_closeButtonImage { CGRect imageRect = CGRectZero; imageRect.size = CGSizeMake(30.0f, 30.0f); UIGraphicsBeginImageContextWithOptions(imageRect.size, NO, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); CGRect outerRingRect = CGRectInset(imageRect, 2.0f, 2.0f); [[UIColor whiteColor] set]; CGContextFillEllipseInRect(context, outerRingRect); CGRect innerRingRect = CGRectInset(outerRingRect, 2.0f, 2.0f); [[UIColor blackColor] set]; CGContextFillEllipseInRect(context, innerRingRect); CGRect crossRect = CGRectInset(innerRingRect, 6.0f, 6.0f); CGContextBeginPath(context); [[UIColor whiteColor] setStroke]; CGContextSetLineWidth(context, 3.0f); CGContextMoveToPoint(context, CGRectGetMinX(crossRect), CGRectGetMinY(crossRect)); CGContextAddLineToPoint(context, CGRectGetMaxX(crossRect), CGRectGetMaxY(crossRect)); CGContextMoveToPoint(context, CGRectGetMaxX(crossRect), CGRectGetMinY(crossRect)); CGContextAddLineToPoint(context, CGRectGetMinX(crossRect), CGRectGetMaxY(crossRect)); CGContextStrokePath(context); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } #pragma mark - #pragma mark Init - (instancetype)init { self = [super initWithFrame:CGRectZero]; if (self) { self.backgroundColor = [UIColor clearColor]; self.autoresizesSubviews = YES; self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.contentMode = UIViewContentModeRedraw; _orientation = UIInterfaceOrientationPortrait; _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; _closeButton.showsTouchWhenHighlighted = YES; _closeButton.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin); [_closeButton setImage:[[self class] _closeButtonImage] forState:UIControlStateNormal]; [_closeButton addTarget:self action:@selector(_cancelButtonAction) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:_closeButton]; CGFloat titleLabelFontSize = (PFOAuth1FlowDialogIsDevicePad() ? 18.0f : 14.0f); _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; _titleLabel.backgroundColor = [UIColor clearColor]; _titleLabel.text = PFOAuth1FlowDialogDefaultTitle; _titleLabel.textColor = [UIColor whiteColor]; _titleLabel.font = [UIFont boldSystemFontOfSize:titleLabelFontSize]; [self addSubview:_titleLabel]; _webView = [[UIWebView alloc] initWithFrame:CGRectZero]; _webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _webView.delegate = self; [self addSubview:_webView]; _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge]; _activityIndicator.color = [UIColor grayColor]; _activityIndicator.autoresizingMask = (UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin); [self addSubview:_activityIndicator]; _modalBackgroundView = [[UIView alloc] init]; } return self; } - (instancetype)initWithURL:(NSURL *)url queryParameters:(NSDictionary *)parameters { self = [self init]; if (self) { _baseURL = url; _queryParameters = [parameters mutableCopy]; } return self; } + (instancetype)dialogWithURL:(NSURL *)url queryParameters:(NSDictionary *)queryParameters { return [[self alloc] initWithURL:url queryParameters:queryParameters]; } #pragma mark - #pragma mark Dealloc - (void)dealloc { _webView.delegate = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; } #pragma mark - #pragma mark UIView - (void)drawRect:(CGRect)rect { [super drawRect:rect]; [[self class] _fillRect:self.bounds withColorComponents:PFOAuth1FlowDialogBorderGreyColorComponents radius:10.0f]; [[self class] _strokeRect:_webView.frame withColorComponents:PFOAuth1FlowDialogBorderBlackColorComponents]; } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; const CGRect contentRect = UIEdgeInsetsInsetRect(bounds, PFOAuth1FlowDialogContentInsets); CGRect titleLabelBoundingRect = UIEdgeInsetsInsetRect(contentRect, PFOAuth1FlowDialogTitleInsets); CGSize titleLabelSize = [_titleLabel sizeThatFits:titleLabelBoundingRect.size]; titleLabelBoundingRect.size.width = (CGRectGetMaxX(contentRect) - PFOAuth1FlowDialogTitleInsets.right - titleLabelSize.height); titleLabelSize = [_titleLabel sizeThatFits:titleLabelBoundingRect.size]; CGRect titleLabelFrame = titleLabelBoundingRect; titleLabelFrame.size.height = titleLabelSize.height; titleLabelFrame.size.width = CGRectGetWidth(titleLabelBoundingRect); _titleLabel.frame = titleLabelFrame; CGRect closeButtonFrame = contentRect; closeButtonFrame.size.height = (CGRectGetHeight(titleLabelFrame) + PFOAuth1FlowDialogTitleInsets.top + PFOAuth1FlowDialogTitleInsets.bottom); closeButtonFrame.size.width = CGRectGetHeight(closeButtonFrame); closeButtonFrame.origin.x = CGRectGetMaxX(contentRect) - CGRectGetWidth(closeButtonFrame); _closeButton.frame = closeButtonFrame; CGRect webViewFrame = contentRect; if (!_showingKeyboard || PFOAuth1FlowDialogIsDevicePad() || UIInterfaceOrientationIsPortrait(_orientation)) { webViewFrame.origin.y = CGRectGetMaxY(titleLabelFrame) + PFOAuth1FlowDialogTitleInsets.bottom; webViewFrame.size.height = CGRectGetMaxY(contentRect) - CGRectGetMinY(webViewFrame); } _webView.frame = webViewFrame; [_activityIndicator sizeToFit]; _activityIndicator.center = _webView.center; } #pragma mark - #pragma mark Accessors - (NSString *)title { return _titleLabel.text; } - (void)setTitle:(NSString *)title { _titleLabel.text = title; [self setNeedsLayout]; } #pragma mark - #pragma mark Present / Dismiss - (void)showAnimated:(BOOL)animated { [self load]; [self _sizeToFitOrientation]; [_activityIndicator startAnimating]; UIWindow *window = [UIApplication sharedApplication].keyWindow; _modalBackgroundView.frame = window.bounds; [_modalBackgroundView addSubview:self]; [window addSubview:_modalBackgroundView]; CGAffineTransform transform = [self _transformForOrientation:_orientation]; if (animated) { self.transform = CGAffineTransformScale(transform, 0.001f, 0.001f); NSTimeInterval animationStepDuration = PFOAuth1FlowDialogAnimationDuration / 2.0f; [UIView animateWithDuration:animationStepDuration animations:^{ self.transform = CGAffineTransformScale(transform, 1.1f, 1.1f); } completion:^(BOOL finished) { [UIView animateWithDuration:animationStepDuration animations:^{ self.transform = CGAffineTransformScale(transform, 0.9f, 0.9f); } completion:^(BOOL finished) { [UIView animateWithDuration:animationStepDuration animations:^{ self.transform = transform; }]; }]; }]; } else { self.transform = transform; } [self _addObservers]; } - (void)dismissAnimated:(BOOL)animated { _loadingURL = nil; __weak typeof(self) wself = self; dispatch_block_t completionBlock = ^{ __strong typeof(wself) sself = wself; [sself _removeObservers]; [sself removeFromSuperview]; [_modalBackgroundView removeFromSuperview]; }; if (animated) { [UIView animateWithDuration:PFOAuth1FlowDialogAnimationDuration animations:^{ typeof(wself) sself = wself; sself.alpha = 0.0f; } completion:^(BOOL finished) { completionBlock(); }]; } else { completionBlock(); } } - (void)_dismissWithSuccess:(BOOL)success url:(NSURL *)url error:(NSError *)error { if (!self.completion) { return; } PFOAuth1FlowDialogCompletion completion = self.completion; self.completion = nil; dispatch_async(dispatch_get_main_queue(), ^{ completion(success, url, error); }); [self dismissAnimated:YES]; } - (void)_cancelButtonAction { [self _dismissWithSuccess:NO url:nil error:nil]; } #pragma mark - #pragma mark Public - (void)load { [self loadURL:_baseURL queryParameters:self.queryParameters]; } - (void)loadURL:(NSURL *)url queryParameters:(NSDictionary *)parameters { _loadingURL = [[self class] _urlFromBaseURL:url queryParameters:parameters]; NSURLRequest *request = [NSURLRequest requestWithURL:_loadingURL]; [_webView loadRequest:request]; } #pragma mark - #pragma mark UIWebViewDelegate - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = request.URL; if ([url.absoluteString hasPrefix:self.redirectURLPrefix]) { [self _dismissWithSuccess:YES url:url error:nil]; return NO; } else if ([_loadingURL isEqual:url]) { return YES; } else if (navigationType == UIWebViewNavigationTypeLinkClicked) { if ([self.dataSource dialog:self shouldOpenURLInExternalBrowser:url]) { [[UIApplication sharedApplication] openURL:url]; } else { return YES; } } return YES; } - (void)webViewDidStartLoad:(UIWebView *)webView { [[PFNetworkActivityIndicatorManager sharedManager] incrementActivityCount]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { [[PFNetworkActivityIndicatorManager sharedManager] decrementActivityCount]; [_activityIndicator stopAnimating]; self.title = [_webView stringByEvaluatingJavaScriptFromString:@"document.title"]; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [[PFNetworkActivityIndicatorManager sharedManager] decrementActivityCount]; // 102 == WebKitErrorFrameLoadInterruptedByPolicyChange if (!([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102)) { [self _dismissWithSuccess:NO url:nil error:error]; } } #pragma mark - #pragma mark Observers - (void)_addObservers { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } - (void)_removeObservers { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; } #pragma mark - #pragma mark UIDeviceOrientationDidChangeNotification - (void)_deviceOrientationDidChange:(NSNotification *)notification { UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if ([self _shouldRotateToOrientation:orientation]) { NSTimeInterval duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; [UIView animateWithDuration:duration animations:^{ [self _sizeToFitOrientation]; }]; } } - (BOOL)_shouldRotateToOrientation:(UIInterfaceOrientation)orientation { if (orientation == _orientation) { return NO; } return (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight || orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown); } - (CGAffineTransform)_transformForOrientation:(UIInterfaceOrientation)orientation { // No manual rotation required on iOS 8 // There is coordinateSpace method, since iOS 8 if (PFOAuth1FlowDialogScreenHasAutomaticRotation()) { return CGAffineTransformIdentity; } switch (orientation) { case UIInterfaceOrientationLandscapeLeft: return CGAffineTransformMakeRotation((CGFloat)(-M_PI / 2.0f)); break; case UIInterfaceOrientationLandscapeRight: return CGAffineTransformMakeRotation((CGFloat)(M_PI / 2.0f)); break; case UIInterfaceOrientationPortraitUpsideDown: return CGAffineTransformMakeRotation((CGFloat)-M_PI); break; case UIInterfaceOrientationPortrait: case UIInterfaceOrientationUnknown: default: break; } return CGAffineTransformIdentity; } - (void)_sizeToFitOrientation { _orientation = [UIApplication sharedApplication].statusBarOrientation; CGAffineTransform transform = [self _transformForOrientation:_orientation]; CGRect bounds = [UIScreen mainScreen].applicationFrame; CGRect transformedBounds = CGRectApplyAffineTransform(bounds, transform); transformedBounds.origin = CGPointZero; CGPoint center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); CGFloat scale = (PFOAuth1FlowDialogIsDevicePad() ? 0.6f : 1.0f); CGFloat width = PFTFloatRound((scale * CGRectGetWidth(transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2.0f, NSRoundDown); CGFloat height = PFTFloatRound((scale * CGRectGetHeight(transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2.0f, NSRoundDown); self.transform = transform; self.center = center; self.bounds = CGRectMake(0.0f, 0.0f, width, height); [self setNeedsLayout]; } #pragma mark - #pragma mark UIKeyboardNotifications - (void)_keyboardWillShow:(NSNotification *)notification { _showingKeyboard = YES; if (PFOAuth1FlowDialogIsDevicePad()) { // On the iPad the screen is large enough that we don't need to // resize the dialog to accomodate the keyboard popping up return; } UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if (UIInterfaceOrientationIsLandscape(orientation)) { NSDictionary *userInfo = [notification userInfo]; NSTimeInterval animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; UIViewAnimationCurve animationCurve = [[notification userInfo][UIKeyboardAnimationCurveUserInfoKey] intValue]; [UIView animateWithDuration:animationDuration delay:0.0 options:animationCurve << 16 | UIViewAnimationOptionBeginFromCurrentState animations:^{ [self setNeedsLayout]; [self layoutIfNeeded]; [self setNeedsDisplay]; } completion:nil]; } } - (void)_keyboardWillHide:(NSNotification *)notification { _showingKeyboard = NO; if (PFOAuth1FlowDialogIsDevicePad()) { return; } UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if (UIInterfaceOrientationIsLandscape(orientation)) { NSDictionary *userInfo = [notification userInfo]; NSTimeInterval animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; UIViewAnimationCurve animationCurve = [[notification userInfo][UIKeyboardAnimationCurveUserInfoKey] intValue]; [UIView animateWithDuration:animationDuration delay:0.0 options:animationCurve << 16 | UIViewAnimationOptionBeginFromCurrentState animations:^{ [self setNeedsLayout]; [self layoutIfNeeded]; [self setNeedsDisplay]; } completion:nil]; } } @end
{ "content_hash": "4e6f58f9cc2da9c1a60b2f30565dc243", "timestamp": "", "source": "github", "line_count": 606, "max_line_length": 133, "avg_line_length": 37.45709570957096, "alnum_prop": 0.6394995374245561, "repo_name": "Himnshu/LoginLib", "id": "47d1d37a24d4b88692773881c64f1c1f83fb8ecd", "size": "23004", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Example/Pods/ParseTwitterUtils/ParseTwitterUtils/Internal/Dialog/PFOAuth1FlowDialog.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3276" }, { "name": "Objective-C", "bytes": "2833198" }, { "name": "Ruby", "bytes": "2267" }, { "name": "Shell", "bytes": "18511" }, { "name": "Swift", "bytes": "167286" } ], "symlink_target": "" }
// Type definitions for sprestlib 1.10.0 // Project: https://gitbrent.github.io/SpRestLib/ // Definitions by: Brent Ely <https://github.com/gitbrent/> // Jandos <https://github.com/Wireliner> // Kelvin Bell <https://github.com/kelvinbell> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 declare namespace sprLib { const version: string; interface optionsOptions { baseUrl?: string; nodeCookie?: string; nodeEnabled?: boolean; nodeServer?: string; queryLimit?: number; } interface IOptions { baseUrl: string; nodeCookie?: string; nodeEnabled?: boolean; nodeServer?: string; queryLimit: number; } function options(): IOptions; function options(options: optionsOptions): IOptions; function baseUrl(): string; function baseUrl(baseUrl: string): void; function nodeConfig(options: object): void; function renewSecurityToken(): void; interface FileCheckInOptions { comment?: string; type?: 'major' | 'minor' | 'overwrite'; } interface FileInfoOptions { version?: number; } interface IFile { checkin(options: FileCheckInOptions): Promise<boolean>; checkout(): Promise<boolean>; delete(): Promise<boolean>; get(): Promise<Blob>; info(options: FileInfoOptions): Promise<object>; perms(): Promise<object[]>; recycle(): Promise<boolean>; } function file(fileName: string): IFile; interface FolderUploadOptions { name: string; data: object; requestDigest?: string; overwrite?: boolean; } interface IFolder { add(folderName: string): Promise<object>; delete(): Promise<boolean>; files(): Promise<object[]>; folders(): Promise<object[]>; info(): Promise<object>; perms(): Promise<object[]>; recycle(): Promise<boolean>; upload(options: FolderUploadOptions): Promise<object>; } function folder(folderName: string): IFolder; /** * SharePoint List/Library API. * * @see \`{@link https://gitbrent.github.io/SpRestLib/docs/api-list.html }\` * @since 1.0 */ interface ListOptions { name?: string; guid?: string; baseUrl?: string; requestDigest?: string; } interface ListItemsOptions { listCols?: Array<string> | object; metadata?: boolean; queryFilter?: string; queryLimit?: number; queryNext?: object; queryOrderBy?: string; } interface IList { cols(): Promise<object[]>; info(): Promise<object>; perms(): Promise<object[]>; items(options: ListItemsOptions): Promise<object[]>; create(options: object): Promise<object[]>; update(options: object): Promise<object[]>; delete(options: object): Promise<number>; recycle(options: object): Promise<number>; } function list(listName: string): IList; function list(listGuid: string): IList; function list(options: ListOptions): IList; interface RestOptions { url: string; type?: 'GET' | 'POST' | 'DELETE'; data?: object; headers?: any; requestDigest?: string; } function rest(options: RestOptions): Promise<object[]>; interface SiteGroupOptions { id: number; } interface IGroup { info(): Promise<object>; create(): Promise<object>; delete(): Promise<boolean>; addUser(): Promise<object>; removeUser(): Promise<boolean>; } interface ISite { group(options: SiteGroupOptions): IGroup; groups(): Promise<object[]>; info(): Promise<object>; lists(): Promise<object[]>; perms(): Promise<object[]>; roles(): Promise<object[]>; subsites(): Promise<object[]>; users(): Promise<object[]>; } function site(siteUrl?: string): ISite; interface UserOptions { baseUrl?: string; id?: string; email?: string; login?: string; title?: string; } interface IUser { info(): Promise<object>; groups(): Promise<object[]>; profile(arrProfileKeys?: object): Promise<object>; } function user(options?: UserOptions): IUser; }
{ "content_hash": "ddd3dff166421043125ad4b1cc5f39bb", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 78, "avg_line_length": 26.56953642384106, "alnum_prop": 0.654037886340977, "repo_name": "gitbrent/SpRestLib", "id": "67df715bd3a6e1878e6dfd1ea90fdb8d74ae825d", "size": "4012", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dist/sprestlib.d.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "31486" }, { "name": "HTML", "bytes": "113094" }, { "name": "JavaScript", "bytes": "121671" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; namespace WpfE.ViewModels { public class DelegateCommand : ICommand { // A method prototype without return value. public Action<object> ExecuteCommand; // A method prototype return a bool type. public Func<object, bool> CanExecuteCommand; public event EventHandler CanExecuteChanged; public bool CanExecute(object parameter) { if (CanExecuteChanged == null) { return true; } return CanExecuteCommand(parameter); } public void Execute(object parameter) { if (CanExecuteCommand == null) { return; } ExecuteCommand(parameter); } public void RaiseCanExecuteChanged() { if (CanExecuteChanged == null) { return; } CanExecuteChanged(this, EventArgs.Empty); } } }
{ "content_hash": "807580e219078203efdfacc832ea4ee6", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 53, "avg_line_length": 22.68, "alnum_prop": 0.5546737213403881, "repo_name": "Ju2ender/CSharp-Exercise", "id": "05954c42eac815d4ba82fc17a296a2351287ce52", "size": "1136", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "x/examples/WpfE/ViewModels/DelegateCommand.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "129122" } ], "symlink_target": "" }
namespace ex = std::experimental::pmr; int constructed = 0; struct default_constructible { default_constructible() : x(42) { ++constructed; } int x{0}; }; int main(int, char**) { // pair<default_constructible, default_constructible> as T() { typedef default_constructible T; typedef std::pair<T, T> P; typedef ex::polymorphic_allocator<void> A; P * ptr = (P*)std::malloc(sizeof(P)); A a; a.construct(ptr); assert(constructed == 2); assert(ptr->first.x == 42); assert(ptr->second.x == 42); std::free(ptr); } return 0; }
{ "content_hash": "fcffd15843a362794a09afdece6eabd1", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 64, "avg_line_length": 22.357142857142858, "alnum_prop": 0.5670926517571885, "repo_name": "llvm-mirror/libcxx", "id": "49cd870c6a46777d9b7f9c617ad26e03b935ea22", "size": "1399", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2035" }, { "name": "C", "bytes": "19789" }, { "name": "C++", "bytes": "25847968" }, { "name": "CMake", "bytes": "147482" }, { "name": "CSS", "bytes": "1237" }, { "name": "HTML", "bytes": "228687" }, { "name": "Objective-C++", "bytes": "2263" }, { "name": "Python", "bytes": "279305" }, { "name": "Shell", "bytes": "21350" } ], "symlink_target": "" }
/** * This package contains the implementation of the replicated map service itself and some connection interfaces only used * internally. */ package com.hazelcast.replicatedmap.impl;
{ "content_hash": "35cd9abfab5cda67db3be6a48ca30f71", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 121, "avg_line_length": 27, "alnum_prop": 0.783068783068783, "repo_name": "emre-aydin/hazelcast", "id": "72aa5c5a26651cfa305af9a4459bdebfbcdb462a", "size": "814", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "hazelcast/src/main/java/com/hazelcast/replicatedmap/impl/package-info.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1261" }, { "name": "C", "bytes": "353" }, { "name": "Java", "bytes": "39634758" }, { "name": "Shell", "bytes": "29479" } ], "symlink_target": "" }
package org.rlcommunity.environments.octopus.odeframework; /** * Runge-Kutta 4th order ODE solver * */ public class RungeKutta4Solver extends ODESolver { @Override public ODEState solve(ODEEquation eq, ODEState initialState, double time, double timeStep) { ODEState k1 = eq.getDeriv(time, initialState); ODEState k2 = eq.getDeriv(time + timeStep/2, initialState.addScaled(k1, timeStep/2)); ODEState k3 = eq.getDeriv(time + timeStep/2, initialState.addScaled(k2, timeStep/2)); ODEState k4 = eq.getDeriv(time + timeStep, initialState.addScaled(k3, timeStep)); ODEState sum = k1.addScaled(k2,2).addScaled(k3,2).addScaled(k4,1); return initialState.addScaled(sum, timeStep/6); } }
{ "content_hash": "9940278ed36d2875fe4ef315d97285c2", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 96, "avg_line_length": 40.10526315789474, "alnum_prop": 0.6876640419947506, "repo_name": "chaostrigger/rl-library", "id": "3f807df91448d184a0d6f936355099de07b6dcd7", "size": "762", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "projects/environments/experimental/octopus/src/org/rlcommunity/environments/octopus/odeframework/RungeKutta4Solver.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "75964" }, { "name": "C++", "bytes": "3154298" }, { "name": "CSS", "bytes": "11927" }, { "name": "HTML", "bytes": "3287272" }, { "name": "Java", "bytes": "1336022" }, { "name": "Makefile", "bytes": "8625" }, { "name": "Matlab", "bytes": "28065" }, { "name": "Python", "bytes": "142408" }, { "name": "Shell", "bytes": "66770" } ], "symlink_target": "" }
// #include "StdAfx.h" #include "LGOCommon.h" #include "LookingGlassOgre.h" #include "AnimTracker.h" #include "Animat.h" #include "AnimatFixedRotation.h" #include "AnimatPosition.h" #include "AnimatRotation.h" namespace LG { AnimTracker* AnimTracker::m_instance = NULL; AnimTracker::AnimTracker() { m_animationsMutex = LGLOCK_ALLOCATE_MUTEX("AnimTracker"); LG::GetOgreRoot()->addFrameListener(this); }; AnimTracker::~AnimTracker() { LG::GetOgreRoot()->removeFrameListener(this); }; // Between frame, update all the animations bool AnimTracker::frameStarted(const Ogre::FrameEvent& evt) { LG::StatIn(LG::InOutAnimTracker); LGLOCK_ALOCK animLock; // a lock that will be released if we have an exception animLock.Lock(m_animationsMutex); std::list<Animat*>::iterator li; for (li = m_animations.begin(); li != m_animations.end(); li++) { try { if (!(*li)->Process(evt.timeSinceLastFrame)) { m_removeAnimations.push_back(*li); } } catch (...) { LG::Log("AnimTracker::frameStarted EXCEPTION calling Process on t=%d, s=%s", (*li)->AnimatType, (*li)->SceneNodeName.c_str()); } } // if any of the animations asked to be removed, remove them now // (done since we can't delete it out of the list while iterating to call Process()) EmptyRemoveAnimationList(); animLock.Unlock(); LG::StatOut(LG::InOutAnimTracker); return true; } // delete animations of a certain type for this scenenode void AnimTracker::RemoveAnimations(Ogre::String sceneNodeName, int typ) { LGLOCK_ALOCK animLock; // a lock that will be released if we have an exception animLock.Lock(m_animationsMutex); std::list<Animat*>::iterator li; for (li = m_animations.begin(); li != m_animations.end(); li++) { if ( !((*li)->SceneNodeName.empty()) ) { if ((typ == AnimatTypeAny) || ((*li)->AnimatType == typ)) { if ((*li)->SceneNodeName == sceneNodeName) { // m_animations.erase(li); m_removeAnimations.push_back(*li); } } } } EmptyRemoveAnimationList(); animLock.Unlock(); } // Delete all animations for this scene node void AnimTracker::RemoveAnimations(Ogre::String sceneNodeName) { RemoveAnimations(sceneNodeName, AnimatTypeAny); } // note: assumes the list is protected by a lock void AnimTracker::EmptyRemoveAnimationList() { std::list<Animat*>::iterator li; for (li = m_removeAnimations.begin(); li != m_removeAnimations.end(); li++) { Animat* anim = *li; m_animations.remove(anim); delete anim; } m_removeAnimations.clear(); } // ======================================================================= // Do a fixed rotation at some rate around some axis void AnimTracker::FixedRotationSceneNode(Ogre::String sceneNodeName, Ogre::Vector3 axis, float rate) { LG::Log("AnimTracker::RotateSceneNode for %s", sceneNodeName.c_str()); LGLOCK_ALOCK animLock; // a lock that will be released if we have an exception // Remove any outstanding animations of this type on this scenenode RemoveAnimations(sceneNodeName, AnimatTypeFixedRotation); animLock.Lock(m_animationsMutex); AnimatFixedRotation* anim = new AnimatFixedRotation(sceneNodeName, axis, rate); m_animations.push_back((Animat*)anim); animLock.Unlock(); } // ======================================================================= void AnimTracker::MoveToPosition(Ogre::String sceneNodeName, Ogre::Vector3 newPos, float duration) { // LG::Log("AnimTracker::MoveToPosition for %s, d=%f", sceneNodeName.c_str(), duration); LGLOCK_ALOCK animLock; // a lock that will be released if we have an exception // Remove any outstanding animations of this type on this scenenode RemoveAnimations(sceneNodeName, AnimatTypePosition); animLock.Lock(m_animationsMutex); AnimatPosition* anim = new AnimatPosition(sceneNodeName, newPos, duration); m_animations.push_back((Animat*)anim); animLock.Unlock(); } // ======================================================================= void AnimTracker::Rotate(Ogre::String sceneNodeName, Ogre::Quaternion newRot, float duration) { // LG::Log("AnimTracker::MoveToPosition for %s, d=%f", sceneNodeName.c_str(), duration); LGLOCK_ALOCK animLock; // a lock that will be released if we have an exception // Remove any outstanding animations of this type on this scenenode RemoveAnimations(sceneNodeName, AnimatTypeRotation); animLock.Lock(m_animationsMutex); AnimatRotation* anim = new AnimatRotation(sceneNodeName, newRot, duration); m_animations.push_back((Animat*)anim); animLock.Unlock(); } }
{ "content_hash": "b438f2d67d56b87354f8e221da20b72a", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 102, "avg_line_length": 36.260162601626014, "alnum_prop": 0.6926008968609866, "repo_name": "Misterblue/LookingGlass-Viewer", "id": "862d4d5142adfde127ead4d53605b508083dc536", "size": "5930", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/LookingGlassOgre/AnimTracker.cpp", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "2087188" }, { "name": "C#", "bytes": "1035483" }, { "name": "C++", "bytes": "15139935" }, { "name": "JavaScript", "bytes": "7396" }, { "name": "Objective-C", "bytes": "6832" }, { "name": "Perl", "bytes": "2099" }, { "name": "Rust", "bytes": "1342" }, { "name": "Shell", "bytes": "15994" } ], "symlink_target": "" }
package org.osgi.service.useradmin; /** * Listener for UserAdminEvents. * * <p> * <code>UserAdminListener</code> objects are registered with the Framework * service registry and notified with a <code>UserAdminEvent</code> object when a * <code>Role</code> object has been created, removed, or modified. * <p> * <code>UserAdminListener</code> objects can further inspect the received * <code>UserAdminEvent</code> object to determine its type, the <code>Role</code> * object it occurred on, and the User Admin service that generated it. * * @see UserAdmin * @see UserAdminEvent * * @version $Revision: 5673 $ */ public interface UserAdminListener { /** * Receives notification that a <code>Role</code> object has been created, * removed, or modified. * * @param event The <code>UserAdminEvent</code> object. */ public void roleChanged(UserAdminEvent event); }
{ "content_hash": "b5b087ec7a52793e97acc0e44e63813a", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 82, "avg_line_length": 31.79310344827586, "alnum_prop": 0.6973969631236443, "repo_name": "boneman1231/org.apache.felix", "id": "2d46f7d0140f45a6a3d19a71980e78043c96afec", "size": "1567", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "trunk/org.osgi.compendium/src/main/java/org/osgi/service/useradmin/UserAdminListener.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1113" }, { "name": "CSS", "bytes": "117591" }, { "name": "Groovy", "bytes": "2059" }, { "name": "HTML", "bytes": "2334581" }, { "name": "Inno Setup", "bytes": "4502" }, { "name": "Java", "bytes": "21825788" }, { "name": "JavaScript", "bytes": "280063" }, { "name": "Perl", "bytes": "6262" }, { "name": "Scala", "bytes": "27038" }, { "name": "Shell", "bytes": "11658" }, { "name": "XSLT", "bytes": "136384" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "3bbf6eb103daa0268452ed4d49865416", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "4743306499bf2e954cf30186a3d32c39201ca5c2", "size": "192", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Thelypteridaceae/Pronephrium/Pronephrium euryphyllum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from questgen.knowledge_base import KnowledgeBase from questgen.facts import Hero, Place, Person, Start, Finish, Choice, Jump, LocatedIn from questgen.states import Option kb = KnowledgeBase() kb += [ Hero(uid='hero'), Place(uid='place_from', label='место отправления'), Person(uid='person_from', label='отправитель'), Place(uid='place_to', label='место назначения'), Place(uid='place_steal', label='место схрона'), Person(uid='person_to', label='получатель'), Start(uid='st_start', require=(LocatedIn('person_from', 'place_from'), LocatedIn('person_to', 'place_to'), LocatedIn('hero', 'place_from'))), Choice(uid='st_steal'), Option(uid='st_steal.steal', choice='st_steal', label='украсть'), Option(uid='st_steal.deliver', choice='st_steal', label='доставить'), Finish(uid='st_finish_delivered', require=(LocatedIn('hero', 'place_to'),)), Finish(uid='st_finish_stealed', require=(LocatedIn('hero', 'place_steal'),)), Jump('st_start', 'st_steal'), Jump('st_steal.deliver', 'st_finish_delivered'), Jump('st_steal.steal', 'st_finish_stealed'), ] # Quest('delivery_quest', globals()) # База знаний делится на уровни # верхни уровень - константные данные о мире общие для всех игроков # средний уровень - данные, специфичные для заданий этого типа # нижний уровень - данные, специфичные для конкретно этого задания # при поиске, информация сначала ищется на нижнем уровне, потом на верхнем # # Выбор не является сюжетной точкой, вместо этого он привязывается к каждому переходу # Состояние же (точка сюжета) устанавливает цели героя (куда придти, что сделать), # которые он должен достигнуть, чтобы перейти в него # при изменении выбора, меняется переход (следовательно конечное состояние) и цели героя # # то же самое и с событиями, при возникновении они меняют переход # # при создании задания, для каждого события (и выбора) сразу решается случается оно или нет, # иными словами они становятся константсными данными, # часть которых (а именно автоматические выборы) может измениться в пользу выбора игрока # # События могут быть альтернативными, в этом случае может случиться только одно событие из группы # но оно случается обязательно, для варианта "ничего не случилось" можно ввести фейковое событие # # Нужны ли вообще переходы? # Условия для автоматического выбора героем (на основе характера) # Влияние выбора на характер (плохой-хороший, честный-лжец) #
{ "content_hash": "ff42d37aa8ef8113f4f8110ca6a81341", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 97, "avg_line_length": 44.67857142857143, "alnum_prop": 0.7138289368505196, "repo_name": "Tiendil/questgen", "id": "4054adc170dc7316c260be9b85a381d9a72e83f0", "size": "3616", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "questgen/examples.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "309268" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "287c332a3e2be3706503837c979c4a1e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "78b5b3b76173d992218c9de0f34ed8bf32fd1c38", "size": "164", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Euphorbiaceae/Buraeavia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
enum E { e }; class C { int f() { int foo, bar; []; // expected-error {{expected body of lambda expression}} [+] {}; // expected-error {{expected variable name or 'this' in lambda capture list}} [foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}} [foo,&this] {}; // expected-error {{'this' cannot be captured by reference}} [&this] {}; // expected-error {{'this' cannot be captured by reference}} [&,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}} [=,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}} [] {}; [=] (int i) {}; [&] (int) mutable -> void {}; [foo,bar] () { return 3; }; [=,&foo] () {}; [&,foo] () {}; [this] () {}; [] () -> class C { return C(); }; [] () -> enum E { return e; }; [] -> int { return 0; }; // expected-error{{lambda requires '()' before return type}} [] mutable -> int { return 0; }; // expected-error{{lambda requires '()' before 'mutable'}} return 1; } void designator_or_lambda() { typedef int T; const int b = 0; const int c = 1; int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from 'C::<lambda}} int a2[1] = {[b] = 1 }; int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}} int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}} int a5[3] = { []{return 0;}() }; int a6[1] = {[this] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'C *'}} } };
{ "content_hash": "249bc530b23bb64397809c126edd95a2", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 145, "avg_line_length": 41.54761904761905, "alnum_prop": 0.5381088825214899, "repo_name": "abduld/clreflect", "id": "45f2ed7513eceaa9972bf99cbe972a267b3197b8", "size": "1819", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "extern/llvm/tools/clang/test/Parser/cxx0x-lambda-expressions.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "694261" }, { "name": "CMake", "bytes": "11725" }, { "name": "Shell", "bytes": "810" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:gravity="center_horizontal" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/em_context_menu_item_bg" android:clickable="true" android:gravity="center_vertical" android:onClick="delete" android:padding="10dp" android:text="@string/delete_message" android:textColor="@android:color/black" android:textSize="20sp" /> <View android:layout_width="match_parent" android:layout_height="1px" android:background="@android:color/darker_gray" /> <TextView android:id="@+id/text_revoke" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/em_context_menu_item_bg" android:clickable="true" android:gravity="center_vertical" android:onClick="revoke" android:padding="10dp" android:text="@string/revoke" android:textColor="@android:color/black" android:textSize="20sp" /> </LinearLayout>
{ "content_hash": "ad39b3afa155e5a085b4617e50312be0", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 72, "avg_line_length": 36.205128205128204, "alnum_prop": 0.6586402266288952, "repo_name": "xadevelop/ChuangKeYuan", "id": "395835eaca1cf70e2ed103f66554d14445655197", "size": "1412", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "build/intermediates/res/merged/debug/layout/em_context_menu_for_location.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "757728" } ], "symlink_target": "" }
require File.expand_path("../test_helper", File.dirname(__FILE__)) require "s7n/secret_generator" module S7n class SecretGeneratorTest < Test::Unit::TestCase def test_s_generate__length (1..1000).each do |length| value = SecretGenerator.generate(length: length) assert_equal(length, value.length) end end def test_s_generate__characters value = SecretGenerator.generate(length: 100, characters: [:upper_alphabet]) assert_equal("", value.delete("A-Z")) value = SecretGenerator.generate(length: 100, characters: [:lower_alphabet]) assert_equal("", value.delete("a-z")) value = SecretGenerator.generate(length: 100, characters: [:number]) assert_equal("", value.delete("0-9")) end end end
{ "content_hash": "1120a07c6ca430b36dc6d47f02172034", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 69, "avg_line_length": 33, "alnum_prop": 0.5757575757575758, "repo_name": "takaokouji/s7n", "id": "280c11cc5c4ddba2d7c56e52488602e3c82b0315", "size": "916", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/s7n/secret_generator_test.rb", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Ruby", "bytes": "96273" } ], "symlink_target": "" }
package dev.adrivankempen.zeeslag; import dev.adrivankempen.zeeslag.input.MouseManager; /**De Handler zorgt ervoor dat alle algemenen variabelen en inputs worden doorgegeven*/ public class Handler { private Game game; private boolean turnP1 = true, turnP2 = false, idle = false; private boolean setupFase = true, attackFase = false; private boolean winP1 = false, winP2 = false; private boolean restart = false; public Handler(Game game) { this.game = game; } public void restart() { turnP1 = true; turnP2 = false; idle = false; setupFase = true; attackFase = false; winP1 = false; winP2 = false; } public MouseManager getMouseManager() { return game.getMouseManager(); } public Game getGame() { return game; } public void setGame(Game game) { this.game = game; } public void resetWin() { winP1 = false; winP2 = false; } public boolean getWinP1() { return winP1; } public boolean getWinP2() { return winP2; } public void winP1() { winP1 = true; } public void winP2() { winP2 = true; } public void switchTurn() { turnP1 = !turnP1; turnP2 = !turnP2; } public boolean getTurnP1() { return turnP1; } public boolean getIdle() { return idle; } public void setIdle(boolean b) { idle = b; } public void switchFase() { if(setupFase) { setupFase = !setupFase; attackFase = !attackFase; } } public void setRestart(boolean b) { restart = b; } public boolean getRestart() { return restart; } public boolean getTurnP2() { return turnP2; } public boolean getSetupFase() { return setupFase; } public boolean getAttackFase() { return attackFase; } }
{ "content_hash": "3201e665d6cf64231bd9da1b112b0a12", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 87, "avg_line_length": 17.339805825242717, "alnum_prop": 0.6276595744680851, "repo_name": "A3vk/BattleshipPWS", "id": "52c9db7785446a0361262ddad77387988a41b67f", "size": "1786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BattleShip/src/dev/adrivankempen/zeeslag/Handler.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "50367" } ], "symlink_target": "" }
(function ($) { var options = { series: { threshold: null } // or { below: number, color: color spec} }; function init(plot) { function thresholdData(plot, s, datapoints, below, color) { var ps = datapoints.pointsize, i, x, y, p, prevp, thresholded = $.extend({}, s); // note: shallow copy thresholded.datapoints = { points: [], pointsize: ps, format: datapoints.format }; thresholded.label = null; thresholded.color = color; thresholded.threshold = null; thresholded.originSeries = s; thresholded.data = []; var origpoints = datapoints.points, addCrossingPoints = s.lines.show; var threspoints = []; var newpoints = []; var m; for (i = 0; i < origpoints.length; i += ps) { x = origpoints[i]; y = origpoints[i + 1]; prevp = p; if (y < below) p = threspoints; else p = newpoints; if (addCrossingPoints && prevp != p && x != null && i > 0 && origpoints[i - ps] != null) { var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]); prevp.push(interx); prevp.push(below); for (m = 2; m < ps; ++m) prevp.push(origpoints[i + m]); p.push(null); // start new segment p.push(null); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); p.push(interx); p.push(below); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); } p.push(x); p.push(y); for (m = 2; m < ps; ++m) p.push(origpoints[i + m]); } datapoints.points = newpoints; thresholded.datapoints.points = threspoints; if (thresholded.datapoints.points.length > 0) { var origIndex = $.inArray(s, plot.getData()); // Insert newly-generated series right after original one (to prevent it from becoming top-most) plot.getData().splice(origIndex + 1, 0, thresholded); } // FIXME: there are probably some edge cases left in bars } function processThresholds(plot, s, datapoints) { if (!s.threshold) return; if (s.threshold instanceof Array) { s.threshold.sort(function(a, b) { return a.below - b.below; }); $(s.threshold).each(function(i, th) { thresholdData(plot, s, datapoints, th.below, th.color); }); } else { thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color); } } plot.hooks.processDatapoints.push(processThresholds); } $.plot.plugins.push({ init: init, options: options, name: 'threshold', version: '1.2' }); })(jQuery);
{ "content_hash": "7edf99e07a483d592ba38fe3176f388f", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 112, "avg_line_length": 34.44, "alnum_prop": 0.43176538908246226, "repo_name": "jbagaresgaray/ENTRANCE-EXAM", "id": "e8bd07de0d408046ce04058927d4ecce76ae9919", "size": "4521", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bower_components/flot/jquery.flot.threshold.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "4052" }, { "name": "CSS", "bytes": "17999" }, { "name": "JavaScript", "bytes": "157972" }, { "name": "PHP", "bytes": "318986" } ], "symlink_target": "" }
// Copyright 2017 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace GoogleCloudExtension.Analytics.Events { internal static class LogsViewerAdvancedFilterEvent { private const string LogsViewerAdvancedFilterEventName = "logsViewerAdvancedFilter"; public static AnalyticsEvent Create() { return new AnalyticsEvent(LogsViewerAdvancedFilterEventName); } } }
{ "content_hash": "ebb7472cbb41ea2ef6f3a64f46fbe050", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 92, "avg_line_length": 37.11538461538461, "alnum_prop": 0.7357512953367875, "repo_name": "ILMTitan/google-cloud-visualstudio", "id": "a41c09d68453ba2ee4956693f71afaed5b1e58f0", "size": "967", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "GoogleCloudExtension/GoogleCloudExtension/Analytics/Events/LogsViewerAdvancedFilterEvent.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "223" }, { "name": "Batchfile", "bytes": "1364" }, { "name": "C#", "bytes": "3193071" }, { "name": "CSS", "bytes": "3846" }, { "name": "HTML", "bytes": "72878" }, { "name": "JavaScript", "bytes": "21870" }, { "name": "PowerShell", "bytes": "6740" }, { "name": "Python", "bytes": "13763" }, { "name": "Shell", "bytes": "4174" } ], "symlink_target": "" }
package org.apache.camel.component.hystrix.springboot; import java.util.HashMap; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.hystrix.processor.HystrixConstants; import org.apache.camel.model.HystrixConfigurationDefinition; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * Hystrix auto configuration. */ @Configuration @ConditionalOnProperty(name = "camel.hystrix.enabled", matchIfMissing = true) @ConditionalOnBean(value = CamelAutoConfiguration.class) @AutoConfigureAfter(value = CamelAutoConfiguration.class) @EnableConfigurationProperties(HystrixConfiguration.class) public class HystrixAutoConfiguration { @Bean(name = HystrixConstants.DEFAULT_HYSTRIX_CONFIGURATION_ID) @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(name = HystrixConstants.DEFAULT_HYSTRIX_CONFIGURATION_ID) HystrixConfigurationDefinition defaultHystrixConfigurationDefinition(CamelContext camelContext, HystrixConfiguration config) throws Exception { Map<String, Object> properties = new HashMap<>(); IntrospectionSupport.getProperties(config, properties, null, false); HystrixConfigurationDefinition definition = new HystrixConfigurationDefinition(); IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), definition, properties); return definition; } }
{ "content_hash": "ed5e74805a2a1063f329c28ab869f240", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 147, "avg_line_length": 46.22727272727273, "alnum_prop": 0.8338249754178958, "repo_name": "allancth/camel", "id": "def622cb6881c97154345ae50202d4fbdbac91a1", "size": "2837", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "platforms/spring-boot/components-starter/camel-hystrix-starter/src/main/java/org/apache/camel/component/hystrix/springboot/HystrixAutoConfiguration.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "106" }, { "name": "CSS", "bytes": "30373" }, { "name": "Elm", "bytes": "10852" }, { "name": "FreeMarker", "bytes": "11410" }, { "name": "Groovy", "bytes": "53560" }, { "name": "HTML", "bytes": "177803" }, { "name": "Java", "bytes": "59025851" }, { "name": "JavaScript", "bytes": "90232" }, { "name": "Protocol Buffer", "bytes": "578" }, { "name": "Python", "bytes": "36" }, { "name": "Ruby", "bytes": "4802" }, { "name": "Scala", "bytes": "323343" }, { "name": "Shell", "bytes": "16236" }, { "name": "Tcl", "bytes": "4974" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "284394" } ], "symlink_target": "" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > The production Assertion :: \b evaluates by returning an internal AssertionTester closure that takes a State argument x and performs the ... es5id: 15.10.2.6_A3_T14 description: > Execute /e\b/.exec("pilot\nsoviet robot\topenoffic\u0065") and check results ---*/ var __executed = /e\b/.exec("pilot\nsoviet robot\topenoffic\u0065"); var __expected = ["e"]; __expected.index = 28; __expected.input = "pilot\nsoviet robot\topenoffice"; //CHECK#1 if (__executed.length !== __expected.length) { $ERROR('#1: __executed = /e\\b/.exec("pilot\\nsoviet robot\\topenoffic\\u0065"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length); } //CHECK#2 if (__executed.index !== __expected.index) { $ERROR('#2: __executed = /e\\b/.exec("pilot\\nsoviet robot\\topenoffic\\u0065"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index); } //CHECK#3 if (__executed.input !== __expected.input) { $ERROR('#3: __executed = /e\\b/.exec("pilot\\nsoviet robot\\topenoffic\\u0065"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input); } //CHECK#4 for(var index=0; index<__expected.length; index++) { if (__executed[index] !== __expected[index]) { $ERROR('#4: __executed = /e\\b/.exec("pilot\\nsoviet robot\\topenoffic\\u0065"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]); } }
{ "content_hash": "ab79ecd2d6e3118763e0b2ff13d85e72", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 171, "avg_line_length": 38.65, "alnum_prop": 0.6384217335058214, "repo_name": "m0ppers/arangodb", "id": "755808062724c9535e467c42c840ea48f130c695", "size": "1546", "binary": false, "copies": "3", "ref": "refs/heads/devel", "path": "3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/RegExp/S15.10.2.6_A3_T14.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ada", "bytes": "89080" }, { "name": "Assembly", "bytes": "397438" }, { "name": "Batchfile", "bytes": "36479" }, { "name": "C", "bytes": "4981599" }, { "name": "C#", "bytes": "96430" }, { "name": "C++", "bytes": "273207213" }, { "name": "CLIPS", "bytes": "5291" }, { "name": "CMake", "bytes": "526333" }, { "name": "CSS", "bytes": "634304" }, { "name": "Cuda", "bytes": "52444" }, { "name": "DIGITAL Command Language", "bytes": "33549" }, { "name": "Emacs Lisp", "bytes": "14357" }, { "name": "Fortran", "bytes": "1856" }, { "name": "Groff", "bytes": "272212" }, { "name": "Groovy", "bytes": "131" }, { "name": "HTML", "bytes": "3470113" }, { "name": "IDL", "bytes": "14" }, { "name": "Java", "bytes": "2325801" }, { "name": "JavaScript", "bytes": "66968092" }, { "name": "LLVM", "bytes": "38070" }, { "name": "Lex", "bytes": "1231" }, { "name": "Lua", "bytes": "16189" }, { "name": "M4", "bytes": "64965" }, { "name": "Makefile", "bytes": "1268118" }, { "name": "Max", "bytes": "36857" }, { "name": "Module Management System", "bytes": "1545" }, { "name": "NSIS", "bytes": "28404" }, { "name": "Objective-C", "bytes": "30435" }, { "name": "Objective-C++", "bytes": "2503" }, { "name": "PHP", "bytes": "39473" }, { "name": "Pascal", "bytes": "145688" }, { "name": "Perl", "bytes": "205308" }, { "name": "Python", "bytes": "6937381" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "R", "bytes": "5123" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "910409" }, { "name": "SAS", "bytes": "1847" }, { "name": "Scheme", "bytes": "10604" }, { "name": "Shell", "bytes": "986221" }, { "name": "Swift", "bytes": "116" }, { "name": "Vim script", "bytes": "4075" }, { "name": "XSLT", "bytes": "473118" }, { "name": "Yacc", "bytes": "72510" } ], "symlink_target": "" }
using System; using System.Threading.Tasks; using ZNS.EliteCompanionAPI; namespace ZNS.EliteCompanionCommand { class Program { static void Main(string[] args) { MainAsync().Wait(); } static async Task MainAsync() { var profileExists = EliteCompanion.Instance.LoadProfile("test@email.com"); if (!profileExists) { EliteCompanion.Instance.CreateProfile("test@email.com", "password"); } var response = await EliteCompanion.Instance.GetProfileData(); var json = ""; if (response.LoginStatus == EliteCompanionAPI.Models.LoginStatus.PendingVerification) { Console.WriteLine("Enter verification code sent as email:"); string code = Console.ReadLine(); var verificationResponse = await EliteCompanion.Instance.SubmitVerification(code); if (verificationResponse.Success) { response = await EliteCompanion.Instance.GetProfileData(); json = response.Json ?? ""; } } Console.Write(response.Json); Console.ReadLine(); } } }
{ "content_hash": "403f8515c89994e14daf469d700c96e4", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 98, "avg_line_length": 33.39473684210526, "alnum_prop": 0.5587076438140268, "repo_name": "ZNS/EliteCompanionAPI", "id": "c0816cfa88139f8af2da68087a3412201f1eaf0b", "size": "1271", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ZNS.EliteCompanionCommand/Program.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "25033" } ], "symlink_target": "" }
import os import subprocess import logging import BotpySE as bp import chatexchange as ce from HalflifeListener import * from DeepSmokeListener import * from CommandUpdate import * from Notifications import Notifications, NotificationsCommandBase from Tagging import * from commands import * class Pulse: def __init__ (self, nick, email, password, rooms): commands = default_commands commands.extend([ CommandUpdate, *NotificationsCommandBase.__subclasses__(), CommandListTags, CommandAddTag, CommandRemoveTag ]) version_hash = self._get_current_hash() self._bot_header = r'\[[PulseMonitor]' \ '(https://github.com/Charcoal-SE/PulseMonitor) ' + \ version_hash + r'\]' bot = bp.Bot(nick, commands, rooms, [], "stackexchange.com", email, password) bot.add_alias("Halflife") try: with open(bot._storage_prefix + 'redunda_key.txt', 'r') as file_handle: key = file_handle.readlines()[0].rstrip('\n') bot.set_redunda_key(key) bot.add_file_to_sync({"name": bot._storage_prefix + 'tags.json', "ispickle": False, "at_home": False}) bot.add_file_to_sync({"name": bot._storage_prefix + 'notifications.json', "ispickle": False, "at_home": False}) bot.redunda_init(bot_version=version_hash) bot.set_redunda_default_callbacks() bot.set_redunda_status(True) except IOError as ioerr: logging.error(str(ioerr)) logging.warn("Bot is not integrated with Redunda.") bot.set_startup_message(self._bot_header + " started on " + bot._location + ".") bot.set_standby_message(self._bot_header + " running on " + bot._location + " shifting to standby.") bot.set_failover_message(self._bot_header + " running on " + bot._location + " received failover.") notifications = Notifications( rooms, bot._storage_prefix + 'notifications.json') tags = TagManager(bot._storage_prefix + 'tags.json') bot._command_manager.notifications = notifications bot._command_manager.tags = tags bot.start() bot.add_privilege_type(1, "owner") bot.set_room_owner_privs_max() roomlist = bot._rooms halflife = HalflifeListener( roomlist[0], roomlist, notifications, bot._command_manager.tags) #deep_smoke = DeepSmokeListener(roomlist[0], roomlist, notifications) halflife.start() #deep_smoke.start() while bot.is_alive: pass halflife.stop() #deep_smoke.stop() def _get_current_hash(self): return subprocess.run(['git', 'log', '-n', '1', '--pretty=format:"%H"'], stdout=subprocess.PIPE).stdout.decode('utf-8')[1:7]
{ "content_hash": "5234cc78e4f5029b36f8667ddd2f1345", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 85, "avg_line_length": 34.23255813953488, "alnum_prop": 0.592391304347826, "repo_name": "Fortunate-MAN/PulseMonitor", "id": "fcee0ac6213fc0b11ec8660d77ed7e7cb0da29ec", "size": "2944", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/Pulse.py", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "567" }, { "name": "Python", "bytes": "11359" }, { "name": "Shell", "bytes": "264" } ], "symlink_target": "" }
package org.ovirt.engine.ui.webadmin.uicommon; import java.util.Arrays; import java.util.List; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.ui.frontend.Message; public abstract class ErrorMessageFormatter { public static String formatMessages(List<Message> values) { StringBuilder msg = new StringBuilder(); for (Message val : values) msg.append(val.getText()); return msg.toString(); } public static String formatMessage(Message value) { return formatMessages(Arrays.asList(value)); } public static String formatReturnValues(List<VdcReturnValueBase> values) { StringBuilder msg = new StringBuilder(); for (VdcReturnValueBase val : values) msg.append(val.getFault().getMessage()); return msg.toString(); } public static String formatQueryReturnValues(List<VdcQueryReturnValue> values) { StringBuilder msg = new StringBuilder(); for (VdcQueryReturnValue val : values) msg.append(val.getExceptionString()); return msg.toString(); } }
{ "content_hash": "59b69ef2a808118239b0b1e56aae7eb0", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 84, "avg_line_length": 27.930232558139537, "alnum_prop": 0.6935886761032473, "repo_name": "anjalshireesh/gluster-ovirt-poc", "id": "3154cf64f47446d5ff99a6640e8cf6df0411b9e2", "size": "1201", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/ErrorMessageFormatter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "4300" }, { "name": "Java", "bytes": "15411501" }, { "name": "JavaScript", "bytes": "28877" }, { "name": "Python", "bytes": "1055301" }, { "name": "Shell", "bytes": "77913" } ], "symlink_target": "" }
""" __IsolHasNoMatchConnected_MDL.py_____________________________________________________ Automatically generated AToM3 Model File (Do not modify directly) Author: gehan Modified: Fri Oct 11 15:11:58 2013 _____________________________________________________________________________________ """ from stickylink import * from widthXfillXdecoration import * from LHS import * from MT_pre__Distributable import * from graph_MT_pre__Distributable import * from graph_LHS import * from ATOM3Enum import * from ATOM3String import * from ATOM3BottomType import * from ATOM3Constraint import * from ATOM3Attribute import * from ATOM3Float import * from ATOM3List import * from ATOM3Link import * from ATOM3Connection import * from ATOM3Boolean import * from ATOM3Appearance import * from ATOM3Text import * from ATOM3Action import * from ATOM3Integer import * from ATOM3Port import * from ATOM3MSEnum import * def IsolHasNoMatchConnected_MDL(self, rootNode, MT_pre__GM2AUTOSAR_MMRootNode=None, MoTifRuleRootNode=None): # --- Generating attributes code for ASG MT_pre__GM2AUTOSAR_MM --- if( MT_pre__GM2AUTOSAR_MMRootNode ): # author MT_pre__GM2AUTOSAR_MMRootNode.author.setValue('Annonymous') # description MT_pre__GM2AUTOSAR_MMRootNode.description.setValue('\n') MT_pre__GM2AUTOSAR_MMRootNode.description.setHeight(15) # name MT_pre__GM2AUTOSAR_MMRootNode.name.setValue('') MT_pre__GM2AUTOSAR_MMRootNode.name.setNone() # --- ASG attributes over --- # --- Generating attributes code for ASG MoTifRule --- if( MoTifRuleRootNode ): # author MoTifRuleRootNode.author.setValue('Annonymous') # description MoTifRuleRootNode.description.setValue('\n') MoTifRuleRootNode.description.setHeight(15) # name MoTifRuleRootNode.name.setValue('IsolHasNoMatchConnected') # --- ASG attributes over --- self.obj1540=LHS(self) self.obj1540.isGraphObjectVisual = True if(hasattr(self.obj1540, '_setHierarchicalLink')): self.obj1540._setHierarchicalLink(False) # constraint self.obj1540.constraint.setValue('if PreNode(\'1\')[\'cardinality\']==\'1\' :\n return True\nreturn False\n') self.obj1540.constraint.setHeight(15) self.obj1540.graphClass_= graph_LHS if self.genGraphics: new_obj = graph_LHS(120.0,60.0,self.obj1540) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("LHS", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.0, 1.0] else: new_obj = None self.obj1540.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj1540) self.globalAndLocalPostcondition(self.obj1540, rootNode) self.obj1540.postAction( rootNode.CREATE ) self.obj1541=MT_pre__Distributable(self) self.obj1541.isGraphObjectVisual = True if(hasattr(self.obj1541, '_setHierarchicalLink')): self.obj1541._setHierarchicalLink(False) # MT_pivotOut__ self.obj1541.MT_pivotOut__.setValue('') self.obj1541.MT_pivotOut__.setNone() # MT_subtypeMatching__ self.obj1541.MT_subtypeMatching__.setValue(('True', 0)) self.obj1541.MT_subtypeMatching__.config = 0 # MT_pre__classtype self.obj1541.MT_pre__classtype.setValue('\n#===============================================================================\n# This code is executed when evaluating if a node shall be matched by this rule.\n# You can access the value of the current node\'s attribute value by: attr_value.\n# You can access any attribute x of this node by: this[\'x\'].\n# If the constraint relies on attribute values from other nodes,\n# use the LHS/NAC constraint instead.\n# The given constraint must evaluate to a boolean expression.\n#===============================================================================\n\nreturn True\n') self.obj1541.MT_pre__classtype.setHeight(15) # MT_pivotIn__ self.obj1541.MT_pivotIn__.setValue('') self.obj1541.MT_pivotIn__.setNone() # MT_label__ self.obj1541.MT_label__.setValue('1') # MT_pre__cardinality self.obj1541.MT_pre__cardinality.setValue('\n#===============================================================================\n# This code is executed when evaluating if a node shall be matched by this rule.\n# You can access the value of the current node\'s attribute value by: attr_value.\n# You can access any attribute x of this node by: this[\'x\'].\n# If the constraint relies on attribute values from other nodes,\n# use the LHS/NAC constraint instead.\n# The given constraint must evaluate to a boolean expression.\n#===============================================================================\n\nreturn True\n') self.obj1541.MT_pre__cardinality.setHeight(15) # MT_pre__name self.obj1541.MT_pre__name.setValue('\n#===============================================================================\n# This code is executed when evaluating if a node shall be matched by this rule.\n# You can access the value of the current node\'s attribute value by: attr_value.\n# You can access any attribute x of this node by: this[\'x\'].\n# If the constraint relies on attribute values from other nodes,\n# use the LHS/NAC constraint instead.\n# The given constraint must evaluate to a boolean expression.\n#===============================================================================\n\nreturn True\n') self.obj1541.MT_pre__name.setHeight(15) self.obj1541.graphClass_= graph_MT_pre__Distributable if self.genGraphics: new_obj = graph_MT_pre__Distributable(180.0,100.0,self.obj1541) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("MT_pre__Distributable", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.0, 1.0] else: new_obj = None self.obj1541.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj1541) self.globalAndLocalPostcondition(self.obj1541, rootNode) self.obj1541.postAction( rootNode.CREATE ) # Connections for obj1540 (graphObject_: Obj2) of type LHS self.drawConnections( ) # Connections for obj1541 (graphObject_: Obj3) of type MT_pre__Distributable self.drawConnections( ) newfunction = IsolHasNoMatchConnected_MDL loadedMMName = ['MT_pre__GM2AUTOSAR_MM_META', 'MoTifRule_META'] atom3version = '0.3'
{ "content_hash": "729a59a3e833800772976236ab5b0351", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 627, "avg_line_length": 44.42857142857143, "alnum_prop": 0.6452304394426581, "repo_name": "levilucio/SyVOLT", "id": "c404038b9499a601700df32d041bca4a65d06911", "size": "6531", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "GM2AUTOSAR_MM/Properties/positive/models/IsolHasNoMatchConnected_MDL.py", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "166159" }, { "name": "Python", "bytes": "34207588" }, { "name": "Shell", "bytes": "1118" } ], "symlink_target": "" }
package syntax type oldStruct struct { n int } // A struct type that is an alias doesn't add new fields. type newStruct oldStruct type oldInterface interface { foo() } // An interface type that is an alias doesn't add new methods. type newInterface oldInterface
{ "content_hash": "15962af23ba34da67665e50872b2d7e7", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 62, "avg_line_length": 17.866666666666667, "alnum_prop": 0.7574626865671642, "repo_name": "kythe/kythe", "id": "c70b4d57576011d509e5c5bca8b168f66d0bc7e3", "size": "414", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "kythe/go/indexer/testdata/syntax.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "4169" }, { "name": "C++", "bytes": "1874842" }, { "name": "Dockerfile", "bytes": "20694" }, { "name": "Go", "bytes": "1876965" }, { "name": "HTML", "bytes": "5148" }, { "name": "Java", "bytes": "844590" }, { "name": "JavaScript", "bytes": "3513" }, { "name": "Lex", "bytes": "5192" }, { "name": "Makefile", "bytes": "222" }, { "name": "OCaml", "bytes": "12652" }, { "name": "Python", "bytes": "10918" }, { "name": "Ruby", "bytes": "2543" }, { "name": "Rust", "bytes": "581728" }, { "name": "SCSS", "bytes": "10113" }, { "name": "Shell", "bytes": "89032" }, { "name": "Starlark", "bytes": "540157" }, { "name": "TeX", "bytes": "2455" }, { "name": "TypeScript", "bytes": "124204" }, { "name": "Yacc", "bytes": "5018" } ], "symlink_target": "" }
require 'spec_helper' require 'ostruct' describe Grape::Entity do let(:fresh_class) { Class.new(Grape::Entity) } context 'class methods' do subject { fresh_class } describe '.expose' do context 'multiple attributes' do it 'is able to add multiple exposed attributes with a single call' do subject.expose :name, :email, :location expect(subject.exposures.size).to eq 3 end it 'sets the same options for all exposures passed' do subject.expose :name, :email, :location, documentation: true subject.exposures.values.each { |v| expect(v).to eq(documentation: true) } end end context 'option validation' do it 'makes sure that :as only works on single attribute calls' do expect { subject.expose :name, :email, as: :foo }.to raise_error ArgumentError expect { subject.expose :name, as: :foo }.not_to raise_error end it 'makes sure that :format_with as a proc cannot be used with a block' do expect { subject.expose :name, format_with: proc {} {} }.to raise_error ArgumentError end it 'makes sure unknown options are not silently ignored' do expect { subject.expose :name, unknown: nil }.to raise_error ArgumentError end end context 'with a block' do it 'errors out if called with multiple attributes' do expect { subject.expose(:name, :email) { true } }.to raise_error ArgumentError end it 'references an instance of the entity with :using option' do module EntitySpec class SomeObject1 attr_accessor :prop1 def initialize @prop1 = 'value1' end end class BogusEntity < Grape::Entity expose :prop1 end end subject.expose(:bogus, using: EntitySpec::BogusEntity) do |entity| entity.prop1 = 'MODIFIED 2' entity end object = EntitySpec::SomeObject1.new value = subject.represent(object).send(:value_for, :bogus) expect(value).to be_instance_of EntitySpec::BogusEntity prop1 = value.send(:value_for, :prop1) expect(prop1).to eq 'MODIFIED 2' end context 'with parameters passed to the block' do it 'sets the :proc option in the exposure options' do block = ->(_) { true } subject.expose :name, using: 'Awesome', &block expect(subject.exposures[:name]).to eq(proc: block, using: 'Awesome') end it 'references an instance of the entity without any options' do subject.expose(:size) { |_| self } expect(subject.represent({}).send(:value_for, :size)).to be_an_instance_of fresh_class end end context 'with no parameters passed to the block' do it 'adds a nested exposure' do subject.expose :awesome do subject.expose :nested do subject.expose :moar_nested, as: 'weee' end subject.expose :another_nested, using: 'Awesome' end expect(subject.exposures).to eq( awesome: {}, awesome__nested: { nested: true }, awesome__nested__moar_nested: { as: 'weee', nested: true }, awesome__another_nested: { using: 'Awesome', nested: true } ) end it 'represents the exposure as a hash of its nested exposures' do subject.expose :awesome do subject.expose(:nested) { |_| 'value' } subject.expose(:another_nested) { |_| 'value' } end expect(subject.represent({}).send(:value_for, :awesome)).to eq( nested: 'value', another_nested: 'value' ) end it 'does not represent nested exposures whose conditions are not met' do subject.expose :awesome do subject.expose(:condition_met, if: ->(_, _) { true }) { |_| 'value' } subject.expose(:condition_not_met, if: ->(_, _) { false }) { |_| 'value' } end expect(subject.represent({}).send(:value_for, :awesome)).to eq(condition_met: 'value') end it 'does not represent attributes, declared inside nested exposure, outside of it' do subject.expose :awesome do subject.expose(:nested) { |_| 'value' } subject.expose(:another_nested) { |_| 'value' } subject.expose :second_level_nested do subject.expose(:deeply_exposed_attr) { |_| 'value' } end end expect(subject.represent({}).serializable_hash).to eq( awesome: { nested: 'value', another_nested: 'value', second_level_nested: { deeply_exposed_attr: 'value' } } ) end it 'complex nested attributes' do class ClassRoom < Grape::Entity expose(:parents, using: 'Parent') { |_| [{}, {}] } end class Person < Grape::Entity expose :user do expose(:in_first) { |_| 'value' } end end class Student < Person expose :user do expose(:user_id) { |_| 'value' } expose(:user_display_id, as: :display_id) { |_| 'value' } end end class Parent < Person expose(:children, using: 'Student') { |_| [{}, {}] } end expect(ClassRoom.represent({}).serializable_hash).to eq( parents: [ { user: { in_first: 'value' }, children: [ { user: { in_first: 'value', user_id: 'value', display_id: 'value' } }, { user: { in_first: 'value', user_id: 'value', display_id: 'value' } } ] }, { user: { in_first: 'value' }, children: [ { user: { in_first: 'value', user_id: 'value', display_id: 'value' } }, { user: { in_first: 'value', user_id: 'value', display_id: 'value' } } ] } ] ) end it 'is safe if its nested exposures are safe' do subject.with_options safe: true do subject.expose :awesome do subject.expose(:nested) { |_| 'value' } end subject.expose :not_awesome do subject.expose :nested end end expect(subject.represent({}, serializable: true)).to eq( awesome: { nested: 'value' }, not_awesome: { nested: nil } ) end end end context 'inherited exposures' do it 'returns exposures from an ancestor' do subject.expose :name, :email child_class = Class.new(subject) expect(child_class.exposures).to eq(subject.exposures) end it 'returns exposures from multiple ancestor' do subject.expose :name, :email parent_class = Class.new(subject) child_class = Class.new(parent_class) expect(child_class.exposures).to eq(subject.exposures) end it 'returns descendant exposures as a priority' do subject.expose :name, :email child_class = Class.new(subject) child_class.expose :name do |_| 'foo' end expect(subject.exposures[:name]).not_to have_key :proc expect(child_class.exposures[:name]).to have_key :proc end end context 'register formatters' do let(:date_formatter) { ->(date) { date.strftime('%m/%d/%Y') } } it 'registers a formatter' do subject.format_with :timestamp, &date_formatter expect(subject.formatters[:timestamp]).not_to be_nil end it 'inherits formatters from ancestors' do subject.format_with :timestamp, &date_formatter child_class = Class.new(subject) expect(child_class.formatters).to eq subject.formatters end it 'does not allow registering a formatter without a block' do expect { subject.format_with :foo }.to raise_error ArgumentError end it 'formats an exposure with a registered formatter' do subject.format_with :timestamp do |date| date.strftime('%m/%d/%Y') end subject.expose :birthday, format_with: :timestamp model = { birthday: Time.gm(2012, 2, 27) } expect(subject.new(double(model)).as_json[:birthday]).to eq '02/27/2012' end it 'formats an exposure with a :format_with lambda that returns a value from the entity instance' do object = {} subject.expose(:size, format_with: ->(_value) { self.object.class.to_s }) expect(subject.represent(object).send(:value_for, :size)).to eq object.class.to_s end it 'formats an exposure with a :format_with symbol that returns a value from the entity instance' do subject.format_with :size_formatter do |_date| self.object.class.to_s end object = {} subject.expose(:size, format_with: :size_formatter) expect(subject.represent(object).send(:value_for, :size)).to eq object.class.to_s end end end describe '.unexpose' do it 'is able to remove exposed attributes' do subject.expose :name, :email subject.unexpose :email expect(subject.exposures).to eq(name: {}) end context 'inherited exposures' do it 'when called from child class, only removes from the attribute from child' do subject.expose :name, :email child_class = Class.new(subject) child_class.unexpose :email expect(child_class.exposures).to eq(name: {}) expect(subject.exposures).to eq(name: {}, email: {}) end context 'when called from the parent class' do it 'remove from parent and do not remove from child classes' do subject.expose :name, :email child_class = Class.new(subject) subject.unexpose :email expect(subject.exposures).to eq(name: {}) expect(child_class.exposures).to eq(name: {}, email: {}) end end end end describe '.with_options' do it 'raises an error for unknown options' do block = proc do with_options(unknown: true) do expose :awesome_thing end end expect { subject.class_eval(&block) }.to raise_error ArgumentError end it 'applies the options to all exposures inside' do subject.class_eval do with_options(if: { awesome: true }) do expose :awesome_thing, using: 'Awesome' end end expect(subject.exposures[:awesome_thing]).to eq(if: { awesome: true }, using: 'Awesome') end it 'allows for nested .with_options' do subject.class_eval do with_options(if: { awesome: true }) do with_options(using: 'Something') do expose :awesome_thing end end end expect(subject.exposures[:awesome_thing]).to eq(if: { awesome: true }, using: 'Something') end it 'overrides nested :as option' do subject.class_eval do with_options(as: :sweet) do expose :awesome_thing, as: :extra_smooth end end expect(subject.exposures[:awesome_thing]).to eq(as: :extra_smooth) end it 'merges nested :if option' do match_proc = ->(_obj, _opts) { true } subject.class_eval do # Symbol with_options(if: :awesome) do # Hash with_options(if: { awesome: true }) do # Proc with_options(if: match_proc) do # Hash (override existing key and merge new key) with_options(if: { awesome: false, less_awesome: true }) do expose :awesome_thing end end end end end expect(subject.exposures[:awesome_thing]).to eq( if: { awesome: false, less_awesome: true }, if_extras: [:awesome, match_proc] ) end it 'merges nested :unless option' do match_proc = ->(_, _) { true } subject.class_eval do # Symbol with_options(unless: :awesome) do # Hash with_options(unless: { awesome: true }) do # Proc with_options(unless: match_proc) do # Hash (override existing key and merge new key) with_options(unless: { awesome: false, less_awesome: true }) do expose :awesome_thing end end end end end expect(subject.exposures[:awesome_thing]).to eq( unless: { awesome: false, less_awesome: true }, unless_extras: [:awesome, match_proc] ) end it 'overrides nested :using option' do subject.class_eval do with_options(using: 'Something') do expose :awesome_thing, using: 'SomethingElse' end end expect(subject.exposures[:awesome_thing]).to eq(using: 'SomethingElse') end it 'aliases :with option to :using option' do subject.class_eval do with_options(using: 'Something') do expose :awesome_thing, with: 'SomethingElse' end end expect(subject.exposures[:awesome_thing]).to eq(using: 'SomethingElse') end it 'overrides nested :proc option' do match_proc = ->(_obj, _opts) { 'more awesomer' } subject.class_eval do with_options(proc: ->(_obj, _opts) { 'awesome' }) do expose :awesome_thing, proc: match_proc end end expect(subject.exposures[:awesome_thing]).to eq(proc: match_proc) end it 'overrides nested :documentation option' do subject.class_eval do with_options(documentation: { desc: 'Description.' }) do expose :awesome_thing, documentation: { desc: 'Other description.' } end end expect(subject.exposures[:awesome_thing]).to eq(documentation: { desc: 'Other description.' }) end end describe '.represent' do it 'returns a single entity if called with one object' do expect(subject.represent(Object.new)).to be_kind_of(subject) end it 'returns a single entity if called with a hash' do expect(subject.represent({})).to be_kind_of(subject) end it 'returns multiple entities if called with a collection' do representation = subject.represent(4.times.map { Object.new }) expect(representation).to be_kind_of Array expect(representation.size).to eq(4) expect(representation.reject { |r| r.is_a?(subject) }).to be_empty end it 'adds the collection: true option if called with a collection' do representation = subject.represent(4.times.map { Object.new }) representation.each { |r| expect(r.options[:collection]).to be true } end it 'returns a serialized hash of a single object if serializable: true' do subject.expose(:awesome) { |_| true } representation = subject.represent(Object.new, serializable: true) expect(representation).to eq(awesome: true) end it 'returns a serialized array of hashes of multiple objects if serializable: true' do subject.expose(:awesome) { |_| true } representation = subject.represent(2.times.map { Object.new }, serializable: true) expect(representation).to eq([{ awesome: true }, { awesome: true }]) end it 'returns a serialized hash of a hash' do subject.expose(:awesome) representation = subject.represent({ awesome: true }, serializable: true) expect(representation).to eq(awesome: true) end it 'returns a serialized hash of an OpenStruct' do subject.expose(:awesome) representation = subject.represent(OpenStruct.new, serializable: true) expect(representation).to eq(awesome: nil) end it 'raises error if field not found' do subject.expose(:awesome) expect do subject.represent(Object.new, serializable: true) end.to raise_error(NoMethodError, /missing attribute `awesome'/) end context 'with specified fields' do it 'returns only specified fields with only option' do subject.expose(:id, :name, :phone) representation = subject.represent(OpenStruct.new, only: [:id, :name], serializable: true) expect(representation).to eq(id: nil, name: nil) end it 'returns all fields except the ones specified in the except option' do subject.expose(:id, :name, :phone) representation = subject.represent(OpenStruct.new, except: [:phone], serializable: true) expect(representation).to eq(id: nil, name: nil) end it 'returns only fields specified in the only option and not specified in the except option' do subject.expose(:id, :name, :phone) representation = subject.represent(OpenStruct.new, only: [:name, :phone], except: [:phone], serializable: true) expect(representation).to eq(name: nil) end context 'with strings or symbols passed to only and except' do let(:object) { OpenStruct.new(user: {}) } before do user_entity = Class.new(Grape::Entity) user_entity.expose(:id, :name, :email) subject.expose(:id, :name, :phone, :address) subject.expose(:user, using: user_entity) end it 'can specify "only" option attributes as strings' do representation = subject.represent(object, only: ['id', 'name', { 'user' => ['email'] }], serializable: true) expect(representation).to eq(id: nil, name: nil, user: { email: nil }) end it 'can specify "except" option attributes as strings' do representation = subject.represent(object, except: ['id', 'name', { 'user' => ['email'] }], serializable: true) expect(representation).to eq(phone: nil, address: nil, user: { id: nil, name: nil }) end it 'can specify "only" option attributes as symbols' do representation = subject.represent(object, only: [:name, :phone, { user: [:name] }], serializable: true) expect(representation).to eq(name: nil, phone: nil, user: { name: nil }) end it 'can specify "except" option attributes as symbols' do representation = subject.represent(object, except: [:name, :phone, { user: [:name] }], serializable: true) expect(representation).to eq(id: nil, address: nil, user: { id: nil, email: nil }) end it 'can specify "only" attributes as strings and symbols' do representation = subject.represent(object, only: [:id, 'address', { user: [:id, 'name'] }], serializable: true) expect(representation).to eq(id: nil, address: nil, user: { id: nil, name: nil }) end it 'can specify "except" attributes as strings and symbols' do representation = subject.represent(object, except: [:id, 'address', { user: [:id, 'name'] }], serializable: true) expect(representation).to eq(name: nil, phone: nil, user: { email: nil }) end end it 'can specify children attributes with only' do user_entity = Class.new(Grape::Entity) user_entity.expose(:id, :name, :email) subject.expose(:id, :name, :phone) subject.expose(:user, using: user_entity) representation = subject.represent(OpenStruct.new(user: {}), only: [:id, :name, { user: [:name, :email] }], serializable: true) expect(representation).to eq(id: nil, name: nil, user: { name: nil, email: nil }) end it 'can specify children attributes with except' do user_entity = Class.new(Grape::Entity) user_entity.expose(:id, :name, :email) subject.expose(:id, :name, :phone) subject.expose(:user, using: user_entity) representation = subject.represent(OpenStruct.new(user: {}), except: [:phone, { user: [:id] }], serializable: true) expect(representation).to eq(id: nil, name: nil, user: { name: nil, email: nil }) end it 'can specify children attributes with mixed only and except' do user_entity = Class.new(Grape::Entity) user_entity.expose(:id, :name, :email, :address) subject.expose(:id, :name, :phone, :mobile_phone) subject.expose(:user, using: user_entity) representation = subject.represent(OpenStruct.new(user: {}), only: [:id, :name, :phone, user: [:id, :name, :email]], except: [:phone, { user: [:id] }], serializable: true) expect(representation).to eq(id: nil, name: nil, user: { name: nil, email: nil }) end context 'specify attribute with exposure condition' do it 'returns only specified fields' do subject.expose(:id) subject.with_options(if: { condition: true }) do subject.expose(:name) end representation = subject.represent(OpenStruct.new, condition: true, only: [:id, :name], serializable: true) expect(representation).to eq(id: nil, name: nil) end it 'does not return fields specified in the except option' do subject.expose(:id, :phone) subject.with_options(if: { condition: true }) do subject.expose(:name, :mobile_phone) end representation = subject.represent(OpenStruct.new, condition: true, except: [:phone, :mobile_phone], serializable: true) expect(representation).to eq(id: nil, name: nil) end end context 'attribute with alias' do it 'returns only specified fields' do subject.expose(:id) subject.expose(:name, as: :title) representation = subject.represent(OpenStruct.new, condition: true, only: [:id, :title], serializable: true) expect(representation).to eq(id: nil, title: nil) end it 'does not return fields specified in the except option' do subject.expose(:id) subject.expose(:name, as: :title) subject.expose(:phone, as: :phone_number) representation = subject.represent(OpenStruct.new, condition: true, except: [:phone_number], serializable: true) expect(representation).to eq(id: nil, title: nil) end end context 'attribute that is an entity itself' do it 'returns correctly the children entity attributes' do user_entity = Class.new(Grape::Entity) user_entity.expose(:id, :name, :email) nephew_entity = Class.new(Grape::Entity) nephew_entity.expose(:id, :name, :email) subject.expose(:id, :name, :phone) subject.expose(:user, using: user_entity) subject.expose(:nephew, using: nephew_entity) representation = subject.represent(OpenStruct.new(user: {}), only: [:id, :name, :user], except: [:nephew], serializable: true) expect(representation).to eq(id: nil, name: nil, user: { id: nil, name: nil, email: nil }) end end end end describe '.present_collection' do it 'make the objects accessible' do subject.present_collection true subject.expose :items representation = subject.represent(4.times.map { Object.new }) expect(representation).to be_kind_of(subject) expect(representation.object).to be_kind_of(Hash) expect(representation.object).to have_key :items expect(representation.object[:items]).to be_kind_of Array expect(representation.object[:items].size).to be 4 end it 'serializes items with my root name' do subject.present_collection true, :my_items subject.expose :my_items representation = subject.represent(4.times.map { Object.new }, serializable: true) expect(representation).to be_kind_of(Hash) expect(representation).to have_key :my_items expect(representation[:my_items]).to be_kind_of Array expect(representation[:my_items].size).to be 4 end end describe '.root' do context 'with singular and plural root keys' do before(:each) do subject.root 'things', 'thing' end context 'with a single object' do it 'allows a root element name to be specified' do representation = subject.represent(Object.new) expect(representation).to be_kind_of Hash expect(representation).to have_key 'thing' expect(representation['thing']).to be_kind_of(subject) end end context 'with an array of objects' do it 'allows a root element name to be specified' do representation = subject.represent(4.times.map { Object.new }) expect(representation).to be_kind_of Hash expect(representation).to have_key 'things' expect(representation['things']).to be_kind_of Array expect(representation['things'].size).to eq 4 expect(representation['things'].reject { |r| r.is_a?(subject) }).to be_empty end end context 'it can be overridden' do it 'can be disabled' do representation = subject.represent(4.times.map { Object.new }, root: false) expect(representation).to be_kind_of Array expect(representation.size).to eq 4 expect(representation.reject { |r| r.is_a?(subject) }).to be_empty end it 'can use a different name' do representation = subject.represent(4.times.map { Object.new }, root: 'others') expect(representation).to be_kind_of Hash expect(representation).to have_key 'others' expect(representation['others']).to be_kind_of Array expect(representation['others'].size).to eq 4 expect(representation['others'].reject { |r| r.is_a?(subject) }).to be_empty end end end context 'with singular root key' do before(:each) do subject.root nil, 'thing' end context 'with a single object' do it 'allows a root element name to be specified' do representation = subject.represent(Object.new) expect(representation).to be_kind_of Hash expect(representation).to have_key 'thing' expect(representation['thing']).to be_kind_of(subject) end end context 'with an array of objects' do it 'allows a root element name to be specified' do representation = subject.represent(4.times.map { Object.new }) expect(representation).to be_kind_of Array expect(representation.size).to eq 4 expect(representation.reject { |r| r.is_a?(subject) }).to be_empty end end end context 'with plural root key' do before(:each) do subject.root 'things' end context 'with a single object' do it 'allows a root element name to be specified' do expect(subject.represent(Object.new)).to be_kind_of(subject) end end context 'with an array of objects' do it 'allows a root element name to be specified' do representation = subject.represent(4.times.map { Object.new }) expect(representation).to be_kind_of Hash expect(representation).to have_key('things') expect(representation['things']).to be_kind_of Array expect(representation['things'].size).to eq 4 expect(representation['things'].reject { |r| r.is_a?(subject) }).to be_empty end end end context 'inheriting from parent entity' do before(:each) do subject.root 'things', 'thing' end it 'inherits single root' do child_class = Class.new(subject) representation = child_class.represent(Object.new) expect(representation).to be_kind_of Hash expect(representation).to have_key 'thing' expect(representation['thing']).to be_kind_of(child_class) end it 'inherits array root root' do child_class = Class.new(subject) representation = child_class.represent(4.times.map { Object.new }) expect(representation).to be_kind_of Hash expect(representation).to have_key('things') expect(representation['things']).to be_kind_of Array expect(representation['things'].size).to eq 4 expect(representation['things'].reject { |r| r.is_a?(child_class) }).to be_empty end end end describe '#initialize' do it 'takes an object and an optional options hash' do expect { subject.new(Object.new) }.not_to raise_error expect { subject.new }.to raise_error ArgumentError expect { subject.new(Object.new, {}) }.not_to raise_error end it 'has attribute readers for the object and options' do entity = subject.new('abc', {}) expect(entity.object).to eq 'abc' expect(entity.options).to eq({}) end end end context 'instance methods' do let(:model) { double(attributes) } let(:attributes) do { name: 'Bob Bobson', email: 'bob@example.com', birthday: Time.gm(2012, 2, 27), fantasies: ['Unicorns', 'Double Rainbows', 'Nessy'], characteristics: [ { key: 'hair_color', value: 'brown' } ], friends: [ double(name: 'Friend 1', email: 'friend1@example.com', characteristics: [], fantasies: [], birthday: Time.gm(2012, 2, 27), friends: []), double(name: 'Friend 2', email: 'friend2@example.com', characteristics: [], fantasies: [], birthday: Time.gm(2012, 2, 27), friends: []) ], extra: { key: 'foo', value: 'bar' }, nested: [ { name: 'n1', data: { key: 'ex1', value: 'v1' } }, { name: 'n2', data: { key: 'ex2', value: 'v2' } } ] } end subject { fresh_class.new(model) } describe '#serializable_hash' do it 'does not throw an exception if a nil options object is passed' do expect { fresh_class.new(model).serializable_hash(nil) }.not_to raise_error end it 'does not blow up when the model is nil' do fresh_class.expose :name expect { fresh_class.new(nil).serializable_hash }.not_to raise_error end context 'with safe option' do it 'does not throw an exception when an attribute is not found on the object' do fresh_class.expose :name, :nonexistent_attribute, safe: true expect { fresh_class.new(model).serializable_hash }.not_to raise_error end it 'exposes values of private method calls' do some_class = Class.new do define_method :name do true end private :name end fresh_class.expose :name, safe: true expect(fresh_class.new(some_class.new).serializable_hash).to eq(name: true) end it "does expose attributes that don't exist on the object as nil" do fresh_class.expose :email, :nonexistent_attribute, :name, safe: true res = fresh_class.new(model).serializable_hash expect(res).to have_key :email expect(res).to have_key :nonexistent_attribute expect(res).to have_key :name end it 'does expose attributes marked as safe if model is a hash object' do fresh_class.expose :name, safe: true res = fresh_class.new(name: 'myname').serializable_hash expect(res).to have_key :name end it "does expose attributes that don't exist on the object as nil if criteria is true" do fresh_class.expose :email fresh_class.expose :nonexistent_attribute, safe: true, if: ->(_obj, _opts) { false } fresh_class.expose :nonexistent_attribute2, safe: true, if: ->(_obj, _opts) { true } res = fresh_class.new(model).serializable_hash expect(res).to have_key :email expect(res).not_to have_key :nonexistent_attribute expect(res).to have_key :nonexistent_attribute2 end end context 'without safe option' do it 'throws an exception when an attribute is not found on the object' do fresh_class.expose :name, :nonexistent_attribute expect { fresh_class.new(model).serializable_hash }.to raise_error end it "exposes attributes that don't exist on the object only when they are generated by a block" do fresh_class.expose :nonexistent_attribute do |_model, _opts| 'well, I do exist after all' end res = fresh_class.new(model).serializable_hash expect(res).to have_key :nonexistent_attribute end it 'does not expose attributes that are generated by a block but have not passed criteria' do fresh_class.expose :nonexistent_attribute, proc: ->(_model, _opts) { 'I exist, but it is not yet my time to shine' }, if: ->(_model, _opts) { false } res = fresh_class.new(model).serializable_hash expect(res).not_to have_key :nonexistent_attribute end end it "exposes attributes that don't exist on the object only when they are generated by a block with options" do module EntitySpec class TestEntity < Grape::Entity end end fresh_class.expose :nonexistent_attribute, using: EntitySpec::TestEntity do |_model, _opts| 'well, I do exist after all' end res = fresh_class.new(model).serializable_hash expect(res).to have_key :nonexistent_attribute end it 'does not expose attributes that are generated by a block but have not passed criteria' do fresh_class.expose :nonexistent_attribute, proc: ->(_, _) { 'I exist, but it is not yet my time to shine' }, if: ->(_, _) { false } res = fresh_class.new(model).serializable_hash expect(res).not_to have_key :nonexistent_attribute end context '#serializable_hash' do module EntitySpec class EmbeddedExample def serializable_hash(_opts = {}) { abc: 'def' } end end class EmbeddedExampleWithHash def name 'abc' end def embedded { a: nil, b: EmbeddedExample.new } end end class EmbeddedExampleWithMany def name 'abc' end def embedded [EmbeddedExample.new, EmbeddedExample.new] end end class EmbeddedExampleWithOne def name 'abc' end def embedded EmbeddedExample.new end end end it 'serializes embedded objects which respond to #serializable_hash' do fresh_class.expose :name, :embedded presenter = fresh_class.new(EntitySpec::EmbeddedExampleWithOne.new) expect(presenter.serializable_hash).to eq(name: 'abc', embedded: { abc: 'def' }) end it 'serializes embedded arrays of objects which respond to #serializable_hash' do fresh_class.expose :name, :embedded presenter = fresh_class.new(EntitySpec::EmbeddedExampleWithMany.new) expect(presenter.serializable_hash).to eq(name: 'abc', embedded: [{ abc: 'def' }, { abc: 'def' }]) end it 'serializes embedded hashes of objects which respond to #serializable_hash' do fresh_class.expose :name, :embedded presenter = fresh_class.new(EntitySpec::EmbeddedExampleWithHash.new) expect(presenter.serializable_hash).to eq(name: 'abc', embedded: { a: nil, b: { abc: 'def' } }) end end context '#attr_path' do it 'for all kinds of attributes' do module EntitySpec class EmailEntity < Grape::Entity expose(:email, as: :addr) { |_, o| o[:attr_path].join('/') } end class UserEntity < Grape::Entity expose(:name, as: :full_name) { |_, o| o[:attr_path].join('/') } expose :email, using: 'EntitySpec::EmailEntity' end class ExtraEntity < Grape::Entity expose(:key) { |_, o| o[:attr_path].join('/') } expose(:value) { |_, o| o[:attr_path].join('/') } end class NestedEntity < Grape::Entity expose(:name) { |_, o| o[:attr_path].join('/') } expose :data, using: 'EntitySpec::ExtraEntity' end end fresh_class.class_eval do expose(:id) { |_, o| o[:attr_path].join('/') } expose(:foo, as: :bar) { |_, o| o[:attr_path].join('/') } expose :title do expose :full do expose(:prefix, as: :pref) { |_, o| o[:attr_path].join('/') } expose(:main) { |_, o| o[:attr_path].join('/') } end end expose :friends, as: :social, using: 'EntitySpec::UserEntity' expose :extra, using: 'EntitySpec::ExtraEntity' expose :nested, using: 'EntitySpec::NestedEntity' end expect(subject.serializable_hash).to eq( id: 'id', bar: 'bar', title: { full: { pref: 'title/full/pref', main: 'title/full/main' } }, social: [ { full_name: 'social/full_name', email: { addr: 'social/email/addr' } }, { full_name: 'social/full_name', email: { addr: 'social/email/addr' } } ], extra: { key: 'extra/key', value: 'extra/value' }, nested: [ { name: 'nested/name', data: { key: 'nested/data/key', value: 'nested/data/value' } }, { name: 'nested/name', data: { key: 'nested/data/key', value: 'nested/data/value' } } ] ) end it 'allows customize path of an attribute' do module EntitySpec class CharacterEntity < Grape::Entity expose(:key) { |_, o| o[:attr_path].join('/') } expose(:value) { |_, o| o[:attr_path].join('/') } end end fresh_class.class_eval do expose :characteristics, using: EntitySpec::CharacterEntity protected def self.path_for(attribute) attribute == :characteristics ? :character : super end end expect(subject.serializable_hash).to eq( characteristics: [ { key: 'character/key', value: 'character/value' } ] ) end it 'can drop one nest level by set path_for to nil' do module EntitySpec class NoPathCharacterEntity < Grape::Entity expose(:key) { |_, o| o[:attr_path].join('/') } expose(:value) { |_, o| o[:attr_path].join('/') } end end fresh_class.class_eval do expose :characteristics, using: EntitySpec::NoPathCharacterEntity protected def self.path_for(_attribute) nil end end expect(subject.serializable_hash).to eq( characteristics: [ { key: 'key', value: 'value' } ] ) end end end describe '#value_for' do before do fresh_class.class_eval do expose :name, :email expose :friends, using: self expose :computed do |_, options| options[:awesome] end expose :birthday, format_with: :timestamp def timestamp(date) date.strftime('%m/%d/%Y') end expose :fantasies, format_with: ->(f) { f.reverse } end end it 'passes through bare expose attributes' do expect(subject.send(:value_for, :name)).to eq attributes[:name] end it 'instantiates a representation if that is called for' do rep = subject.send(:value_for, :friends) expect(rep.reject { |r| r.is_a?(fresh_class) }).to be_empty expect(rep.first.serializable_hash[:name]).to eq 'Friend 1' expect(rep.last.serializable_hash[:name]).to eq 'Friend 2' end context 'child representations' do it 'disables root key name for child representations' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name, :email end end fresh_class.class_eval do expose :friends, using: EntitySpec::FriendEntity end rep = subject.send(:value_for, :friends) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::FriendEntity) }).to be_empty expect(rep.first.serializable_hash[:name]).to eq 'Friend 1' expect(rep.last.serializable_hash[:name]).to eq 'Friend 2' end it 'passes through the proc which returns an array of objects with custom options(:using)' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name, :email end end fresh_class.class_eval do expose :custom_friends, using: EntitySpec::FriendEntity do |user, _opts| user.friends end end rep = subject.send(:value_for, :custom_friends) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::FriendEntity) }).to be_empty expect(rep.first.serializable_hash).to eq(name: 'Friend 1', email: 'friend1@example.com') expect(rep.last.serializable_hash).to eq(name: 'Friend 2', email: 'friend2@example.com') end it 'passes through the proc which returns single object with custom options(:using)' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name, :email end end fresh_class.class_eval do expose :first_friend, using: EntitySpec::FriendEntity do |user, _opts| user.friends.first end end rep = subject.send(:value_for, :first_friend) expect(rep).to be_kind_of EntitySpec::FriendEntity expect(rep.serializable_hash).to eq(name: 'Friend 1', email: 'friend1@example.com') end it 'passes through the proc which returns empty with custom options(:using)' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name, :email end end fresh_class.class_eval do expose :first_friend, using: EntitySpec::FriendEntity do |_user, _opts| end end rep = subject.send(:value_for, :first_friend) expect(rep).to be_kind_of EntitySpec::FriendEntity expect(rep.serializable_hash).to be_nil end it 'passes through exposed entity with key and value attributes' do module EntitySpec class CharacteristicsEntity < Grape::Entity root 'characteristics', 'characteristic' expose :key, :value end end fresh_class.class_eval do expose :characteristics, using: EntitySpec::CharacteristicsEntity end rep = subject.send(:value_for, :characteristics) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::CharacteristicsEntity) }).to be_empty expect(rep.first.serializable_hash[:key]).to eq 'hair_color' expect(rep.first.serializable_hash[:value]).to eq 'brown' end it 'passes through custom options' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name expose :email, if: { user_type: :admin } end end fresh_class.class_eval do expose :friends, using: EntitySpec::FriendEntity end rep = subject.send(:value_for, :friends) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::FriendEntity) }).to be_empty expect(rep.first.serializable_hash[:email]).to be_nil expect(rep.last.serializable_hash[:email]).to be_nil rep = subject.send(:value_for, :friends, user_type: :admin) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::FriendEntity) }).to be_empty expect(rep.first.serializable_hash[:email]).to eq 'friend1@example.com' expect(rep.last.serializable_hash[:email]).to eq 'friend2@example.com' end it 'ignores the :collection parameter in the source options' do module EntitySpec class FriendEntity < Grape::Entity root 'friends', 'friend' expose :name expose :email, if: { collection: true } end end fresh_class.class_eval do expose :friends, using: EntitySpec::FriendEntity end rep = subject.send(:value_for, :friends, collection: false) expect(rep).to be_kind_of Array expect(rep.reject { |r| r.is_a?(EntitySpec::FriendEntity) }).to be_empty expect(rep.first.serializable_hash[:email]).to eq 'friend1@example.com' expect(rep.last.serializable_hash[:email]).to eq 'friend2@example.com' end end it 'calls through to the proc if there is one' do expect(subject.send(:value_for, :computed, awesome: 123)).to eq 123 end it 'returns a formatted value if format_with is passed' do expect(subject.send(:value_for, :birthday)).to eq '02/27/2012' end it 'returns a formatted value if format_with is passed a lambda' do expect(subject.send(:value_for, :fantasies)).to eq ['Nessy', 'Double Rainbows', 'Unicorns'] end it 'tries instance methods on the entity first' do module EntitySpec class DelegatingEntity < Grape::Entity root 'friends', 'friend' expose :name expose :email private def name 'cooler name' end end end friend = double('Friend', name: 'joe', email: 'joe@example.com') rep = EntitySpec::DelegatingEntity.new(friend) expect(rep.send(:value_for, :name)).to eq 'cooler name' expect(rep.send(:value_for, :email)).to eq 'joe@example.com' end context 'using' do before do module EntitySpec class UserEntity < Grape::Entity expose :name, :email end end end it 'string' do fresh_class.class_eval do expose :friends, using: 'EntitySpec::UserEntity' end rep = subject.send(:value_for, :friends) expect(rep).to be_kind_of Array expect(rep.size).to eq 2 expect(rep.all? { |r| r.is_a?(EntitySpec::UserEntity) }).to be true end it 'class' do fresh_class.class_eval do expose :friends, using: EntitySpec::UserEntity end rep = subject.send(:value_for, :friends) expect(rep).to be_kind_of Array expect(rep.size).to eq 2 expect(rep.all? { |r| r.is_a?(EntitySpec::UserEntity) }).to be true end end end describe '#documentation' do it 'returns an empty hash is no documentation is provided' do fresh_class.expose :name expect(subject.documentation).to eq({}) end it 'returns each defined documentation hash' do doc = { type: 'foo', desc: 'bar' } fresh_class.expose :name, documentation: doc fresh_class.expose :email, documentation: doc fresh_class.expose :birthday expect(subject.documentation).to eq(name: doc, email: doc) end it 'returns each defined documentation hash with :as param considering' do doc = { type: 'foo', desc: 'bar' } fresh_class.expose :name, documentation: doc, as: :label fresh_class.expose :email, documentation: doc fresh_class.expose :birthday expect(subject.documentation).to eq(label: doc, email: doc) end context 'inherited documentation' do it 'returns documentation from ancestor' do doc = { type: 'foo', desc: 'bar' } fresh_class.expose :name, documentation: doc child_class = Class.new(fresh_class) child_class.expose :email, documentation: doc expect(fresh_class.documentation).to eq(name: doc) expect(child_class.documentation).to eq(name: doc, email: doc) end it 'obeys unexposed attributes in subclass' do doc = { type: 'foo', desc: 'bar' } fresh_class.expose :name, documentation: doc fresh_class.expose :email, documentation: doc child_class = Class.new(fresh_class) child_class.unexpose :email expect(fresh_class.documentation).to eq(name: doc, email: doc) expect(child_class.documentation).to eq(name: doc) end it 'obeys re-exposed attributes in subclass' do doc = { type: 'foo', desc: 'bar' } fresh_class.expose :name, documentation: doc fresh_class.expose :email, documentation: doc child_class = Class.new(fresh_class) child_class.unexpose :email nephew_class = Class.new(child_class) new_doc = { type: 'todler', descr: '???' } nephew_class.expose :email, documentation: new_doc expect(fresh_class.documentation).to eq(name: doc, email: doc) expect(child_class.documentation).to eq(name: doc) expect(nephew_class.documentation).to eq(name: doc, email: new_doc) end end end describe '#key_for' do it 'returns the attribute if no :as is set' do fresh_class.expose :name expect(subject.class.send(:key_for, :name)).to eq :name end it 'returns a symbolized version of the attribute' do fresh_class.expose :name expect(subject.class.send(:key_for, 'name')).to eq :name end it 'returns the :as alias if one exists' do fresh_class.expose :name, as: :nombre expect(subject.class.send(:key_for, 'name')).to eq :nombre end end describe '#conditions_met?' do it 'only passes through hash :if exposure if all attributes match' do exposure_options = { if: { condition1: true, condition2: true } } expect(subject.send(:conditions_met?, exposure_options, {})).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true, condition2: true)).to be true expect(subject.send(:conditions_met?, exposure_options, condition1: false, condition2: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true, condition2: true, other: true)).to be true end it 'looks for presence/truthiness if a symbol is passed' do exposure_options = { if: :condition1 } expect(subject.send(:conditions_met?, exposure_options, {})).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true)).to be true expect(subject.send(:conditions_met?, exposure_options, condition1: false)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: nil)).to be false end it 'looks for absence/falsiness if a symbol is passed' do exposure_options = { unless: :condition1 } expect(subject.send(:conditions_met?, exposure_options, {})).to be true expect(subject.send(:conditions_met?, exposure_options, condition1: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: false)).to be true expect(subject.send(:conditions_met?, exposure_options, condition1: nil)).to be true end it 'only passes through proc :if exposure if it returns truthy value' do exposure_options = { if: ->(_, opts) { opts[:true] } } expect(subject.send(:conditions_met?, exposure_options, true: false)).to be false expect(subject.send(:conditions_met?, exposure_options, true: true)).to be true end it 'only passes through hash :unless exposure if any attributes do not match' do exposure_options = { unless: { condition1: true, condition2: true } } expect(subject.send(:conditions_met?, exposure_options, {})).to be true expect(subject.send(:conditions_met?, exposure_options, condition1: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true, condition2: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: false, condition2: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: true, condition2: true, other: true)).to be false expect(subject.send(:conditions_met?, exposure_options, condition1: false, condition2: false)).to be true end it 'only passes through proc :unless exposure if it returns falsy value' do exposure_options = { unless: ->(_, opts) { opts[:true] == true } } expect(subject.send(:conditions_met?, exposure_options, true: false)).to be true expect(subject.send(:conditions_met?, exposure_options, true: true)).to be false end end describe '::DSL' do subject { Class.new } it 'creates an Entity class when called' do expect(subject).not_to be_const_defined :Entity subject.send(:include, Grape::Entity::DSL) expect(subject).to be_const_defined :Entity end context 'pre-mixed' do before { subject.send(:include, Grape::Entity::DSL) } it 'is able to define entity traits through DSL' do subject.entity do expose :name end expect(subject.entity_class.exposures).not_to be_empty end it 'is able to expose straight from the class' do subject.entity :name, :email expect(subject.entity_class.exposures.size).to eq 2 end it 'is able to mix field and advanced exposures' do subject.entity :name, :email do expose :third end expect(subject.entity_class.exposures.size).to eq 3 end context 'instance' do let(:instance) { subject.new } describe '#entity' do it 'is an instance of the entity class' do expect(instance.entity).to be_kind_of(subject.entity_class) end it 'has an object of itself' do expect(instance.entity.object).to eq instance end it 'instantiates with options if provided' do expect(instance.entity(awesome: true).options).to eq(awesome: true) end end end end end end end
{ "content_hash": "2dc86a9362ff7fd918250550d6047d35", "timestamp": "", "source": "github", "line_count": 1534, "max_line_length": 146, "avg_line_length": 37.339634941329855, "alnum_prop": 0.5739799926674698, "repo_name": "tyre/grape-entity", "id": "825b2e94697a183038deb436b20e0f66a15a6c35", "size": "57279", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/grape_entity/entity_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "89725" } ], "symlink_target": "" }
require 'ncurses' class Terminal KEY_UP = 27.chr + '[A' # Ncurses::KEY_UP KEY_DOWN = 27.chr + '[B' # Ncurses::KEY_DOWN KEY_LEFT = 27.chr + '[D' # Ncurses::KEY_LEFT KEY_RIGHT = 27.chr + '[C' # Ncurses::KEY_RIGHT NOTHING = -1 def Terminal.init Ncurses.initscr Ncurses.cbreak # provide unbuffered input Ncurses.noecho # turn off input echoing Ncurses.nonl # turn off newline translation #Ncurses.stdscr.addstr("Press a key to continue") # output string #Ncurses.stdscr.getch # get a charachter Ncurses.curs_set(0) Ncurses.stdscr.nodelay(true) Ncurses.stdscr.intrflush(false) # turn off flush-on-interrupt @nc = Ncurses @screen = Ncurses.stdscr #Ncurses.stdscr.keypad(true) # turn on keypad mode # end def Terminal.cursorTo x, y @screen.move y, x end #module_function :cursorTo def Terminal.clear @screen.clear end def Terminal.put str @screen.addstr str end def Terminal.get result = '' last = @screen.getch while last != -1 result += last.chr last = @screen.getch end if result == '' return nil end result end def Terminal.uninit Ncurses.curs_set 1 Ncurses.echo Ncurses.nocbreak Ncurses.nl Ncurses.endwin end end
{ "content_hash": "e538849f7df075dafd5c0bc83a4bda3e", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 72, "avg_line_length": 20.791044776119403, "alnum_prop": 0.5944005743000718, "repo_name": "smarr/Snake", "id": "9c28fc738d8f451a14ab494dd18edface0d12714", "size": "1487", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Ruby/terminal.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "3478" }, { "name": "C", "bytes": "8409" }, { "name": "Clojure", "bytes": "26331" }, { "name": "Erlang", "bytes": "21452" }, { "name": "HTML", "bytes": "1501" }, { "name": "Java", "bytes": "18481" }, { "name": "JavaScript", "bytes": "5037" }, { "name": "Makefile", "bytes": "968" }, { "name": "PHP", "bytes": "6501" }, { "name": "Ruby", "bytes": "6449" }, { "name": "Rust", "bytes": "11299" }, { "name": "Shell", "bytes": "785" } ], "symlink_target": "" }
namespace tigl { namespace generated { CPACSAxle::CPACSAxle(CPACSAxleAssembly* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) , m_length(0) , m_shaftProperties(this, m_uidMgr) , m_numberOfWheels(0) , m_wheel(this, m_uidMgr) { //assert(parent != NULL); m_parent = parent; m_parentType = &typeid(CPACSAxleAssembly); } CPACSAxle::CPACSAxle(CPACSLandingGearComponentAssembly* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) , m_length(0) , m_shaftProperties(this, m_uidMgr) , m_numberOfWheels(0) , m_wheel(this, m_uidMgr) { //assert(parent != NULL); m_parent = parent; m_parentType = &typeid(CPACSLandingGearComponentAssembly); } CPACSAxle::~CPACSAxle() { if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); } const CTiglUIDObject* CPACSAxle::GetNextUIDParent() const { if (m_parent) { if (IsParent<CPACSAxleAssembly>()) { return GetParent<CPACSAxleAssembly>()->GetNextUIDParent(); } if (IsParent<CPACSLandingGearComponentAssembly>()) { return GetParent<CPACSLandingGearComponentAssembly>()->GetNextUIDParent(); } } return nullptr; } CTiglUIDObject* CPACSAxle::GetNextUIDParent() { if (m_parent) { if (IsParent<CPACSAxleAssembly>()) { return GetParent<CPACSAxleAssembly>()->GetNextUIDParent(); } if (IsParent<CPACSLandingGearComponentAssembly>()) { return GetParent<CPACSLandingGearComponentAssembly>()->GetNextUIDParent(); } } return nullptr; } CTiglUIDManager& CPACSAxle::GetUIDManager() { if (!m_uidMgr) { throw CTiglError("UIDManager is null"); } return *m_uidMgr; } const CTiglUIDManager& CPACSAxle::GetUIDManager() const { if (!m_uidMgr) { throw CTiglError("UIDManager is null"); } return *m_uidMgr; } void CPACSAxle::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read attribute uID if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { m_uID = tixi::TixiGetAttribute<std::string>(tixiHandle, xpath, "uID"); if (m_uID.empty()) { LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; } } else { LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; } // read element length if (tixi::TixiCheckElement(tixiHandle, xpath + "/length")) { m_length = tixi::TixiGetElement<double>(tixiHandle, xpath + "/length"); } else { LOG(ERROR) << "Required element length is missing at xpath " << xpath; } // read element shaftProperties if (tixi::TixiCheckElement(tixiHandle, xpath + "/shaftProperties")) { m_shaftProperties.ReadCPACS(tixiHandle, xpath + "/shaftProperties"); } else { LOG(ERROR) << "Required element shaftProperties is missing at xpath " << xpath; } // read element numberOfWheels if (tixi::TixiCheckElement(tixiHandle, xpath + "/numberOfWheels")) { m_numberOfWheels = tixi::TixiGetElement<int>(tixiHandle, xpath + "/numberOfWheels"); } else { LOG(ERROR) << "Required element numberOfWheels is missing at xpath " << xpath; } // read element sideOfFirstWheel if (tixi::TixiCheckElement(tixiHandle, xpath + "/sideOfFirstWheel")) { m_sideOfFirstWheel = stringToCPACSAxle_sideOfFirstWheel(tixi::TixiGetElement<std::string>(tixiHandle, xpath + "/sideOfFirstWheel")); } else { LOG(ERROR) << "Required element sideOfFirstWheel is missing at xpath " << xpath; } // read element wheel if (tixi::TixiCheckElement(tixiHandle, xpath + "/wheel")) { m_wheel.ReadCPACS(tixiHandle, xpath + "/wheel"); } else { LOG(ERROR) << "Required element wheel is missing at xpath " << xpath; } if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } void CPACSAxle::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const { // write attribute uID tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); // write element length tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/length"); tixi::TixiSaveElement(tixiHandle, xpath + "/length", m_length); // write element shaftProperties tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/shaftProperties"); m_shaftProperties.WriteCPACS(tixiHandle, xpath + "/shaftProperties"); // write element numberOfWheels tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/numberOfWheels"); tixi::TixiSaveElement(tixiHandle, xpath + "/numberOfWheels", m_numberOfWheels); // write element sideOfFirstWheel tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/sideOfFirstWheel"); tixi::TixiSaveElement(tixiHandle, xpath + "/sideOfFirstWheel", CPACSAxle_sideOfFirstWheelToString(m_sideOfFirstWheel)); // write element wheel tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/wheel"); m_wheel.WriteCPACS(tixiHandle, xpath + "/wheel"); } const std::string& CPACSAxle::GetUID() const { return m_uID; } void CPACSAxle::SetUID(const std::string& value) { if (m_uidMgr && value != m_uID) { if (m_uID.empty()) { m_uidMgr->RegisterObject(value, *this); } else { m_uidMgr->UpdateObjectUID(m_uID, value); } } m_uID = value; } const double& CPACSAxle::GetLength() const { return m_length; } void CPACSAxle::SetLength(const double& value) { m_length = value; } const CPACSStrutProperties& CPACSAxle::GetShaftProperties() const { return m_shaftProperties; } CPACSStrutProperties& CPACSAxle::GetShaftProperties() { return m_shaftProperties; } const int& CPACSAxle::GetNumberOfWheels() const { return m_numberOfWheels; } void CPACSAxle::SetNumberOfWheels(const int& value) { m_numberOfWheels = value; } const CPACSAxle_sideOfFirstWheel& CPACSAxle::GetSideOfFirstWheel() const { return m_sideOfFirstWheel; } void CPACSAxle::SetSideOfFirstWheel(const CPACSAxle_sideOfFirstWheel& value) { m_sideOfFirstWheel = value; } const CPACSWheel& CPACSAxle::GetWheel() const { return m_wheel; } CPACSWheel& CPACSAxle::GetWheel() { return m_wheel; } } // namespace generated } // namespace tigl
{ "content_hash": "bf821b89f7fbdd8977fa0af71cc5d8aa", "timestamp": "", "source": "github", "line_count": 228, "max_line_length": 144, "avg_line_length": 31.07017543859649, "alnum_prop": 0.5957086391869001, "repo_name": "DLR-SC/tigl", "id": "808ef7dbfa693e73e65a521444ea66d67b426574", "size": "8075", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/generated/CPACSAxle.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5617" }, { "name": "C", "bytes": "307361" }, { "name": "C++", "bytes": "3813493" }, { "name": "CMake", "bytes": "274651" }, { "name": "GLSL", "bytes": "15750" }, { "name": "Java", "bytes": "165629" }, { "name": "JavaScript", "bytes": "5338" }, { "name": "Makefile", "bytes": "247" }, { "name": "Python", "bytes": "237583" }, { "name": "SWIG", "bytes": "49596" }, { "name": "Shell", "bytes": "12988" } ], "symlink_target": "" }
title: Login description: This tutorial demonstrates how to integrate Lock in your iOS Swift project in order to present a login screen. budicon: 448 --- This multi-step quickstart guide will walk you through managing authentication in your iOS apps with Auth0. ## Sample Projects Each tutorial in the series includes a link to its corresponding sample project, which demonstrates how to achieve the tutorial's goal. You can find all the samples [here](https://github.com/auth0-samples/auth0-ios-swift-sample/). ## Dependencies Each tutorial will require you to use either [Lock](https://github.com/auth0/Lock.iOS-OSX) or the [Auth0.swift](https://github.com/auth0/Auth0.swift) toolkit, or both. A brief description: - [**Lock**](https://github.com/auth0/Lock.iOS-OSX) is a widget that is easy to present in your app. It contains default templates (that can be customized) for login with email/password, signup, social providers integration, and password recovery. - [**Auth0.swift**](https://github.com/auth0/Auth0.swift) is a toolkit that lets you communicate efficiently with many of the basic [Auth0 API](/api/info) functions. ::: panel-info Universal Links Because universal links establish a *verified relationship between domains and applications*, both your Auth0 Client settings and your iOS application need to be in sync. You can view instructions on setting up universal links [here](/clients/enable-universal-links). ::: #### Carthage If you are using Carthage, add the following lines to your `Cartfile`: ```ruby github "auth0/Lock.iOS-OSX" ~> 2.0 github "auth0/Auth0.swift" ~> 1.2 ``` Then run `carthage bootstrap`. > For more information about Carthage usage, check [their official documentation](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). #### Cocoapods If you are using [Cocoapods](https://cocoapods.org/), add these lines to your `Podfile`: ```ruby use_frameworks! pod 'Lock', '~> 2.0' pod 'Auth0', '~> 1.2' ``` Then, run `pod install`. > For further reference on Cocoapods, check [their official documentation](http://guides.cocoapods.org/using/getting-started.html). <%= include('../../_includes/_new_app') %> <%= include('_includes/_config') %> <%= include('../../_includes/_package', { org: 'auth0-samples', repo: 'auth0-ios-swift-v2-sample', path: '01-Login', requirements: [ 'CocoaPods 1.1.1', 'Version 8.2 (8C38)', 'iPhone 6 - iOS 10.2 (14C89)' ] }) %> <%= include('_includes/_login') %>
{ "content_hash": "d9caef4808a3a45f6f146b883880568d", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 267, "avg_line_length": 37.25373134328358, "alnum_prop": 0.7271634615384616, "repo_name": "Annyv2/docs", "id": "7242157efd4ff645f11ad44d3d4bd18e362b59cb", "size": "2500", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "articles/native-platforms/ios-swift/01-login.md", "mode": "33188", "license": "mit", "language": [ { "name": "GCC Machine Description", "bytes": "6824" }, { "name": "HTML", "bytes": "48270" }, { "name": "JavaScript", "bytes": "2044" }, { "name": "Shell", "bytes": "1549" } ], "symlink_target": "" }
using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Input; namespace SqlServerRunnerNet.Controls.Common { public static class VirtualToggleButton { #region attached properties #region IsChecked /// <summary> /// IsChecked Attached Dependency Property /// </summary> public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.RegisterAttached("IsChecked", typeof(bool?), typeof(VirtualToggleButton), new FrameworkPropertyMetadata((bool?)false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal, OnIsCheckedChanged)); /// <summary> /// Gets the IsChecked property. This dependency property /// indicates whether the toggle button is checked. /// </summary> public static bool? GetIsChecked(DependencyObject d) { return (bool?)d.GetValue(IsCheckedProperty); } /// <summary> /// Sets the IsChecked property. This dependency property /// indicates whether the toggle button is checked. /// </summary> public static void SetIsChecked(DependencyObject d, bool? value) { d.SetValue(IsCheckedProperty, value); } /// <summary> /// Handles changes to the IsChecked property. /// </summary> private static void OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var pseudobutton = d as UIElement; if (pseudobutton != null) { var newValue = (bool?)e.NewValue; if (newValue == true) { RaiseCheckedEvent(pseudobutton); } else if (newValue == false) { RaiseUncheckedEvent(pseudobutton); } else { RaiseIndeterminateEvent(pseudobutton); } } } #endregion #region IsThreeState /// <summary> /// IsThreeState Attached Dependency Property /// </summary> public static readonly DependencyProperty IsThreeStateProperty = DependencyProperty.RegisterAttached("IsThreeState", typeof(bool), typeof(VirtualToggleButton), new FrameworkPropertyMetadata(false)); /// <summary> /// Gets the IsThreeState property. This dependency property /// indicates whether the control supports two or three states. /// IsChecked can be set to null as a third state when IsThreeState is true. /// </summary> public static bool GetIsThreeState(DependencyObject d) { return (bool)d.GetValue(IsThreeStateProperty); } /// <summary> /// Sets the IsThreeState property. This dependency property /// indicates whether the control supports two or three states. /// IsChecked can be set to null as a third state when IsThreeState is true. /// </summary> public static void SetIsThreeState(DependencyObject d, bool value) { d.SetValue(IsThreeStateProperty, value); } #endregion #region IsVirtualToggleButton /// <summary> /// IsVirtualToggleButton Attached Dependency Property /// </summary> public static readonly DependencyProperty IsVirtualToggleButtonProperty = DependencyProperty.RegisterAttached("IsVirtualToggleButton", typeof(bool), typeof(VirtualToggleButton), new FrameworkPropertyMetadata(false, OnIsVirtualToggleButtonChanged)); /// <summary> /// Gets the IsVirtualToggleButton property. This dependency property /// indicates whether the object to which the property is attached is treated as a VirtualToggleButton. /// If true, the object will respond to keyboard and mouse input the same way a ToggleButton would. /// </summary> public static bool GetIsVirtualToggleButton(DependencyObject d) { return (bool)d.GetValue(IsVirtualToggleButtonProperty); } /// <summary> /// Sets the IsVirtualToggleButton property. This dependency property /// indicates whether the object to which the property is attached is treated as a VirtualToggleButton. /// If true, the object will respond to keyboard and mouse input the same way a ToggleButton would. /// </summary> public static void SetIsVirtualToggleButton(DependencyObject d, bool value) { d.SetValue(IsVirtualToggleButtonProperty, value); } /// <summary> /// Handles changes to the IsVirtualToggleButton property. /// </summary> private static void OnIsVirtualToggleButtonChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var element = d as IInputElement; if (element != null) { if ((bool)e.NewValue) { element.MouseLeftButtonDown += OnMouseLeftButtonDown; element.KeyDown += OnKeyDown; } else { element.MouseLeftButtonDown -= OnMouseLeftButtonDown; element.KeyDown -= OnKeyDown; } } } #endregion #endregion #region routed events #region Checked /// <summary> /// A static helper method to raise the Checked event on a target element. /// </summary> /// <param name="target">UIElement or ContentElement on which to raise the event</param> internal static RoutedEventArgs RaiseCheckedEvent(UIElement target) { if (target == null) return null; var args = new RoutedEventArgs {RoutedEvent = ToggleButton.CheckedEvent}; RaiseEvent(target, args); return args; } #endregion #region Unchecked /// <summary> /// A static helper method to raise the Unchecked event on a target element. /// </summary> /// <param name="target">UIElement or ContentElement on which to raise the event</param> internal static RoutedEventArgs RaiseUncheckedEvent(UIElement target) { if (target == null) return null; var args = new RoutedEventArgs {RoutedEvent = ToggleButton.UncheckedEvent}; RaiseEvent(target, args); return args; } #endregion #region Indeterminate /// <summary> /// A static helper method to raise the Indeterminate event on a target element. /// </summary> /// <param name="target">UIElement or ContentElement on which to raise the event</param> internal static RoutedEventArgs RaiseIndeterminateEvent(UIElement target) { if (target == null) return null; var args = new RoutedEventArgs {RoutedEvent = ToggleButton.IndeterminateEvent}; RaiseEvent(target, args); return args; } #endregion #endregion #region private methods private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; UpdateIsChecked(sender as DependencyObject); } private static void OnKeyDown(object sender, KeyEventArgs e) { if (e.OriginalSource == sender) { if (e.Key == Key.Space) { // ignore alt+space which invokes the system menu if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) return; UpdateIsChecked(sender as DependencyObject); e.Handled = true; } else if (e.Key == Key.Enter && (bool)((DependencyObject) sender).GetValue(KeyboardNavigation.AcceptsReturnProperty)) { UpdateIsChecked(sender as DependencyObject); e.Handled = true; } } } private static void UpdateIsChecked(DependencyObject d) { bool? isChecked = GetIsChecked(d); if (isChecked == true) { SetIsChecked(d, GetIsThreeState(d) ? (bool?)null : false); } else { SetIsChecked(d, isChecked.HasValue); } } private static void RaiseEvent(DependencyObject target, RoutedEventArgs args) { if (target is UIElement) { (target as UIElement).RaiseEvent(args); } else if (target is ContentElement) { (target as ContentElement).RaiseEvent(args); } } #endregion } }
{ "content_hash": "3fa2b792ef0ff94b257b9fa1cf55bd61", "timestamp": "", "source": "github", "line_count": 263, "max_line_length": 120, "avg_line_length": 28.250950570342205, "alnum_prop": 0.713593539703903, "repo_name": "kosmakoff/SqlRunnerNet", "id": "7ece47367008359cc7e25dce7c3d77ff025e31cd", "size": "7432", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SqlServerRunnerNet/Controls/Common/VirtualToggleButton.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "103122" } ], "symlink_target": "" }
package org.kuali.rice.krad.uif.field; import org.kuali.rice.krad.uif.component.Component; import org.kuali.rice.krad.uif.element.Label; import org.kuali.rice.krad.uif.element.Message; import org.kuali.rice.krad.uif.service.ViewHelperService; import org.kuali.rice.krad.uif.view.View; import org.junit.Test; import static junit.framework.Assert.*; import static org.mockito.Mockito.*; /** * test various FieldBase methods * @author Kuali Rice Team (rice.collab@kuali.org) */ public class FieldBaseTest { @Test /** * Tests rendering on required messages * * @see KULRICE-7130 */ public void testRequiredMessageDisplay() { // create mock objects for view, view helper service, model, and component View mockView = mock(View.class); ViewHelperService mockViewHelperService = mock(ViewHelperService.class); when(mockView.getViewHelperService()).thenReturn(mockViewHelperService); Object nullModel = null; Component mockComponent = mock(Component.class); // build asterisk required message and mock label to test rendering Label mockLabel = mock(Label.class); Message requiredMessage = new Message(); requiredMessage.setMessageText("*"); requiredMessage.setRender(true); when(mockLabel.getRequiredMessage()).thenReturn(requiredMessage); try { FieldBase fieldBase = new FieldBase(); fieldBase.setFieldLabel(mockLabel); fieldBase.setRequired(true); // required and not readonly - render fieldBase.setReadOnly(false); fieldBase.performFinalize(mockView, nullModel, mockComponent); assertTrue(fieldBase.getFieldLabel().getRequiredMessage().isRender()); // required and readonly - do not render fieldBase.setReadOnly(true); fieldBase.performFinalize(mockView, nullModel, mockComponent); assertFalse(fieldBase.getFieldLabel().getRequiredMessage().isRender()); } catch(Exception ex) { fail("Unit Test Exception - " + ex.getMessage()); } } }
{ "content_hash": "35ae0aaaad4a58a2bebcd5a7d1aac049", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 83, "avg_line_length": 34.596774193548384, "alnum_prop": 0.6764568764568765, "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "id": "0bfb8e8bbd2983dbe6829c4eeace79b4af31e852", "size": "2766", "binary": false, "copies": "1", "ref": "refs/heads/development", "path": "rice-framework/krad-web-framework/src/test/java/org/kuali/rice/krad/uif/field/FieldBaseTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "542248" }, { "name": "Groovy", "bytes": "2403552" }, { "name": "HTML", "bytes": "3275928" }, { "name": "Java", "bytes": "30805440" }, { "name": "JavaScript", "bytes": "2486893" }, { "name": "PHP", "bytes": "15766" }, { "name": "PLSQL", "bytes": "108325" }, { "name": "SQLPL", "bytes": "51212" }, { "name": "Shell", "bytes": "1808" }, { "name": "XSLT", "bytes": "109576" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <title>Thumbnail Structure Reference</title> <link rel="stylesheet" type="text/css" href="../../css/jazzy.css" /> <link rel="stylesheet" type="text/css" href="../../css/highlight.css" /> <meta charset="utf-8"> <script src="../../js/jquery.min.js" defer></script> <script src="../../js/jazzy.js" defer></script> <script src="../../js/lunr.min.js" defer></script> <script src="../../js/typeahead.jquery.js" defer></script> <script src="../../js/jazzy.search.js" defer></script> </head> <body> <a name="//apple_ref/swift/Struct/Thumbnail" class="dashAnchor"></a> <a title="Thumbnail Structure Reference"></a> <header class="header"> <p class="header-col header-col--primary"> <a class="header-link" href="../../index.html"> SwiftDiscord Docs </a> (100% documented) </p> <p class="header-col--secondary"> <form role="search" action="../../search.json"> <input type="text" placeholder="Search documentation" data-typeahead> </form> </p> </header> <p class="breadcrumbs"> <a class="breadcrumb" href="../../index.html">SwiftDiscord Reference</a> <img class="carat" src="../../img/carat.png" /> Thumbnail Structure Reference </p> <div class="content-wrapper"> <nav class="navigation"> <ul class="nav-groups"> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Guides.html">Guides</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../getting-started.html">Getting Started</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../installing-swiftdiscord-for-ios.html">Installing SwiftDiscord for iOS</a> </li> </ul> </li> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Classes.html">Classes</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordAuditLog.html">DiscordAuditLog</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordBufferedVoiceDataSource.html">DiscordBufferedVoiceDataSource</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordClient.html">DiscordClient</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordEncoderMiddleware.html">DiscordEncoderMiddleware</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordEngine.html">DiscordEngine</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordGuild.html">DiscordGuild</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordLazyValue.html">DiscordLazyValue</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordOpusDecoder.html">DiscordOpusDecoder</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordOpusEncoder.html">DiscordOpusEncoder</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordRateLimiter.html">DiscordRateLimiter</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordShardManager.html">DiscordShardManager</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordSilenceVoiceDataSource.html">DiscordSilenceVoiceDataSource</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordVoiceEngine.html">DiscordVoiceEngine</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordVoiceFileDataSource.html">DiscordVoiceFileDataSource</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordVoiceManager.html">DiscordVoiceManager</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Classes/DiscordVoiceSessionDecoder.html">DiscordVoiceSessionDecoder</a> </li> </ul> </li> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Enums.html">Enumerations</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordActivityType.html">DiscordActivityType</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordAuditLogActionType.html">DiscordAuditLogActionType</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordChannelType.html">DiscordChannelType</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordClientOption.html">DiscordClientOption</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordDispatchEvent.html">DiscordDispatchEvent</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordEndpoint.html">DiscordEndpoint</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordEndpoint/EndpointRequest.html">– EndpointRequest</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordEndpoint/Options.html">– Options</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordGatewayCloseReason.html">DiscordGatewayCloseReason</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordGatewayCode.html">DiscordGatewayCode</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordGatewayPayloadData.html">DiscordGatewayPayloadData</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordHeader.html">DiscordHeader</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordLogLevel.html">DiscordLogLevel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordNormalGatewayCode.html">DiscordNormalGatewayCode</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordOAuthEndpoint.html">DiscordOAuthEndpoint</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordPermissionOverwriteType.html">DiscordPermissionOverwriteType</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordPresenceStatus.html">DiscordPresenceStatus</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordVoiceDataSourceStatus.html">DiscordVoiceDataSourceStatus</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordVoiceError.html">DiscordVoiceError</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/DiscordVoiceGatewayCode.html">DiscordVoiceGatewayCode</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Enums/HTTPContent.html">HTTPContent</a> </li> </ul> </li> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Protocols.html">Protocols</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordChannel.html">DiscordChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordClientDelegate.html">DiscordClientDelegate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordClientHolder.html">DiscordClientHolder</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordClientSpec.html">DiscordClientSpec</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordDispatchEventHandler.html">DiscordDispatchEventHandler</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordEndpointConsumer.html">DiscordEndpointConsumer</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordEngineHeartbeatable.html">DiscordEngineHeartbeatable</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordEngineSpec.html">DiscordEngineSpec</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordGatewayable.html">DiscordGatewayable</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordGuildChannel.html">DiscordGuildChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordLogger.html">DiscordLogger</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordOpusCodeable.html">DiscordOpusCodeable</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordRateLimiterSpec.html">DiscordRateLimiterSpec</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordShard.html">DiscordShard</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordShardDelegate.html">DiscordShardDelegate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordShardManagerDelegate.html">DiscordShardManagerDelegate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordTextChannel.html">DiscordTextChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordTokenBearer.html">DiscordTokenBearer</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordUserActor.html">DiscordUserActor</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordVoiceDataSource.html">DiscordVoiceDataSource</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordVoiceEngineDelegate.html">DiscordVoiceEngineDelegate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordVoiceEngineSpec.html">DiscordVoiceEngineSpec</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordVoiceManagerDelegate.html">DiscordVoiceManagerDelegate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Protocols/DiscordWebSocketable.html">DiscordWebSocketable</a> </li> </ul> </li> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Structs.html">Structures</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordActivity.html">DiscordActivity</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordActivityAssets.html">DiscordActivityAssets</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordActivityTimestamps.html">DiscordActivityTimestamps</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordAttachment.html">DiscordAttachment</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordAuditLogChange.html">DiscordAuditLogChange</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordAuditLogEntry.html">DiscordAuditLogEntry</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordBan.html">DiscordBan</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordDMChannel.html">DiscordDMChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed.html">DiscordEmbed</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Author.html">– Author</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Field.html">– Field</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Footer.html">– Footer</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Image.html">– Image</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Provider.html">– Provider</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Thumbnail.html">– Thumbnail</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmbed/Video.html">– Video</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordEmoji.html">DiscordEmoji</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordFileUpload.html">DiscordFileUpload</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGatewayPayload.html">DiscordGatewayPayload</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGroupDMChannel.html">DiscordGroupDMChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGuildChannelCategory.html">DiscordGuildChannelCategory</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGuildMember.html">DiscordGuildMember</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGuildTextChannel.html">DiscordGuildTextChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordGuildVoiceChannel.html">DiscordGuildVoiceChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordInvite.html">DiscordInvite</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordInviteChannel.html">DiscordInviteChannel</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordInviteGuild.html">DiscordInviteGuild</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordLazyDictionary.html">DiscordLazyDictionary</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordLazyDictionaryIndex.html">DiscordLazyDictionaryIndex</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordMessage.html">DiscordMessage</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordMessage/MessageType.html">– MessageType</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordMessage/MessageActivity.html">– MessageActivity</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordMessage/MessageApplication.html">– MessageApplication</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordOpusVoiceData.html">DiscordOpusVoiceData</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordParty.html">DiscordParty</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordPermission.html">DiscordPermission</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordPermissionOverwrite.html">DiscordPermissionOverwrite</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordPresence.html">DiscordPresence</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordPresenceUpdate.html">DiscordPresenceUpdate</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordRateLimitKey.html">DiscordRateLimitKey</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordRateLimitKey/DiscordRateLimitURLParts.html">– DiscordRateLimitURLParts</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordRawVoiceData.html">DiscordRawVoiceData</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordReaction.html">DiscordReaction</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordRole.html">DiscordRole</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordShardInformation.html">DiscordShardInformation</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordShardInformation/ShardingError.html">– ShardingError</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordToken.html">DiscordToken</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordUser.html">DiscordUser</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordUserGuild.html">DiscordUserGuild</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordVoiceEngineConfiguration.html">DiscordVoiceEngineConfiguration</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordVoiceServerInformation.html">DiscordVoiceServerInformation</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordVoiceState.html">DiscordVoiceState</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/DiscordWebhook.html">DiscordWebhook</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Structs/Snowflake.html">Snowflake</a> </li> </ul> </li> <li class="nav-group-name"> <a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord12AttachmentIDa">AttachmentID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord9ChannelIDa">ChannelID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord7EmojiIDa">EmojiID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord7GuildIDa">GuildID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord13IntegrationIDa">IntegrationID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord9MessageIDa">MessageID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord11OverwriteIDa">OverwriteID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord6RoleIDa">RoleID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord6UserIDa">UserID</a> </li> <li class="nav-group-task"> <a class="nav-group-task-link" href="../../Typealiases.html#/s:12SwiftDiscord9WebhookIDa">WebhookID</a> </li> </ul> </li> </ul> </nav> <article class="main-content"> <section class="section"> <div class="section-content"> <h1>Thumbnail</h1> <div class="declaration"> <div class="language"> <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Thumbnail</span> <span class="p">:</span> <span class="kt">Encodable</span></code></pre> </div> </div> <p>Represents the thumbnail of an embed.</p> </div> </section> <section class="section"> <div class="section-content"> <div class="task-group"> <div class="task-name-container"> <a name="/Properties"></a> <a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a> <a href="#/Properties"> <h3 class="section-name">Properties</h3> </a> </div> <ul class="item-container"> <li class="item"> <div> <code> <a name="/s:12SwiftDiscord0B5EmbedV9ThumbnailV6heightSivp"></a> <a name="//apple_ref/swift/Property/height" class="dashAnchor"></a> <a class="token" href="#/s:12SwiftDiscord0B5EmbedV9ThumbnailV6heightSivp">height</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>The height of this image.</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">height</span><span class="p">:</span> <span class="kt">Int</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:12SwiftDiscord0B5EmbedV9ThumbnailV8proxyUrl10Foundation3URLVSgvp"></a> <a name="//apple_ref/swift/Property/proxyUrl" class="dashAnchor"></a> <a class="token" href="#/s:12SwiftDiscord0B5EmbedV9ThumbnailV8proxyUrl10Foundation3URLVSgvp">proxyUrl</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>The proxy url for this image.</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">proxyUrl</span><span class="p">:</span> <span class="kt">URL</span><span class="p">?</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:12SwiftDiscord0B5EmbedV9ThumbnailV3url10Foundation3URLVvp"></a> <a name="//apple_ref/swift/Property/url" class="dashAnchor"></a> <a class="token" href="#/s:12SwiftDiscord0B5EmbedV9ThumbnailV3url10Foundation3URLVvp">url</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>The url for this image.</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">url</span><span class="p">:</span> <span class="kt">URL</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:12SwiftDiscord0B5EmbedV9ThumbnailV5widthSivp"></a> <a name="//apple_ref/swift/Property/width" class="dashAnchor"></a> <a class="token" href="#/s:12SwiftDiscord0B5EmbedV9ThumbnailV5widthSivp">width</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>The width of this image.</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">width</span><span class="p">:</span> <span class="kt">Int</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:12SwiftDiscord0B5EmbedV9ThumbnailV3urlAE10Foundation3URLV_tcfc"></a> <a name="//apple_ref/swift/Method/init(url:)" class="dashAnchor"></a> <a class="token" href="#/s:12SwiftDiscord0B5EmbedV9ThumbnailV3urlAE10Foundation3URLV_tcfc">init(url:)</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Creates a Thumbnail object.</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">URL</span><span class="p">)</span></code></pre> </div> </div> <div> <h4>Parameters</h4> <table class="graybox"> <tbody> <tr> <td> <code> <em>url</em> </code> </td> <td> <div> <p>The url for this field</p> </div> </td> </tr> </tbody> </table> </div> </section> </div> </li> </ul> </div> </div> </section> </article> </div> <section class="footer"> <p>&copy; 2018 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2018-06-21)</p> <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p> </section> </body> </div> </html>
{ "content_hash": "cf3121b2c6208049985e360490a0aea3", "timestamp": "", "source": "github", "line_count": 654, "max_line_length": 260, "avg_line_length": 52.73853211009175, "alnum_prop": 0.5060160621611435, "repo_name": "nuclearace/SwiftDiscord", "id": "665a60a806cae4788cc12e7ff3a775da085b279e", "size": "34523", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/Structs/DiscordEmbed/Thumbnail.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2782" }, { "name": "Shell", "bytes": "745" }, { "name": "Swift", "bytes": "527730" } ], "symlink_target": "" }
Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("")> <Assembly: AssemblyCopyright("Copyright © 2014")> <Assembly: AssemblyTrademark("")> <Assembly: ComVisible(False)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("a5678baf-72a8-452c-b140-de5204964cb1")> ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: <Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyFileVersion("1.0.0.0")>
{ "content_hash": "352b67bb90141dbfe56e21a6af2e3541", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 83, "avg_line_length": 31.294117647058822, "alnum_prop": 0.7509398496240601, "repo_name": "ljw1004/blog", "id": "98407739070328543a3b4e4589d6f385f59b8497", "size": "1067", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VSIX/dotnet-code-analyzer/Analyzer_XamlTips/My Project/AssemblyInfo.vb", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2211" }, { "name": "C", "bytes": "375755" }, { "name": "C#", "bytes": "1291052" }, { "name": "C++", "bytes": "1116300" }, { "name": "CSS", "bytes": "2345" }, { "name": "HTML", "bytes": "247309" }, { "name": "Objective-C", "bytes": "33720" }, { "name": "PowerShell", "bytes": "3687" }, { "name": "Visual Basic", "bytes": "861451" } ], "symlink_target": "" }
import {Inject, Injectable, InjectionToken} from '@angular/core'; import {Options} from '../common_options'; import {Metric} from '../metric'; import {PerfLogEvent, PerfLogFeatures, WebDriverExtension} from '../web_driver_extension'; /** * A metric that reads out the performance log */ @Injectable() export class PerflogMetric extends Metric { static SET_TIMEOUT = new InjectionToken('PerflogMetric.setTimeout'); static IGNORE_NAVIGATION = new InjectionToken('PerflogMetric.ignoreNavigation'); static PROVIDERS = [ { provide: PerflogMetric, deps: [ WebDriverExtension, PerflogMetric.SET_TIMEOUT, Options.MICRO_METRICS, Options.FORCE_GC, Options.CAPTURE_FRAMES, Options.RECEIVED_DATA, Options.REQUEST_COUNT, PerflogMetric.IGNORE_NAVIGATION ] }, { provide: PerflogMetric.SET_TIMEOUT, useValue: (fn: Function, millis: number) => <any>setTimeout(fn, millis) }, {provide: PerflogMetric.IGNORE_NAVIGATION, useValue: false} ]; private _remainingEvents: PerfLogEvent[]; private _measureCount: number; private _perfLogFeatures: PerfLogFeatures; /** * @param driverExtension * @param setTimeout * @param microMetrics Name and description of metrics provided via console.time / console.timeEnd * @param ignoreNavigation If true, don't measure from navigationStart events. These events are * usually triggered by a page load, but can also be triggered when adding iframes to the DOM. **/ constructor( private _driverExtension: WebDriverExtension, @Inject(PerflogMetric.SET_TIMEOUT) private _setTimeout: Function, @Inject(Options.MICRO_METRICS) private _microMetrics: {[key: string]: string}, @Inject(Options.FORCE_GC) private _forceGc: boolean, @Inject(Options.CAPTURE_FRAMES) private _captureFrames: boolean, @Inject(Options.RECEIVED_DATA) private _receivedData: boolean, @Inject(Options.REQUEST_COUNT) private _requestCount: boolean, @Inject(PerflogMetric.IGNORE_NAVIGATION) private _ignoreNavigation: boolean) { super(); this._remainingEvents = []; this._measureCount = 0; this._perfLogFeatures = _driverExtension.perfLogFeatures(); if (!this._perfLogFeatures.userTiming) { // User timing is needed for navigationStart. this._receivedData = false; this._requestCount = false; } } describe(): {[key: string]: string} { const res: {[key: string]: any} = { 'scriptTime': 'script execution time in ms, including gc and render', 'pureScriptTime': 'script execution time in ms, without gc nor render' }; if (this._perfLogFeatures.render) { res['renderTime'] = 'render time in ms'; } if (this._perfLogFeatures.gc) { res['gcTime'] = 'gc time in ms'; res['gcAmount'] = 'gc amount in kbytes'; res['majorGcTime'] = 'time of major gcs in ms'; if (this._forceGc) { res['forcedGcTime'] = 'forced gc time in ms'; res['forcedGcAmount'] = 'forced gc amount in kbytes'; } } if (this._receivedData) { res['receivedData'] = 'encoded bytes received since navigationStart'; } if (this._requestCount) { res['requestCount'] = 'count of requests sent since navigationStart'; } if (this._captureFrames) { if (!this._perfLogFeatures.frameCapture) { const warningMsg = 'WARNING: Metric requested, but not supported by driver'; // using dot syntax for metric name to keep them grouped together in console reporter res['frameTime.mean'] = warningMsg; res['frameTime.worst'] = warningMsg; res['frameTime.best'] = warningMsg; res['frameTime.smooth'] = warningMsg; } else { res['frameTime.mean'] = 'mean frame time in ms (target: 16.6ms for 60fps)'; res['frameTime.worst'] = 'worst frame time in ms'; res['frameTime.best'] = 'best frame time in ms'; res['frameTime.smooth'] = 'percentage of frames that hit 60fps'; } } for (const name in this._microMetrics) { res[name] = this._microMetrics[name]; } return res; } beginMeasure(): Promise<any> { let resultPromise = Promise.resolve(null); if (this._forceGc) { resultPromise = resultPromise.then((_) => this._driverExtension.gc()); } return resultPromise.then((_) => this._beginMeasure()); } endMeasure(restart: boolean): Promise<{[key: string]: number}> { if (this._forceGc) { return this._endPlainMeasureAndMeasureForceGc(restart); } else { return this._endMeasure(restart); } } /** @internal */ private _endPlainMeasureAndMeasureForceGc(restartMeasure: boolean) { return this._endMeasure(true).then((measureValues) => { // disable frame capture for measurements during forced gc const originalFrameCaptureValue = this._captureFrames; this._captureFrames = false; return this._driverExtension.gc() .then((_) => this._endMeasure(restartMeasure)) .then((forceGcMeasureValues) => { this._captureFrames = originalFrameCaptureValue; measureValues['forcedGcTime'] = forceGcMeasureValues['gcTime']; measureValues['forcedGcAmount'] = forceGcMeasureValues['gcAmount']; return measureValues; }); }); } private _beginMeasure(): Promise<any> { return this._driverExtension.timeBegin(this._markName(this._measureCount++)); } private _endMeasure(restart: boolean): Promise<{[key: string]: number}> { const markName = this._markName(this._measureCount - 1); const nextMarkName = restart ? this._markName(this._measureCount++) : null; return this._driverExtension.timeEnd(markName, nextMarkName) .then((_: any) => this._readUntilEndMark(markName)); } private _readUntilEndMark( markName: string, loopCount: number = 0, startEvent: PerfLogEvent|null = null) { if (loopCount > _MAX_RETRY_COUNT) { throw new Error(`Tried too often to get the ending mark: ${loopCount}`); } return this._driverExtension.readPerfLog().then((events) => { this._addEvents(events); const result = this._aggregateEvents(this._remainingEvents, markName); if (result) { this._remainingEvents = events; return result; } let resolve: (result: any) => void; const promise = new Promise<{[key: string]: number}>(res => { resolve = res; }); this._setTimeout(() => resolve(this._readUntilEndMark(markName, loopCount + 1)), 100); return promise; }); } private _addEvents(events: PerfLogEvent[]) { let needSort = false; events.forEach(event => { if (event['ph'] === 'X') { needSort = true; const startEvent: PerfLogEvent = {}; const endEvent: PerfLogEvent = {}; for (const prop in event) { startEvent[prop] = event[prop]; endEvent[prop] = event[prop]; } startEvent['ph'] = 'B'; endEvent['ph'] = 'E'; endEvent['ts'] = startEvent['ts'] ! + startEvent['dur'] !; this._remainingEvents.push(startEvent); this._remainingEvents.push(endEvent); } else { this._remainingEvents.push(event); } }); if (needSort) { // Need to sort because of the ph==='X' events this._remainingEvents.sort((a, b) => { const diff = a['ts'] ! - b['ts'] !; return diff > 0 ? 1 : diff < 0 ? -1 : 0; }); } } private _aggregateEvents(events: PerfLogEvent[], markName: string): {[key: string]: number}|null { const result: {[key: string]: number} = {'scriptTime': 0, 'pureScriptTime': 0}; if (this._perfLogFeatures.gc) { result['gcTime'] = 0; result['majorGcTime'] = 0; result['gcAmount'] = 0; } if (this._perfLogFeatures.render) { result['renderTime'] = 0; } if (this._captureFrames) { result['frameTime.mean'] = 0; result['frameTime.best'] = 0; result['frameTime.worst'] = 0; result['frameTime.smooth'] = 0; } for (const name in this._microMetrics) { result[name] = 0; } if (this._receivedData) { result['receivedData'] = 0; } if (this._requestCount) { result['requestCount'] = 0; } let markStartEvent: PerfLogEvent = null !; let markEndEvent: PerfLogEvent = null !; events.forEach((event) => { const ph = event['ph']; const name = event['name']; if (ph === 'B' && name === markName) { markStartEvent = event; } else if (ph === 'I' && name === 'navigationStart' && !this._ignoreNavigation) { // if a benchmark measures reload of a page, use the last // navigationStart as begin event markStartEvent = event; } else if (ph === 'E' && name === markName) { markEndEvent = event; } }); if (!markStartEvent || !markEndEvent) { // not all events have been received, no further processing for now return null; } let gcTimeInScript = 0; let renderTimeInScript = 0; const frameTimestamps: number[] = []; const frameTimes: number[] = []; let frameCaptureStartEvent: PerfLogEvent|null = null; let frameCaptureEndEvent: PerfLogEvent|null = null; const intervalStarts: {[key: string]: PerfLogEvent} = {}; const intervalStartCount: {[key: string]: number} = {}; let inMeasureRange = false; events.forEach((event) => { const ph = event['ph']; let name = event['name'] !; let microIterations = 1; const microIterationsMatch = name.match(_MICRO_ITERATIONS_REGEX); if (microIterationsMatch) { name = microIterationsMatch[1]; microIterations = parseInt(microIterationsMatch[2], 10); } if (event === markStartEvent) { inMeasureRange = true; } else if (event === markEndEvent) { inMeasureRange = false; } if (!inMeasureRange || event['pid'] !== markStartEvent['pid']) { return; } if (this._requestCount && name === 'sendRequest') { result['requestCount'] += 1; } else if (this._receivedData && name === 'receivedData' && ph === 'I') { result['receivedData'] += event['args'] !['encodedDataLength'] !; } if (ph === 'B' && name === _MARK_NAME_FRAME_CAPTURE) { if (frameCaptureStartEvent) { throw new Error('can capture frames only once per benchmark run'); } if (!this._captureFrames) { throw new Error( 'found start event for frame capture, but frame capture was not requested in benchpress'); } frameCaptureStartEvent = event; } else if (ph === 'E' && name === _MARK_NAME_FRAME_CAPTURE) { if (!frameCaptureStartEvent) { throw new Error('missing start event for frame capture'); } frameCaptureEndEvent = event; } if (ph === 'I' && frameCaptureStartEvent && !frameCaptureEndEvent && name === 'frame') { frameTimestamps.push(event['ts'] !); if (frameTimestamps.length >= 2) { frameTimes.push( frameTimestamps[frameTimestamps.length - 1] - frameTimestamps[frameTimestamps.length - 2]); } } if (ph === 'B') { if (!intervalStarts[name]) { intervalStartCount[name] = 1; intervalStarts[name] = event; } else { intervalStartCount[name]++; } } else if ((ph === 'E') && intervalStarts[name]) { intervalStartCount[name]--; if (intervalStartCount[name] === 0) { const startEvent = intervalStarts[name]; const duration = (event['ts'] ! - startEvent['ts'] !); intervalStarts[name] = null !; if (name === 'gc') { result['gcTime'] += duration; const amount = (startEvent['args'] !['usedHeapSize'] ! - event['args'] !['usedHeapSize'] !) / 1000; result['gcAmount'] += amount; const majorGc = event['args'] !['majorGc']; if (majorGc && majorGc) { result['majorGcTime'] += duration; } if (intervalStarts['script']) { gcTimeInScript += duration; } } else if (name === 'render') { result['renderTime'] += duration; if (intervalStarts['script']) { renderTimeInScript += duration; } } else if (name === 'script') { result['scriptTime'] += duration; } else if (this._microMetrics[name]) { (<any>result)[name] += duration / microIterations; } } } }); if (frameCaptureStartEvent && !frameCaptureEndEvent) { throw new Error('missing end event for frame capture'); } if (this._captureFrames && !frameCaptureStartEvent) { throw new Error('frame capture requested in benchpress, but no start event was found'); } if (frameTimes.length > 0) { this._addFrameMetrics(result, frameTimes); } result['pureScriptTime'] = result['scriptTime'] - gcTimeInScript - renderTimeInScript; return result; } private _addFrameMetrics(result: {[key: string]: number}, frameTimes: any[]) { result['frameTime.mean'] = frameTimes.reduce((a, b) => a + b, 0) / frameTimes.length; const firstFrame = frameTimes[0]; result['frameTime.worst'] = frameTimes.reduce((a, b) => a > b ? a : b, firstFrame); result['frameTime.best'] = frameTimes.reduce((a, b) => a < b ? a : b, firstFrame); result['frameTime.smooth'] = frameTimes.filter(t => t < _FRAME_TIME_SMOOTH_THRESHOLD).length / frameTimes.length; } private _markName(index: number) { return `${_MARK_NAME_PREFIX}${index}`; } } const _MICRO_ITERATIONS_REGEX = /(.+)\*(\d+)$/; const _MAX_RETRY_COUNT = 20; const _MARK_NAME_PREFIX = 'benchpress'; const _MARK_NAME_FRAME_CAPTURE = 'frameCapture'; // using 17ms as a somewhat looser threshold, instead of 16.6666ms const _FRAME_TIME_SMOOTH_THRESHOLD = 17;
{ "content_hash": "9aa1e5128c104061b7e826c649d04b47", "timestamp": "", "source": "github", "line_count": 378, "max_line_length": 104, "avg_line_length": 37.16931216931217, "alnum_prop": 0.6086832740213524, "repo_name": "meeroslav/angular", "id": "033c1b6da522b876044bfe90182b996d0e0ecfd3", "size": "14252", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "packages/benchpress/src/metric/perflog_metric.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "289331" }, { "name": "Dart", "bytes": "2872" }, { "name": "HTML", "bytes": "284657" }, { "name": "JavaScript", "bytes": "489069" }, { "name": "Shell", "bytes": "74986" }, { "name": "TypeScript", "bytes": "7398844" } ], "symlink_target": "" }
package de.iritgo.aktario.jdbc; import de.iritgo.aktario.core.plugin.Plugin; import de.iritgo.aktario.framework.base.FrameworkPlugin; /** * The persist-jdbc plugin implements persistent methods to be used with * a relational database accessed through JDBC. */ public class JDBCPlugin extends FrameworkPlugin { protected void registerDataObjects() { } protected void registerActions() { } protected void registerGUIPanes() { } protected void registerManagers() { registerManager(Plugin.SERVER, new JDBCManager()); } protected void registerCommands() { registerCommand(new LoadUser()); registerCommand(new LoadAllUsers()); registerCommand(new LoadObject()); registerCommand(new LoadAllObjects()); registerCommand(new StoreUser()); registerCommand(new UpdateObject()); registerCommand(new StoreObject()); registerCommand(new DeleteUser()); registerCommand(new Insert()); registerCommand(new Select()); registerCommand(new GetDatabaseVersion()); registerCommand(new GetDefaultDataSource()); } protected void registerConsoleCommands() { } }
{ "content_hash": "f7dbf6b12c6ab4eb5bfe950f828f9f9d", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 72, "avg_line_length": 21.03846153846154, "alnum_prop": 0.7568555758683729, "repo_name": "iritgo/iritgo-aktario", "id": "6f2796efcc4a03284491b8b30714fd15b9412904", "size": "1826", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aktario-jdbc/src/main/java/de/iritgo/aktario/jdbc/JDBCPlugin.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1859734" }, { "name": "Shell", "bytes": "2297" } ], "symlink_target": "" }
package xmlobject.detailed; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlObject; import org.junit.jupiter.api.Test; import org.tranxml.tranXML.version40.CarLocationMessageDocument; import org.tranxml.tranXML.version40.CityNameDocument.CityName; import org.tranxml.tranXML.version40.ETADocument.ETA; import org.tranxml.tranXML.version40.EventStatusDocument.EventStatus; import org.tranxml.tranXML.version40.GeographicLocationDocument.GeographicLocation; import test.xbean.xmlcursor.purchaseOrder.PurchaseOrderDocument; import xmlcursor.common.Common; import java.math.BigDecimal; import static org.junit.jupiter.api.Assertions.*; import static xmlcursor.common.BasicCursorTestCase.jobj; public class CompareToTest { @Test void testCompareToEquals() throws Exception { CarLocationMessageDocument clmDoc = (CarLocationMessageDocument) jobj(Common.TRANXML_FILE_CLM); EventStatus[] aEventStatus = clmDoc.getCarLocationMessage().getEventStatusArray(); assertTrue(aEventStatus.length > 0, "Unexpected: Missing EventStatus element. Test harness failure."); GeographicLocation gl = aEventStatus[0].getGeographicLocation(); CityName cname0 = gl.getCityName(); ETA eta = aEventStatus[0].getETA(); CityName cname1 = eta.getGeographicLocation().getCityName(); assertTrue(cname0.valueEquals(cname1)); assertThrows(ClassCastException.class, () -> cname0.compareTo(cname1)); } @Test void testCompareToNull() throws Exception { XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM); assertThrows(ClassCastException.class, () -> m_xo.compareTo(null)); } @Test void testCompareToLessThan() throws Exception { PurchaseOrderDocument poDoc = (PurchaseOrderDocument) jobj("xbean/xmlcursor/po.xml"); BigDecimal bdUSPrice0 = poDoc.getPurchaseOrder().getItems().getItemArray(0).getUSPrice(); BigDecimal bdUSPrice1 = poDoc.getPurchaseOrder().getItems().getItemArray(1).getUSPrice(); assertEquals(XmlObject.LESS_THAN, bdUSPrice1.compareTo(bdUSPrice0)); } @Test void testCompareToGreaterThan() throws Exception { PurchaseOrderDocument poDoc = (PurchaseOrderDocument) jobj("xbean/xmlcursor/po.xml"); BigDecimal bdUSPrice0 = poDoc.getPurchaseOrder().getItems().getItemArray(0).getUSPrice(); BigDecimal bdUSPrice1 = poDoc.getPurchaseOrder().getItems().getItemArray(1).getUSPrice(); assertEquals(XmlObject.GREATER_THAN, bdUSPrice0.compareTo(bdUSPrice1)); } @Test void testCompareToString() throws Exception { XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM); assertThrows(ClassCastException.class, () -> m_xo.compareTo("")); } @Test void testCompareValue() throws Exception { XmlObject m_xo = jobj(Common.TRANXML_FILE_CLM); try (XmlCursor m_xc = m_xo.newCursor()) { m_xc.toFirstChild(); XmlObject xo = m_xc.getObject(); assertEquals(XmlObject.NOT_EQUAL, m_xo.compareValue(xo)); } } }
{ "content_hash": "564b4d20e672a1c3b60338959743d778", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 111, "avg_line_length": 40.02597402597402, "alnum_prop": 0.7242050616482804, "repo_name": "apache/xmlbeans", "id": "86767afce393c089582ab324d196eb4f98489d3b", "size": "3711", "binary": false, "copies": "2", "ref": "refs/heads/trunk", "path": "src/test/java/xmlobject/detailed/CompareToTest.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "60552" }, { "name": "CSS", "bytes": "1961" }, { "name": "HTML", "bytes": "2640" }, { "name": "Java", "bytes": "7628118" }, { "name": "Shell", "bytes": "37436" }, { "name": "XQuery", "bytes": "2172" }, { "name": "XS", "bytes": "6502" }, { "name": "XSLT", "bytes": "78459" } ], "symlink_target": "" }
<div class="row"> <div class="=col-md-12"> <div class="menuheader"> Administrare întrebari </div> <div class="row"> <div class="col-xs-4 col-sm-3"> <label class="control-label">Selectaţi modulul</label> <select class="form-control black" ng-model="current.ModulId" ng-change="onModulChange()" ng-options="modul.ID as modul.Numar + '. ' + modul.Nume for modul in module"></select> </div> <div class="col-xs-4 col-sm-3"> <label class="control-label">Selectaţi capitolul</label> <select class="form-control black" ng-model="current.CapitolId" ng-change="onCapitolChange()" ng-options="capitol.ID as capitol.Numar + '. ' + capitol.Nume for capitol in capitole"></select> </div> <div class="col-xs-4 col-sm-3"> <label class="control-label">Selectaţi subcapitolul</label> <select class="form-control black" ng-model="current.SubcapitolId" ng-change="onSubcapitolChange()" ng-options="subcapitol.ID as subcapitol.Numar + '. ' + subcapitol.Nume for subcapitol in subcapitole"></select> </div> </div> <br /> <br /> <button type="button" id="addIntrebare" class="btn btn-success btn-sm" ng-click="onAddIntrebareClick()"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>Adaugă întrebare </button> <br /> <div class="gridStyle" ui-grid="intrebariGridOptions"></div> </div> </div> <!-- Edit Modal --> <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title" id="editModalLabel">Editează întrebare</h4> </div> <div class="modal-body"> <div class="form-group" style="padding-left: 15px;padding-right: 15px"> <div class="row"> <div class="col-xs-12 col-sm-12"> <div class="row"> <label>Este de tip eseu? <input type="checkbox" ng-model="current.Eseu" /></label> </div> <div class="row"> <label class="control-label">Enunţ</label> <textarea aria-multiline="true" class="form-control" name="inputText" type="text" ng-model="current.Text" placeholder="Enunţ" validate-on="blur" required required-message="'Introduceţi un enunţ!'"></textarea> </div> <div ng-if="!current.Eseu"> <div class="row"> <label class="control-label">Varianta 1</label> <textarea class="form-control" name="inputV1" type="text" ng-model="current.V1" placeholder="Varianta 1" validate-on="blur" required required-message="'Introduceţi prima variantă!'"></textarea> </div> <div class="row"> <label class="control-label">Varianta 2</label> <textarea class="form-control" name="inputV2" type="text" ng-model="current.V2" placeholder="Varianta 2" validate-on="blur" required required-message="'Introduceţi a doua variantă!'"></textarea> </div> <div class="row"> <label class="control-label">Varianta 3</label> <textarea class="form-control" name="inputV1" type="text" ng-model="current.V3" placeholder="Varianta 3" validate-on="blur" required required-message="'Introduceţi a treia variantă!'"></textarea> </div> <div class="row"> <label class="control-label">Răspuns</label> <input class="form-control" name="inputV1" type="text" ng-model="current.Raspuns" placeholder="Răspuns(1/2/3)" validate-on="blur" required required-message="'Introduceţi răspunsul!'"> </div> </div> <div class="row"> <label class="control-label">Nivel</label> <select class="form-control black" ng-model="current.Nivel" ng-options="nivel as nivel for nivel in nivele"></select> </div> <br /> <div class="row" ng-hide="!current.Imagine"> <label class="control-label" ng-hide="!current.Imagine">Imagine curentă întrebare</label> <div class="media"> <a class="pull-left" href="#"> <img class="media-object" height="150" ng-src="data:image/png;base64,{{current.Imagine}}" alt="" /> </a> </div> </div> <br /> <div class="row alert alert-warning" ng-hide="current.ID"> Pentru a încărca o imagine trebuie sa salvați întrebarea în prealabil. </div> <div class="row" ng-hide="!current.ID"> <label class="control-label" ng-hide="current.Imagine">Selectaţi imaginea pentru întrebare</label> <label class="control-label" ng-hide="!current.Imagine">Selectaţi altă imagine pentru întrebare</label> <input type="file" class="file addEditImg"> </div> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" ng-click="closeModal()">Închide</button> <button type="button" ng-click="addEditIntrebare()" class="btn btn-primary">Salvează</button> </div> </div> </div> </div>
{ "content_hash": "914281888fc4df2b041fa49cb9eece1e", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 168, "avg_line_length": 64.18518518518519, "alnum_prop": 0.4723023658395845, "repo_name": "mihaibulaicon/RandomTests1", "id": "44849c815df20c463ab28882501b4b5ff2844203", "size": "6970", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RandomTests.Web/Scripts/spa/admin/intrebari/intrebari.html", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "98" }, { "name": "C#", "bytes": "235875" }, { "name": "CSS", "bytes": "76931" }, { "name": "HTML", "bytes": "66523" }, { "name": "JavaScript", "bytes": "283244" }, { "name": "SQLPL", "bytes": "3016" } ], "symlink_target": "" }
namespace SharedUI.Shared { #if ECHOES using System.Windows; using System.Windows.Controls; public partial class MainWindow : Window { public this withController(MainWindowController controller) { DataContext = controller; InitializeComponent(); } private MainWindowController controller { get { return DataContext as MainWindowController; } } // // Forward actions to the controller // private void CalculateResult_Click(object sender, RoutedEventArgs e) { controller.calculateResult(sender); } } #endif }
{ "content_hash": "f53266505ca87919d4608ed0d04c9c6d", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 97, "avg_line_length": 21.22222222222222, "alnum_prop": 0.7085514834205934, "repo_name": "remobjects/ElementsSamples", "id": "6af93d8627668c1ce1a61edcdaf584dc1ecb55a3", "size": "575", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Hydrogene/All/SharedUI/SharedUI.Shared/MainWindow.xaml.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP.NET", "bytes": "8446" }, { "name": "C", "bytes": "1844" }, { "name": "C#", "bytes": "123653" }, { "name": "CSS", "bytes": "435" }, { "name": "GLSL", "bytes": "1486" }, { "name": "Go", "bytes": "513138" }, { "name": "HTML", "bytes": "22290" }, { "name": "Java", "bytes": "51837" }, { "name": "Metal", "bytes": "12625" }, { "name": "Objective-C", "bytes": "4470" }, { "name": "Pascal", "bytes": "1497534" }, { "name": "Swift", "bytes": "76044" }, { "name": "Visual Basic .NET", "bytes": "11935" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>smslib-parent</artifactId> <groupId>org.smslib</groupId> <version>dev-SNAPSHOT</version> </parent> <artifactId>smslib-camel</artifactId> <packaging>bundle</packaging> <name>SMSLib - SMSLib Camel Endpoint</name> <description>Apache Camel endpoint implementation of the SMSlib API</description> <developers> <developer> <name>Thanasis Delenikas</name> <email>admin@smslib.org</email> <roles> <role>Author</role> </roles> </developer> <developer> <name>derjust</name> <email>zeeman@zeeman.de</email> <roles> <role>Author</role> </roles> </developer> </developers> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>smslib</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>${camel.version}</version> </dependency> <!-- logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j-api.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j-log4j12.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> <scope>runtime</scope> </dependency> <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test</artifactId> <version>${camel.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.neuronrobotics</groupId> <artifactId>nrjavaserial</artifactId> <version>${nrjavaserial.version}</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <!-- to generate the MANIFEST-FILE of the bundle --> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.7</version> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>org.smslib.smslib-camel</Bundle-SymbolicName> <Export-Service>org.apache.camel.spi.ComponentResolver;component=smslib</Export-Service> </instructions> </configuration> </plugin> </plugins> </build> </project>
{ "content_hash": "8259b76c5bb4548bb43d0d06a6c9aa29", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 201, "avg_line_length": 27.91509433962264, "alnum_prop": 0.6522473808719161, "repo_name": "RoyZeng/smslib", "id": "2e3ab9b152b2b4a2a7cd2990caa37ee233a095dc", "size": "2959", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "smslib-camel/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "283" }, { "name": "Java", "bytes": "492014" } ], "symlink_target": "" }
function Project(name, dates, description, projectlink) { this.name = name; this.dates = dates; this.description = description; this.projectlink = projectlink; } module.exports = Project;
{ "content_hash": "a47f35842f3382f06ecb909b4374b5dc", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 57, "avg_line_length": 26.75, "alnum_prop": 0.6728971962616822, "repo_name": "ztratar/lis", "id": "19f9e4e6076fcbc64b496aee0cabce67df093962", "size": "214", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "data-containers/projects.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "5015" } ], "symlink_target": "" }
package com.tearsofaunicorn.wordpress.api.model.converter; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import junit.framework.Assert; public abstract class ConverterTest<T> { @SuppressWarnings("unchecked") protected T loadObject(String filename) throws IOException, ClassNotFoundException { ObjectInputStream in = new ObjectInputStream(new FileInputStream(filename)); Object o = in.readObject(); in.close(); Assert.assertNotNull(o); return (T) o; } }
{ "content_hash": "5602feafbcfc589ad2264a7bbadb1ac1", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 85, "avg_line_length": 27.263157894736842, "alnum_prop": 0.7837837837837838, "repo_name": "ashri/java-wordpress-api", "id": "c27341be6aa91972ed3f94e7f45d75bfd5330a85", "size": "518", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/com/tearsofaunicorn/wordpress/api/model/converter/ConverterTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "26089" } ], "symlink_target": "" }
package org.fusesource.fabric.service; import org.fusesource.fabric.api.FabricException; import org.fusesource.insight.log.*; import org.fusesource.insight.log.service.LogQueryCallback; import org.fusesource.insight.log.service.LogQueryMBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.management.JMX; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import java.io.IOException; import java.util.Arrays; import java.util.Hashtable; /** * Utility class which contains code related to JMX connectivity. * * @author ldywicki */ public abstract class JmxTemplateSupport { private static final Logger LOGGER = LoggerFactory.getLogger(JmxTemplateSupport.class); public interface JmxConnectorCallback<T> { T doWithJmxConnector(JMXConnector connector) throws Exception; } public abstract <T> T execute(JmxConnectorCallback<T> callback); public <T> T execute(final LogQueryCallback<T> callback) { return execute(new JmxTemplateSupport.JmxConnectorCallback<T>() { public T doWithJmxConnector(JMXConnector connector) throws Exception { String[] bean = new String[]{"type", "LogQuery"}; return callback.doWithLogQuery(getMBean(connector, LogQueryMBean.class, "org.fusesource.insight", bean)); } }); } // MBean specific callbacks public static ObjectName safeObjectName(String domain, String ... args) { if ((args.length % 2) != 0) { LOGGER.warn("Not all values were defined for arguments %", Arrays.toString(args)); } Hashtable<String, String> table = new Hashtable<String, String>(); for (int i = 0; i < args.length; i += 2) { table.put(args[i], args[i + 1]); } try { return new ObjectName(domain, table); } catch (MalformedObjectNameException e) { throw new RuntimeException("Object name is invalid", e); } } public <T> T getMBean(JMXConnector connector, Class<T> type, String domain, String ... params) { try { return JMX.newMBeanProxy(connector.getMBeanServerConnection(), safeObjectName(domain, params), type); } catch (IOException e) { throw new FabricException(e); } } }
{ "content_hash": "fbfd0ed0f936dd196a010856f0a7f102", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 121, "avg_line_length": 33.563380281690144, "alnum_prop": 0.6802349979018044, "repo_name": "Jitendrakry/fuse", "id": "ee534ef8678132919f3fdb281e6638eb7423650a", "size": "3006", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fabric/fabric-core/src/main/scala/org/fusesource/fabric/service/JmxTemplateSupport.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "16117" }, { "name": "GAP", "bytes": "3273" }, { "name": "Java", "bytes": "2573655" }, { "name": "Scala", "bytes": "172894" }, { "name": "Shell", "bytes": "767" }, { "name": "XSLT", "bytes": "2430" } ], "symlink_target": "" }
module Main where import Control.Lens as L import Data.List import Text.ParserCombinators.Parsec as P data IPFragment = Regular { _content :: String } | Hypernet { _content :: String } deriving (Show, Eq) makePrisms ''IPFragment data IP = IP { _fragments :: [IPFragment] } deriving (Show, Eq) makePrisms ''IP parseIPv7 :: String -> IP parseIPv7 s = case parse ipv7 "(unknown)" s of Left _ -> error "parse error" Right ip -> ip ipv7 :: GenParser Char st IP ipv7 = IP <$> many1 (Regular <$> fragment <|> Hypernet <$> hypernet) fragment :: GenParser Char st String fragment = many1 (P.noneOf "[]") hypernet :: GenParser Char st String hypernet = char '[' *> fragment <* char ']' hasABBA :: String -> Bool hasABBA (a:s@(b:c:d:_)) = (a /= b && [a, b] == [d, c]) || hasABBA s hasABBA _ = False supportsTLS :: IP -> Bool supportsTLS ip = anyOf (_IP . folded . _Regular) hasABBA ip && L.noneOf (_IP . folded . _Hypernet) hasABBA ip findABAs :: IP -> [String] findABAs ip = ip ^.. _IP . folded . _Regular . to findABAs' . folded where findABAs' :: String -> [String] findABAs' (a:s@(b:c:_)) = if a == c && a /= b then [a,b,c]:findABAs' s else findABAs' s findABAs' _ = [] supportsSSL :: IP -> Bool supportsSSL ip = any hasBAB (findABAs ip) where hasBAB :: String -> Bool hasBAB (a:b:_) = anyOf (_IP . folded . _Hypernet) ([b,a,b] `isInfixOf`) ip hasBAB _ = error "invalid ABA" main :: IO () main = do putStrLn "Examples:" print $ supportsTLS (parseIPv7 "abba[mnop]qrst") print $ supportsTLS (parseIPv7 "abcd[bddb]xyyx") print $ supportsTLS (parseIPv7 "aaaa[qwer]tyui") print $ supportsTLS (parseIPv7 "ioxxoj[asdfgh]zxcvbn") putStrLn "-------" input <- map parseIPv7 . lines <$> readFile "Day07.txt" print . length . filter supportsTLS $ input putStrLn "-------" putStrLn "Examples:" print $ supportsSSL (parseIPv7 "aba[bab]xyz") print $ supportsSSL (parseIPv7 "xyx[xyx]xyx") print $ supportsSSL (parseIPv7 "aaa[kek]eke") print $ supportsSSL (parseIPv7 "zazbz[bzb]cdb") putStrLn "-------" print . length . filter supportsSSL $ input
{ "content_hash": "88f4136bc5552f40f91ee5bd57e97990", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 82, "avg_line_length": 30.43661971830986, "alnum_prop": 0.6260990282276724, "repo_name": "mithrandi/advent2016", "id": "f4dcd51e4e6bdd399a0fd5cb3ec4549d81657a3a", "size": "2161", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Day07.hs", "mode": "33188", "license": "mit", "language": [ { "name": "Haskell", "bytes": "11277" } ], "symlink_target": "" }
import 'es6-shim'; import 'reflect-metadata'; import 'zone.js/dist/zone'; import 'zone.js/dist/long-stack-trace-zone'; import '@angular/platform-browser'; import 'rxjs';
{ "content_hash": "5f6fc5e148aa4a5a2de0929bbc3f9995", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 44, "avg_line_length": 19.11111111111111, "alnum_prop": 0.7325581395348837, "repo_name": "davidverme/restaurant-menu-angular2", "id": "a034fb6b79838b26d7c19ad1b03f840d948c974a", "size": "172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/vendor.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "876" }, { "name": "HTML", "bytes": "1543" }, { "name": "JavaScript", "bytes": "5295" }, { "name": "TypeScript", "bytes": "23227" } ], "symlink_target": "" }
namespace Microsoft.Azure.Management.Synapse { using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; /// <summary> /// RestorableDroppedSqlPoolsOperations operations. /// </summary> internal partial class RestorableDroppedSqlPoolsOperations : IServiceOperations<SynapseManagementClient>, IRestorableDroppedSqlPoolsOperations { /// <summary> /// Initializes a new instance of the RestorableDroppedSqlPoolsOperations class. /// </summary> /// <param name='client'> /// Reference to the service client. /// </param> /// <exception cref="System.ArgumentNullException"> /// Thrown when a required parameter is null /// </exception> internal RestorableDroppedSqlPoolsOperations(SynapseManagementClient client) { if (client == null) { throw new System.ArgumentNullException("client"); } Client = client; } /// <summary> /// Gets a reference to the SynapseManagementClient /// </summary> public SynapseManagementClient Client { get; private set; } /// <summary> /// Gets a deleted sql pool that can be restored /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='workspaceName'> /// The name of the workspace /// </param> /// <param name='restorableDroppedSqlPoolId'> /// The id of the deleted Sql Pool in the form of /// sqlPoolName,deletionTimeInFileTimeFormat /// </param> /// <param name='customHeaders'> /// Headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="ErrorResponseException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="ValidationException"> /// Thrown when a required parameter is null /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown when a required parameter is null /// </exception> /// <return> /// A response object containing the response body and response headers. /// </return> public async Task<AzureOperationResponse<RestorableDroppedSqlPool>> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string restorableDroppedSqlPoolId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } if (Client.SubscriptionId != null) { if (Client.SubscriptionId.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (workspaceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (restorableDroppedSqlPoolId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "restorableDroppedSqlPoolId"); } string apiVersion = "2021-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("restorableDroppedSqlPoolId", restorableDroppedSqlPoolId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{restorableDroppedSqlPoolId}", System.Uri.EscapeDataString(restorableDroppedSqlPoolId)); List<string> _queryParameters = new List<string>(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); } if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } catch (JsonException) { // Ignore the exception } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new AzureOperationResponse<RestorableDroppedSqlPool>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<RestorableDroppedSqlPool>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } /// <summary> /// Gets a list of deleted Sql pools that can be restored /// </summary> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='workspaceName'> /// The name of the workspace /// </param> /// <param name='customHeaders'> /// Headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="ErrorResponseException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="ValidationException"> /// Thrown when a required parameter is null /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown when a required parameter is null /// </exception> /// <return> /// A response object containing the response body and response headers. /// </return> public async Task<AzureOperationResponse<IEnumerable<RestorableDroppedSqlPool>>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } if (Client.SubscriptionId != null) { if (Client.SubscriptionId.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { if (resourceGroupName.Length > 90) { throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (workspaceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } string apiVersion = "2021-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); List<string> _queryParameters = new List<string>(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); } if (customHeaders != null) { foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } catch (JsonException) { // Ignore the exception } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new AzureOperationResponse<IEnumerable<RestorableDroppedSqlPool>>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page1<RestorableDroppedSqlPool>>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return _result; } } }
{ "content_hash": "d21f50128b846efe1907f7f66ddda80e", "timestamp": "", "source": "github", "line_count": 468, "max_line_length": 304, "avg_line_length": 45.73076923076923, "alnum_prop": 0.5592935239697224, "repo_name": "AsrOneSdk/azure-sdk-for-net", "id": "7abd51dc428458350c2fc9af8fb3211de7e03592", "size": "21755", "binary": false, "copies": "1", "ref": "refs/heads/psSdkJson6Current", "path": "sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/RestorableDroppedSqlPoolsOperations.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "15473" }, { "name": "Bicep", "bytes": "13438" }, { "name": "C#", "bytes": "72203239" }, { "name": "CSS", "bytes": "6089" }, { "name": "Dockerfile", "bytes": "5652" }, { "name": "HTML", "bytes": "6169271" }, { "name": "JavaScript", "bytes": "16012" }, { "name": "PowerShell", "bytes": "649218" }, { "name": "Shell", "bytes": "31287" }, { "name": "Smarty", "bytes": "11135" } ], "symlink_target": "" }
/*eslint-env mocha */ 'use strict'; const assert = require('assert'); const docRouter = require('../'); const GraphDescriptorNode = require('./graph-descriptor-node'); const React = require('react'); const reactDomServer = require('react-dom/server'); const cheerio = require('cheerio'); describe('graph-descriptor-node', () => { it('should render to string', () => { const html = stringify([{ route: 'foo.bar' }]); assert.strictEqual(typeof html, 'string'); }); it('should render a li at root', () => { const $ = $ify([{ route: 'foo.bar' }]); assert.strictEqual($(':root')[0].name, 'li'); }); it('should render collapsed by default', () => { const $ = $ify([ { route: 'foo.bar.baz' }, ], { /* expanded: true */ }); assert.strictEqual($('li li').length, 0); }); it('should render expanded if prop passed', () => { const $ = $ify([ { route: 'foo.bar.baz' }, ], { expanded: true }); assert.strictEqual($('li li li').length, 1); }); }); function stringify(routes, passedProps) { const descriptor = docRouter.createClass(routes).descriptor(); const child = descriptor.children[0]; const props = Object.assign({}, passedProps, { node: child, path: [child], steps: [true] }); const reactEl = React.createElement(GraphDescriptorNode, props); const html = reactDomServer.renderToStaticMarkup(reactEl); return html; } function $ify(routes, passedProps) { const html = stringify(routes, passedProps); const $ = cheerio.load(html); return $; }
{ "content_hash": "741501a7311c849c621686cd01d5ec5f", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 94, "avg_line_length": 29.941176470588236, "alnum_prop": 0.6260641781270465, "repo_name": "greim/falcor-doc-router", "id": "9479211d69d6ce55dbbd12f1e64eae4274df1347", "size": "1527", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/graph-descriptor/graph-descriptor-node.test.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "22050" } ], "symlink_target": "" }
from nemreader import NEMFile def test_optional_scheduled_read(): nf = NEMFile("examples/unzipped/Example_NEM12_no_scheduled_read.csv", strict=True) meter_data = nf.nem_data() readings = meter_data.readings["NMI111"]["E1"] assert len(readings) == 96
{ "content_hash": "6e742458092c2b12a018f8d996754c97", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 86, "avg_line_length": 33.5, "alnum_prop": 0.7052238805970149, "repo_name": "aguinane/nem-reader", "id": "9152e2d1fc34fe4259eab793c392777472238b5d", "size": "268", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/test_optional_columns.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "48282" } ], "symlink_target": "" }
package armeventgrid import ( "context" "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" ) // ChannelsClient contains the methods for the Channels group. // Don't use this type directly, use NewChannelsClient() instead. type ChannelsClient struct { host string subscriptionID string pl runtime.Pipeline } // NewChannelsClient creates a new instance of ChannelsClient with the specified values. // subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms // part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewChannelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChannelsClient, error) { if options == nil { options = &arm.ClientOptions{} } ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) if err != nil { return nil, err } client := &ChannelsClient{ subscriptionID: subscriptionID, host: ep, pl: pl, } return client, nil } // CreateOrUpdate - Synchronously creates or updates a new channel with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // channelName - Name of the channel. // channelInfo - Channel information. // options - ChannelsClientCreateOrUpdateOptions contains the optional parameters for the ChannelsClient.CreateOrUpdate method. func (client *ChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelInfo Channel, options *ChannelsClientCreateOrUpdateOptions) (ChannelsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, channelInfo, options) if err != nil { return ChannelsClientCreateOrUpdateResponse{}, err } resp, err := client.pl.Do(req) if err != nil { return ChannelsClientCreateOrUpdateResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return ChannelsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) } return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ChannelsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelInfo Channel, options *ChannelsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) if channelName == "" { return nil, errors.New("parameter channelName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{channelName}", url.PathEscape(channelName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, channelInfo) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ChannelsClient) createOrUpdateHandleResponse(resp *http.Response) (ChannelsClientCreateOrUpdateResponse, error) { result := ChannelsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Channel); err != nil { return ChannelsClientCreateOrUpdateResponse{}, err } return result, nil } // BeginDelete - Delete an existing channel. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // channelName - Name of the channel. // options - ChannelsClientBeginDeleteOptions contains the optional parameters for the ChannelsClient.BeginDelete method. func (client *ChannelsClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientBeginDeleteOptions) (*runtime.Poller[ChannelsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return nil, err } return runtime.NewPoller[ChannelsClientDeleteResponse](resp, client.pl, nil) } else { return runtime.NewPollerFromResumeToken[ChannelsClientDeleteResponse](options.ResumeToken, client.pl, nil) } } // Delete - Delete an existing channel. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 func (client *ChannelsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return nil, err } resp, err := client.pl.Do(req) if err != nil { return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. func (client *ChannelsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) if channelName == "" { return nil, errors.New("parameter channelName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{channelName}", url.PathEscape(channelName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get properties of a channel. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // channelName - Name of the channel. // options - ChannelsClientGetOptions contains the optional parameters for the ChannelsClient.Get method. func (client *ChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetOptions) (ChannelsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return ChannelsClientGetResponse{}, err } resp, err := client.pl.Do(req) if err != nil { return ChannelsClientGetResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return ChannelsClientGetResponse{}, runtime.NewResponseError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. func (client *ChannelsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) if channelName == "" { return nil, errors.New("parameter channelName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{channelName}", url.PathEscape(channelName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. func (client *ChannelsClient) getHandleResponse(resp *http.Response) (ChannelsClientGetResponse, error) { result := ChannelsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Channel); err != nil { return ChannelsClientGetResponse{}, err } return result, nil } // GetFullURL - Get the full endpoint URL of a partner destination channel. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // channelName - Name of the Channel. // options - ChannelsClientGetFullURLOptions contains the optional parameters for the ChannelsClient.GetFullURL method. func (client *ChannelsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetFullURLOptions) (ChannelsClientGetFullURLResponse, error) { req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return ChannelsClientGetFullURLResponse{}, err } resp, err := client.pl.Do(req) if err != nil { return ChannelsClientGetFullURLResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return ChannelsClientGetFullURLResponse{}, runtime.NewResponseError(resp) } return client.getFullURLHandleResponse(resp) } // getFullURLCreateRequest creates the GetFullURL request. func (client *ChannelsClient) getFullURLCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetFullURLOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}/getFullUrl" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) if channelName == "" { return nil, errors.New("parameter channelName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{channelName}", url.PathEscape(channelName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getFullURLHandleResponse handles the GetFullURL response. func (client *ChannelsClient) getFullURLHandleResponse(resp *http.Response) (ChannelsClientGetFullURLResponse, error) { result := ChannelsClientGetFullURLResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionFullURL); err != nil { return ChannelsClientGetFullURLResponse{}, err } return result, nil } // NewListByPartnerNamespacePager - List all the channels in a partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // options - ChannelsClientListByPartnerNamespaceOptions contains the optional parameters for the ChannelsClient.ListByPartnerNamespace // method. func (client *ChannelsClient) NewListByPartnerNamespacePager(resourceGroupName string, partnerNamespaceName string, options *ChannelsClientListByPartnerNamespaceOptions) *runtime.Pager[ChannelsClientListByPartnerNamespaceResponse] { return runtime.NewPager(runtime.PagingHandler[ChannelsClientListByPartnerNamespaceResponse]{ More: func(page ChannelsClientListByPartnerNamespaceResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ChannelsClientListByPartnerNamespaceResponse) (ChannelsClientListByPartnerNamespaceResponse, error) { var req *policy.Request var err error if page == nil { req, err = client.listByPartnerNamespaceCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ChannelsClientListByPartnerNamespaceResponse{}, err } resp, err := client.pl.Do(req) if err != nil { return ChannelsClientListByPartnerNamespaceResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return ChannelsClientListByPartnerNamespaceResponse{}, runtime.NewResponseError(resp) } return client.listByPartnerNamespaceHandleResponse(resp) }, }) } // listByPartnerNamespaceCreateRequest creates the ListByPartnerNamespace request. func (client *ChannelsClient) listByPartnerNamespaceCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *ChannelsClientListByPartnerNamespaceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listByPartnerNamespaceHandleResponse handles the ListByPartnerNamespace response. func (client *ChannelsClient) listByPartnerNamespaceHandleResponse(resp *http.Response) (ChannelsClientListByPartnerNamespaceResponse, error) { result := ChannelsClientListByPartnerNamespaceResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ChannelsListResult); err != nil { return ChannelsClientListByPartnerNamespaceResponse{}, err } return result, nil } // Update - Synchronously updates a channel with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-06-15 // resourceGroupName - The name of the resource group within the partners subscription. // partnerNamespaceName - Name of the partner namespace. // channelName - Name of the channel. // channelUpdateParameters - Channel update information. // options - ChannelsClientUpdateOptions contains the optional parameters for the ChannelsClient.Update method. func (client *ChannelsClient) Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelUpdateParameters ChannelUpdateParameters, options *ChannelsClientUpdateOptions) (ChannelsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, channelUpdateParameters, options) if err != nil { return ChannelsClientUpdateResponse{}, err } resp, err := client.pl.Do(req) if err != nil { return ChannelsClientUpdateResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { return ChannelsClientUpdateResponse{}, runtime.NewResponseError(resp) } return ChannelsClientUpdateResponse{}, nil } // updateCreateRequest creates the Update request. func (client *ChannelsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelUpdateParameters ChannelUpdateParameters, options *ChannelsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if partnerNamespaceName == "" { return nil, errors.New("parameter partnerNamespaceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) if channelName == "" { return nil, errors.New("parameter channelName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{channelName}", url.PathEscape(channelName)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, channelUpdateParameters) }
{ "content_hash": "6b4a9ceec0b296295ebd9a38f4e3d628", "timestamp": "", "source": "github", "line_count": 427, "max_line_length": 259, "avg_line_length": 49.76580796252927, "alnum_prop": 0.7774588235294118, "repo_name": "Azure/azure-sdk-for-go", "id": "27a8be0b7d6a5a115297b0a8b5dbdaf10bc67a53", "size": "21589", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_channels_client.go", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1629" }, { "name": "Bicep", "bytes": "8394" }, { "name": "CSS", "bytes": "6089" }, { "name": "Dockerfile", "bytes": "1435" }, { "name": "Go", "bytes": "5463500" }, { "name": "HTML", "bytes": "8933" }, { "name": "JavaScript", "bytes": "8137" }, { "name": "PowerShell", "bytes": "504494" }, { "name": "Shell", "bytes": "3893" }, { "name": "Smarty", "bytes": "1723" } ], "symlink_target": "" }
<?php namespace RonRademaker\Exporter\Option\Test; use PHPUnit_Framework_TestCase; use RonRademaker\Exporter\Option\FileOption; /** * Unit test for outputting to a file * * @author Ron Rademaker */ class FileOptionTest extends PHPUnit_Framework_TestCase { /** * Test outputting Hello World to a file */ public function testOutputHelloWorld() { $fileOption = new FileOption('hello.txt'); $fileOption->stream('Hello World!'); $this->assertFileExists('hello.txt'); $this->assertEquals('Hello World!', file_get_contents('hello.txt')); unlink('hello.txt'); } }
{ "content_hash": "9d1a2ca61e98c7d056790252748a6e32", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 76, "avg_line_length": 21.79310344827586, "alnum_prop": 0.6598101265822784, "repo_name": "RonRademaker/Exporter", "id": "723ff6a52a0315b75b3854badf5d22892f846a81", "size": "632", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/Option/FileOptionTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "21482" } ], "symlink_target": "" }
(function(window, undefined) { MOTION = function(duration, delay) { this._name = ''; this._playTime = 0; this._time = 0; this._duration = (typeof duration === 'undefined') ? 0 : duration; this._delayTime = (typeof delay === 'undefined') ? 0 : delay; this._repeatTime = 0; this._repeatDuration = 0; this._reverseTime = 0; this._timeScale = 1; this._isPlaying = false; this._isRepeating = false; this._isRepeatingDelay = false; this._isReversing = false; this._isSeeking = false; this._hasController = false; this._useOnce = MOTION._useOnce; this._onStart = null; this._onEnd = null; this._onUpdate = null; this._onRepeat = null; MOTION._add(this); }; MOTION.REVISION = '1'; MOTION.ABSOLUTE = 'absolute'; MOTION.RELATIVE = 'relative'; MOTION.LINEAR = 'linear'; MOTION.COSINE = 'cosine'; MOTION.CUBIC = 'cubic'; MOTION.HERMITE = 'hermite'; MOTION._motions = []; MOTION._performance = (typeof window !== undefined && window.performance !== undefined && window.performance.now !== undefined) ? window.performance : Date; MOTION._useOnce = false; MOTION._time = 0; MOTION._valueMode = MOTION.ABSOLUTE; MOTION.valueMode = function(mode) { MOTION._valueMode = mode; } MOTION.playAll = function() { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].play(); }; MOTION.stopAll = function() { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].stop(); }; MOTION.resumeAll = function() { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].resume(); }; MOTION.pauseAll = function() { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].pause(); }; MOTION.seekAll = function(t) { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].seek(t); }; MOTION.repeatAll = function(duration) { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].repeat(duration); }; MOTION.reverseAll = function() { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].reverse(); }; MOTION.timeScaleAll = function(t) { for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].timeScale(t); }; MOTION.useOnce = function(useOnce) { MOTION._useOnce = (typeof useOnce !== 'undefined') ? useOnce : true; for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i].useOnce(MOTION._useOnce); }; MOTION._add = function(child) { MOTION._motions.push(child); }; MOTION.remove = function(child) { var i = MOTION._motions.indexOf(child); MOTION._motions.splice(i, 1); }; MOTION.removeAll = function(child) { MOTION._motions = []; }; MOTION.update = function(time) { if (typeof time == 'undefined') return false; MOTION._time = typeof time !== undefined ? time : this._performance.now(); for (var i = 0; i < MOTION._motions.length; i++) MOTION._motions[i]._update(); }; MOTION.autoUpdate = function() { _isAutoUpdating = true; return this; }; MOTION.noAutoUpdate = function() { _isAutoUpdating = false; return this; }; MOTION.time = function() { return MOTION._time; } MOTION.isPlaying = function() { for (var i = 0; i < MOTION._motions.length; i++) if (MOTION._motions[i].isPlaying()) return true; return false; }; MOTION.prototype.constructor = MOTION; MOTION.prototype.play = function() { this.dispatchStartedEvent(); this.seek(0); this.resume(); this._repeatTime = 0; return this; }; MOTION.prototype.stop = function() { this.seek(1); this.pause(); this._repeatTime = 0; this.dispatchEndedEvent(); if (this._useOnce && !this._hasController) MOTION.remove(this); else return this; }; MOTION.prototype.pause = function() { this._isPlaying = false; this._playTime = this._time; return this; }; MOTION.prototype.resume = function() { this._isPlaying = true; this._playTime = MOTION._time - this._playTime; return this; }; MOTION.prototype.seek = function(value) { this._isPlaying = false; this._isSeeking = true; this._playTime = (this._delayTime + this._duration) * value; this.setTime(this._playTime); this.dispatchChangedEvent(); this._isSeeking = false; return this; }; MOTION.prototype.repeat = function(duration) { this._isRepeating = true; this._repeatDuration = (typeof duration !== 'undefined') ? duration : 0; return this; }; MOTION.prototype.noRepeat = function() { this._isRepeating = false; this._repeatDuration = 0; return this; }; MOTION.prototype.reverse = function() { this._isReversing = true; return this; }; MOTION.prototype.noReverse = function() { this._isReversing = false; return this; }; MOTION.prototype._update = function(time) { if (this._isPlaying) { if (typeof time == 'undefined') this._updateTime(); else this.setTime(time); this.dispatchChangedEvent(); if (!this._isInsidePlayingTime(this._time) && !this._isInsideDelayingTime(this._time)) { this._reverseTime = (this._reverseTime === 0) ? this._duration : 0; if (this._isRepeating && (this._repeatDuration === 0 || this._repeatTime < this._repeatDuration)) { this.seek(0); this.resume(); this._repeatTime++; if (!this._isRepeatingDelay) this._delayTime = 0; this.dispatchRepeatedEvent(); } else { this.stop(); } } } }; MOTION.prototype._updateTime = function() { this._time = (MOTION._time - this._playTime) * this._timeScale; if (this._isReversing && this._reverseTime !== 0) this._time = this._reverseTime - this._time; }; MOTION.prototype.setName = function(name) { this._name = name; return this; }; MOTION.prototype.name = MOTION.prototype.setName; MOTION.prototype.getName = function() { return this._name; }; MOTION.prototype.setTime = function(time) { this._time = time * this._timeScale; if (this._isReversing && this._reverseTime !== 0) this._time = this._reverseTime - this._time; return this; }; MOTION.prototype.getTime = function() { return (this._time < this._delayTime) ? 0 : (this._time - this._delayTime); }; MOTION.prototype.time = MOTION.prototype.getTime; MOTION.prototype.setTimeScale = function(timeScale) { this._timeScale = timeScale; return this; }; MOTION.prototype.timeScale = MOTION.prototype.setTimeScale; MOTION.prototype.getTimeScale = function() { return this._timeScale; }; MOTION.prototype.getPosition = function() { return this.getTime() / this._duration; }; MOTION.prototype.position = MOTION.prototype.getPosition; MOTION.prototype.setDuration = function(_duration) { this._duration = _duration; return this; }; MOTION.prototype.getDuration = function() { return this._duration; }; MOTION.prototype.duration = MOTION.prototype.getDuration; MOTION.prototype.getRepeatTime = function() { return this._repeatTime; }; MOTION.prototype.repeatTime = MOTION.prototype.getRepeatTime; MOTION.prototype.setDelay = function(delay) { this._delayTime = delay; return this; }; MOTION.prototype.delay = MOTION.prototype.setDelay; MOTION.prototype.noDelay = function() { this._delayTime = 0; return this; }; MOTION.prototype.getDelay = function() { return this._delayTime; }; MOTION.prototype.repeatDelay = function(duration) { this.repeat(duration); this._isRepeatingDelay = true; return this; }; MOTION.prototype.noRepeatDelay = function() { this.noRepeat(); this._isRepeatingDelay = false; return this; }; MOTION.prototype.isDelaying = function() { return (this._time <= this._delayTime); }; MOTION.prototype.isPlaying = function() { return this._isPlaying; }; MOTION.prototype._isInsideDelayingTime = function(value) { return (value >= 0 && value < this._delayTime); }; MOTION.prototype._isInsidePlayingTime = function(value) { return (value >= this._delayTime && value < this._delayTime + this._duration); }; MOTION.prototype._isAbovePlayingTime = function(value) { return value >= this._delayTime + this._duration; }; MOTION.prototype.useOnce = function(useOnce) { this._useOnce = (typeof useOnce !== 'undefined') ? useOnce : true; return this; } MOTION._map = function(n, start1, end1, start2, end2) { return ((n - start1) / (end1 - start1)) * (end2 - start2) + start2; }; MOTION.prototype.onStart = function(func) { this._onStart = func; return this; }; MOTION.prototype.onEnd = function(func) { this._onEnd = func; return this; }; MOTION.prototype.onUpdate = function(func) { this._onUpdate = func; return this; }; MOTION.prototype.onRepeat = function(func) { this._onRepeat = func; return this; }; MOTION.prototype.dispatchStartedEvent = function() { if (this._onStart) this._onStart(); }; MOTION.prototype.dispatchEndedEvent = function() { if (this._onEnd) this._onEnd(); }; MOTION.prototype.dispatchChangedEvent = function() { if (this._onUpdate) this._onUpdate(); }; MOTION.prototype.dispatchRepeatedEvent = function() { if (this._onRepeat) this._onRepeat(); }; window.MOTION = MOTION; if (typeof Object.create != 'function') { Object.create = (function() { var Object = function() {}; return function(prototype) { if (arguments.length > 1) { throw Error('Second argument not supported'); } if (typeof prototype != 'object') { throw TypeError('Argument must be an object'); } Object.prototype = prototype; var result = new Object(); Object.prototype = null; return result; }; })(); } })(window);;(function(MOTION, undefined) { MOTION.Easing = function() {}; MOTION.Easing.Quad = function() {}; MOTION.Easing.Quad.In = function(t) { return (t /= 1) * t; }; MOTION.Easing.Quad.Out = function(t) { return -(t /= 1) * (t - 2); }; MOTION.Easing.Quad.InOut = function(t) { if ((t /= 1 / 2) < 1) return .5 * t * t; return -.5 * ((--t) * (t - 2) - 1); }; MOTION.Easing.Cubic = function() {}; MOTION.Easing.Cubic.In = function(t) { return (t /= 1) * t * t; }; MOTION.Easing.Cubic.Out = function(t) { return ((t = t / 1 - 1) * t * t + 1); }; MOTION.Easing.Cubic.InOut = function(t) { if ((t /= 1 / 2) < 1) return .5 * t * t * t; return .5 * ((t -= 2) * t * t + 2); }; MOTION.Easing.Quart = function() {}; MOTION.Easing.Quart.In = function(t) { return (t /= 1) * t * t * t; }; MOTION.Easing.Quart.Out = function(t) { return -((t = t / 1 - 1) * t * t * t - 1); }; MOTION.Easing.Quart.InOut = function(t) { if ((t /= 1 / 2) < 1) return .5 * t * t * t * t; return -.5 * ((t -= 2) * t * t * t - 2); }; MOTION.Easing.Quint = function() {}; MOTION.Easing.Quint.In = function(t) { return (t /= 1) * t * t * t * t; }; MOTION.Easing.Quint.Out = function(t) { return ((t = t / 1 - 1) * t * t * t * t + 1); }; MOTION.Easing.Quint.InOut = function(t) { if ((t /= 1 / 2) < 1) return .5 * t * t * t * t * t; return .5 * ((t -= 2) * t * t * t * t + 2); }; MOTION.Easing.Sine = function() {}; MOTION.Easing.Sine.In = function(t) { return -Math.cos(t / 1 * (Math.PI / 2)) + 1; }; MOTION.Easing.Sine.Out = function(t) { return Math.sin(t / 1 * (Math.PI / 2)); }; MOTION.Easing.Sine.InOut = function(t) { return -.5 * (Math.cos(Math.PI * t / 1) - 1); }; MOTION.Easing.Expo = function() {}; MOTION.Easing.Expo.In = function(t) { return (t == 0) ? 0 : Math.pow(2, 10 * (t / 1 - 1)); }; MOTION.Easing.Expo.Out = function(t) { return (t == 1) ? 1 : (-Math.pow(2, -10 * t / 1) + 1); }; MOTION.Easing.Expo.InOut = function(t) { if (t == 0) return 0; if (t == 1) return 1; if ((t /= 1 / 2) < 1) return .5 * Math.pow(2, 10 * (t - 1)); return .5 * (-Math.pow(2, -10 * --t) + 2); }; MOTION.Easing.Circ = function() {}; MOTION.Easing.Circ.In = function(t) { return -(Math.sqrt(1 - (t /= 1) * t) - 1); }; MOTION.Easing.Circ.Out = function(t) { return Math.sqrt(1 - (t = t / 1 - 1) * t); }; MOTION.Easing.Circ.InOut = function(t) { if ((t /= 1 / 2) < 1) return -.5 * (Math.sqrt(1 - t * t) - 1); return .5 * (Math.sqrt(1 - (t -= 2) * t) + 1); }; MOTION.Easing.Elastic = function() {}; MOTION.Easing.Elastic.In = function(t) { var s = 1.70158; var p = 0; var a = 1; if (t == 0) return 0; if ((t /= 1) == 1) return 1; if (!p) p = .3; if (a < Math.abs(1)) { a = 1; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(1 / a); return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); }; MOTION.Easing.Elastic.Out = function(t) { var s = 1.70158; var p = 0; var a = 1; if (t == 0) return 0; if ((t /= 1) == 1) return 1; if (!p) p = .3; if (a < Math.abs(1)) { a = 1; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(1 / a); return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1; }; MOTION.Easing.Elastic.InOut = function(t) { var s = 1.70158; var p = 0; var a = 1; if (t == 0) return 0; if ((t /= 1 / 2) == 2) return 1; if (!p) p = (.3 * 1.5); if (a < Math.abs(1)) { a = 1; var s = p / 4; } else var s = p / (2 * Math.PI) * Math.asin(1 / a); if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * .5 + 1; }; MOTION.Easing.Back = function() {}; MOTION.Easing.Back.In = function(t, s) { if (s == undefined) s = 1.70158; return (t /= 1) * t * ((s + 1) * t - s); }; MOTION.Easing.Back.Out = function(t, s) { if (s == undefined) s = 1.70158; return ((t = t / 1 - 1) * t * ((s + 1) * t + s) + 1); }; MOTION.Easing.Back.InOut = function(t, s) { if (s == undefined) s = 1.70158; if ((t /= 1 / 2) < 1) return .5 * (t * t * (((s *= (1.525)) + 1) * t - s)); return .5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2); }; MOTION.Easing.Bounce = function() {}; MOTION.Easing.Bounce.In = function(t) { return 1 - MOTION.Easing.Bounce.Out(1 - t, 0); }; MOTION.Easing.Bounce.Out = function(t) { if ((t /= 1) < (1 / 2.75)) { return (7.5625 * t * t); } else if (t < (2 / 2.75)) { return (7.5625 * (t -= (1.5 / 2.75)) * t + .75); } else if (t < (2.5 / 2.75)) { return (7.5625 * (t -= (2.25 / 2.75)) * t + .9375); } else { return (7.5625 * (t -= (2.625 / 2.75)) * t + .984375); } }; MOTION.Easing.Bounce.InOut = function(t) { if (t < .5) return MOTION.Easing.Bounce.In(t * 2, 0) * .5; return MOTION.Easing.Bounce.Out(t * 2 - 1, 0) * .5 + .5; }; MOTION.Quad = MOTION.Easing.Quad; MOTION.Cubic = MOTION.Easing.Cubic; MOTION.Quart = MOTION.Easing.Quart; MOTION.Quint = MOTION.Easing.Quint; MOTION.Sine = MOTION.Easing.Sine; MOTION.Expo = MOTION.Easing.Expo; MOTION.Circ = MOTION.Easing.Circ; MOTION.Elastic = MOTION.Easing.Elastic; MOTION.Back = MOTION.Easing.Back; MOTION.Bounce = MOTION.Easing.Bounce; })(MOTION);;(function(MOTION, undefined) { MOTION.Interoplation = function() {} MOTION.Interoplation.Linear = function(t, y1, y2) { // debugger if (y1 instanceof Array) { y2 = y1[2]; y1 = y1[1]; } return (y1 * (1 - t) + y2 * t); }; // MOTION.Interoplation.Smoothstep = function(t,y1, y2) { // // return (y1 * (1 - t) + y2 * t); // // ((x) * (x) * (3 - 2 * (x))) // }; MOTION.Interoplation.Cosine = function(t, y1, y2) { if (y1 instanceof Array) { y2 = y1[2]; y1 = y1[1]; } var t2 = (1 - PApplet.cos(t * PConstants.PI)) / 2; return (y1 * (1 - t2) + y2 * t2); }; MOTION.Interoplation.Cubic = function(t, y0, y1, y2, y3) { // debugger if (y0 instanceof Array) { y1 = y0[1]; y2 = y0[2]; y3 = y0[3]; y0 = y0[0]; } var a0, a1, a2, a3, t2; t2 = t * t; a0 = y3 - y2 - y0 + y1; a1 = y0 - y1 - a0; a2 = y2 - y0; a3 = y1; //http://paulbourke.net/miscellaneous/interpolation/ // a0 = -0.5*y0 + 1.5*y1 - 1.5*y2 + 0.5*y3; // a1 = y0 - 2.5*y1 + 2*y2 - 0.5*y3; // a2 = -0.5*y0 + 0.5*y2; // a3 = y1; return (a0 * t * t2 + a1 * t2 + a2 * t + a3); }; /* * Tension: 1 is high, 0 normal, -1 is low Bias: 0 is even, positive is * towards first segment, negative towards the other */ MOTION.Interoplation.Hermite = function(t, y0, y1, y2, y3, tension, bias) { if (tension == undefined) tension = 0; if (bias == undefined) bias = 0; if (y0 instanceof Array) { y1 = y0[1]; y2 = y0[2]; y3 = y0[3]; y0 = y0[0]; } var m0, m1, t2, t3; var a0, a1, a2, a3; t2 = t * t; t3 = t2 * t; m0 = (y1 - y0) * (1 + bias) * (1 - tension) / 2; m0 += (y2 - y1) * (1 - bias) * (1 - tension) / 2; m1 = (y2 - y1) * (1 + bias) * (1 - tension) / 2; m1 += (y3 - y2) * (1 - bias) * (1 - tension) / 2; a0 = 2 * t3 - 3 * t2 + 1; a1 = t3 - 2 * t2 + t; a2 = t3 - t2; a3 = -2 * t3 + 3 * t2; return (a0 * y1 + a1 * m0 + a2 * m1 + a3 * y2); }; MOTION.Interoplation.getInterpolationAt = function(t, points, interpolation) { if (interpolation == undefined) interpolation = MOTION.Interoplation.Hermite; var segmentLength = 1 / points.length var segmentIndex = Math.floor(MOTION._map(t, 0, 1, 0, points.length)); var segmentT = MOTION._map(t, segmentIndex * segmentLength, (segmentIndex + 1) * segmentLength, 0, 1); var segmentLength = 1 / points.length var segmentIndex = Math.floor(MOTION._map(t, 0, 1, 0, points.length)); var p1, p2, p3, p4; p2 = points[segmentIndex]; p3 = points[segmentIndex + 1]; if (segmentIndex == 0) { var segmentBegin = points[0]; var segmentEnd = points[1]; var segmentSlope = segmentEnd - segmentBegin; p1 = segmentEnd - segmentSlope; } else p1 = points[segmentIndex - 1]; if (segmentIndex == points.length - 2) { var segmentBegin = points[points.length - 2]; var segmentEnd = points[points.length - 1]; var segmentSlope = segmentEnd - segmentBegin; p4 = segmentEnd + segmentSlope; } else p4 = points[segmentIndex + 2]; return interpolation(segmentT, [p1, p2, p3, p4]) } })(MOTION); ;(function(MOTION, undefined) { MOTION.MotionController = function(motions) { MOTION.call(this); this._motions = []; this._valueMode = null; if (motions) this.addAll(motions); }; MOTION.MotionController.prototype = Object.create(MOTION.prototype); MOTION.MotionController.prototype.constructor = MOTION.MotionController; MOTION.MotionController.prototype.reverse = function() { MOTION.prototype.reverse.call(this); for (var i = 0; i < this._motions.length; i++) this._motions[i].reverse(); return this; }; MOTION.MotionController.prototype._updateMotions = function() { for (var i = 0; i < this._motions.length; i++) { var m = this._motions[i]; if (this._isSeeking) { if (m._isInsidePlayingTime(this.getTime())) m.seek(MOTION._map(this.getTime(), 0, m.getDelay() + m.getDuration(), 0, 1)); else if (m._isAbovePlayingTime(this.getTime())) m.seek(1); else m.seek(0); } else if (m._isInsidePlayingTime(this.getTime())) { if (m.isPlaying()) m._update(this.getTime(), false); else m.play(); } else if (m.isPlaying()) m.stop(); } }; MOTION.MotionController.prototype._updateDuration = function() { for (var i = 0; i < this._motions.length; i++) this._duration = Math.max(this._duration, this._motions[i].getDelay() + this._motions[i].getDuration()); }; MOTION.MotionController.prototype.getPosition = function() { return this.getTime() / this._duration; }; MOTION.MotionController.prototype.get = function(name) { if (typeof arguments[0] === 'number') { return this._motions[arguments[0]]; } else if (typeof arguments[0] === 'string') { for (var j = 0; j < this._motions.length; j++) if (this._motions[j]._name === arguments[0]) return this._motions[j]; } return this._motions; }; MOTION.MotionController.prototype.getFirst = function() { return this._motions[0]; } MOTION.MotionController.prototype.first = MOTION.MotionController.prototype.getFirst; MOTION.MotionController.prototype.getLast = function() { return this._motions[this._motions.length]; } MOTION.MotionController.prototype.last = MOTION.MotionController.prototype.getLast; MOTION.MotionController.prototype.getCount = function() { return this._motions.length; }; MOTION.MotionController.prototype.count = MOTION.MotionController.prototype.getCount; MOTION.MotionController.prototype.setEasing = function(easing) { this._easing = (typeof easing == 'undefined') ? (function(t) { return t; }) : easing; for (var i = 0; i < this._motions.length; i++) { if (this._motions[i] instanceof MOTION.Tween) { this._motions[i].easing(this._easing); } } return this; }; MOTION.MotionController.prototype.easing = MOTION.MotionController.prototype.setEasing; MOTION.MotionController.prototype.getEasing = function() { return this._easing; }; MOTION.MotionController.prototype.add = function(motion) { this.insert(motion, 0); return this; }; MOTION.MotionController.prototype.insert = function(motion, time) { motion.delay(time); // if (this._valueMode) motion.valueMode(this._valueMode); motion._hasController = true; this._motions.push(motion); MOTION.remove(motion); this._updateDuration(); return this; }; MOTION.MotionController.prototype.remove = function(motion) { var i; if (typeof arguments[0] === 'number') { i = arguments[0]; } else if (typeof arguments[0] === 'string') { for (var j = 0; j < this._motions.length; j++) if (this._motions[j]._name === arguments[0]) motion = this._motions[j]; } else if (typeof arguments[0] === 'object') { i = this._motions.indexOf(motion); } if (i != -1) { this._motions.splice(i, 1); this._updateDuration(); } return this; }; MOTION.MotionController.prototype.addAll = function(motions) { for (var i = 0; i < motions.length; i++) this.add(motions[i]); return this; }; MOTION.MotionController.prototype.removeAll = function() { for (var i = 0; i < this._motions.length; i++) this.remove(this._motions[i]); return this; }; MOTION.MotionController.prototype.dispatchChangedEvent = function() { this._updateMotions(); MOTION.prototype.dispatchChangedEvent.call(this); }; })(MOTION) ;(function(MOTION, undefined) { MOTION.Parallel = function(motions) { MOTION.MotionController.call(this, name, motions); }; MOTION.Parallel.prototype = Object.create(MOTION.MotionController.prototype); MOTION.Parallel.prototype.constructor = MOTION.Parallel; MOTION.Parallel.prototype._updateMotions = function() { for (var i = 0; i < this._motions.length; i++) { var m = this._motions[i]; if (this._isSeeking) { if (m._isInsidePlayingTime(this.getTime())) m.seek(MOTION._map(this.getTime(), 0, m.getDelay() + m.getDuration(), 0, 1)); else if (m._isAbovePlayingTime(this.getTime())) m.seek(1); else m.seek(0); } else if (m._isInsidePlayingTime(this.getTime())) { if (m.isPlaying()) m._update(this.getTime(), false); else m.play(); } else if (m.isPlaying()) { if (this._isReversing && i < this._motions.length - 1) m.seek(1); else for (var i = 0; i < this._motions.length; i++) this._motions[i].stop(); } } }; })(MOTION); ;(function(MOTION, undefined) { MOTION._properties = []; MOTION.Property = function(object, field, values) { this._object = (typeof arguments[0] == 'object') ? object : window; this._field = (typeof arguments[1] == 'string') ? field : arguments[0]; this._order = MOTION._properties.filter(function(d) { return d._object == this._object && d._field == this._field; }, this).length; this._isArray = false; this._isPath = false; var values = (typeof arguments[1] == 'string') ? values : arguments[1]; if (values instanceof Array) { //it'll either be interpolating between 2 arrays or through multiple points if (values.length == 2) { //interpolates between a start and end number or number values/properties of a custom color or vector object; //(window, 'x', [0,1]) or (window, 'x', [[0,0,0],[1,2,3]) this._start = values[0]; this._end = values[1] this._isArray = values[0] instanceof Array && values[1] instanceof Array; } else { if (this._object[this._field] instanceof Array) { this._start = (this._object[this._field].length == 0) ? new Array(values.length) : this._object[this._field]; this._end = values; this._isArray = true; } else { //interpolates through an array of values as a path //(window, 'x', [0,1,2,3,4]) this._start = values[0]; this._end = values this._isPath = true; } } } else { //it'll either interpolating between a number or number values/properties of a custom color or vector object //(window, 'x', 1) this._start = (typeof this._object[this._field] == 'undefined') ? 0 : this._object[this._field]; this._end = values; } MOTION._properties.push(this); }; MOTION.Property.prototype.update = function(t, easing, interoplation) { // if ((t > 0 && t <= 1) || (t == 0 && this._order == 1)) { if (this._isArray) { var a = []; for (var i = 0; i < this._start.length; i++) a.push(MOTION.Interoplation.Linear(easing(t), this._start[i], this._end[i])); this._object[this._field] = a; } else if (this._isPath) this._object[this._field] = MOTION.Interoplation.getInterpolationAt(easing(t), this._end, interoplation); else this._object[this._field] = MOTION.Interoplation.Linear(easing(t), this._start, this._end); // } else {} }; MOTION.Property.prototype.getStart = function() { return this._start; }; MOTION.Property.prototype.setStart = function(start) { if (typeof start === 'undefined') { debugger if (typeof this._object[this._field] === 'undefined') this._start = 0; else this._start = this._object[this._field]; } else this._start = start; return this; }; MOTION.Property.prototype.start = MOTION.Property.prototype.setStart; MOTION.Property.prototype.getEnd = function() { return this._end; }; MOTION.Property.prototype.setEnd = function(end) { this._end = end; return this; }; MOTION.Property.prototype.end = MOTION.Property.prototype.setEnd; MOTION.Property.prototype.getValue = function() { return this._object[this._field]; }; MOTION.Property.prototype.value = MOTION.Property.prototype.getValue; })(MOTION); ;(function(MOTION, undefined) { MOTION.Sequence = function(children) { MOTION.MotionController.call(this, children); this._current = null; this._currentIndex = 0; }; MOTION.Sequence.prototype = Object.create(MOTION.MotionController.prototype); MOTION.Sequence.prototype.constructor = MOTION.Sequence; MOTION.Sequence.prototype.add = function(child) { MOTION.MotionController.prototype.insert.call(this, child, this._duration); return this; }; MOTION.Sequence.prototype.getCurrentIndex = function() { return this._currentIndex; }; MOTION.Sequence.prototype.currentIndex = MOTION.Sequence.prototype.getCurrentIndex; MOTION.Sequence.prototype.getCurrent = function() { return this._current; }; MOTION.Sequence.prototype.current = MOTION.Sequence.prototype.getCurrent; MOTION.MotionController.prototype.dispatchStartedEvent = function() { this._current = null; this._currentIndex = 0; MOTION.prototype.dispatchStartedEvent.call(this) }; MOTION.MotionController.prototype.dispatchChangedEvent = function() { this._updateMotions(); if (this._isPlaying) { for (var i = 0; i < this._motions.length; i++) { var c = this._motions[i]; if (c._isInsidePlayingTime(this._time)) { this._currentIndex = i; this._current = c; break; } } } MOTION.prototype.dispatchChangedEvent.call(this) }; MOTION.MotionController.prototype.dispatchRepeatedEvent = function() { this._current = null; this._currentIndex = 0; MOTION.prototype.dispatchRepeatedEvent.call(this) }; })(MOTION); ;(function(MOTION, undefined) { MOTION.Keyframe = function(time, motions) { MOTION.MotionController.call(this, motions) this.delay(time); }; MOTION.Keyframe.prototype = Object.create(MOTION.MotionController.prototype); MOTION.Keyframe.prototype.constructor = MOTION.Keyframe; MOTION.Timeline = function() { MOTION.MotionController.call(this); }; MOTION.Timeline.prototype = Object.create(MOTION.MotionController.prototype); MOTION.Timeline.prototype.constructor = MOTION.Timeline; MOTION.Timeline.prototype.play = function(time) { if (typeof arguments[0] == 'undefined') { MOTION.MotionController.prototype.play.call(this); } else if (typeof arguments[0] == 'number') { this.seek(arguments[0] / this._duration); this.resume(); } else if (typeof arguments[0] == 'string') { for (var i = 0; i < this._motions.length; i++) if (this._motions[i]._name === arguments[0]) { this.seek(this._motions[i] / this._duration); this.resume(); } } else if (typeof arguments[0] == 'object') { this.seek(arguments[0].getPlayTime() / this._duration); this.resume(); } return this; }; MOTION.Timeline.prototype.stop = function(time) { if (typeof arguments[0] == 'undefined') MOTION.MotionController.prototype.stop.call(this); else if (typeof arguments[0] == 'number') { this.seek(arguments[0] / this._duration); this.pause(); } else if (typeof arguments[0] == 'string') { for (var i = 0; i < this._motions.length; i++) if (this._motions[i]._name === arguments[0]) { this.seek(this._motions[i] / this._duration); this.pause(); } } else if (typeof arguments[0] == 'object') { this.seek(arguments[0].getPlayTime() / this._duration); this.pause(); } return this; }; MOTION.Timeline.prototype.add = function(motion, time) { if (motion instanceof MOTION.Keyframe) { if (typeof time == 'undefined') this.insert(motion, motion.getDelay()); else this.insert(motion, time); } else { if (typeof time == 'undefined') { this._motions[this._motions.indexOf(c)] = c; } else { var key = time + ''; var k = new MOTION.Keyframe(time + ''); k.add(motion); this.insert(k, time); } } return this; }; MOTION.Timeline.prototype.getCurrent = function(index) { var current = []; for (var i = 0; i < this._motions.length; i++) if (this._motions[i].isInsidePlayingTime(this.getTime())) current.push(this._motions[i]); if (current.length == 0) return null; else return current; }; MOTION.Timeline.prototype.current = MOTION.Timeline.prototype.getCurrent })(MOTION) ;(function(MOTION, undefined) { MOTION.Tween = function(object, property, end, duration, delay, easing) { this._properties = [];; this._easing = function(t) { return t; }; this._interpolation = MOTION.Interoplation.Hermite; if (typeof arguments[0] === 'object') { MOTION.call(this, arguments[3], arguments[4]); this.addProperty(arguments[0], arguments[1], arguments[2]); if (typeof arguments[5] !== 'undefined') this.setEasing(arguments[5]); } else if (typeof arguments[0] === 'string') { MOTION.call(this, arguments[2], arguments[3]); this.addProperty(arguments[0], arguments[1]); if (typeof arguments[4] !== 'undefined') this.setEasing(arguments[4]); } else { MOTION.call(this, arguments[0], arguments[1]); if (typeof arguments[2] !== 'undefined') this.setEasing(arguments[2]); } }; MOTION.Tween.prototype = Object.create(MOTION.prototype); MOTION.Tween.prototype.constrctor = MOTION.Tween; MOTION.Tween.prototype._updateProperties = function() { for (var i = 0; i < this._properties.length; i++) this._properties[i].update(this.position(), this._easing, this._interpolation); }; MOTION.Tween.prototype.addProperty = function(object, property, values) { if (arguments[0] instanceof MOTION.Property) this._properties.push(arguments[0]); else if (typeof arguments[0] === 'object') this._properties.push(new MOTION.Property(object, property, values)); else this._properties.push(new MOTION.Property(arguments[0], arguments[1])); return this; }; MOTION.Tween.prototype.add = MOTION.Tween.prototype.addProperty; MOTION.Tween.prototype.remove = function(child) { var i; if (typeof arguments[0] === 'number') { i = arguments[0]; } else if (typeof arguments[0] === 'name') { i = this._properties.indexOf(property); } else if (typeof arguments[0] === 'object') { for (var j = 0; j < this._properties.length; j++) if (this._properties[j]._field === arguments[0]) j = i; } if (i && i != -1) this._properties.splice(i, 1); return this; }; MOTION.Tween.prototype.getProperty = function() { if (typeof arguments[0] === 'string') { for (var j = 0; j < this._properties.length; j++) if (this._properties[j]._field === arguments[0]) return this._properties[j]; } else if (typeof arguments[0] === 'number') { return this._properties[arguments[0]]; } else { return this._properties; } }; MOTION.Tween.prototype.get = MOTION.Tween.prototype.getProperty; MOTION.Tween.prototype.getFirstProperty = function() { return this._properties[0]; } MOTION.Tween.prototype.first = MOTION.Tween.prototype.getFirstProperty; MOTION.Tween.prototype.getLastProperty = function() { return this._properties[this._properties.length]; } MOTION.Tween.prototype.last = MOTION.Tween.prototype.getLastProperty; MOTION.Tween.prototype.getCount = function() { return this._properties.length; }; MOTION.Tween.prototype.count = MOTION.Tween.prototype.getCount; MOTION.Tween.prototype.setEasing = function(easing) { this._easing = easing; return this; }; MOTION.Tween.prototype.easing = MOTION.Tween.prototype.setEasing; MOTION.Tween.prototype.getEasing = function() { return this._easing; }; MOTION.Tween.prototype.noEasing = function() { this._easing = function(t) { return t; }; return this; }; MOTION.Tween.prototype.setInterpolation = function(inpterpolation) { this._interpolation = inpterpolation; return this; }; MOTION.Tween.prototype.interpolation = MOTION.Tween.prototype.setInterpolation; MOTION.Tween.prototype.getInterpolation = function() { return this._interpolation; }; MOTION.Tween.prototype.relative = function() { this.setValueMode(MOTION.RELATIVE); return this; }; MOTION.Tween.prototype.absolute = function() { this.setValueMode(MOTION.ABSOLUTE); return this; }; MOTION.Tween.prototype.setValueMode = function(_valueMode) { this._valueMode = _valueMode; return this; }; MOTION.Tween.prototype.valueMode = MOTION.Tween.prototype.setValueMode; MOTION.Tween.prototype.getValueMode = function() { return this._valueMode; }; MOTION.Tween.prototype.dispatchStartedEvent = function() { if (this._valueMode == MOTION.RELATIVE) for (var i = 0; i < this._properties.length; i++) this._properties[i].setStart(); if (this._onStart) this._onStart(this._object); }; MOTION.Tween.prototype.dispatchEndedEvent = function() { if (this._onEnd) this._onEnd(this._object); }; MOTION.Tween.prototype.dispatchChangedEvent = function() { this._updateProperties(); if (this._onUpdate) this._onUpdate(this._object); }; MOTION.Tween.prototype.dispatchRepeatedEvent = function() { if (this._onRepeat) this._onRepeat(this._object); }; })(MOTION);
{ "content_hash": "56485795f790659946e399a1aa12a22d", "timestamp": "", "source": "github", "line_count": 1373, "max_line_length": 160, "avg_line_length": 30.477785870356882, "alnum_prop": 0.5342446111934235, "repo_name": "ekeneijeoma/ijeoma.js", "id": "46a879546f73b9ef35df2596a8a363ed20d0d51b", "size": "41846", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "build/ijeoma.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "57976" }, { "name": "JavaScript", "bytes": "88373" } ], "symlink_target": "" }
SOS.js ====== Introduction ------------ SOS.js is a JavaScript library to browse, visualise, and access, data from an Open Geospatial Consortium (`OGC`_) Sensor Observation Service (`SOS`_). This project contains two main directories: - **web** contains the source code and examples - **docs** contains the documentation Documentation & Support ----------------------- The SOS.js documentation is available online at http://sosjs.readthedocs.org/en/latest/. If you have any questions, please get in touch on the 52°North Sensor Web Community mailing list or forum: http://list.52north.org/mailman/listinfo/swe respectively http://sensorweb.forum.52north.org/ Building the documentation -------------------------- This projects uses Sphinx to write and build the documentation, all details at http://sphinx-doc.org. To build documentation install Sphinx and then run ``make html`` in the root directory ``/``. License ------- This project is licensed under the Apache Software License, Version 2.0. For details see the LICENSE file. .. _OGC: http://www.opengeospatial.org/ .. _SOS: http://www.opengeospatial.org/standards/sos
{ "content_hash": "a9f1dc6879ae4bf922493729eb2def1f", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 200, "avg_line_length": 30.83783783783784, "alnum_prop": 0.7160385626643295, "repo_name": "52North/sos-js", "id": "edee2be60366022f3ba876770bf20113884975a8", "size": "1142", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "README.rst", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6469" }, { "name": "CSS", "bytes": "8136" }, { "name": "HTML", "bytes": "43937" }, { "name": "JavaScript", "bytes": "321525" }, { "name": "Makefile", "bytes": "6772" }, { "name": "PHP", "bytes": "5429" } ], "symlink_target": "" }
layout: default title: Test Modal --- <div class="box-column clear"> <!-- Modal Buttons --> <button id="1" class="btn btn-primary modal-button mobile-full" type="button" arial-controls="modal1">Modal 1</button> <!-- ./ Modal Buttons --> <!-- Modal --> <div class="modal"> <div id="modal1" class="modal-container"> <div class="modal-close">&times;</div> <div id="modal-content"> <div class="modal-header"> <h3>Modal #1</h3> </div> <div class="modal-body"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cum, officia, quaerat, incidunt, ratione minus blanditiis ipsum ducimus eum commodi reiciendis atque dolores cumque eaque? Qui, voluptate, quis nisi accusamus voluptatem distinctio nemo facere labore error tenetur veniam id rerum quisquam recusandae aspernatur quam in. Eligendi, sit, sunt provident atque dicta illo dolorem adipisci voluptatum quis velit ratione nam libero necessitatibus nisi optio officia debitis voluptatem dolorum fugit voluptas. Lorem ipsum dolor sit amet, consectetur adipisicing elit. </p> </div> <div class="modal-footer"> <a href="" class="btn btn-primary right mobile-full">Continue</a> </div> </div> </div> <div class="modal-overlay"></div> </div> <!-- ./ Modal -->
{ "content_hash": "849b32b96deb6e655524c8ec8243c597", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 580, "avg_line_length": 39.705882352941174, "alnum_prop": 0.6592592592592592, "repo_name": "quattromani/scaffold", "id": "4ad2855a7720a175856b3469c9d323ec36aafbe2", "size": "1354", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "sandbox/test-modal/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "31153" }, { "name": "CSS", "bytes": "628510" }, { "name": "HTML", "bytes": "864630" }, { "name": "JavaScript", "bytes": "243018" } ], "symlink_target": "" }
local Portals = {} function Portals.clearPortalTarget(portal) if not portal.teleport_target then return end portal.teleport_target.teleport_target = nil portal.teleport_target = nil end function Portals.setPortalTarget(portal, target) Portals.clearPortalTarget(portal) portal.teleport_target = target target.teleport_target = portal -- TODO: Allow this to be toggled in GUI. -- TODO: Allow naming things (soon). -- TODO: (Much later) GUI can show connections diagrammatically if target.entity.name == "portal-chest" then target.is_sender = false target.teleport_target.is_sender = true end -- Buffer size will need to change Portals.updateEnergyProperties(target) Portals.updateEnergyProperties(target.teleport_target) -- Refresh portal details for any players that have them open Gui.update{object=portal} Gui.update{object=target} end function Portals.emergencyHomeTeleport(player) -- Laws-of-physics-defying emergency teleport ... it will at least destroy a portal (if still valid) -- as a punishment! -- TODO: Consequences could be more drastic. Cause a nuke-like explosion at the arrival point. Drain all machines energy. Destroy the asteroid as you leave. etc. etc. -- Also, if the original portal is invalid, look for a different one on the same surface. local playerData = getPlayerData(player) local surface = game.surfaces["nauvis"] local portal = playerData.emergency_home_portal if portal and portal.entity.valid then surface = portal.entity.surface end player.teleport(playerData.emergency_home_position or {x=0,y=0}, surface) playerData.emergency_home_portal = nil playerData.emergency_home_position = nil -- TODO: Stage this a bit so we see it blow up before the player teleports in -- TODO: And display warning and require confirmationn -- Note: Simply setting the health to 0 doesn't seem to ever actually destroy the object. -- Could also use die() ... but that wouldn't attribute the kill to anyone! if portal and portal.entity.valid then portal.entity.damage(portal.entity.health, player.force) end end function Portals.openPortalGui(player, portal) Gui.showPortalDetails(player, portal) end -- TODO: Duplicated in control.lua, consolidate and sort all this out somehow -- TODO: Bring cost down on research levels for force local BASE_COST = 1000000 -- 1MJ local PLAYER_COST = 25000000 / 2 local GROUND_DISTANCE_MODIFIER = 0.1 local DISTANCE_MODIFIER = 100 -- TODO: Thinking realistically about how portals should work(!), need to change everything a bit. -- Opening a portal should incur the big base cost, keeping it open has an ongoing cost, moving matter -- has an additional cost. So as long as a portal stays open things will be cheaper, but portals -- should automatically close while idle? local function maxEnergyRequiredForPlayerTeleport(portal) -- Algorithm as follows: -- Base cost to initate a teleport -- Plus cost for player (adjust depending on inventory size? Items carried? In vehicle?) -- Multiplied by distance cost if not portal.teleport_target then return 0 end return BASE_COST + PLAYER_COST * ( DISTANCE_MODIFIER * Portals.spaceDistanceOfTeleport(portal) + GROUND_DISTANCE_MODIFIER * Portals.groundDistanceOfTeleport(portal)) end local function energyRequiredForPlayerTeleport(portal, player) -- TODO: Adjust on player inventory size return maxEnergyRequiredForPlayerTeleport(portal) end local function enterPortal(player, portal, direction) local playerData = getPlayerData(player) if portal.teleport_target == nil then -- Open the dialog slightly more permanently Gui.showEntityDetails(player, portal) playerData.opened_object = portal playerData.manually_opened_object = true return end -- Check enough energy is available local energyRequired = energyRequiredForPlayerTeleport(portal) local energyAvailable = portal.entity.energy + portal.teleport_target.entity.energy -- TODO: Use the portal visual to show that energy isn't available if energyAvailable < energyRequired then player.print("Not enough energy, required " .. energyRequired / 1000000 .. "MJ, had " .. energyAvailable / 1000000 .. "MJ") return end player.print("Teleporting using " .. energyRequired / 1000000 .. "MJ") -- When travelling offworld, set the emergency teleport back to where we left -- Note: "home" is always nauvis for now. local currentSite = Sites.getSiteForEntity(player) if currentSite ~= portal.site and (currentSite == nil or currentSite.surface.name == "nauvis") then playerData.emergency_home_portal = portal playerData.emergency_home_position = portal.entity.position end -- TODO: Freeze player and show teleport anim/sound for a second local targetPos = { -- x is the same relative to both portals, y is inverted x = portal.teleport_target.entity.position.x + player.position.x - portal.entity.position.x, y = portal.teleport_target.entity.position.y - player.position.y + portal.entity.position.y } -- Sap energy from both ends of the portal, local end first local missingEnergy = math.max(0, energyRequired - portal.entity.energy) portal.entity.energy = portal.entity.energy - energyRequired portal.teleport_target.entity.energy = portal.teleport_target.entity.energy - missingEnergy player.teleport(targetPos, portal.teleport_target.site.surface) end function findPortalInArea(surface, area) local candidates = surface.find_entities_filtered{area=area, name="medium-portal"} for _,entity in pairs(candidates) do return getEntityData(entity) end return nil end function Portals.checkPlayersForTeleports() local tick = game.tick for player_index, player in pairs(game.players) do -- TODO: Allow driving into BIG portals? -- TODO: Balance ticks... local playerData = getPlayerData(player) if player.connected and not player.driving then -- and tick - (global.last_player_teleport[player_index] or 0) >= 45 then -- Look for a portal nearby local portal = findPortalInArea(player.surface, { {player.position.x-0.3, player.position.y-0.3}, {player.position.x+0.3, player.position.y+0.3} }) -- Update model/gui based on last frame if playerData.nearest_portal == portal then if not portal then return end else -- Portal nearby has changed if not portal then Gui.closeEntityDetails(player, playerData.nearest_portal) else playerData.last_position = player.position if not playerData.opened_object then Gui.showEntityDetails(player, portal) end end playerData.nearest_portal = portal return end -- So, nearby portal was also nearby last frame. Check if player has moved across the center point. local walking_state = player.walking_state if walking_state.walking then -- TODO: Allow portal rotation and support east/west portal entry if (playerData.last_position.y < portal.entity.position.y) ~= (player.position.y < portal.entity.position.y) then -- Teleport enterPortal(player, portal, direction) else -- Update position for next time playerData.last_position = player.position end end end end end function Portals.groundDistanceOfTeleport(portal) if portal.site ~= portal.teleport_target.site then return 0 else return distanceBetween(portal.teleport_target.entity, portal.entity) end end function Portals.spaceDistanceOfTeleport(portal) if portal.site == portal.teleport_target.site then return 0 else return math.abs(portal.teleport_target.site.distance - portal.site.distance) end end function Portals.updateEnergyProperties(portal) -- TODO: Seems like a) portals should charge quicker, and b) chests and/or portals should -- have a larger buffer e.g. 4 teleports; seeing loads of mwave energy being wasted then portals -- failing to operate local entity = portal.entity local requiredEnergy = 0 if entity.name == "medium-portal" and portal.teleport_target then requiredEnergy = maxEnergyRequiredForPlayerTeleport(portal) end if entity.name == "portal-chest" and portal.teleport_target then requiredEnergy = maxEnergyRequiredForStackTeleport(portal) end if entity.name == "portal-belt" and portal.entity.neighbours then requiredEnergy = maxEnergyRequiredForBeltTeleport(portal) * 4 / 100 end requiredEnergy = math.ceil(requiredEnergy) -- Buffer stores enough for 2 teleports local BUFFER_NUM = 2 local SECONDS_TO_CHARGE = 2 local interface = ensureEnergyInterface(portal) interface.electric_buffer_size = BUFFER_NUM * requiredEnergy -- Buffer fill rate scales with -- TODO: Should scale a bit but not as much as this interface.electric_input_flow_limit = requiredEnergy / SECONDS_TO_CHARGE interface.electric_output_flow_limit = interface.prototype.electric_energy_source_prototype.output_flow_limit interface.electric_drain = interface.prototype.electric_energy_source_prototype.drain -- Landed portals come pre-charged, but we didn't know *how* much they needed until now. if portal.is_fully_charged then portal.is_fully_charged = false interface.energy = interface.electric_buffer_size end --TODO: This caused a super strange error but I don't know if drain is the same energy_usage value from the actual prototype... --interface.power_usage = interface.prototype.energy_usage end return Portals
{ "content_hash": "fe8dcf83280e518ae5c8dadb3f90b6dd", "timestamp": "", "source": "github", "line_count": 251, "max_line_length": 168, "avg_line_length": 38.278884462151396, "alnum_prop": 0.7378226477935054, "repo_name": "chucksellick/factorio-portal-research", "id": "583ceab70cac511fa5496feb8afa99926bded18b", "size": "9608", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/modules/portals.lua", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1285" }, { "name": "Lua", "bytes": "202251" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "33544c8547f91e9c5bac8fb8a0ed8d1e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "ba254e24e8cdcdf558f245a5a2d39f61e72463d8", "size": "212", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Eulalia/Eulalia madkotiensis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Sat Mar 16 04:11:57 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Interface org.wildfly.swarm.config.io.worker.ServerSupplier (BOM: * : All 2.3.1.Final-SNAPSHOT API)</title> <meta name="date" content="2019-03-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="Uses of Interface org.wildfly.swarm.config.io.worker.ServerSupplier (BOM: * : All 2.3.1.Final-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../overview-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 class="aboutLanguage">Thorntail API, 2.3.1.Final-SNAPSHOT</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/io/worker/class-use/ServerSupplier.html" target="_top">Frames</a></li> <li><a href="ServerSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface org.wildfly.swarm.config.io.worker.ServerSupplier" class="title">Uses of Interface<br>org.wildfly.swarm.config.io.worker.ServerSupplier</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">ServerSupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.io">org.wildfly.swarm.config.io</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.io"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">ServerSupplier</a> in <a href="../../../../../../../org/wildfly/swarm/config/io/package-summary.html">org.wildfly.swarm.config.io</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/io/package-summary.html">org.wildfly.swarm.config.io</a> with parameters of type <a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">ServerSupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/io/Worker.html" title="type parameter in Worker">T</a></code></td> <td class="colLast"><span class="typeNameLabel">Worker.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/io/Worker.html#server-org.wildfly.swarm.config.io.worker.ServerSupplier-">server</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">ServerSupplier</a>&nbsp;supplier)</code> <div class="block">Install a supplied Server object to the list of subresources</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/io/worker/ServerSupplier.html" title="interface in org.wildfly.swarm.config.io.worker">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../overview-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 class="aboutLanguage">Thorntail API, 2.3.1.Final-SNAPSHOT</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/io/worker/class-use/ServerSupplier.html" target="_top">Frames</a></li> <li><a href="ServerSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "4a00353fa8e17939b8f5b7147780967b", "timestamp": "", "source": "github", "line_count": 170, "max_line_length": 426, "avg_line_length": 44.27058823529412, "alnum_prop": 0.6311453627424927, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "d09f4eb382d333e9ae9fcfa2c52f023a5f35a2dd", "size": "7526", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2.3.1.Final-SNAPSHOT/apidocs/org/wildfly/swarm/config/io/worker/class-use/ServerSupplier.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!doctype html> <!-- This file is generated by build.py. --> <title>img wide.jpg; overflow:visible; -o-object-fit:contain; -o-object-position:top right</title> <link rel="stylesheet" href="../../support/reftests.css"> <link rel='match' href='visible_contain_top_right-ref.html'> <style> #test > * { overflow:visible; -o-object-fit:contain; -o-object-position:top right } </style> <div id="test"> <img src="../../support/wide.jpg"> </div>
{ "content_hash": "de0e7d8ecc4680c8ab6783ccc7e838f9", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 98, "avg_line_length": 40, "alnum_prop": 0.6795454545454546, "repo_name": "gsnedders/presto-testo", "id": "382455e8caa4411ac1cea0f90be458a4973b81ad", "size": "440", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "css/image-fit/reftests/img-jpg-wide/visible_contain_top_right.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "2312" }, { "name": "ActionScript", "bytes": "23470" }, { "name": "AutoHotkey", "bytes": "8832" }, { "name": "Batchfile", "bytes": "5001" }, { "name": "C", "bytes": "116512" }, { "name": "C++", "bytes": "219486" }, { "name": "CSS", "bytes": "207914" }, { "name": "Erlang", "bytes": "18523" }, { "name": "Groff", "bytes": "674" }, { "name": "HTML", "bytes": "103359143" }, { "name": "Haxe", "bytes": "3874" }, { "name": "Java", "bytes": "125658" }, { "name": "JavaScript", "bytes": "22516843" }, { "name": "Makefile", "bytes": "13409" }, { "name": "PHP", "bytes": "531453" }, { "name": "Perl", "bytes": "321672" }, { "name": "Python", "bytes": "948191" }, { "name": "Ruby", "bytes": "1006850" }, { "name": "Shell", "bytes": "12140" }, { "name": "Smarty", "bytes": "1860" }, { "name": "XSLT", "bytes": "2567445" } ], "symlink_target": "" }
class Browser; class SigninUIError; class TurnSyncOnHelperPolicyFetchTracker; class AccountSelectionInProgressHandle; #if BUILDFLAG(ENABLE_DICE_SUPPORT) class DiceSignedInProfileCreator; #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) class ProfilePickerLacrosSignInProvider; #endif namespace signin { class IdentityManager; } namespace syncer { class SyncService; class SyncSetupInProgressHandle; } // namespace syncer // Handles details of setting the primary account with IdentityManager and // turning on sync for an account for which there is already a refresh token. class TurnSyncOnHelper { public: // Behavior when the signin is aborted (by an error or cancelled by the user). // The mode has no effect on the sync-is-disabled flow where cancelling always // implies removing the account. enum class SigninAbortedMode { // The token is revoked and the account is signed out of the web. REMOVE_ACCOUNT, // The account is kept. KEEP_ACCOUNT }; // Delegate implementing the UI prompts. class Delegate { public: virtual ~Delegate() {} // Shows a login error to the user. virtual void ShowLoginError(const SigninUIError& error) = 0; // Shows a confirmation dialog when the user was previously signed in with a // different account in the same profile. |callback| must be called. virtual void ShowMergeSyncDataConfirmation( const std::string& previous_email, const std::string& new_email, signin::SigninChoiceCallback callback) = 0; // Shows a confirmation dialog when the user is signing in a managed // account. |callback| must be called. // NOTE: When this is called, any subsequent call to // ShowSync(Disabled)Confirmation will have is_managed_account set to true. // The other implication is only partially true: for a managed account, // ShowEnterpriseAccountConfirmation() must be called before calling // ShowSyncConfirmation() but it does not have to be called before calling // ShowSyncDisabledConfirmation(). Namely, Chrome can have clarity about // sync being disabled even before fetching enterprise policies (e.g. sync // engine gets a 'disabled-by-enterprise' error from the server). virtual void ShowEnterpriseAccountConfirmation( const AccountInfo& account_info, signin::SigninChoiceCallback callback) = 0; // Shows a sync confirmation screen offering to open the Sync settings. // |callback| must be called. // NOTE: The account is managed iff ShowEnterpriseAccountConfirmation() has // been called before. virtual void ShowSyncConfirmation( base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> callback) = 0; // Whether the delegate wants to silently abort the turn sync on process // when the sync is disabled for the user before showing the sync disabled // UI. // This can be used in cases when the turn sync on is triggered not by the // user action but a promo process. // Defaults to false. virtual bool ShouldAbortBeforeShowSyncDisabledConfirmation(); // Shows a screen informing that sync is disabled for the user. // |is_managed_account| is true if the account (where sync is being set up) // is managed (which may influence the UI or strings). |callback| must be // called. // TODO(crbug.com/1126913): Use a new enum for this callback with only // values that make sense here (stay signed-in / signout). virtual void ShowSyncDisabledConfirmation( bool is_managed_account, base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> callback) = 0; // Opens the Sync settings page. virtual void ShowSyncSettings() = 0; // Informs the delegate that the flow is switching to a new profile. virtual void SwitchToProfile(Profile* new_profile) = 0; // Shows the `error` for `browser`. // This helper is static because in some cases it needs to be called // after this object gets destroyed. static void ShowLoginErrorForBrowser(const SigninUIError& error, Browser* browser); }; // Create a helper that turns sync on for an account that is already present // in the token service. // |callback| is called at the end of the flow (i.e. after the user closes the // sync confirmation dialog). TurnSyncOnHelper(Profile* profile, signin_metrics::AccessPoint signin_access_point, signin_metrics::PromoAction signin_promo_action, signin_metrics::Reason signin_reason, const CoreAccountId& account_id, SigninAbortedMode signin_aborted_mode, std::unique_ptr<Delegate> delegate, base::OnceClosure callback); // Convenience constructor using the default delegate and empty callback. TurnSyncOnHelper(Profile* profile, Browser* browser, signin_metrics::AccessPoint signin_access_point, signin_metrics::PromoAction signin_promo_action, signin_metrics::Reason signin_reason, const CoreAccountId& account_id, SigninAbortedMode signin_aborted_mode); TurnSyncOnHelper(const TurnSyncOnHelper&) = delete; TurnSyncOnHelper& operator=(const TurnSyncOnHelper&) = delete; // Fakes that sync enabled for testing, but does not create a sync service. static void SetShowSyncEnabledUiForTesting( bool show_sync_enabled_ui_for_testing); // Returns true if a `TurnSyncOnHelper` is currently active for `profile`. static bool HasCurrentTurnSyncOnHelperForTesting(Profile* profile); // Used as callback for `SyncStartupTracker`. // Public for testing. void OnSyncStartupStateChanged(SyncStartupTracker::ServiceStartupState state); private: enum class ProfileMode { // Attempts to sign the user in |profile_|. Note that if the account to be // signed in is a managed account, then a profile confirmation dialog is // shown and the user has the possibility to create a new profile before // signing in. CURRENT_PROFILE, // Creates a new profile and signs the user in this new profile. NEW_PROFILE }; // TurnSyncOnHelper deletes itself. ~TurnSyncOnHelper(); // Triggers the start of the flow. void TurnSyncOnInternal(); // Handles can offer sign-in errors. It returns true if there is an error, // and false otherwise. bool HasCanOfferSigninError(); // Used as callback for ShowMergeSyncDataConfirmation(). void OnMergeAccountConfirmation(signin::SigninChoice choice); // Used as callback for ShowEnterpriseAccountConfirmation(). void OnEnterpriseAccountConfirmation(signin::SigninChoice choice); // Turns sync on with the current profile or a new profile. void TurnSyncOnWithProfileMode(ProfileMode profile_mode); // Callback invoked once policy registration is complete. void OnRegisteredForPolicy(bool is_account_managed); // Helper function that loads policy with the cached |dm_token_| and // |client_id|, then completes the signin process. void LoadPolicyWithCachedCredentials(); // Callback invoked when a policy fetch request has completed. |success| is // true if policy was successfully fetched. void OnPolicyFetchComplete(bool success); // Called to create a new profile, which is then signed in with the // in-progress auth credentials currently stored in this object. void CreateNewSignedInProfile(); // Called when the new profile is created. void OnNewSignedInProfileCreated(Profile* new_profile); // Returns the SyncService, or nullptr if sync is not allowed. syncer::SyncService* GetSyncService(); // Completes the signin in IdentityManager and displays the Sync confirmation // UI. void SigninAndShowSyncConfirmationUI(); // Displays the Sync confirmation UI. // Note: If sync fails to start (e.g. sync is disabled by admin), the sync // confirmation dialog will be updated accordingly. void ShowSyncConfirmationUI(); // Handles the user input from the sync confirmation UI and deletes this // object. void FinishSyncSetupAndDelete( LoginUIService::SyncConfirmationUIClosedResult result); // Switch to a new profile after exporting the token. void SwitchToProfile(Profile* new_profile); // Only one TurnSyncOnHelper can be attached per profile. This deletes // any other helper attached to the profile. void AttachToProfile(); // Aborts the flow and deletes this object. void AbortAndDelete(); std::unique_ptr<Delegate> delegate_; raw_ptr<Profile> profile_; raw_ptr<signin::IdentityManager> identity_manager_; const signin_metrics::AccessPoint signin_access_point_; const signin_metrics::PromoAction signin_promo_action_; const signin_metrics::Reason signin_reason_; // Whether the refresh token should be deleted if the Sync flow is aborted. SigninAbortedMode signin_aborted_mode_; // Account information. const AccountInfo account_info_; // Prevents Sync from running until configuration is complete. std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_; // Prevents `SigninManager` from changing the unconsented primary account // until the flow is complete. std::unique_ptr<AccountSelectionInProgressHandle> account_change_blocker_; // Called when this object is deleted. base::ScopedClosureRunner scoped_callback_runner_; std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; std::unique_ptr<TurnSyncOnHelperPolicyFetchTracker> policy_fetch_tracker_; #if BUILDFLAG(ENABLE_DICE_SUPPORT) std::unique_ptr<DiceSignedInProfileCreator> dice_signed_in_profile_creator_; #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) std::unique_ptr<ProfilePickerLacrosSignInProvider> lacros_sign_in_provider_; #endif base::CallbackListSubscription shutdown_subscription_; bool enterprise_account_confirmed_ = false; base::WeakPtrFactory<TurnSyncOnHelper> weak_pointer_factory_{this}; }; #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_TURN_SYNC_ON_HELPER_H_
{ "content_hash": "51677297a53f066e30a66bfbb82c42e7", "timestamp": "", "source": "github", "line_count": 255, "max_line_length": 80, "avg_line_length": 39.741176470588236, "alnum_prop": 0.7276494967436353, "repo_name": "chromium/chromium", "id": "32ce7cbfc3af3352c2872ab5acffdc4cb903b949", "size": "11135", "binary": false, "copies": "5", "ref": "refs/heads/main", "path": "chrome/browser/ui/webui/signin/turn_sync_on_helper.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Glonium halaxyli Kravtzev ### Remarks null
{ "content_hash": "30f151b9bf2d55d8954eac5e8d9c0b64", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 25, "avg_line_length": 10, "alnum_prop": 0.7153846153846154, "repo_name": "mdoering/backbone", "id": "5ff527b4cebc43ce23169beae1418448d69912ec", "size": "179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Dothideomycetes/Hysteriales/Hysteriaceae/Glonium/Glonium halaxyli/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Html; namespace MatreshkaExpress.Web.Helpers { public static class HTMLHelpers { public static MvcHtmlString RadioButtonsListForEnum<TModel, TEnum>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TEnum>> expression) { var sb = new StringBuilder(); foreach (var value in Enum.GetValues(typeof(TEnum))) { if ((int)value < 1) continue; var radio = htmlHelper.RadioButtonFor(expression, value, new { @class = "item_check", id = "GenderEnum" + ((Enum)value).ToString() }); string GenderLabel = String.Empty; sb.AppendFormat( radio + "<label for=\"GenderEnum" + ((Enum)value).ToString() + "\" class=\"gender_check_label\"></label>" + "<p class=\"genderName\">{0}</p>", GetGenderLabel(((Enum)value).ToString()) ); } return MvcHtmlString.Create(sb.ToString()); } private static string GetGenderLabel(string value) { switch(value) { case "Male": return "Мужской"; case "Female": return "Женский"; case "Unisex": default: return "Унисекс"; } } } }
{ "content_hash": "9961a43c611256e3bb44b4bd867b9a8d", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 154, "avg_line_length": 32.02, "alnum_prop": 0.5184259837601499, "repo_name": "ddzoff/MatreshkaExpress", "id": "38c26c55d303370e237c1c1091d39f74ef7d4937", "size": "1624", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MatreshkaExpress.Web/Helpers/HTMLHelpers.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "111" }, { "name": "C#", "bytes": "344773" }, { "name": "CSS", "bytes": "158100" }, { "name": "JavaScript", "bytes": "403189" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>sphlib: sph_types.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">sphlib</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#define-members">Defines</a> &#124; <a href="#typedef-members">Typedefs</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>sph_types.h File Reference</h1> </div> </div> <div class="contents"> <div class="textblock"><code>#include &lt;limits.h&gt;</code><br/> </div> <p><a href="sph__types_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a9aa5041e567e11581beb3237623b7af0">SPH_C32</a>(x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a6b2da7fb1eca675723880c22fa7918ca">SPH_T32</a>(x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a2f0780c6a4e1d5f1b3845d48fe8b1f9f">SPH_ROTL32</a>(x, n)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a8bc9d8182b074b7bd4752658034df72d">SPH_ROTR32</a>(x, n)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a383758264298b1cb816e1aa5b8143e74">SPH_64</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#aa0762a5223a026586eecaeb11932071d">SPH_64_TRUE</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ae0984a800c78947d723a27a4bbf61a62">SPH_C64</a>(x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a862296a164555017b55e37bb09e20162">SPH_T64</a>(x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a0cd067baca3c2ed4b2f3e048dd503393">SPH_ROTL64</a>(x, n)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a2f3d33872596a0f5f3cf36b9eecdca5b">SPH_ROTR64</a>(x, n)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#af65f6f033a520b641563a2574c5d1df8">SPH_INLINE</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ae933da6e8036611f455b220e5fd54518">SPH_LITTLE_ENDIAN</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a89fe884c64ec670a09eb9792b6614dd7">SPH_BIG_ENDIAN</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a446ac387eeb89e845682be803b40c308">SPH_LITTLE_FAST</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a566b63ce77b2a83dff599f829819d80d">SPH_BIG_FAST</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#add0ead78918ca1b3c98eefd65854b8fa">SPH_UPTR</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#aea5170f5e2463294bb3c5858742c416b">SPH_UNALIGNED</a></td></tr> <tr><td colspan="2"><h2><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef __arch_dependant__&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef __arch_dependant__&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a9096255be60de8b630c6d268461a0972">sph_s32</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef __arch_dependant__&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef __arch_dependant__&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ae48722d443535f1e82905e742f2b3d11">sph_s64</a></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#aa21c79a8abd42546ea5862eca100acce">sph_bswap32</a> (<a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a9fe9a72d55ebe6b5f47925a631eb5030">sph_bswap64</a> (<a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> x)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a7f729a6c8b9ead5cb2b0835aeae3217d">sph_dec16le</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a6107a9b15c1ba89e5b37e1bb728ad654">sph_enc16le</a> (void *dst, unsigned val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a19d8b62deef02aac1b42b6606e5eabd4">sph_dec16be</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ae84619401c2338dd568d7466e2000279">sph_enc16be</a> (void *dst, unsigned val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ad3eeb6346fffa1029a239fe94bfdc4e6">sph_dec32le</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ac808629acbf32dba42e5259b40983528">sph_dec32le_aligned</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ac1eaa2034411e7619613a70a3813d074">sph_enc32le</a> (void *dst, <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a77c96bbda2549c001f7807a035cf4d42">sph_enc32le_aligned</a> (void *dst, <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a0334b8b7e706679f1e6588305eb194df">sph_dec32be</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a1dbf6ceed8e6a9bf198ad5e759b62d54">sph_dec32be_aligned</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a15f055c4bbfa9f4c296c2b41fd163ba1">sph_enc32be</a> (void *dst, <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a8e05e0b98da9cc62523d171bbbffd04e">sph_enc32be_aligned</a> (void *dst, <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#aacbb6c4e2857cbe072efc28668e4235b">sph_dec64le</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ab622d8132749d2030f11d805a381cf24">sph_dec64le_aligned</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ad941f3fa0312fe430d675595c9f56444">sph_enc64le</a> (void *dst, <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a18be3c60bf0074d44a241a4671af81fc">sph_enc64le_aligned</a> (void *dst, <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a26b1954cb1e2377c8aee81cb03446f8b">sph_dec64be</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a46484fd5d8c4780edca4b4e4df05f95b">sph_dec64be_aligned</a> (const void *src)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#a690d29ac8e29c8d0c09d72914bf120d2">sph_enc64be</a> (void *dst, <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> val)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sph__types_8h.html#ac6ea69fade68ec76765ac37f379787d2">sph_enc64be_aligned</a> (void *dst, <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> val)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Basic type definitions.</p> <p>This header file defines the generic integer types that will be used for the implementation of hash functions; it also contains helper functions which encode and decode multi-byte integer values, using either little-endian or big-endian conventions.</p> <p>This file contains a compile-time test on the size of a byte (the <code>unsigned char</code> C type). If bytes are not octets, i.e. if they do not have a size of exactly 8 bits, then compilation is aborted. Architectures where bytes are not octets are relatively rare, even in the embedded devices market. We forbid non-octet bytes because there is no clear convention on how octet streams are encoded on such systems.</p> <p>==========================(LICENSE BEGIN)============================</p> <p>Copyright (c) 2007-2010 Projet RNRT SAPHIR</p> <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p> <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p> <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> <p>===========================(LICENSE END)=============================</p> <dl class="author"><dt><b>Author:</b></dt><dd>Thomas Pornin &lt;<a href="mailto:thomas.pornin@cryptolog.com">thomas.pornin@cryptolog.com</a>&gt; </dd></dl> </div><hr/><h2>Define Documentation</h2> <a class="anchor" id="a9aa5041e567e11581beb3237623b7af0"></a><!-- doxytag: member="sph_types.h::SPH_C32" ref="a9aa5041e567e11581beb3237623b7af0" args="(x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_C32</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x</td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>This macro expands the token <code>x</code> into a suitable constant expression of type <code>sph_u32</code>. Depending on how this type is defined, a suffix such as <code>UL</code> may be appended to the argument.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the token to expand into a suitable constant expression </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a6b2da7fb1eca675723880c22fa7918ca"></a><!-- doxytag: member="sph_types.h::SPH_T32" ref="a6b2da7fb1eca675723880c22fa7918ca" args="(x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_T32</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x</td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Truncate a 32-bit value to exactly 32 bits. On most systems, this is a no-op, recognized as such by the compiler.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to truncate (of type <code>sph_u32</code>) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a2f0780c6a4e1d5f1b3845d48fe8b1f9f"></a><!-- doxytag: member="sph_types.h::SPH_ROTL32" ref="a2f0780c6a4e1d5f1b3845d48fe8b1f9f" args="(x, n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_ROTL32</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">n&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Rotate a 32-bit value by a number of bits to the left. The rotate count must reside between 1 and 31. This macro assumes that its first argument fits in 32 bits (no extra bit allowed on machines where <code>sph_u32</code> is wider); both arguments may be evaluated several times.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to rotate (of type <code>sph_u32</code>) </td></tr> <tr><td class="paramname">n</td><td>the rotation count (between 1 and 31, inclusive) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a8bc9d8182b074b7bd4752658034df72d"></a><!-- doxytag: member="sph_types.h::SPH_ROTR32" ref="a8bc9d8182b074b7bd4752658034df72d" args="(x, n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_ROTR32</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">n&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Rotate a 32-bit value by a number of bits to the left. The rotate count must reside between 1 and 31. This macro assumes that its first argument fits in 32 bits (no extra bit allowed on machines where <code>sph_u32</code> is wider); both arguments may be evaluated several times.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to rotate (of type <code>sph_u32</code>) </td></tr> <tr><td class="paramname">n</td><td>the rotation count (between 1 and 31, inclusive) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a383758264298b1cb816e1aa5b8143e74"></a><!-- doxytag: member="sph_types.h::SPH_64" ref="a383758264298b1cb816e1aa5b8143e74" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_64</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined on systems for which a 64-bit type has been detected, and is used for <code>sph_u64</code>. </p> </div> </div> <a class="anchor" id="aa0762a5223a026586eecaeb11932071d"></a><!-- doxytag: member="sph_types.h::SPH_64_TRUE" ref="aa0762a5223a026586eecaeb11932071d" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_64_TRUE</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined on systems for the "native" integer size is 64 bits (64-bit values fit in one register). </p> </div> </div> <a class="anchor" id="ae0984a800c78947d723a27a4bbf61a62"></a><!-- doxytag: member="sph_types.h::SPH_C64" ref="ae0984a800c78947d723a27a4bbf61a62" args="(x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_C64</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x</td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>This macro expands the token <code>x</code> into a suitable constant expression of type <code>sph_u64</code>. Depending on how this type is defined, a suffix such as <code>ULL</code> may be appended to the argument. This macro is defined only if a 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the token to expand into a suitable constant expression </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a862296a164555017b55e37bb09e20162"></a><!-- doxytag: member="sph_types.h::SPH_T64" ref="a862296a164555017b55e37bb09e20162" args="(x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_T64</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x</td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Truncate a 64-bit value to exactly 64 bits. On most systems, this is a no-op, recognized as such by the compiler. This macro is defined only if a 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to truncate (of type <code>sph_u64</code>) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a0cd067baca3c2ed4b2f3e048dd503393"></a><!-- doxytag: member="sph_types.h::SPH_ROTL64" ref="a0cd067baca3c2ed4b2f3e048dd503393" args="(x, n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_ROTL64</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">n&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Rotate a 64-bit value by a number of bits to the left. The rotate count must reside between 1 and 63. This macro assumes that its first argument fits in 64 bits (no extra bit allowed on machines where <code>sph_u64</code> is wider); both arguments may be evaluated several times. This macro is defined only if a 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to rotate (of type <code>sph_u64</code>) </td></tr> <tr><td class="paramname">n</td><td>the rotation count (between 1 and 63, inclusive) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a2f3d33872596a0f5f3cf36b9eecdca5b"></a><!-- doxytag: member="sph_types.h::SPH_ROTR64" ref="a2f3d33872596a0f5f3cf36b9eecdca5b" args="(x, n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_ROTR64</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">x, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">n&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Rotate a 64-bit value by a number of bits to the left. The rotate count must reside between 1 and 63. This macro assumes that its first argument fits in 64 bits (no extra bit allowed on machines where <code>sph_u64</code> is wider); both arguments may be evaluated several times. This macro is defined only if a 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the value to rotate (of type <code>sph_u64</code>) </td></tr> <tr><td class="paramname">n</td><td>the rotation count (between 1 and 63, inclusive) </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="af65f6f033a520b641563a2574c5d1df8"></a><!-- doxytag: member="sph_types.h::SPH_INLINE" ref="af65f6f033a520b641563a2574c5d1df8" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_INLINE</td> </tr> </table> </div> <div class="memdoc"> <p>This macro evaluates to <code>inline</code> or an equivalent construction, if available on the compilation platform, or to nothing otherwise. This is used to declare inline functions, for which the compiler should endeavour to include the code directly in the caller. Inline functions are typically defined in header files as replacement for macros. </p> </div> </div> <a class="anchor" id="ae933da6e8036611f455b220e5fd54518"></a><!-- doxytag: member="sph_types.h::SPH_LITTLE_ENDIAN" ref="ae933da6e8036611f455b220e5fd54518" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_LITTLE_ENDIAN</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined if the platform has been detected as using little-endian convention. This implies that the <code>sph_u32</code> type (and the <code>sph_u64</code> type also, if it is defined) has an exact width (i.e. exactly 32-bit, respectively 64-bit). </p> </div> </div> <a class="anchor" id="a89fe884c64ec670a09eb9792b6614dd7"></a><!-- doxytag: member="sph_types.h::SPH_BIG_ENDIAN" ref="a89fe884c64ec670a09eb9792b6614dd7" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_BIG_ENDIAN</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined if the platform has been detected as using big-endian convention. This implies that the <code>sph_u32</code> type (and the <code>sph_u64</code> type also, if it is defined) has an exact width (i.e. exactly 32-bit, respectively 64-bit). </p> </div> </div> <a class="anchor" id="a446ac387eeb89e845682be803b40c308"></a><!-- doxytag: member="sph_types.h::SPH_LITTLE_FAST" ref="a446ac387eeb89e845682be803b40c308" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_LITTLE_FAST</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined if 32-bit words (and 64-bit words, if defined) can be read from and written to memory efficiently in little-endian convention. This is the case for little-endian platforms, and also for the big-endian platforms which have special little-endian access opcodes (e.g. Ultrasparc). </p> </div> </div> <a class="anchor" id="a566b63ce77b2a83dff599f829819d80d"></a><!-- doxytag: member="sph_types.h::SPH_BIG_FAST" ref="a566b63ce77b2a83dff599f829819d80d" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_BIG_FAST</td> </tr> </table> </div> <div class="memdoc"> <p>This macro is defined if 32-bit words (and 64-bit words, if defined) can be read from and written to memory efficiently in big-endian convention. This is the case for little-endian platforms, and also for the little-endian platforms which have special big-endian access opcodes. </p> </div> </div> <a class="anchor" id="add0ead78918ca1b3c98eefd65854b8fa"></a><!-- doxytag: member="sph_types.h::SPH_UPTR" ref="add0ead78918ca1b3c98eefd65854b8fa" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_UPTR</td> </tr> </table> </div> <div class="memdoc"> <p>On some platforms, this macro is defined to an unsigned integer type into which pointer values may be cast. The resulting value can then be tested for being a multiple of 2, 4 or 8, indicating an aligned pointer for, respectively, 16-bit, 32-bit or 64-bit memory accesses. </p> </div> </div> <a class="anchor" id="aea5170f5e2463294bb3c5858742c416b"></a><!-- doxytag: member="sph_types.h::SPH_UNALIGNED" ref="aea5170f5e2463294bb3c5858742c416b" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define SPH_UNALIGNED</td> </tr> </table> </div> <div class="memdoc"> <p>When defined, this macro indicates that unaligned memory accesses are possible with only a minor penalty, and thus should be prefered over strategies which first copy data to an aligned buffer. </p> </div> </div> <hr/><h2>Typedef Documentation</h2> <a class="anchor" id="a75df7959945379764b2993e32d7c5bcb"></a><!-- doxytag: member="sph_types.h::sph_u32" ref="a75df7959945379764b2993e32d7c5bcb" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef __arch_dependant__ <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a></td> </tr> </table> </div> <div class="memdoc"> <p>Unsigned integer type whose length is at least 32 bits; on most architectures, it will have a width of exactly 32 bits. Unsigned C types implement arithmetics modulo a power of 2; use the <code><a class="el" href="sph__types_8h.html#a6b2da7fb1eca675723880c22fa7918ca">SPH_T32()</a></code> macro to ensure that the value is truncated to exactly 32 bits. Unless otherwise specified, all macros and functions which accept <code>sph_u32</code> values assume that these values fit on 32 bits, i.e. do not exceed 2^32-1, even on architectures where <code>sph_u32</code> is larger than that. </p> </div> </div> <a class="anchor" id="a9096255be60de8b630c6d268461a0972"></a><!-- doxytag: member="sph_types.h::sph_s32" ref="a9096255be60de8b630c6d268461a0972" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef __arch_dependant__ <a class="el" href="sph__types_8h.html#a9096255be60de8b630c6d268461a0972">sph_s32</a></td> </tr> </table> </div> <div class="memdoc"> <p>Signed integer type corresponding to <code>sph_u32</code>; it has width 32 bits or more. </p> </div> </div> <a class="anchor" id="ab8785020c236aac895d020a3367ef227"></a><!-- doxytag: member="sph_types.h::sph_u64" ref="ab8785020c236aac895d020a3367ef227" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef __arch_dependant__ <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a></td> </tr> </table> </div> <div class="memdoc"> <p>Unsigned integer type whose length is at least 64 bits; on most architectures which feature such a type, it will have a width of exactly 64 bits. C99-compliant platform will have this type; it is also defined when the GNU compiler (gcc) is used, and on platforms where <code>unsigned long</code> is large enough. If this type is not available, then some hash functions which depends on a 64-bit type will not be available (most notably SHA-384, SHA-512, Tiger and WHIRLPOOL). </p> </div> </div> <a class="anchor" id="ae48722d443535f1e82905e742f2b3d11"></a><!-- doxytag: member="sph_types.h::sph_s64" ref="ae48722d443535f1e82905e742f2b3d11" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef __arch_dependant__ <a class="el" href="sph__types_8h.html#ae48722d443535f1e82905e742f2b3d11">sph_s64</a></td> </tr> </table> </div> <div class="memdoc"> <p>Signed integer type corresponding to <code>sph_u64</code>; it has width 64 bits or more. </p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="aa21c79a8abd42546ea5862eca100acce"></a><!-- doxytag: member="sph_types.h::sph_bswap32" ref="aa21c79a8abd42546ea5862eca100acce" args="(sph_u32 x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> sph_bswap32 </td> <td>(</td> <td class="paramtype"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td> <td class="paramname"><em>x</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Byte-swap a 32-bit word (i.e. <code>0x12345678</code> becomes <code>0x78563412</code>). This is an inline function which resorts to inline assembly on some platforms, for better performance.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the 32-bit value to byte-swap </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the byte-swapped value </dd></dl> </div> </div> <a class="anchor" id="a9fe9a72d55ebe6b5f47925a631eb5030"></a><!-- doxytag: member="sph_types.h::sph_bswap64" ref="a9fe9a72d55ebe6b5f47925a631eb5030" args="(sph_u64 x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> sph_bswap64 </td> <td>(</td> <td class="paramtype"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td> <td class="paramname"><em>x</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Byte-swap a 64-bit word. This is an inline function which resorts to inline assembly on some platforms, for better performance. This function is defined only if a suitable 64-bit type was found for <code>sph_u64</code></p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>the 64-bit value to byte-swap </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the byte-swapped value </dd></dl> </div> </div> <a class="anchor" id="a7f729a6c8b9ead5cb2b0835aeae3217d"></a><!-- doxytag: member="sph_types.h::sph_dec16le" ref="a7f729a6c8b9ead5cb2b0835aeae3217d" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static unsigned sph_dec16le </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 16-bit unsigned value from memory, in little-endian convention (least significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="a6107a9b15c1ba89e5b37e1bb728ad654"></a><!-- doxytag: member="sph_types.h::sph_enc16le" ref="a6107a9b15c1ba89e5b37e1bb728ad654" args="(void *dst, unsigned val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc16le </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 16-bit unsigned value into memory, in little-endian convention (least significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a19d8b62deef02aac1b42b6606e5eabd4"></a><!-- doxytag: member="sph_types.h::sph_dec16be" ref="a19d8b62deef02aac1b42b6606e5eabd4" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static unsigned sph_dec16be </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 16-bit unsigned value from memory, in big-endian convention (most significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="ae84619401c2338dd568d7466e2000279"></a><!-- doxytag: member="sph_types.h::sph_enc16be" ref="ae84619401c2338dd568d7466e2000279" args="(void *dst, unsigned val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc16be </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 16-bit unsigned value into memory, in big-endian convention (most significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ad3eeb6346fffa1029a239fe94bfdc4e6"></a><!-- doxytag: member="sph_types.h::sph_dec32le" ref="ad3eeb6346fffa1029a239fe94bfdc4e6" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> sph_dec32le </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 32-bit unsigned value from memory, in little-endian convention (least significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="ac808629acbf32dba42e5259b40983528"></a><!-- doxytag: member="sph_types.h::sph_dec32le_aligned" ref="ac808629acbf32dba42e5259b40983528" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> sph_dec32le_aligned </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 32-bit unsigned value from memory, in little-endian convention (least significant byte comes first). This function assumes that the source address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#ad3eeb6346fffa1029a239fe94bfdc4e6">sph_dec32le()</a></code> function.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="ac1eaa2034411e7619613a70a3813d074"></a><!-- doxytag: member="sph_types.h::sph_enc32le" ref="ac1eaa2034411e7619613a70a3813d074" args="(void *dst, sph_u32 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc32le </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 32-bit unsigned value into memory, in little-endian convention (least significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a77c96bbda2549c001f7807a035cf4d42"></a><!-- doxytag: member="sph_types.h::sph_enc32le_aligned" ref="a77c96bbda2549c001f7807a035cf4d42" args="(void *dst, sph_u32 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc32le_aligned </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 32-bit unsigned value into memory, in little-endian convention (least significant byte comes first). This function assumes that the destination address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#ac1eaa2034411e7619613a70a3813d074">sph_enc32le()</a></code> function.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a0334b8b7e706679f1e6588305eb194df"></a><!-- doxytag: member="sph_types.h::sph_dec32be" ref="a0334b8b7e706679f1e6588305eb194df" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> sph_dec32be </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 32-bit unsigned value from memory, in big-endian convention (most significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="a1dbf6ceed8e6a9bf198ad5e759b62d54"></a><!-- doxytag: member="sph_types.h::sph_dec32be_aligned" ref="a1dbf6ceed8e6a9bf198ad5e759b62d54" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a> sph_dec32be_aligned </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 32-bit unsigned value from memory, in big-endian convention (most significant byte comes first). This function assumes that the source address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#a0334b8b7e706679f1e6588305eb194df">sph_dec32be()</a></code> function.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="a15f055c4bbfa9f4c296c2b41fd163ba1"></a><!-- doxytag: member="sph_types.h::sph_enc32be" ref="a15f055c4bbfa9f4c296c2b41fd163ba1" args="(void *dst, sph_u32 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc32be </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 32-bit unsigned value into memory, in big-endian convention (most significant byte comes first).</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a8e05e0b98da9cc62523d171bbbffd04e"></a><!-- doxytag: member="sph_types.h::sph_enc32be_aligned" ref="a8e05e0b98da9cc62523d171bbbffd04e" args="(void *dst, sph_u32 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc32be_aligned </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#a75df7959945379764b2993e32d7c5bcb">sph_u32</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 32-bit unsigned value into memory, in big-endian convention (most significant byte comes first). This function assumes that the destination address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#a15f055c4bbfa9f4c296c2b41fd163ba1">sph_enc32be()</a></code> function.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="aacbb6c4e2857cbe072efc28668e4235b"></a><!-- doxytag: member="sph_types.h::sph_dec64le" ref="aacbb6c4e2857cbe072efc28668e4235b" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> sph_dec64le </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 64-bit unsigned value from memory, in little-endian convention (least significant byte comes first). This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="ab622d8132749d2030f11d805a381cf24"></a><!-- doxytag: member="sph_types.h::sph_dec64le_aligned" ref="ab622d8132749d2030f11d805a381cf24" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> sph_dec64le_aligned </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 64-bit unsigned value from memory, in little-endian convention (least significant byte comes first). This function assumes that the source address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#aacbb6c4e2857cbe072efc28668e4235b">sph_dec64le()</a></code> function. This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="ad941f3fa0312fe430d675595c9f56444"></a><!-- doxytag: member="sph_types.h::sph_enc64le" ref="ad941f3fa0312fe430d675595c9f56444" args="(void *dst, sph_u64 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc64le </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 64-bit unsigned value into memory, in little-endian convention (least significant byte comes first). This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a18be3c60bf0074d44a241a4671af81fc"></a><!-- doxytag: member="sph_types.h::sph_enc64le_aligned" ref="a18be3c60bf0074d44a241a4671af81fc" args="(void *dst, sph_u64 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc64le_aligned </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 64-bit unsigned value into memory, in little-endian convention (least significant byte comes first). This function assumes that the destination address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#ad941f3fa0312fe430d675595c9f56444">sph_enc64le()</a></code> function. This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a26b1954cb1e2377c8aee81cb03446f8b"></a><!-- doxytag: member="sph_types.h::sph_dec64be" ref="a26b1954cb1e2377c8aee81cb03446f8b" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> sph_dec64be </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 64-bit unsigned value from memory, in big-endian convention (most significant byte comes first). This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="a46484fd5d8c4780edca4b4e4df05f95b"></a><!-- doxytag: member="sph_types.h::sph_dec64be_aligned" ref="a46484fd5d8c4780edca4b4e4df05f95b" args="(const void *src)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a> sph_dec64be_aligned </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>src</em></td><td>)</td> <td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Decode a 64-bit unsigned value from memory, in big-endian convention (most significant byte comes first). This function assumes that the source address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#a26b1954cb1e2377c8aee81cb03446f8b">sph_dec64be()</a></code> function. This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">src</td><td>the source address </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the decoded value </dd></dl> </div> </div> <a class="anchor" id="a690d29ac8e29c8d0c09d72914bf120d2"></a><!-- doxytag: member="sph_types.h::sph_enc64be" ref="a690d29ac8e29c8d0c09d72914bf120d2" args="(void *dst, sph_u64 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc64be </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 64-bit unsigned value into memory, in big-endian convention (most significant byte comes first). This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ac6ea69fade68ec76765ac37f379787d2"></a><!-- doxytag: member="sph_types.h::sph_enc64be_aligned" ref="ac6ea69fade68ec76765ac37f379787d2" args="(void *dst, sph_u64 val)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void sph_enc64be_aligned </td> <td>(</td> <td class="paramtype">void *&#160;</td> <td class="paramname"><em>dst</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="sph__types_8h.html#ab8785020c236aac895d020a3367ef227">sph_u64</a>&#160;</td> <td class="paramname"><em>val</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Encode a 64-bit unsigned value into memory, in big-endian convention (most significant byte comes first). This function assumes that the destination address is suitably aligned for a direct access, if the platform supports such things; it can thus be marginally faster than the generic <code><a class="el" href="sph__types_8h.html#a690d29ac8e29c8d0c09d72914bf120d2">sph_enc64be()</a></code> function. This function is defined only if a suitable 64-bit type was detected and used for <code>sph_u64</code>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">dst</td><td>the destination buffer </td></tr> <tr><td class="paramname">val</td><td>the value to encode </td></tr> </table> </dd> </dl> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Jul 20 2011 21:15:30 for sphlib by&#160; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>
{ "content_hash": "57f4bf82c19723afcc28c6106ff664f7", "timestamp": "", "source": "github", "line_count": 1187, "max_line_length": 592, "avg_line_length": 52.35888795282224, "alnum_prop": 0.644424778761062, "repo_name": "miningathome/sphlib", "id": "17e8a93176791e7fc1e8a0f101ae4491a6abd427", "size": "62150", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/api-c/sph__types_8h.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "15809214" }, { "name": "C++", "bytes": "2270" }, { "name": "CSS", "bytes": "14499" }, { "name": "Java", "bytes": "4834139" }, { "name": "Shell", "bytes": "5723" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <androidx.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout app:layout_box="bottom|left|right" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView style="@style/TextAppearance.AppCompat.Title" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/material_baseline_grid_2x" android:paddingLeft="@dimen/material_baseline_grid_4x" android:paddingRight="@dimen/material_baseline_grid_4x" android:background="@color/darkPrimary" android:elevation="@dimen/material_baseline_grid_1x" android:text="Select Launches to Follow" android:textAlignment="center" /> <ScrollView android:paddingStart="@dimen/material_baseline_grid_1.5x" android:paddingEnd="@dimen/material_baseline_grid_1.5x" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginEnd="@dimen/material_baseline_grid_1x" android:layout_marginStart="@dimen/material_baseline_grid_1x" android:orientation="vertical" android:paddingEnd="10dp" android:paddingStart="10dp"> <Switch android:id="@+id/switch_all" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_1x" android:text="All" /> <Switch android:id="@+id/switch_spacex" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_0.5x" android:text="SpaceX" /> <Switch android:id="@+id/switch_nasa" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_0.5x" android:text="NASA" /> <Switch android:id="@+id/switch_ula" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_0.5x" android:text="ULA" /> <Switch android:id="@+id/switch_roscosmos" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_0.5x" android:text="ROSCOSMOS" /> <Switch android:id="@+id/switch_cnsa" style="@style/Widget.Wear.RoundSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/material_baseline_grid_0.5x" android:layout_marginTop="@dimen/material_baseline_grid_0.5x" android:text="CSNA" /> <Button android:id="@+id/button_ok" android:layout_width="match_parent" android:layout_height="match_parent" android:text="Accept" /> <Space android:layout_width="match_parent" android:layout_height="@dimen/material_baseline_grid_6x" /> </LinearLayout> </ScrollView> </LinearLayout> </androidx.wear.widget.BoxInsetLayout>
{ "content_hash": "18e8889ca3bb2561adf8cc1538c6096c", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 84, "avg_line_length": 46.06422018348624, "alnum_prop": 0.5562636924915355, "repo_name": "ItsCalebJones/SpaceLaunchNow", "id": "7f0c7e8a4049e4c853d1ee7f5a5c91081f2dd9ec", "size": "5021", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wear/src/main/res/layout-round/activity_next_launch_complication_configuration.xml", "mode": "33188", "license": "mit", "language": [ { "name": "IDL", "bytes": "6468" }, { "name": "Java", "bytes": "931097" } ], "symlink_target": "" }
import React from 'react'; import SortArrow from './SortArrow'; const Header = ({ columnKey, handleClick, sortOrder, sortable }) => ( <th style={{ cursor: sortable ? 'pointer' : 'default' }} onClick={handleClick}> {columnKey} {sortable ? <SortArrow order={sortOrder} /> : null} </th> ); export default Header;
{ "content_hash": "f06e5453301e87c268d3533edc69878e", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 81, "avg_line_length": 29.363636363636363, "alnum_prop": 0.6625386996904025, "repo_name": "a-type/redux-data-table", "id": "0c571ebab366f50077d77a3be3e5877945cf4da3", "size": "323", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/components/Header.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "125" }, { "name": "JavaScript", "bytes": "22585" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>User agent detail - Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="../circle.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /><small>vendor/piwik/device-detector/Tests/fixtures/tablet.yml</small></td><td>Android Browser </td><td>WebKit </td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Fujitsu</td><td>Arrows Tab F-05E</td><td>tablet</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-a952e161-ace3-4c73-a03c-12746b7cf6d1">Detail</a> <!-- Modal Structure --> <div id="modal-a952e161-ace3-4c73-a03c-12746b7cf6d1" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [user_agent] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 [os] => Array ( [name] => Android [short_name] => AND [version] => 4.0.4 [platform] => ) [client] => Array ( [type] => browser [name] => Android Browser [short_name] => AN [version] => [engine] => WebKit ) [device] => Array ( [type] => tablet [brand] => FU [model] => Arrows Tab F-05E ) [os_family] => Android [browser_family] => Android Browser ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td><td>Android 4.0</td><td>WebKit </td><td>Android 4.0</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.013</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-47a9cd06-e213-4882-bc34-db6aed664223">Detail</a> <!-- Modal Structure --> <div id="modal-47a9cd06-e213-4882-bc34-db6aed664223" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapFull result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.4\.0.* build\/.*\).*applewebkit\/.*\(.*khtml,.*like gecko.*\).*version\/4\.0.*safari.*$/ [browser_name_pattern] => mozilla/5.0 (*linux*android?4.0* build/*)*applewebkit/*(*khtml,*like gecko*)*version/4.0*safari* [parent] => Android Browser 4.0 [comment] => Android Browser 4.0 [browser] => Android [browser_type] => Browser [browser_bits] => 32 [browser_maker] => Google Inc [browser_modus] => unknown [version] => 4.0 [majorver] => 4 [minorver] => 0 [platform] => Android [platform_version] => 4.0 [platform_description] => Android OS [platform_bits] => 32 [platform_maker] => Google Inc [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [backgroundsounds] => [javascript] => 1 [vbscript] => [javaapplets] => 1 [activexcontrols] => [ismobiledevice] => 1 [istablet] => [issyndicationreader] => [crawler] => [isfake] => [isanonymized] => [ismodified] => [cssversion] => 3 [aolversion] => 0 [device_name] => general Mobile Phone [device_maker] => unknown [device_type] => Mobile Phone [device_pointing_method] => touchscreen [device_code_name] => general Mobile Phone [device_brand_name] => unknown [renderingengine_name] => WebKit [renderingengine_version] => unknown [renderingengine_description] => For Google Chrome, iOS (including both mobile Safari, WebViews within third-party apps, and web clips), Safari, Arora, Midori, OmniWeb, Shiira, iCab since version 4, Web, SRWare Iron, Rekonq, and in Maxthon 3. [renderingengine_maker] => Apple Inc ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td><td>Android 4.0</td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile Phone</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.005</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-42bb56ba-b834-47c5-bea0-c0270e9ab371">Detail</a> <!-- Modal Structure --> <div id="modal-42bb56ba-b834-47c5-bea0-c0270e9ab371" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapLite result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.* build\/.*\).*applewebkit\/.*\(.*khtml,.*like gecko.*\).*version\/4\.0.*safari.*$/ [browser_name_pattern] => mozilla/5.0 (*linux*android* build/*)*applewebkit/*(*khtml,*like gecko*)*version/4.0*safari* [parent] => Android Browser 4.0 [comment] => Android Browser 4.0 [browser] => Android [browser_type] => unknown [browser_bits] => 0 [browser_maker] => unknown [browser_modus] => unknown [version] => 4.0 [majorver] => 0 [minorver] => 0 [platform] => Android [platform_version] => unknown [platform_description] => unknown [platform_bits] => 0 [platform_maker] => unknown [alpha] => false [beta] => false [win16] => false [win32] => false [win64] => false [frames] => false [iframes] => false [tables] => false [cookies] => false [backgroundsounds] => false [javascript] => false [vbscript] => false [javaapplets] => false [activexcontrols] => false [ismobiledevice] => 1 [istablet] => [issyndicationreader] => false [crawler] => false [isfake] => false [isanonymized] => false [ismodified] => false [cssversion] => 0 [aolversion] => 0 [device_name] => unknown [device_maker] => unknown [device_type] => Mobile Phone [device_pointing_method] => unknown [device_code_name] => unknown [device_brand_name] => unknown [renderingengine_name] => unknown [renderingengine_version] => unknown [renderingengine_description] => unknown [renderingengine_maker] => unknown ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td><td>Android 4.0</td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.01</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-ad0041a2-b0f4-43f6-a70d-cad1443caa68">Detail</a> <!-- Modal Structure --> <div id="modal-ad0041a2-b0f4-43f6-a70d-cad1443caa68" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapPhp result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.* build\/.*\).*applewebkit\/.*\(.*khtml,.*like gecko.*\).*version\/4\.0.*safari.*$/ [browser_name_pattern] => mozilla/5.0 (*linux*android* build/*)*applewebkit/*(*khtml,*like gecko*)*version/4.0*safari* [parent] => Android Browser 4.0 [comment] => Android Browser 4.0 [browser] => Android [browser_type] => unknown [browser_bits] => 0 [browser_maker] => Google Inc [browser_modus] => unknown [version] => 4.0 [majorver] => 4 [minorver] => 0 [platform] => Android [platform_version] => unknown [platform_description] => unknown [platform_bits] => 0 [platform_maker] => unknown [alpha] => false [beta] => false [win16] => false [win32] => false [win64] => false [frames] => false [iframes] => false [tables] => false [cookies] => false [backgroundsounds] => false [javascript] => false [vbscript] => false [javaapplets] => false [activexcontrols] => false [ismobiledevice] => 1 [istablet] => [issyndicationreader] => false [crawler] => [isfake] => false [isanonymized] => false [ismodified] => false [cssversion] => 0 [aolversion] => 0 [device_name] => unknown [device_maker] => unknown [device_type] => Mobile Phone [device_pointing_method] => touchscreen [device_code_name] => unknown [device_brand_name] => unknown [renderingengine_name] => unknown [renderingengine_version] => unknown [renderingengine_description] => unknown [renderingengine_maker] => unknown ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>Android Browser 4.0</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050">Detail</a> <!-- Modal Structure --> <div id="modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => Android [browser] => Android Browser [version] => 4.0 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td><td>Safari 4.0</td><td><i class="material-icons">close</i></td><td>AndroidOS 4.0.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51">Detail</a> <!-- Modal Structure --> <div id="modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>JenssegersAgent result detail</h4> <p><pre><code class="php">Array ( [browserName] => Safari [browserVersion] => 4.0 [osName] => AndroidOS [osVersion] => 4.0.4 [deviceModel] => FujitsuTablet [isMobile] => 1 [isRobot] => [botName] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td>Android Webkit 4.0</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Fujitsu</td><td>ARROWS Tab F-05E</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.29002</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b">Detail</a> <!-- Modal Structure --> <div id="modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [mobile_screen_height] => 480 [is_mobile] => 1 [type] => mobile-browser [mobile_brand] => Fujitsu [mobile_model] => ARROWS Tab F-05E [version] => 4.0 [is_android] => 1 [browser_name] => Android Webkit [operating_system_family] => Android [operating_system_version] => 4.0.4 [is_ios] => [producer] => Google Inc. [operating_system] => Android 4.0.x Ice Cream Sandwich [mobile_screen_width] => 320 [mobile_browser] => Android Webkit ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td>Android Browser </td><td>WebKit </td><td>Android 4.0</td><td style="border-left: 1px solid #555">Fujitsu</td><td>Arrows Tab F-05E</td><td>tablet</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-4a941d34-a8d3-4914-9724-346f60ad7046">Detail</a> <!-- Modal Structure --> <div id="modal-4a941d34-a8d3-4914-9724-346f60ad7046" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => Array ( [type] => browser [name] => Android Browser [short_name] => AN [version] => [engine] => WebKit ) [operatingSystem] => Array ( [name] => Android [short_name] => AND [version] => 4.0 [platform] => ) [device] => Array ( [brand] => FU [brandName] => Fujitsu [model] => Arrows Tab F-05E [device] => 2 [deviceName] => tablet ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => 1 [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [isPortableMediaPlayer] => [isSmartDisplay] => [isSmartphone] => [isTablet] => 1 [isTV] => [isDesktop] => [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.1</small><br /></td><td>Navigator 4.0</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-ec1cd248-02b0-457e-8a9d-35bb99af008c">Detail</a> <!-- Modal Structure --> <div id="modal-ec1cd248-02b0-457e-8a9d-35bb99af008c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>SinergiBrowserDetector result detail</h4> <p><pre><code class="php">Array ( [browser] => Sinergi\BrowserDetector\Browser Object ( [userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 ) [name:Sinergi\BrowserDetector\Browser:private] => Navigator [version:Sinergi\BrowserDetector\Browser:private] => 4.0 [isRobot:Sinergi\BrowserDetector\Browser:private] => [isChromeFrame:Sinergi\BrowserDetector\Browser:private] => [isFacebookWebView:Sinergi\BrowserDetector\Browser:private] => [isCompatibilityMode:Sinergi\BrowserDetector\Browser:private] => ) [operatingSystem] => Sinergi\BrowserDetector\Os Object ( [name:Sinergi\BrowserDetector\Os:private] => Android [version:Sinergi\BrowserDetector\Os:private] => 4.0.4 [isMobile:Sinergi\BrowserDetector\Os:private] => 1 [userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 ) ) [device] => Sinergi\BrowserDetector\Device Object ( [name:Sinergi\BrowserDetector\Device:private] => unknown [userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 ) ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td>Android 4.0.4</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Fujitsu</td><td>F-05E</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-3160e405-8a8f-46dd-8f47-5115f06462d2">Detail</a> <!-- Modal Structure --> <div id="modal-3160e405-8a8f-46dd-8f47-5115f06462d2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => 4 [minor] => 0 [patch] => 4 [family] => Android ) [os] => UAParser\Result\OperatingSystem Object ( [major] => 4 [minor] => 0 [patch] => 4 [patchMinor] => [family] => Android ) [device] => UAParser\Result\Device Object ( [brand] => Fujitsu [model] => F-05E [family] => F-05E ) [originalUserAgent] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td><td>Safari 534.30</td><td>WebKit 534.30</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.15101</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6">Detail</a> <!-- Modal Structure --> <div id="modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UserAgentApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [platform_name] => Android [platform_version] => 4.0.4 [platform_type] => Mobile [browser_name] => Safari [browser_version] => 534.30 [engine_name] => WebKit [engine_version] => 534.30 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentStringCom<br /><small></small><br /></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.11801</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee">Detail</a> <!-- Modal Structure --> <div id="modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UserAgentStringCom result detail</h4> <p><pre><code class="php">stdClass Object ( [agent_type] => Browser [agent_name] => Android Webkit Browser [agent_version] => -- [os_type] => Android [os_name] => Android [os_versionName] => [os_versionNumber] => 4.0.4 [os_producer] => [os_producerURL] => [linux_distibution] => Null [agent_language] => Japanese - Japan [agent_languageTag] => ja-jp ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td><td>Android Browser 4.0</td><td>WebKit 534.30</td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.24401</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c">Detail</a> <!-- Modal Structure --> <div id="modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [operating_system_name] => Android [simple_sub_description_string] => [simple_browser_string] => Android Browser 4 on Android (Ice Cream Sandwich) [browser_version] => 4 [extra_info] => Array ( ) [operating_platform] => [extra_info_table] => stdClass Object ( [System Build] => V18R41A ) [layout_engine_name] => WebKit [detected_addons] => Array ( ) [operating_system_flavour_code] => [hardware_architecture] => [operating_system_flavour] => [operating_system_frameworks] => Array ( ) [browser_name_code] => android-browser [operating_system_version] => Ice Cream Sandwich [simple_operating_platform_string] => [is_abusive] => [layout_engine_version] => 534.30 [browser_capabilities] => Array ( ) [operating_platform_vendor_name] => [operating_system] => Android (Ice Cream Sandwich) [operating_system_version_full] => 4.0.4 [operating_platform_code] => [browser_name] => Android Browser [operating_system_name_code] => android [user_agent] => Mozilla/5.0 (Linux; U; Android 4.0.4; ja-jp; F-05E Build/V18R41A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 [browser_version_full] => 4.0 [browser] => Android Browser 4 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td>Android Browser </td><td>Webkit 534.30</td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Fujitsu</td><td>ARROWS Tab F-05E</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-083a336f-5d73-4505-84f3-c5fc9bb78652">Detail</a> <!-- Modal Structure --> <div id="modal-083a336f-5d73-4505-84f3-c5fc9bb78652" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [name] => Android Browser ) [engine] => Array ( [name] => Webkit [version] => 534.30 ) [os] => Array ( [name] => Android [version] => 4.0.4 ) [device] => Array ( [type] => mobile [subtype] => smart [manufacturer] => Fujitsu [model] => ARROWS Tab F-05E [carrier] => DoCoMo ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td><td>Safari 4.0</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9">Detail</a> <!-- Modal Structure --> <div id="modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Woothee result detail</h4> <p><pre><code class="php">Array ( [name] => Safari [vendor] => Apple [version] => 4.0 [category] => smartphone [os] => Android [os_version] => 4.0.4 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td>Android Webkit 4.0.4</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"></td><td></td><td>Tablet</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.017</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50">Detail</a> <!-- Modal Structure --> <div id="modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => true [is_ios] => false [is_windows_phone] => false [is_app] => false [is_full_desktop] => false [is_largescreen] => true [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => true [is_wml_preferred] => false [is_xhtmlmp_preferred] => false [is_html_preferred] => true [advertised_device_os] => Android [advertised_device_os_version] => 4.0.4 [advertised_browser] => Android Webkit [advertised_browser_version] => 4.0.4 [complete_device_name] => Generic Android 4 Tablet [device_name] => Generic Android 4 Tablet [form_factor] => Tablet [is_phone] => false [is_app_webview] => false ) [all] => Array ( [brand_name] => Generic [model_name] => Android 4 Tablet [unique] => true [ununiqueness_handler] => [is_wireless_device] => true [device_claims_web_support] => true [has_qwerty_keyboard] => true [can_skip_aligned_link_row] => true [uaprof] => [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => Android [mobile_browser] => Android Webkit [mobile_browser_version] => [device_os_version] => 4.0 [pointing_method] => touchscreen [release_date] => 2012_january [marketing_name] => [model_extra_info] => [nokia_feature_pack] => 0 [can_assign_phone_number] => false [is_tablet] => true [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [built_in_back_button_support] => false [card_title_support] => true [softkey_support] => false [table_support] => true [numbered_menus] => false [menu_with_select_element_recommended] => false [menu_with_list_of_links_recommended] => true [icons_on_menu_items_support] => false [break_list_of_links_with_br_element_recommended] => true [access_key_support] => false [wrap_mode_support] => false [times_square_mode_support] => false [deck_prefetch_support] => false [elective_forms_recommended] => true [wizards_recommended] => false [image_as_link_support] => false [insert_br_element_after_widget_recommended] => false [wml_can_display_images_and_text_on_same_line] => false [wml_displays_image_in_center] => false [opwv_wml_extensions_support] => false [wml_make_phone_call_string] => wtai://wp/mc; [chtml_display_accesskey] => false [emoji] => false [chtml_can_display_images_and_text_on_same_line] => false [chtml_displays_image_in_center] => false [imode_region] => none [chtml_make_phone_call_string] => tel: [chtml_table_support] => false [xhtml_honors_bgcolor] => true [xhtml_supports_forms_in_table] => true [xhtml_support_wml2_namespace] => false [xhtml_autoexpand_select] => false [xhtml_select_as_dropdown] => false [xhtml_select_as_radiobutton] => false [xhtml_select_as_popup] => false [xhtml_display_accesskey] => false [xhtml_supports_invisible_text] => false [xhtml_supports_inline_input] => false [xhtml_supports_monospace_font] => false [xhtml_supports_table_for_layout] => true [xhtml_supports_css_cell_table_coloring] => true [xhtml_format_as_css_property] => false [xhtml_format_as_attribute] => false [xhtml_nowrap_mode] => false [xhtml_marquee_as_css_property] => false [xhtml_readable_background_color1] => #FFFFFF [xhtml_readable_background_color2] => #FFFFFF [xhtml_allows_disabled_form_elements] => true [xhtml_document_title_support] => true [xhtml_preferred_charset] => iso-8859-1 [opwv_xhtml_extensions_support] => false [xhtml_make_phone_call_string] => tel: [xhtmlmp_preferred_mime_type] => text/html [xhtml_table_support] => true [xhtml_send_sms_string] => sms: [xhtml_send_mms_string] => mms: [xhtml_file_upload] => supported [cookie_support] => true [accept_third_party_cookie] => true [xhtml_supports_iframe] => full [xhtml_avoid_accesskeys] => true [xhtml_can_embed_video] => none [ajax_support_javascript] => true [ajax_manipulate_css] => true [ajax_support_getelementbyid] => true [ajax_support_inner_html] => true [ajax_xhr_type] => standard [ajax_manipulate_dom] => true [ajax_support_events] => true [ajax_support_event_listener] => true [ajax_preferred_geoloc_api] => w3c_api [xhtml_support_level] => 4 [preferred_markup] => html_web_4_0 [wml_1_1] => false [wml_1_2] => false [wml_1_3] => false [html_wi_w3_xhtmlbasic] => true [html_wi_oma_xhtmlmp_1_0] => true [html_wi_imode_html_1] => false [html_wi_imode_html_2] => false [html_wi_imode_html_3] => false [html_wi_imode_html_4] => false [html_wi_imode_html_5] => false [html_wi_imode_htmlx_1] => false [html_wi_imode_htmlx_1_1] => false [html_wi_imode_compact_generic] => false [html_web_3_2] => true [html_web_4_0] => true [voicexml] => false [multipart_support] => false [total_cache_disable_support] => false [time_to_live_support] => false [resolution_width] => 480 [resolution_height] => 800 [columns] => 60 [max_image_width] => 480 [max_image_height] => 800 [rows] => 40 [physical_screen_width] => 92 [physical_screen_height] => 153 [dual_orientation] => true [density_class] => 1.0 [wbmp] => true [bmp] => false [epoc_bmp] => false [gif_animated] => false [jpg] => true [png] => true [tiff] => false [transparent_png_alpha] => true [transparent_png_index] => true [svgt_1_1] => true [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 65536 [webp_lossy_support] => true [webp_lossless_support] => false [post_method_support] => true [basic_authentication_support] => true [empty_option_value_support] => true [emptyok] => false [nokia_voice_call] => false [wta_voice_call] => false [wta_phonebook] => false [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 3600 [wifi] => true [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 2000000 [max_url_length_in_requests] => 256 [max_url_length_homepage] => 0 [max_url_length_bookmark] => 0 [max_url_length_cached_page] => 0 [max_no_of_connection_settings] => 0 [max_no_of_bookmarks] => 0 [max_length_of_username] => 0 [max_length_of_password] => 0 [max_object_size] => 0 [downloadfun_support] => false [directdownload_support] => true [inline_support] => false [oma_support] => true [ringtone] => false [ringtone_3gpp] => false [ringtone_midi_monophonic] => false [ringtone_midi_polyphonic] => false [ringtone_imelody] => false [ringtone_digiplug] => false [ringtone_compactmidi] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [ringtone_df_size_limit] => 0 [ringtone_directdownload_size_limit] => 0 [ringtone_inline_size_limit] => 0 [ringtone_oma_size_limit] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [wallpaper_max_height] => 0 [wallpaper_preferred_width] => 0 [wallpaper_preferred_height] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [wallpaper_df_size_limit] => 0 [wallpaper_directdownload_size_limit] => 0 [wallpaper_inline_size_limit] => 0 [wallpaper_oma_size_limit] => 0 [screensaver] => false [screensaver_max_width] => 0 [screensaver_max_height] => 0 [screensaver_preferred_width] => 0 [screensaver_preferred_height] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [screensaver_greyscale] => false [screensaver_colors] => 2 [screensaver_df_size_limit] => 0 [screensaver_directdownload_size_limit] => 0 [screensaver_inline_size_limit] => 0 [screensaver_oma_size_limit] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [picture_preferred_width] => 0 [picture_preferred_height] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [picture_df_size_limit] => 0 [picture_directdownload_size_limit] => 0 [picture_inline_size_limit] => 0 [picture_oma_size_limit] => 0 [video] => false [oma_v_1_0_forwardlock] => false [oma_v_1_0_combined_delivery] => false [oma_v_1_0_separate_delivery] => false [streaming_video] => true [streaming_3gpp] => true [streaming_mp4] => true [streaming_mov] => false [streaming_video_size_limit] => 0 [streaming_real_media] => none [streaming_flv] => false [streaming_3g2] => false [streaming_vcodec_h263_0] => 10 [streaming_vcodec_h263_3] => -1 [streaming_vcodec_mpeg4_sp] => 2 [streaming_vcodec_mpeg4_asp] => -1 [streaming_vcodec_h264_bp] => 3.0 [streaming_acodec_amr] => nb [streaming_acodec_aac] => lc [streaming_wmv] => none [streaming_preferred_protocol] => rtsp [streaming_preferred_http_protocol] => apple_live_streaming [wap_push_support] => false [connectionless_service_indication] => false [connectionless_service_load] => false [connectionless_cache_operation] => false [connectionoriented_unconfirmed_service_indication] => false [connectionoriented_unconfirmed_service_load] => false [connectionoriented_unconfirmed_cache_operation] => false [connectionoriented_confirmed_service_indication] => false [connectionoriented_confirmed_service_load] => false [connectionoriented_confirmed_cache_operation] => false [utf8_support] => true [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [j2me_siemens_color_game] => false [j2me_siemens_extension] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [j2me_max_record_store_size] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [j2me_audio_capture_enabled] => false [j2me_video_capture_enabled] => false [j2me_photo_capture_enabled] => false [j2me_capture_image_formats] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [j2me_left_softkey_code] => 0 [j2me_right_softkey_code] => 0 [j2me_middle_softkey_code] => 0 [j2me_select_key_code] => 0 [j2me_return_key_code] => 0 [j2me_clear_key_code] => 0 [j2me_datefield_no_accepts_null_date] => false [j2me_datefield_broken] => false [receiver] => false [sender] => false [mms_max_size] => 0 [mms_max_height] => 0 [mms_max_width] => 0 [built_in_recorder] => false [built_in_camera] => true [mms_jpeg_baseline] => false [mms_jpeg_progressive] => false [mms_gif_static] => false [mms_gif_animated] => false [mms_png] => false [mms_bmp] => false [mms_wbmp] => false [mms_amr] => false [mms_wav] => false [mms_midi_monophonic] => false [mms_midi_polyphonic] => false [mms_midi_polyphonic_voices] => 0 [mms_spmidi] => false [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [mms_nokia_operatorlogo] => false [mms_nokia_3dscreensaver] => false [mms_nokia_ringingtone] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => false [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [ems_variablesizedpictures] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [siemens_screensaver_width] => 101 [siemens_screensaver_height] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => false [mmf] => false [smf] => false [mld] => false [midi_monophonic] => false [midi_polyphonic] => false [sp_midi] => false [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => false [au] => false [amr] => false [awb] => false [aac] => true [mp3] => true [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => true [css_supports_width_as_percentage] => true [css_border_image] => webkit [css_rounded_corners] => webkit [css_gradient] => none [css_spriting] => true [css_gradient_linear] => none [is_transcoder] => false [transcoder_ua_header] => user-agent [rss_support] => false [pdf_support] => true [progressive_download] => true [playback_vcodec_h263_0] => 10 [playback_vcodec_h263_3] => -1 [playback_vcodec_mpeg4_sp] => 0 [playback_vcodec_mpeg4_asp] => -1 [playback_vcodec_h264_bp] => 3.0 [playback_real_media] => none [playback_3gpp] => true [playback_3g2] => false [playback_mp4] => true [playback_mov] => false [playback_acodec_amr] => nb [playback_acodec_aac] => none [playback_df_size_limit] => 0 [playback_directdownload_size_limit] => 0 [playback_inline_size_limit] => 0 [playback_oma_size_limit] => 0 [playback_acodec_qcelp] => false [playback_wmv] => none [hinted_progressive_download] => true [html_preferred_dtd] => html4 [viewport_supported] => true [viewport_width] => device_width_token [viewport_userscalable] => no [viewport_initial_scale] => [viewport_maximum_scale] => [viewport_minimum_scale] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => full [image_inlining] => true [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => A [is_sencha_touch_ok] => false ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td><td>Android Webkit 4.0</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5d43e024-b46c-44f6-8914-529b05569bc2">Detail</a> <!-- Modal Structure --> <div id="modal-5d43e024-b46c-44f6-8914-529b05569bc2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Zsxsoft result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [link] => http://developer.android.com/reference/android/webkit/package-summary.html [title] => Android Webkit 4.0 [name] => Android Webkit [version] => 4.0 [code] => android-webkit [image] => img/16/browser/android-webkit.png ) [os] => Array ( [link] => http://www.android.com/ [name] => Android [version] => 4.0.4 [code] => android [x64] => [title] => Android 4.0.4 [type] => os [dir] => os [image] => img/16/os/android.png ) [device] => Array ( [link] => [title] => [model] => [brand] => [code] => null [dir] => device [type] => device [image] => img/16/device/null.png ) [platform] => Array ( [link] => http://www.android.com/ [name] => Android [version] => 4.0.4 [code] => android [x64] => [title] => Android 4.0.4 [type] => os [dir] => os [image] => img/16/os/android.png ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-05-10 08:05:22</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
{ "content_hash": "e09d348a3c994908141d23ffc6f58c6a", "timestamp": "", "source": "github", "line_count": 1395, "max_line_length": 883, "avg_line_length": 40.847311827956986, "alnum_prop": 0.5453125548418799, "repo_name": "ThaDafinser/UserAgentParserComparison", "id": "ed5a147832fc95331f6ae55becf187eeea99e5d5", "size": "56991", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "v5/user-agent-detail/b0/34/b034dea0-783e-413d-80f3-a72a3c84a235.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2060859160" } ], "symlink_target": "" }
namespace url { class SchemeHostPort; } namespace net { // An HttpAuthPreferences class which allows all origins to use default // credentials and delegate. This should only be used in unit testing. class MockAllowHttpAuthPreferences : public HttpAuthPreferences { public: MockAllowHttpAuthPreferences(); MockAllowHttpAuthPreferences(const MockAllowHttpAuthPreferences&) = delete; MockAllowHttpAuthPreferences& operator=(const MockAllowHttpAuthPreferences&) = delete; ~MockAllowHttpAuthPreferences() override; bool CanUseDefaultCredentials( const url::SchemeHostPort& auth_scheme_host_port) const override; HttpAuth::DelegationType GetDelegationType( const url::SchemeHostPort& auth_scheme_host_port) const override; }; } // namespace net #endif // NET_HTTP_MOCK_ALLOW_HTTP_AUTH_PREFERENCES_H_
{ "content_hash": "bfe26bd2af993e4da5d9fc32a7fcf3f4", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 80, "avg_line_length": 30.88888888888889, "alnum_prop": 0.7829736211031175, "repo_name": "scheib/chromium", "id": "5820c7365ef857765d7d4f8b2156216594b698a4", "size": "1156", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "net/http/mock_allow_http_auth_preferences.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
require "sparkle_formation" class SparkleFormation # Resources helper class Resources # Google specific resources collection class Google < Resources # Characters to be removed from supplied key on matching RESOURCE_TYPE_TR = "._" # String to split for resource namespacing RESOURCE_TYPE_NAMESPACE_SPLITTER = ["."] class << self include Bogo::Memoization # Load the builtin AWS resources # # @return [TrueClass] def load! memoize(:google_resources, :global) do load( File.join( File.dirname(__FILE__), "google_resources.json" ) ) # NOTE: Internal resource type used for nesting registry["sparkleformation.stack"] = { "properties" => [], "full_properties" => {}, } true end end # Auto load data when included def included(_klass) load! end end end end end
{ "content_hash": "b3dc941c573ecb7f5b7e5a94b9e9149e", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 62, "avg_line_length": 23.434782608695652, "alnum_prop": 0.5241187384044527, "repo_name": "sparkleformation/sparkle_formation", "id": "b55633efe324715f2ee68d1f7598c3202aefd155", "size": "1078", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "lib/sparkle_formation/resources/google.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ruby", "bytes": "402725" } ], "symlink_target": "" }
package test.writable; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; public class SDKWritableCleanUpTest extends AbstractDependencyInjectionSpringContextTests { private JdbcTemplate jdbcTemplate; private static Logger log = Logger.getLogger(SDKWritableCleanUpTest.class); protected String[] getConfigLocations() { return new String[] { "classpath*:application-config-cleanup-writableapi-test.xml" }; } final String ORACLE_ALL_TABLES_SQL = "select TABLE_NAME from ALL_TABLES where tablespace_name like 'CACORESDK_ANT'"; final String ORACLE_FOREIGN_TABLES_SQL = "select table_name from all_constraints where constraint_type='R' and r_constraint_name in (select constraint_name from all_constraints where constraint_type in ('P','U') and OWNER='CACORESDK_ANT')"; final String PK_KEY_TABLE_SQL = "SELECT cols.column_name FROM all_constraints cons, all_cons_columns cols WHERE cols.table_name = ? AND cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner"; final String MYSQL_ALL_TABLES_SQL = "SHOW TABLES FROM cacoresdk"; public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public void testCleanUpWritableApiDatabase() throws Exception{ String driverName=jdbcTemplate.getDataSource().getConnection().getMetaData().getDriverName(); int index = driverName.indexOf("MySQL"); if (index == 0) { cleanMySQLWritableApiDatabase(); } index = driverName.indexOf("Oracle"); if (index == 0) { cleanOracleWritableApiDatabase(); } } @SuppressWarnings("unchecked") public void cleanOracleWritableApiDatabase() { List<Map<String, Object>> fktableNames = jdbcTemplate.queryForList(ORACLE_FOREIGN_TABLES_SQL); for (Map<String, Object> tableNameMap : fktableNames) { String tableName = (String)tableNameMap.get("TABLE_NAME"); log.info(tableName); Object args[] = new Object[1]; args[0] = tableName; List pkColumnNames = jdbcTemplate.queryForList(PK_KEY_TABLE_SQL,args); if (pkColumnNames != null && pkColumnNames.size() > 0) { Map<String, String> pkColumnNameMap = (Map) pkColumnNames.get(0); String pkColumnName = pkColumnNameMap.get("column_name"); try { jdbcTemplate.execute("DELETE from " + tableName + " where "+ pkColumnName + " > 10000"); } catch (Exception e) { e.printStackTrace(); } } } log.info("non foreign key dependent tables "); List<Map<String, Object>> tableNames = jdbcTemplate.queryForList(ORACLE_ALL_TABLES_SQL); for (Map<String, Object> tableNameMap : tableNames) { String tableName = (String)tableNameMap.get("TABLE_NAME"); log.info(tableName); Object args[] = new Object[1]; args[0] = tableName; List pkColumnNames = jdbcTemplate.queryForList(PK_KEY_TABLE_SQL,args); if (pkColumnNames != null && pkColumnNames.size() > 0) { Map<String, String> pkColumnNameMap = (Map) pkColumnNames.get(0); String pkColumnName = pkColumnNameMap.get("column_name"); try { jdbcTemplate.execute("DELETE from " + tableName + " where "+ pkColumnName + " > 10000"); } catch (Exception e) { e.printStackTrace(); } } } } @SuppressWarnings("unchecked") public void cleanMySQLWritableApiDatabase() { List<Map<String, Object>> tableNames = jdbcTemplate.queryForList(MYSQL_ALL_TABLES_SQL); List<Map<String, Object>> nonFkTableMap = new ArrayList<Map<String, Object>>(); for (Map<String, Object> tableNameMap : tableNames) { String tableName = (String)tableNameMap.get("TABLE_NAME"); if(tableName==null) return; List<Map<String, Object>> indexList = jdbcTemplate.queryForList("SHOW index FROM " + tableName); if (indexList.size() > 1) { log.info(tableName); try { for (Map<String, Object> pkColumnNameMap : indexList) { if(pkColumnNameMap.get("INDEX_NAME").equals("PRIMARY")){ String pkColumnName = (String)pkColumnNameMap.get("Column_name"); jdbcTemplate.execute("DELETE from " + tableName + " where "+ pkColumnName + " > 10000"); } } } catch (Exception e) { e.printStackTrace(); } } else { if(!indexList.isEmpty()) nonFkTableMap.add(tableNameMap); } } log.info("\n non foreign key dependent tables \n"); for (Map<String, Object> tableNameMap : nonFkTableMap) { String tableName = (String)tableNameMap.get("TABLE_NAME"); log.info(tableName); List<Map<String, Object>> indexList = jdbcTemplate.queryForList("SHOW index FROM " + tableName); try { Map<String, Object> pkColumnNameMap = indexList.get(0); String pkColumnName = (String)pkColumnNameMap.get("Column_name"); jdbcTemplate.execute("DELETE from " + tableName + " where "+ pkColumnName + " > 10000"); } catch (Exception e) { e.printStackTrace(); } } } }
{ "content_hash": "123ae8bd9e1ac41a98165cb7aa611c0a", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 241, "avg_line_length": 40.16535433070866, "alnum_prop": 0.6930013722799451, "repo_name": "NCIP/cacore-sdk", "id": "ff3f0b867b4b3a7916ee2abaf19bbbb3b624b809", "size": "5328", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sdk-toolkit/example-project/junit/src/test/writable/SDKWritableCleanUpTest.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "1778" }, { "name": "C++", "bytes": "1996" }, { "name": "CSS", "bytes": "1494100" }, { "name": "Groovy", "bytes": "36044" }, { "name": "HTML", "bytes": "412048" }, { "name": "Java", "bytes": "9544258" }, { "name": "JavaScript", "bytes": "9968646" }, { "name": "PHP", "bytes": "33092" }, { "name": "PLSQL", "bytes": "380647" }, { "name": "Perl", "bytes": "9604" }, { "name": "Shell", "bytes": "39259" }, { "name": "Smalltalk", "bytes": "332" }, { "name": "XSLT", "bytes": "186455" } ], "symlink_target": "" }
from django.shortcuts import get_object_or_404 from django.template import Context, loader as template_loader from django.conf import settings from django.core.context_processors import csrf from rest_framework import decorators, permissions, viewsets, status from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer from rest_framework.response import Response from bookmarks.models import Bookmark from builds.models import Version from projects.models import Project @decorators.api_view(['GET']) @decorators.permission_classes((permissions.AllowAny,)) @decorators.renderer_classes((JSONRenderer, JSONPRenderer, BrowsableAPIRenderer)) def footer_html(request): project_slug = request.GET.get('project', None) version_slug = request.GET.get('version', None) page_slug = request.GET.get('page', None) theme = request.GET.get('theme', False) docroot = request.GET.get('docroot', '') subproject = request.GET.get('subproject', False) source_suffix = request.GET.get('source_suffix', '.rst') new_theme = (theme == "sphinx_rtd_theme") using_theme = (theme == "default") project = get_object_or_404(Project, slug=project_slug) version = get_object_or_404(Version.objects.public(request.user, project=project, only_active=False), slug=version_slug) main_project = project.main_language_project or project if page_slug and page_slug != "index": if main_project.documentation_type == "sphinx_htmldir" or main_project.documentation_type == "mkdocs": path = page_slug + "/" elif main_project.documentation_type == "sphinx_singlehtml": path = "index.html#document-" + page_slug else: path = page_slug + ".html" else: path = "" host = request.get_host() if settings.PRODUCTION_DOMAIN in host and request.user.is_authenticated(): show_bookmarks = True try: bookmark = Bookmark.objects.get( user=request.user, project=project, version=version, page=page_slug, ) except (Bookmark.DoesNotExist, Bookmark.MultipleObjectsReturned, Exception): bookmark = None else: show_bookmarks = False bookmark = None context = Context({ 'show_bookmarks': show_bookmarks, 'bookmark': bookmark, 'project': project, 'path': path, 'downloads': version.get_downloads(pretty=True), 'current_version': version.slug, 'versions': Version.objects.public(user=request.user, project=project), 'main_project': main_project, 'translations': main_project.translations.all(), 'current_language': project.language, 'using_theme': using_theme, 'new_theme': new_theme, 'settings': settings, 'subproject': subproject, 'github_edit_url': version.get_github_url(docroot, page_slug, source_suffix, 'edit'), 'github_view_url': version.get_github_url(docroot, page_slug, source_suffix, 'view'), 'bitbucket_url': version.get_bitbucket_url(docroot, page_slug, source_suffix), }) context.update(csrf(request)) html = template_loader.get_template('restapi/footer.html').render(context) return Response({ 'html': html, 'version_active': version.active, 'version_supported': version.supported, })
{ "content_hash": "3be9d519f90bbe50f0af5852adfbf7e3", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 124, "avg_line_length": 40.423529411764704, "alnum_prop": 0.6618160651920838, "repo_name": "apparena/docs", "id": "9c988bb3ab840c4a7391ba8c45a7f654e2269f52", "size": "3436", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "readthedocs/restapi/views/footer_views.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "4515" }, { "name": "CSS", "bytes": "59103" }, { "name": "HTML", "bytes": "186330" }, { "name": "JavaScript", "bytes": "75772" }, { "name": "Makefile", "bytes": "4594" }, { "name": "Python", "bytes": "1292855" }, { "name": "Shell", "bytes": "479" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.CardView android:id="@+id/notification_hist_card" android:layout_width="match_parent" android:layout_height="wrap_content" android:elevation="5dp" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:layout_margin="5dp" android:visibility="gone" app:cardCornerRadius="6dp"> <TextView android:id="@+id/loading_message" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:textAlignment="center" android:text="@string/you_haven_t_received_any_notifications_yet"/> </android.support.v7.widget.CardView> <android.support.v7.widget.RecyclerView android:id="@+id/notification_hist_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
{ "content_hash": "7e64049a9b7adc5b8f0ce7009c44b327", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 79, "avg_line_length": 37.48571428571429, "alnum_prop": 0.6570121951219512, "repo_name": "jakdor/SSCAndroidApp", "id": "177aa496d97a333be7828d09012a943e956059a6", "size": "1312", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ssc/app/src/main/res/layout/notification_history_fragment.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "228" }, { "name": "Java", "bytes": "113374" }, { "name": "Python", "bytes": "15471" } ], "symlink_target": "" }
package com.amazonaws.services.cloudformation.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * The StackSummary Data Type * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSummary" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class StackSummary implements Serializable, Cloneable { /** * <p> * Unique stack identifier. * </p> */ private String stackId; /** * <p> * The name associated with the stack. * </p> */ private String stackName; /** * <p> * The template description of the template used to create the stack. * </p> */ private String templateDescription; /** * <p> * The time the stack was created. * </p> */ private java.util.Date creationTime; /** * <p> * The time the stack was last updated. This field will only be returned if the stack has been updated at least * once. * </p> */ private java.util.Date lastUpdatedTime; /** * <p> * The time the stack was deleted. * </p> */ private java.util.Date deletionTime; /** * <p> * The current status of the stack. * </p> */ private String stackStatus; /** * <p> * Success/Failure message associated with the stack status. * </p> */ private String stackStatusReason; /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this * stack. For the first level of nested stacks, the root stack is also the parent stack. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> */ private String parentId; /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which * the nested stack ultimately belongs. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> */ private String rootId; /** * <p> * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from it's * expected configuration, as defined in the stack template and any values specified as template parameters. For * more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. * </p> */ private StackDriftInformationSummary driftInformation; /** * <p> * Unique stack identifier. * </p> * * @param stackId * Unique stack identifier. */ public void setStackId(String stackId) { this.stackId = stackId; } /** * <p> * Unique stack identifier. * </p> * * @return Unique stack identifier. */ public String getStackId() { return this.stackId; } /** * <p> * Unique stack identifier. * </p> * * @param stackId * Unique stack identifier. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withStackId(String stackId) { setStackId(stackId); return this; } /** * <p> * The name associated with the stack. * </p> * * @param stackName * The name associated with the stack. */ public void setStackName(String stackName) { this.stackName = stackName; } /** * <p> * The name associated with the stack. * </p> * * @return The name associated with the stack. */ public String getStackName() { return this.stackName; } /** * <p> * The name associated with the stack. * </p> * * @param stackName * The name associated with the stack. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withStackName(String stackName) { setStackName(stackName); return this; } /** * <p> * The template description of the template used to create the stack. * </p> * * @param templateDescription * The template description of the template used to create the stack. */ public void setTemplateDescription(String templateDescription) { this.templateDescription = templateDescription; } /** * <p> * The template description of the template used to create the stack. * </p> * * @return The template description of the template used to create the stack. */ public String getTemplateDescription() { return this.templateDescription; } /** * <p> * The template description of the template used to create the stack. * </p> * * @param templateDescription * The template description of the template used to create the stack. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withTemplateDescription(String templateDescription) { setTemplateDescription(templateDescription); return this; } /** * <p> * The time the stack was created. * </p> * * @param creationTime * The time the stack was created. */ public void setCreationTime(java.util.Date creationTime) { this.creationTime = creationTime; } /** * <p> * The time the stack was created. * </p> * * @return The time the stack was created. */ public java.util.Date getCreationTime() { return this.creationTime; } /** * <p> * The time the stack was created. * </p> * * @param creationTime * The time the stack was created. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withCreationTime(java.util.Date creationTime) { setCreationTime(creationTime); return this; } /** * <p> * The time the stack was last updated. This field will only be returned if the stack has been updated at least * once. * </p> * * @param lastUpdatedTime * The time the stack was last updated. This field will only be returned if the stack has been updated at * least once. */ public void setLastUpdatedTime(java.util.Date lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } /** * <p> * The time the stack was last updated. This field will only be returned if the stack has been updated at least * once. * </p> * * @return The time the stack was last updated. This field will only be returned if the stack has been updated at * least once. */ public java.util.Date getLastUpdatedTime() { return this.lastUpdatedTime; } /** * <p> * The time the stack was last updated. This field will only be returned if the stack has been updated at least * once. * </p> * * @param lastUpdatedTime * The time the stack was last updated. This field will only be returned if the stack has been updated at * least once. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withLastUpdatedTime(java.util.Date lastUpdatedTime) { setLastUpdatedTime(lastUpdatedTime); return this; } /** * <p> * The time the stack was deleted. * </p> * * @param deletionTime * The time the stack was deleted. */ public void setDeletionTime(java.util.Date deletionTime) { this.deletionTime = deletionTime; } /** * <p> * The time the stack was deleted. * </p> * * @return The time the stack was deleted. */ public java.util.Date getDeletionTime() { return this.deletionTime; } /** * <p> * The time the stack was deleted. * </p> * * @param deletionTime * The time the stack was deleted. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withDeletionTime(java.util.Date deletionTime) { setDeletionTime(deletionTime); return this; } /** * <p> * The current status of the stack. * </p> * * @param stackStatus * The current status of the stack. * @see StackStatus */ public void setStackStatus(String stackStatus) { this.stackStatus = stackStatus; } /** * <p> * The current status of the stack. * </p> * * @return The current status of the stack. * @see StackStatus */ public String getStackStatus() { return this.stackStatus; } /** * <p> * The current status of the stack. * </p> * * @param stackStatus * The current status of the stack. * @return Returns a reference to this object so that method calls can be chained together. * @see StackStatus */ public StackSummary withStackStatus(String stackStatus) { setStackStatus(stackStatus); return this; } /** * <p> * The current status of the stack. * </p> * * @param stackStatus * The current status of the stack. * @see StackStatus */ public void setStackStatus(StackStatus stackStatus) { withStackStatus(stackStatus); } /** * <p> * The current status of the stack. * </p> * * @param stackStatus * The current status of the stack. * @return Returns a reference to this object so that method calls can be chained together. * @see StackStatus */ public StackSummary withStackStatus(StackStatus stackStatus) { this.stackStatus = stackStatus.toString(); return this; } /** * <p> * Success/Failure message associated with the stack status. * </p> * * @param stackStatusReason * Success/Failure message associated with the stack status. */ public void setStackStatusReason(String stackStatusReason) { this.stackStatusReason = stackStatusReason; } /** * <p> * Success/Failure message associated with the stack status. * </p> * * @return Success/Failure message associated with the stack status. */ public String getStackStatusReason() { return this.stackStatusReason; } /** * <p> * Success/Failure message associated with the stack status. * </p> * * @param stackStatusReason * Success/Failure message associated with the stack status. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withStackStatusReason(String stackStatusReason) { setStackStatusReason(stackStatusReason); return this; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this * stack. For the first level of nested stacks, the root stack is also the parent stack. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @param parentId * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of * this stack. For the first level of nested stacks, the root stack is also the parent stack.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. */ public void setParentId(String parentId) { this.parentId = parentId; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this * stack. For the first level of nested stacks, the root stack is also the parent stack. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @return For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of * this stack. For the first level of nested stacks, the root stack is also the parent stack.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. */ public String getParentId() { return this.parentId; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of this * stack. For the first level of nested stacks, the root stack is also the parent stack. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @param parentId * For nested stacks--stacks created as resources for another stack--the stack ID of the direct parent of * this stack. For the first level of nested stacks, the root stack is also the parent stack.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withParentId(String parentId) { setParentId(parentId); return this; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which * the nested stack ultimately belongs. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @param rootId * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to * which the nested stack ultimately belongs.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. */ public void setRootId(String rootId) { this.rootId = rootId; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which * the nested stack ultimately belongs. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @return For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to * which the nested stack ultimately belongs.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. */ public String getRootId() { return this.rootId; } /** * <p> * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to which * the nested stack ultimately belongs. * </p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working with * Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * </p> * * @param rootId * For nested stacks--stacks created as resources for another stack--the stack ID of the top-level stack to * which the nested stack ultimately belongs.</p> * <p> * For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html">Working * with Nested Stacks</a> in the <i>CloudFormation User Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withRootId(String rootId) { setRootId(rootId); return this; } /** * <p> * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from it's * expected configuration, as defined in the stack template and any values specified as template parameters. For * more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. * </p> * * @param driftInformation * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from * it's expected configuration, as defined in the stack template and any values specified as template * parameters. For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. */ public void setDriftInformation(StackDriftInformationSummary driftInformation) { this.driftInformation = driftInformation; } /** * <p> * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from it's * expected configuration, as defined in the stack template and any values specified as template parameters. For * more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. * </p> * * @return Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from * it's expected configuration, as defined in the stack template and any values specified as template * parameters. For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. */ public StackDriftInformationSummary getDriftInformation() { return this.driftInformation; } /** * <p> * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from it's * expected configuration, as defined in the stack template and any values specified as template parameters. For * more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. * </p> * * @param driftInformation * Summarizes information about whether a stack's actual configuration differs, or has <i>drifted</i>, from * it's expected configuration, as defined in the stack template and any values specified as template * parameters. For more information, see <a * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html">Detecting * Unregulated Configuration Changes to Stacks and Resources</a>. * @return Returns a reference to this object so that method calls can be chained together. */ public StackSummary withDriftInformation(StackDriftInformationSummary driftInformation) { setDriftInformation(driftInformation); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStackId() != null) sb.append("StackId: ").append(getStackId()).append(","); if (getStackName() != null) sb.append("StackName: ").append(getStackName()).append(","); if (getTemplateDescription() != null) sb.append("TemplateDescription: ").append(getTemplateDescription()).append(","); if (getCreationTime() != null) sb.append("CreationTime: ").append(getCreationTime()).append(","); if (getLastUpdatedTime() != null) sb.append("LastUpdatedTime: ").append(getLastUpdatedTime()).append(","); if (getDeletionTime() != null) sb.append("DeletionTime: ").append(getDeletionTime()).append(","); if (getStackStatus() != null) sb.append("StackStatus: ").append(getStackStatus()).append(","); if (getStackStatusReason() != null) sb.append("StackStatusReason: ").append(getStackStatusReason()).append(","); if (getParentId() != null) sb.append("ParentId: ").append(getParentId()).append(","); if (getRootId() != null) sb.append("RootId: ").append(getRootId()).append(","); if (getDriftInformation() != null) sb.append("DriftInformation: ").append(getDriftInformation()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof StackSummary == false) return false; StackSummary other = (StackSummary) obj; if (other.getStackId() == null ^ this.getStackId() == null) return false; if (other.getStackId() != null && other.getStackId().equals(this.getStackId()) == false) return false; if (other.getStackName() == null ^ this.getStackName() == null) return false; if (other.getStackName() != null && other.getStackName().equals(this.getStackName()) == false) return false; if (other.getTemplateDescription() == null ^ this.getTemplateDescription() == null) return false; if (other.getTemplateDescription() != null && other.getTemplateDescription().equals(this.getTemplateDescription()) == false) return false; if (other.getCreationTime() == null ^ this.getCreationTime() == null) return false; if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false) return false; if (other.getLastUpdatedTime() == null ^ this.getLastUpdatedTime() == null) return false; if (other.getLastUpdatedTime() != null && other.getLastUpdatedTime().equals(this.getLastUpdatedTime()) == false) return false; if (other.getDeletionTime() == null ^ this.getDeletionTime() == null) return false; if (other.getDeletionTime() != null && other.getDeletionTime().equals(this.getDeletionTime()) == false) return false; if (other.getStackStatus() == null ^ this.getStackStatus() == null) return false; if (other.getStackStatus() != null && other.getStackStatus().equals(this.getStackStatus()) == false) return false; if (other.getStackStatusReason() == null ^ this.getStackStatusReason() == null) return false; if (other.getStackStatusReason() != null && other.getStackStatusReason().equals(this.getStackStatusReason()) == false) return false; if (other.getParentId() == null ^ this.getParentId() == null) return false; if (other.getParentId() != null && other.getParentId().equals(this.getParentId()) == false) return false; if (other.getRootId() == null ^ this.getRootId() == null) return false; if (other.getRootId() != null && other.getRootId().equals(this.getRootId()) == false) return false; if (other.getDriftInformation() == null ^ this.getDriftInformation() == null) return false; if (other.getDriftInformation() != null && other.getDriftInformation().equals(this.getDriftInformation()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStackId() == null) ? 0 : getStackId().hashCode()); hashCode = prime * hashCode + ((getStackName() == null) ? 0 : getStackName().hashCode()); hashCode = prime * hashCode + ((getTemplateDescription() == null) ? 0 : getTemplateDescription().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getLastUpdatedTime() == null) ? 0 : getLastUpdatedTime().hashCode()); hashCode = prime * hashCode + ((getDeletionTime() == null) ? 0 : getDeletionTime().hashCode()); hashCode = prime * hashCode + ((getStackStatus() == null) ? 0 : getStackStatus().hashCode()); hashCode = prime * hashCode + ((getStackStatusReason() == null) ? 0 : getStackStatusReason().hashCode()); hashCode = prime * hashCode + ((getParentId() == null) ? 0 : getParentId().hashCode()); hashCode = prime * hashCode + ((getRootId() == null) ? 0 : getRootId().hashCode()); hashCode = prime * hashCode + ((getDriftInformation() == null) ? 0 : getDriftInformation().hashCode()); return hashCode; } @Override public StackSummary clone() { try { return (StackSummary) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
{ "content_hash": "b54f0b36b181e6a811ae331e2545494c", "timestamp": "", "source": "github", "line_count": 794, "max_line_length": 137, "avg_line_length": 35.404282115869016, "alnum_prop": 0.6168403827683113, "repo_name": "aws/aws-sdk-java", "id": "9e3d51cb3e827118c3f1d6ff7c7419e68323a2b6", "size": "28691", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-cloudformation/src/main/java/com/amazonaws/services/cloudformation/model/StackSummary.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
""" Preprocess image files in fits format to be input to fitssub. """ from datetime import datetime from glob import glob from os.path import splitext, basename, join import re import pfits import sys import numpy as np import pandas as pd class Preprocessor(object): """Cleans image datasets in preparation for reduction. Takes a path to a directory with a set of fits files, from which the cleaned set will be created. """ def __init__(self, path_to_fits_dir): # filter out bad images full_set = self._mask(self._get_headers(path_to_fits_dir)) # select images with SCIENCE and DARK image types self.science_set = full_set[full_set['IMAGE_TYPE'] == 'SCIENCE'] self.dark_set = full_set[full_set['IMAGE_TYPE'] == 'DARK'] self.full_set = full_set # PUBLIC ################################################################## def nearest_dark_pairings(self): """Pairs SCIENCE images with the DARK image closest in time of observation. I'm assuming self.science_set & self.dark_set are numpy arrays with the following format: [Index, Time, FileName, Type, Shutter] (0, 1415079006000000000L, 'V47_20141104053006072910', 'DARK', 'SHUT') This is the thinking behind the code: Pull up first science image, go through dark images and find minimum absolute time distance difference. (Once the absolute difference increases, we can assume that the previous dark image was the minimum distance.) Then write that match to the dictionary Pull up the next science image, go through dark images again (this time start where we left off last time) Since the input was already sorted in ascending order, we don't have to look through earlier dark images because they are guaranteed to have a greater time difference. """ # sort on times, convert to numpy science_set = self._to_sorted_numpy(self.science_set) dark_set = self._to_sorted_numpy(self.dark_set) if science_set.size == 0 or dark_set.size == 0: return {} science_dark_matches = {} dark_index_skip = 0 # this jumps to the dark_index where we left off # Iterate through all SCIENCE images for science_index in range(science_set.shape[0]): science_entry = science_set[science_index] science_time = science_entry[2] abs_difference = sys.maxint science_dark_matches[science_entry[3]] = dark_set[dark_index_skip][3] # loop over rest of the darks until diff increases for dark_index in range(dark_set.shape[0]): dark_index += dark_index_skip # This makes it so the loop starts where it left off from the # last match (This assums files are in ascending order based on # TIME, therefore there is no reason to research previous DARK # images) previous_difference = abs_difference # Important so we can find # when difference increases dark_entry = dark_set[dark_index] dark_time = dark_entry[2] # Compute the absolute time distance abs_difference = abs(int(science_time) - int(dark_time)) # Here we check to see if differences are increasing, if they # are then we just passed the minimum time difference if abs_difference > previous_difference: # I have to grab the previous dark image science_dark_matches[science_entry[3]] = dark_set[dark_index-1][3] dark_index_skip = dark_index-1 break # edge case (once hit, all subsequent science images will # fall through to this case) if dark_index == dark_set.shape[0] - 1: science_dark_matches[science_entry[3]] = dark_set[dark_index][3] dark_index_skip = dark_index break return science_dark_matches # PRIVATE ################################################################# @staticmethod def _extract_datetime(datetime_str): """Get a datetime object from the date numbers in a FITS header.""" p = re.compile( r"\'(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)\.(\d\d\d\d\d\d)\'" ) datetime_match = p.match(datetime_str) datetime_numbers = tuple(int(x) for x in datetime_match.groups()) return datetime(*datetime_numbers) @staticmethod def _to_sorted_numpy(df): """Convert a pandas DataFrame to a sorted numpy array.""" time_sorted_df = df.sort(['DATETIME']) return np.array(time_sorted_df.to_records()) @staticmethod def _get_header(filename): """Extract header metadata from a fits file. """ base = splitext(basename(filename))[0] try: f = pfits.FITS(filename) h = f.get_hdus()[0] keys = [row[0] for row in h.cards] vals = [row[1:] for row in h.cards] d = dict(zip(keys, vals)) dt = Preprocessor._extract_datetime(d['DATE-OBS'][0]) image_type = d['VIMTYPE'][0][1:-1].strip() shutter_state = d['VSHUTTER'][0][1:-1].strip() ao_loop_state = d['AOLOOPST'][0][1:-1].strip() processed_row = { 'IMAGE_NAME': base, 'DATETIME': dt, 'AO_LOOP_STATE': ao_loop_state, 'IMAGE_TYPE': image_type, 'SHUTTER_STATE': shutter_state } except IOError as (errnum, msg): print "I/O Error({0}): {1}".format(errnum, msg) exit(errnum) return processed_row @staticmethod def _get_headers(path_to_fits): """Gets the headers for the fits files in this directory.""" filepath = join(path_to_fits, '*.fits') headers = map(Preprocessor._get_header, glob(filepath)) return pd.DataFrame.from_dict(headers) @staticmethod def _mask(df): """Extracts legal rows from a table of image headers.""" good_rows = df[ ~((df['SHUTTER_STATE'] == 'OPEN') & (df['IMAGE_TYPE'] == 'DARK')) & ~((df['SHUTTER_STATE'] == 'SHUT') & (df['IMAGE_TYPE'] == 'SCIENCE')) & ~((df['AO_LOOP_STATE'] == 'OPEN') & (df['IMAGE_TYPE'] == 'SCIENCE')) ] return good_rows
{ "content_hash": "a40e388cf4961dca165ca3c3d05161d3", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 86, "avg_line_length": 40.1030303030303, "alnum_prop": 0.5664198277164878, "repo_name": "aesoll/makeflowgen", "id": "a52f2b7d6bbab83e9052ab84601c7e9b1a7a6e74", "size": "6940", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "pyAIR/preprocessor.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Python", "bytes": "14852" } ], "symlink_target": "" }
package org.continuum.blocks; import org.continuum.utilities.Helper; import org.lwjgl.util.vector.Vector2f; import org.lwjgl.util.vector.Vector4f; /** * A high grass billboard block. */ public class BlockHighGrass extends Block { @Override public Vector4f getColorOffsetFor(SIDE side, double temperature, double humidity) { Vector4f foliageColor = foliageColorForTemperatureAndHumidity(temperature, humidity); return new Vector4f(foliageColor.x, foliageColor.y, foliageColor.z, 1.0f); } @Override public boolean isBlockTypeTranslucent() { return true; } @Override public Vector2f getTextureOffsetFor(Block.SIDE side) { return Helper.calcOffsetForTextureAt(12, 11); } @Override public boolean isPenetrable() { return true; } @Override public boolean isCastingShadows() { return true; } @Override public boolean shouldRenderBoundingBox() { return false; } @Override public BLOCK_FORM getBlockForm() { return BLOCK_FORM.BILLBOARD; } }
{ "content_hash": "6b7e64abda25a5042cc167208b656571", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 93, "avg_line_length": 22.306122448979593, "alnum_prop": 0.6816102470265325, "repo_name": "gil0mendes/continuum", "id": "80aa64a833a30789f10267299da6b411f9339d83", "size": "1692", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "engine/src/main/java/org/continuum/blocks/BlockHighGrass.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "48" }, { "name": "GLSL", "bytes": "5641" }, { "name": "Java", "bytes": "354512" }, { "name": "Shell", "bytes": "162" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>34.0</apiVersion> <availableInTouch>false</availableInTouch> <confirmationTokenRequired>false</confirmationTokenRequired> <label>DAN_ManageTrigger</label> </ApexPage>
{ "content_hash": "428ecc41cf4afcceff1f52632048dd8b", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 64, "avg_line_length": 41.857142857142854, "alnum_prop": 0.7406143344709898, "repo_name": "cdcarter/declarative-autonaming", "id": "8e8e187aa3ca733046e3258be79c5d82e90772ac", "size": "293", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/pages/DAN_ManageTrigger.page-meta.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Apex", "bytes": "915808" } ], "symlink_target": "" }
<?php namespace SmartDump\Node\Type\StringType; use SmartDump\Node\Type\NodeType; /** * Class StringNodeType * * @package SmartDump * @subpackage Node */ class StringNodeType extends NodeType { const TYPE = 'string-node'; /** * Constructor */ public function __construct() { $this->types[] = self::TYPE; } }
{ "content_hash": "2072364d98a4dab6b6266fd07c3e1dda", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 41, "avg_line_length": 14.36, "alnum_prop": 0.6128133704735376, "repo_name": "Bonemeijer/SmartDump", "id": "42d53d0356455f4e2e3dbdce8738a54df946f2e1", "size": "1496", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Node/Type/StringType/StringNodeType.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2496" }, { "name": "JavaScript", "bytes": "956" }, { "name": "PHP", "bytes": "121386" } ], "symlink_target": "" }
/* * This file is auto-generated. DO NOT MODIFY. * Original file: E:\\android_workspace2\\system_code\\src\\android\\speech\\IRecognitionService.aidl */ package android.speech; /** * A Service interface to speech recognition. Call startListening when * you want to begin capturing audio; RecognitionService will automatically * determine when the user has finished speaking, stream the audio to the * recognition servers, and notify you when results are ready. In most of the cases, * this class should not be used directly, instead use {@link SpeechRecognizer} for * accessing recognition service. * {@hide} */ public interface IRecognitionService extends android.os.IInterface { /** Local-side IPC implementation stub class. */ public static abstract class Stub extends android.os.Binder implements android.speech.IRecognitionService { private static final java.lang.String DESCRIPTOR = "android.speech.IRecognitionService"; /** Construct the stub at attach it to the interface. */ public Stub() { this.attachInterface(this, DESCRIPTOR); } /** * Cast an IBinder object into an android.speech.IRecognitionService interface, * generating a proxy if needed. */ public static android.speech.IRecognitionService asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.speech.IRecognitionService))) { return ((android.speech.IRecognitionService)iin); } return new android.speech.IRecognitionService.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { switch (code) { case INTERFACE_TRANSACTION: { reply.writeString(DESCRIPTOR); return true; } case TRANSACTION_startListening: { data.enforceInterface(DESCRIPTOR); android.content.Intent _arg0; if ((0!=data.readInt())) { _arg0 = android.content.Intent.CREATOR.createFromParcel(data); } else { _arg0 = null; } android.speech.IRecognitionListener _arg1; _arg1 = android.speech.IRecognitionListener.Stub.asInterface(data.readStrongBinder()); this.startListening(_arg0, _arg1); return true; } case TRANSACTION_stopListening: { data.enforceInterface(DESCRIPTOR); android.speech.IRecognitionListener _arg0; _arg0 = android.speech.IRecognitionListener.Stub.asInterface(data.readStrongBinder()); this.stopListening(_arg0); return true; } case TRANSACTION_cancel: { data.enforceInterface(DESCRIPTOR); android.speech.IRecognitionListener _arg0; _arg0 = android.speech.IRecognitionListener.Stub.asInterface(data.readStrongBinder()); this.cancel(_arg0); return true; } } return super.onTransact(code, data, reply, flags); } private static class Proxy implements android.speech.IRecognitionService { private android.os.IBinder mRemote; Proxy(android.os.IBinder remote) { mRemote = remote; } @Override public android.os.IBinder asBinder() { return mRemote; } public java.lang.String getInterfaceDescriptor() { return DESCRIPTOR; } /** * Starts listening for speech. Please note that the recognition service supports * one listener only, therefore, if this function is called from two different threads, * only the latest one will get the notifications * * @param recognizerIntent the intent from which the invocation occurred. Additionally, * this intent can contain extra parameters to manipulate the behavior of the recognition * client. For more information see {@link RecognizerIntent}. * @param listener to receive callbacks, note that this must be non-null */ @Override public void startListening(android.content.Intent recognizerIntent, android.speech.IRecognitionListener listener) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); if ((recognizerIntent!=null)) { _data.writeInt(1); recognizerIntent.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeStrongBinder((((listener!=null))?(listener.asBinder()):(null))); mRemote.transact(Stub.TRANSACTION_startListening, _data, null, android.os.IBinder.FLAG_ONEWAY); } finally { _data.recycle(); } } /** * Stops listening for speech. Speech captured so far will be recognized as * if the user had stopped speaking at this point. The function has no effect unless it * is called during the speech capturing. * * @param listener to receive callbacks, note that this must be non-null */ @Override public void stopListening(android.speech.IRecognitionListener listener) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeStrongBinder((((listener!=null))?(listener.asBinder()):(null))); mRemote.transact(Stub.TRANSACTION_stopListening, _data, null, android.os.IBinder.FLAG_ONEWAY); } finally { _data.recycle(); } } /** * Cancels the speech recognition. * * @param listener to receive callbacks, note that this must be non-null */ @Override public void cancel(android.speech.IRecognitionListener listener) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeStrongBinder((((listener!=null))?(listener.asBinder()):(null))); mRemote.transact(Stub.TRANSACTION_cancel, _data, null, android.os.IBinder.FLAG_ONEWAY); } finally { _data.recycle(); } } } static final int TRANSACTION_startListening = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); static final int TRANSACTION_stopListening = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); static final int TRANSACTION_cancel = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); } /** * Starts listening for speech. Please note that the recognition service supports * one listener only, therefore, if this function is called from two different threads, * only the latest one will get the notifications * * @param recognizerIntent the intent from which the invocation occurred. Additionally, * this intent can contain extra parameters to manipulate the behavior of the recognition * client. For more information see {@link RecognizerIntent}. * @param listener to receive callbacks, note that this must be non-null */ public void startListening(android.content.Intent recognizerIntent, android.speech.IRecognitionListener listener) throws android.os.RemoteException; /** * Stops listening for speech. Speech captured so far will be recognized as * if the user had stopped speaking at this point. The function has no effect unless it * is called during the speech capturing. * * @param listener to receive callbacks, note that this must be non-null */ public void stopListening(android.speech.IRecognitionListener listener) throws android.os.RemoteException; /** * Cancels the speech recognition. * * @param listener to receive callbacks, note that this must be non-null */ public void cancel(android.speech.IRecognitionListener listener) throws android.os.RemoteException; }
{ "content_hash": "790f5749becff0041a3fafe688363d93", "timestamp": "", "source": "github", "line_count": 198, "max_line_length": 157, "avg_line_length": 36.39393939393939, "alnum_prop": 0.7592284207604774, "repo_name": "haikuowuya/android_system_code", "id": "b409cc82439b3720de41587c660cff3fbee2eaeb", "size": "7206", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gen/android/speech/IRecognitionService.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "182432" }, { "name": "Java", "bytes": "124952631" } ], "symlink_target": "" }
/* eslint-disable jsx-a11y/label-has-for */ import React, { Component, PropTypes } from 'react'; import Filter from '../../components/Filter'; if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, 'includes', { value(searchElement, fromIndex) { if (this == null) { throw new TypeError('"this" is null or not defined'); } const o = Object(this); const len = o.length >>> 0; if (len === 0) { return false; } const n = fromIndex | 0; let k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); while (k < len) { if (o[k] === searchElement) { return true; } k++; } return false; }, }); } class FilterController extends Component { constructor(props) { super(props); this.state = { filterBy: [], }; } updateFilter(key, val) { this.setState({ filterBy: val ? [...this.state.filterBy, key] : this.state.filterBy.filter(item => item !== key), }); } renderFilterControls() { return this.props.filterControls.map(name => ( <label style={{ paddingRight: 20, lineHeight: 2 }}> <input type="checkbox" val={this.state.filterBy.includes(name)} onChange={ev => this.updateFilter(name, ev.target.checked)} /> {name} </label> )); } render() { const predicate = item => ( this.state.filterBy.every(filterKey => item[filterKey] === true) ); return ( <div> <h4>Filter By</h4> <div> {this.renderFilterControls()} </div> <Filter collection={this.props.collection} predicate={predicate}> {item => ( React.createElement(this.props.elementType, { key: item.id, ...item }) )} </Filter> </div> ); } } FilterController.displayName = 'FilterController'; FilterController.propTypes = { filterControls: PropTypes.arrayOf(PropTypes.string), collection: PropTypes.array, elementType: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), }; FilterController.defaultProps = { }; export default FilterController;
{ "content_hash": "f7c3dd3113cae1cf24e45f1e317edd96", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 82, "avg_line_length": 21.782178217821784, "alnum_prop": 0.5645454545454546, "repo_name": "joshwcomeau/react-collection-helpers", "id": "b222e1c061ea4294a1f995cac94dd4cbf8be2763", "size": "2200", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/helpers/story/FilterController.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4405" }, { "name": "HTML", "bytes": "533" }, { "name": "JavaScript", "bytes": "90828" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Epicoccum intermedium Allesch. ### Remarks null
{ "content_hash": "977e11439e99093010e433e0a2b5f255", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 30, "avg_line_length": 10.384615384615385, "alnum_prop": 0.7185185185185186, "repo_name": "mdoering/backbone", "id": "bfc01610554c2c6ad2e9d313e0f946d03d055348", "size": "203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Pleosporaceae/Clathrococcum/Clathrococcum intermedium/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package tv.savageboy74.savagetech.blocks.lootbox; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tv.savageboy74.savagetech.SavageTech; import tv.savageboy74.savagetech.blocks.base.STBlockContainer; import tv.savageboy74.savagetech.util.reference.Names; public class BlockLootBox extends STBlockContainer { protected static final AxisAlignedBB field_185557_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0D, 0.9375D, 0.875D, 0.9375D); protected static final AxisAlignedBB field_185558_c = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 1.0D); protected static final AxisAlignedBB field_185559_d = new AxisAlignedBB(0.0D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); protected static final AxisAlignedBB field_185560_e = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 1.0D, 0.875D, 0.9375D); protected static final AxisAlignedBB field_185561_f = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockLootBox() { super(Material.WOOD); this.setHardness(10.4F); this.setResistance(10.5F); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); //this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); this.setUnlocalizedName(Names.Blocks.lootBox); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return source.getBlockState(pos.north()).getBlock() == this ? field_185557_b : (source.getBlockState(pos.south()).getBlock() == this ? field_185558_c : (source.getBlockState(pos.west()).getBlock() == this ? field_185559_d : (source.getBlockState(pos.east()).getBlock() == this ? field_185560_e : field_185561_f))); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { playerIn.openGui(SavageTech.instance, Names.Gui.LOOT_BOX_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { super.breakBlock(worldIn, pos, state); } public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state) { EnumFacing enumfacing = null; for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) { IBlockState iblockstate = worldIn.getBlockState(pos.offset(enumfacing1)); if (iblockstate.getBlock() == this) { return state; } if (iblockstate.getBlock().isFullBlock(state)) { if (enumfacing != null) { enumfacing = null; break; } enumfacing = enumfacing1; } } if (enumfacing != null) { return state.withProperty(FACING, enumfacing.getOpposite()); } else { EnumFacing enumfacing2 = (EnumFacing)state.getValue(FACING); if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock(state)) { enumfacing2 = enumfacing2.getOpposite(); } if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock(state)) { enumfacing2 = enumfacing2.rotateY(); } if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock(state)) { enumfacing2 = enumfacing2.getOpposite(); } return state.withProperty(FACING, enumfacing2); } } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite(); state = state.withProperty(FACING, enumfacing); BlockPos posNorth = pos.north(); BlockPos posSouth = pos.south(); BlockPos posWest = pos.west(); BlockPos posEast = pos.east(); boolean flag = this == worldIn.getBlockState(posNorth).getBlock(); boolean flag1 = this == worldIn.getBlockState(posSouth).getBlock(); boolean flag2 = this == worldIn.getBlockState(posWest).getBlock(); boolean flag3 = this == worldIn.getBlockState(posEast).getBlock(); if (!flag && !flag1 && !flag2 && !flag3) { worldIn.setBlockState(pos, state, 3); } else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1) { if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3)) { if (flag2) { worldIn.setBlockState(posWest, state, 3); } else { worldIn.setBlockState(posEast, state, 3); } worldIn.setBlockState(pos, state, 3); } } else { if (flag) { worldIn.setBlockState(posNorth, state, 3); } else { worldIn.setBlockState(posSouth, state, 3); } worldIn.setBlockState(pos, state, 3); } if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityLootBox) { ((TileEntityLootBox)tileentity).setCustomName(stack.getDisplayName()); } } } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); } // @Override // public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { // if (worldIn.getBlockState(pos.north()).getBlock() == this) { // this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); // } else if (worldIn.getBlockState(pos.south()).getBlock() == this) { // this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); // } else if (worldIn.getBlockState(pos.west()).getBlock() == this) { // this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); // } else if (worldIn.getBlockState(pos.east()).getBlock() == this) { // this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); // } else { // this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); // } // } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING}); } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } private boolean isBlocked(World worldIn, BlockPos pos) { return this.isBelowSolidBlock(worldIn, pos) || this.isOcelotSittingOnChest(worldIn, pos); } private boolean isBelowSolidBlock(World worldIn, BlockPos pos) { return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); } private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) { for (Entity entity : worldIn.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1)))) { EntityOcelot entityocelot = (EntityOcelot)entity; if (entityocelot.isSitting()) { return true; } } return false; } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityLootBox(); } }
{ "content_hash": "24afe3afb1374c6649a2ac5a15d0179a", "timestamp": "", "source": "github", "line_count": 235, "max_line_length": 322, "avg_line_length": 40.64255319148936, "alnum_prop": 0.6502983980735002, "repo_name": "savageboy74/SavageTech", "id": "379ba4d685f502f67467fc5c16133fe99e87a495", "size": "10703", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/tv/savageboy74/savagetech/blocks/lootbox/BlockLootBox.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "443022" } ], "symlink_target": "" }