code
stringlengths
4
991k
repo_name
stringlengths
6
116
path
stringlengths
4
249
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
4
991k
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
<!DOCTYPE html> <html> <head> <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"> <!-- jQuery --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Bootstrap --> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <!-- React --> <script src="https://npmcdn.com/react@15.3.1/dist/react.js"></script> <script src="https://npmcdn.com/react-dom@15.3.1/dist/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script> <!-- UU5 --> <!-- <link rel="stylesheet" href="../../uu5.css" /> --> <script type="application/javascript" src="../../uu5.js"></script> <title>Forms Select Demo</title> <style> .uu5-layout-flc { overflow: visible !important; } </style> </head> <body> <div id="renderHere"></div> <script type="text/babel"> var CustomSelect = React.createClass({ mixins: [UU5.Common.BaseMixin, UU5.Common.ElementaryMixin], statics: { tagName: 'UU5.CustomSelect', classNames: { main: 'uu5-custom-select' } }, propTypes: { items: React.PropTypes.arrayOf(React.PropTypes.string) }, getDefaultProps: function () { return { items: ['Value 1', 'Value 2', 'Value 3'] }; }, getInitialState: function () { return { value: [] }; }, _onChangeValue: function (opt) { this.setState(function (state) { var result = state.value; var index = result.indexOf(opt.value); if (index == -1) { result.push(opt.value); } else { result.splice(index, 1); } return {value: result}; }); return this; }, _getOptions: function () { var select = this; return this.props.items.map(function (item, i) { return ( <UU5.Forms.Select.Option value={item} selectedContent={item} key={i}> <UU5.Forms.Checkbox label={item} labelPosition="right" size="sm" value={select.state.value.indexOf(item) > -1} /> </UU5.Forms.Select.Option> ); }); }, render: function () { return ( <UU5.Forms.Select {...this.props} name="seven" label={this.props.label} multiple value={this.state.value} onChange={this._onChangeValue} parent={this} > {this._getOptions()} </UU5.Forms.Select> ); } }); var Page = React.createClass({ getInitialState: function() { return {value: 'Value 1'} }, render: function () { return ( <UU5.Layout.Root header="UU5.Forms.Select"> <UU5.Forms.BasicForm submitLabel="Ok" onSubmit={function (form) { console.log(form.getValues()); console.log(form.getInputByName('five').getSelectedValue()) }}> <UU5.Forms.Number name="number" label="Year of manufacture" step={1} nanMessage="Please insert an number" value={1990} min={1900} isRequired={true} placeholder="dsadsa" /> <UU5.Forms.Select name="one" label="Select" placeholder="Placeholder" isRequired onChange={function (opt) { console.log(opt); opt.component.setValue(opt.value) }}> <UU5.Forms.Select.Option value="Value 1" /> <UU5.Forms.Select.Option value="Value 2" /> </UU5.Forms.Select> <UU5.Forms.Select name="two" label="Select" feedback="error" message="test"> <UU5.Forms.Select.Option value="Value 1" /> <UU5.Forms.Select.Option value="Value 2" /> </UU5.Forms.Select> <UU5.Forms.Select name="three" label="Select" size="sm" isButtonHidden isRequired> <UU5.Forms.Select.Option value="Value 1" /> <UU5.Forms.Select.Option value="Value 2" /> </UU5.Forms.Select> <UU5.Forms.Select name="four" label="Select" size="lg" isRequired value="Value 1"> <UU5.Forms.Select.Option value="Value 1" /> <UU5.Forms.Select.Option value="Value 2" /> <UU5.Forms.Select.Option value="Value 3"><b>some children 3</b><i>:-)</i></UU5.Forms.Select.Option> <UU5.Forms.Select.Option value="Value 4" content="<i>some content 4 sa hdkjsa hdsjka hdskaj hdsajklh sakjl hdsajkl dhsajkhd asjkl dhsajkdh sajkd hsajkhdlsaj kdlhasj klsah jkdsahjk dsalhjklhd sa</i>" /> <UU5.Forms.Select.Option value="Value 5" content="<i>some content 5</i>" selectedContent="<u>some selected content 5</u>" /> </UU5.Forms.Select> <UU5.Forms.Select name="four" label="Select" size="lg" isRequired placeholder="Value 1" value={this.state.value}> <UU5.Forms.Select.Option value="Value 1" /> <UU5.Forms.Select.Option value="Value 2" /> <UU5.Forms.Select.Option value="Value 3"><b>some children 3</b><i>:-)</i></UU5.Forms.Select.Option> <UU5.Forms.Select.Option value="Value 4" content="<i>some content 4 sa hdkjsa hdsjka hdskaj hdsajklh sakjl hdsajkl dhsajkhd asjkl dhsajkdh sajkd hsajkhdlsaj kdlhasj klsah jkdsahjk dsalhjklhd sa</i>" /> <UU5.Forms.Select.Option value="Value 5" content="<i>some content 5</i>" selectedContent="<u>some selected content 5</u>" /> </UU5.Forms.Select> <UU5.Forms.Select name="five" label="Multiple" isRequired multiple placeholder="Value 1"> <UU5.Forms.Select.Option value="Value1" content="Value 1"/> <UU5.Forms.Select.Option value="Value2" content="Value 2" /> <UU5.Forms.Select.Option value="Value3" content="Value 3"><b>some children 3</b><i>:-)</i></UU5.Forms.Select.Option> <UU5.Forms.Select.Option value="Value4" content="<i>some content 4 sa hdkjsa hdsjka hdskaj hdsajklh sakjl hdsajkl dhsajkhd asjkl dhsajkdh sajkd hsajkhdlsaj kdlhasj klsah jkdsahjk dsalhjklhd sa</i>" /> <UU5.Forms.Select.Option value="Value 5" content="<i>some content 5</i>" selectedContent="<u>some selected content 5</u>" /> </UU5.Forms.Select> <UU5.Forms.Select name="five" label="Multiple onChange" isRequired multiple placeholder="Value 1" onChange={function (opt) { console.log(opt); opt.component.setValue(opt.value); }}> <UU5.Forms.Select.Option value="Value1" content="Value 1"/> <UU5.Forms.Select.Option value="Value2" content="Value 2" /> <UU5.Forms.Select.Option value="Value3" content="Value 3"><b>some children 3</b><i>:-)</i></UU5.Forms.Select.Option> <UU5.Forms.Select.Option value="Value4" content="<i>some content 4 sa hdkjsa hdsjka hdskaj hdsajklh sakjl hdsajkl dhsajkhd asjkl dhsajkdh sajkd hsajkhdlsaj kdlhasj klsah jkdsahjk dsalhjklhd sa</i>" /> <UU5.Forms.Select.Option value="Value 5" content="<i>some content 5</i>" selectedContent="<u>some selected content 5</u>" /> </UU5.Forms.Select> <UU5.Forms.Text name="six" label="Text" /> <CustomSelect label="Test"/> </UU5.Forms.BasicForm> </UU5.Layout.Root> ); } }); ReactDOM.render(React.createElement(Page, null), document.getElementById('renderHere')); </script> </body> </html>
UnicornCollege/ucl.itkpd.configurator
client/node_modules/uu5g03/dist-node/forms/demo/select.html
HTML
mit
8,668
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 2171, 1027, 1000, 3193, 6442, 1000, 4180, 1027, 1000, 9381, 1027, 5080, 1011, 9381, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import React, { Component, PropTypes } from 'react'; import { View, Image, Text, StyleSheet } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; const glassPrimary = '#d5d2da'; const glassSecondary = '#bb2130'; class ProfilePicture extends Component { render() { const profileImage = this.props.image; return ( <View style={Styles.container}> <Image source={profileImage} resizeMode='contain' style={Styles.profilePic}> </Image> <LinearGradient colors={[glassPrimary, glassSecondary, glassPrimary]} start={{x: 0.0, y: 0.1}} end={{x: 0.5, y: 1.0}} style={Styles.frame}> </LinearGradient> </View> ) } } const Styles = StyleSheet.create({ container: { height: 120, width: 70, shadowColor: '#000', shadowOffset: { width: 2, height: 2 }, shadowOpacity: 0.7, shadowRadius: 2, elevation: 3, backgroundColor: 'transparent' }, profilePic: { height: 120, width: 70, shadowRadius: 2, shadowOpacity: 0.7, shadowColor: '#000000', borderColor: '#320f1c', borderWidth: 1, }, frame: { position: 'absolute', top: 0, height: 120, width: 70, opacity: 0.25, } }); export default ProfilePicture;
TekkenChicken/t7-chicken-native
src/components/CharacterProfile/ProfilePicture.js
JavaScript
gpl-3.0
1,316
[ 30522, 12324, 10509, 1010, 1063, 6922, 1010, 17678, 13874, 2015, 1065, 2013, 1005, 10509, 1005, 1025, 12324, 1063, 3193, 1010, 3746, 1010, 3793, 1010, 6782, 21030, 2102, 1065, 2013, 1005, 10509, 1011, 3128, 1005, 1025, 12324, 7399, 16307, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
\section{Creature and Irate Locals} \setcounter{rc}{0} \begin{center} \begin{longtable}{| p{\first} | p{\second} | p{\third} | p{\fourth} |} \hline \textbf{\#}& \textbf{Rule Description}& \textbf{Reference(s)}& \textbf{Metric} \\ \hline \newrule{The description of any creature overrides any general rule of the game.}{13.45}{3} \newrule{Creature stats and descriptions are found in the Galactic Guide.}{13.45}{0} \newrule{Creatures are used during an action card that states a creature attacks (See Galactic Guide)}{5.3K}{1} \newrule{Creatures are only spawned on environs in which they are listed.}{5.3K}{3} \newrule{If no creature is named on the environ during a ÒCreature AttacksÓ event, the card may state that the mission group is attacked by one or sentry robots.}{13.46}{2} \newrule{During an ÒIrate locals attacksÓ event, the race is determined by the environ and the stats by the ÒIrate Locals ChartÓ.}{13.47}{2} \newrule{If more than one race is named, use the first on listed on the ÒIrate Locals Chart.Ó}{13.47}{1} \newrule{If the planet is currently in rebellion or rebel-controlled, ignore the event if the Rebel player is conducting the mission.}{13.47}{2} \end{longtable} \end{center}
ui-cs383/SSRS
rules/creature_rules.tex
TeX
mit
1,306
[ 30522, 1032, 2930, 1063, 6492, 1998, 11209, 2618, 10575, 1065, 1032, 2275, 3597, 16671, 2121, 1063, 22110, 1065, 1063, 1014, 1065, 1032, 4088, 1063, 2415, 1065, 1032, 4088, 1063, 2146, 10880, 1065, 1063, 1064, 1052, 1063, 1032, 2034, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // Distributed under 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://www.boost.org/libs/iostreams for documentation. #ifndef BOOST_IOSTREAMS_STREAM_HPP_INCLUDED #define BOOST_IOSTREAMS_STREAM_HPP_INCLUDED #if defined(_MSC_VER) # pragma once #endif #include <boost/iostreams/constants.hpp> #include <boost/iostreams/detail/char_traits.hpp> #include <boost/iostreams/detail/config/overload_resolution.hpp> #include <boost/iostreams/detail/forward.hpp> #include <boost/iostreams/detail/iostream.hpp> // standard streams. #include <boost/iostreams/detail/select.hpp> #include <boost/iostreams/stream_buffer.hpp> #include <boost/mpl/and.hpp> #include <boost/type_traits/is_convertible.hpp> #include <boost/utility/base_from_member.hpp> namespace boost { namespace iostreams { namespace detail { template<typename Device, typename Tr> struct stream_traits { typedef typename char_type_of<Device>::type char_type; typedef Tr traits_type; typedef typename category_of<Device>::type mode; typedef typename iostreams::select< // Disambiguation required for Tru64. mpl::and_< is_convertible<mode, input>, is_convertible<mode, output> >, BOOST_IOSTREAMS_BASIC_IOSTREAM(char_type, traits_type), is_convertible<mode, input>, BOOST_IOSTREAMS_BASIC_ISTREAM(char_type, traits_type), else_, BOOST_IOSTREAMS_BASIC_OSTREAM(char_type, traits_type) >::type stream_type; typedef typename iostreams::select< // Disambiguation required for Tru64. mpl::and_< is_convertible<mode, input>, is_convertible<mode, output> >, iostream_tag, is_convertible<mode, input>, istream_tag, else_, ostream_tag >::type stream_tag; }; #if defined(BOOST_MSVC) && (BOOST_MSVC == 1700) # pragma warning(push) // https://connect.microsoft.com/VisualStudio/feedback/details/733720/ # pragma warning(disable: 4250) #endif // By encapsulating initialization in a base, we can define the macro // BOOST_IOSTREAMS_DEFINE_FORWARDING_FUNCTIONS to generate constructors // without base member initializer lists. template< typename Device, typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS( BOOST_DEDUCED_TYPENAME char_type_of<Device>::type ), typename Alloc = std::allocator< BOOST_DEDUCED_TYPENAME char_type_of<Device>::type >, typename Base = // VC6 Workaround. BOOST_DEDUCED_TYPENAME detail::stream_traits<Device, Tr>::stream_type > class stream_base : protected base_from_member< stream_buffer<Device, Tr, Alloc> >, public Base { private: typedef base_from_member< stream_buffer<Device, Tr, Alloc> > pbase_type; typedef typename stream_traits<Device, Tr>::stream_type stream_type; protected: using pbase_type::member; // Avoid warning about 'this' in initializer list. public: stream_base() : pbase_type(), stream_type(&member) { } }; #if defined(BOOST_MSVC) && (BOOST_MSVC == 1700) # pragma warning(pop) #endif } } } // End namespaces detail, iostreams, boost. #ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION # include <boost/iostreams/detail/broken_overload_resolution/stream.hpp> #else namespace boost { namespace iostreams { #if defined(BOOST_MSVC) && (BOOST_MSVC == 1700) # pragma warning(push) // https://connect.microsoft.com/VisualStudio/feedback/details/733720/ # pragma warning(disable: 4250) #endif // // Template name: stream. // Description: A iostream which reads from and writes to an instance of a // designated device type. // Template parameters: // Device - A device type. // Alloc - The allocator type. // template< typename Device, typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS( BOOST_DEDUCED_TYPENAME char_type_of<Device>::type ), typename Alloc = std::allocator< BOOST_DEDUCED_TYPENAME char_type_of<Device>::type > > struct stream : detail::stream_base<Device, Tr, Alloc> { public: typedef typename char_type_of<Device>::type char_type; struct category : mode_of<Device>::type, closable_tag, detail::stream_traits<Device, Tr>::stream_tag { }; BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) private: typedef typename detail::stream_traits< Device, Tr >::stream_type stream_type; public: stream() { } BOOST_IOSTREAMS_FORWARD( stream, open_impl, Device, BOOST_IOSTREAMS_PUSH_PARAMS, BOOST_IOSTREAMS_PUSH_ARGS ) bool is_open() const { return this->member.is_open(); } void close() { this->member.close(); } bool auto_close() const { return this->member.auto_close(); } void set_auto_close(bool close) { this->member.set_auto_close(close); } bool strict_sync() { return this->member.strict_sync(); } Device& operator*() { return *this->member; } Device* operator->() { return &*this->member; } Device* component() { return this->member.component(); } private: void open_impl(const Device& dev BOOST_IOSTREAMS_PUSH_PARAMS()) // For forwarding. { this->clear(); this->member.open(dev BOOST_IOSTREAMS_PUSH_ARGS()); } }; #if defined(BOOST_MSVC) && (BOOST_MSVC == 1700) # pragma warning(pop) #endif } } // End namespaces iostreams, boost. #endif // #ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION #endif // #ifndef BOOST_IOSTREAMS_stream_HPP_INCLUDED
zcobell/MetOceanViewer
thirdparty/boost_1_67_0/boost/iostreams/stream.hpp
C++
gpl-3.0
6,133
[ 30522, 1013, 1013, 1006, 1039, 1007, 9385, 2263, 3642, 24449, 1010, 11775, 1006, 22883, 7088, 2015, 2012, 3642, 24449, 11089, 4012, 1007, 1013, 1013, 1006, 1039, 1007, 9385, 2494, 1011, 2289, 5655, 22883, 7088, 2015, 1013, 1013, 5500, 2104,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<html> <head> <script src="../../../dojo/dojo.js"></script> <script src="../storage-browser.js"></script> <script> dojo.require("dojox.storage"); function runDemo(){ // setup event handlers dojo.byId("saveButton").onclick = saveValue; // write out what our storage provider is for debugging dojo.byId("currentProvider").innerHTML = dojox.storage.manager.currentProvider.declaredClass; loadValues(); } function loadValues(){ // get any values that were saved before and write them into the page var results = dojox.storage.get("myValues"); if(results){ var printMe = "<ul>"; for(var i = 0; i < results.length; i++){ printMe += "<li>" + results[i] + "</li>"; } printMe += "</ul>"; dojo.byId("allValues").innerHTML = printMe; } } function saveValue(){ var value = dojo.byId("saveValue").value; if(value == undefined || value === ""){ alert("Please enter a correct value"); return; } // get the old values first, since we are saving everything // as one key var results = dojox.storage.get("myValues"); if(!results){ results = new Array(); } // add new value results.push(value); dojox.storage.put("myValues", results, function(status, keyName){ if(status == dojox.storage.FAILED){ alert("You do not have permission to store data for this web site."); }else if(status == dojox.storage.SUCCESS){ loadValues(); } }); } // wait until the storage system is finished loading if(!dojox.storage.manager.isInitialized()){ dojo.connect(dojox.storage.manager, "loaded", runDemo); }else{ dojo.connect(dojo, "loaded", runDemo); } </script> </head> <body> <h1>Dojo Storage Hello World</h1> <p>Simple Dojo Storage example. Enter values below to have them persisted in Dojo Storage; refresh browser page or close browser and then return to this page to see the values again. Note that Dojo Storage will not work from file:// URLs.</p> <h2>Save Values:</h2> <div> <input id="saveValue" type="text"></input> <button id="saveButton">Save Value</button> </div> <h2>All Saved Values:</h2> <p id="allValues"></p> <p>Using Dojo Storage Provider (autodetected): <span id="currentProvider"></span> <p> </body> </html>
avz-cmf/zaboy-middleware
www/js/dojox/storage/demos/helloworld.html
HTML
gpl-3.0
2,685
[ 30522, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 5896, 5034, 2278, 1027, 1000, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 2079, 5558, 1013, 2079, 5558, 1012, 1046, 2015, 1000, 1028, 1026, 1013, 5896, 1028, 1026, 5896, 5034, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2013-2019 52°North Initiative for Geospatial Open Source * Software GmbH * * 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. * * If the program is linked with libraries which are licensed under one of * the following licenses, the combination of the program with the linked * library is not considered a "derivative work" of the program: * * - Apache License, version 2.0 * - Apache Software License, version 1.0 * - GNU Lesser General Public License, version 3 * - Mozilla Public License, versions 1.0, 1.1 and 2.0 * - Common Development and Distribution License (CDDL), version 1.0 * * Therefore the distribution of the program linked with libraries licensed * under the aforementioned licenses, is permitted by the copyright holders * if the distribution is compliant with both the GNU General Public License * version 2 and the aforementioned licenses. * * 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. */ package org.n52.series.spi.geo; import org.locationtech.jts.geom.Geometry; import org.n52.io.crs.CRSUtils; import org.n52.io.request.IoParameters; import org.n52.io.response.dataset.StationOutput; import org.opengis.referencing.FactoryException; import org.opengis.referencing.operation.TransformException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TransformationService { private static final Logger LOGGER = LoggerFactory.getLogger(TransformationService.class); /** * @param station * the station to transform * @param parameters * the query containing CRS and how to handle axes order */ protected void transformInline(StationOutput station, IoParameters parameters) { String crs = parameters.getCrs(); if (CRSUtils.DEFAULT_CRS.equals(crs)) { // no need to transform return; } Geometry geometry = transform(station.getGeometry(), parameters); station.setValue(StationOutput.GEOMETRY, geometry, parameters, station::setGeometry); } public Geometry transform(Geometry geometry, IoParameters query) { String crs = query.getCrs(); if (CRSUtils.DEFAULT_CRS.equals(crs)) { // no need to transform return geometry; } return transformGeometry(query, geometry, crs); } private Geometry transformGeometry(IoParameters query, Geometry geometry, String crs) throws RuntimeException { try { CRSUtils crsUtils = query.isForceXY() ? CRSUtils.createEpsgForcedXYAxisOrder() : CRSUtils.createEpsgStrictAxisOrder(); return geometry != null ? crsUtils.transformInnerToOuter(geometry, crs) : geometry; } catch (TransformException e) { throwRuntimeException(crs, e); } catch (FactoryException e) { LOGGER.debug("Couldn't create geometry factory", e); } return geometry; } private void throwRuntimeException(String crs, TransformException e) throws RuntimeException { throw new RuntimeException("Could not transform to requested CRS: " + crs, e); } }
ridoo/series-rest-api
spi/src/main/java/org/n52/series/spi/geo/TransformationService.java
Java
gpl-2.0
3,637
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2286, 1011, 10476, 4720, 7737, 12131, 2705, 6349, 2005, 20248, 13102, 10450, 2389, 2330, 3120, 1008, 4007, 18289, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.finalteam.jarbuild; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; /** * * @author pengjianbo * */ public class FileUtils { public static String getFileExtension(String filePath) { if (filePath == null || filePath.trim().length() == 0) { return filePath; } int extenPosi = filePath.lastIndexOf("."); int filePosi = filePath.lastIndexOf(File.separator); if (extenPosi == -1) { return ""; } return (filePosi >= extenPosi) ? "" : filePath.substring(extenPosi + 1); } public static boolean makeDirs(String filePath) { String folderName = getFolderName(filePath); if (folderName == null || folderName.trim().length() == 0) { return false; } File folder = new File(folderName); return (folder.exists() && folder.isDirectory()) ? true : folder.mkdirs(); } public static String getFolderName(String filePath) { if (filePath == null || filePath.trim().length() == 0) { return filePath; } int filePosi = filePath.lastIndexOf(File.separator); return (filePosi == -1) ? "" : filePath.substring(0, filePosi); } public static String getFileNameWithoutExtension(String filePath) { if (filePath == null || filePath.trim().length() == 0) { return filePath; } int extenPosi = filePath.lastIndexOf("."); int filePosi = filePath.lastIndexOf(File.separator); if (filePosi == -1) { return (extenPosi == -1 ? filePath : filePath.substring(0, extenPosi)); } if (extenPosi == -1) { return filePath.substring(filePosi + 1); } return (filePosi < extenPosi ? filePath.substring(filePosi + 1, extenPosi) : filePath.substring(filePosi + 1)); } /** * 使用文件通道的方式复制文件 * @param s 源文件 * @param t复制到的新文件 */ public static void copy(File sourceFile, File targeFile) { FileInputStream fi = null; FileOutputStream fo = null; FileChannel in = null; FileChannel out = null; try { fi = new FileInputStream(sourceFile); fo = new FileOutputStream(targeFile); in = fi.getChannel();// 得到对应的文件通道 out = fo.getChannel();// 得到对应的文件通道 in.transferTo(0, in.size(), out);// 连接两个通道,并且从in通道读取,然后写入out通道 } catch (IOException e) { e.printStackTrace(); } finally { try { fi.close(); in.close(); fo.close(); out.close(); } catch (IOException e) { e.printStackTrace(); } } } }
immqy/MutiChannelPackup
jar-build/JarBuild/src/com/finalteam/jarbuild/FileUtils.java
Java
apache-2.0
2,757
[ 30522, 7427, 4012, 1012, 2345, 27058, 2213, 1012, 15723, 8569, 4014, 2094, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 2378, 18780, 21422, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 5833, 18780, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using Microsoft.VisualStudio.TestTools.UnitTesting; using TypeMock.ArrangeActAssert; using Nucleo.Web.Core; namespace Nucleo.Web.Views { [TestClass] public class WebViewHostTest { #region " Tests " [TestMethod] public void CreatingNewWebViewHostWorksOK() { //Arrange var dict = new Dictionary<object, object>(); var ctx = Isolate.Fake.Instance<IWebContext>(); Isolate.WhenCalled(() => ctx.LocalStorage).WillReturn(dict); //Act var host = WebViewHost.CreateOrGet(ctx); //Assert Assert.IsTrue(dict.ContainsKey(typeof(WebViewHost))); Assert.AreEqual(host, dict[typeof(WebViewHost)]); } #endregion } }
brianmains/Nucleo.NET
src/Nucleo.UnitTests.40.MS/Web/Views/WebViewHostTest.cs
C#
mit
757
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 2291, 1012, 4773, 1025, 2478, 2291, 1012, 4773, 1012, 21318, 1025, 2478, 7513, 1012, 26749, 8525, 20617, 1012, 3231, 3406, 27896,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Symfony 2 Benchmarking Test This is the Symfony 2 PHP portion of a [benchmarking test suite](../) comparing a variety of web development platforms. ### JSON Encoding Test Uses the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-encode.php). * [JSON test controller](src/Skamander/BenchmarkBundle/Controller/BenchController.php) ### Data-Store/Database Mapping Test Uses the Symfony 2/Doctrine 2 Entity functionality. * [DB test controller](src/Skamander/BenchmarkBundle/Controller/BenchController.php) * [DB test model](src/Skamander/BenchmarkBundle/Entity/World.php) ### Template Test Uses Symfony's template engine 'Twig' * [Template test controller](src/Skamander/BenchmarkBundle/Controller/BenchController.php) ## Infrastructure Software Versions The tests were run with: * [Symfony Version 2.2.1](http://symfony.com/) * [PHP Version 5.4.13](http://www.php.net/) with FPM and APC * [nginx 1.4.0](http://nginx.org/) * [MySQL 5.5.29](https://dev.mysql.com/) ## Test URLs ### JSON Encoding Test http://localhost/json ### Data-Store/Database Mapping Test http://localhost/db ### Variable Query Test http://localhost/db?queries=2 ### Templating Test http://localhost/fortunes
seem-sky/FrameworkBenchmarks
php-symfony2/README.md
Markdown
bsd-3-clause
1,223
[ 30522, 1001, 25353, 2213, 14876, 4890, 1016, 6847, 10665, 2075, 3231, 2023, 2003, 1996, 25353, 2213, 14876, 4890, 1016, 25718, 4664, 1997, 1037, 1031, 6847, 10665, 2075, 3231, 7621, 1033, 1006, 1012, 1012, 1013, 1007, 13599, 1037, 3528, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // Compatible with sf_escaping_strategy: true $firstPass = isset($firstPass) ? $sf_data->getRaw('firstPass') : null; $form = isset($form) ? $sf_data->getRaw('form') : null; $i = isset($i) ? $sf_data->getRaw('i') : null; $item = isset($item) ? $sf_data->getRaw('item') : null; $itemFormScripts = isset($itemFormScripts) ? $sf_data->getRaw('itemFormScripts') : null; $n = isset($n) ? $sf_data->getRaw('n') : null; $withPreview = isset($withPreview) ? $sf_data->getRaw('withPreview') : true; $popularTags = isset($popularTags) ? $sf_data->getRaw('popularTags') : array(); $allTags = isset($allTags) ? $sf_data->getRaw('allTags') : array(); // There is just one edit form for new uploads, even in bulk $submitSelector = $item ? ('#' . $item->getSlug() . '-submit') : '.a-media-multiple-submit-button'; $single = isset($single) ? $sf_data->getRaw('single') : false; $formAction = isset($formAction) ? $sf_data->getRaw('formAction') : null; $editVideoSuccess = isset($editVideoSuccess) ? $sf_data->getRaw('editVideoSuccess') : null; ?> <?php // Oops: with embedded forms you are not allowed to unset widgets. Didn't bite us in the ?> <?php // one-file case. Lovely. Work around it by using flags instead ?> <?php $fileShown = false ?> <?php $embedShown = false ?> <?php if (!isset($form['file'])): ?> <?php $withPreview = false ?> <?php endif ?> <?php $embeddable = ($form instanceof BaseaMediaVideoForm) || ($item && $item->getEmbeddable()) ?> <?php use_helper('a') ?> <?php // Sometimes this is one item in a list of several in embedded forms, in ?> <?php // which case $n is our ordinal in the list and $i is an acceptably unique suffix ?> <?php // to distinguish this particular item (its ID). When we're editing just one item we use ?> <?php // 0 and 'single' instead. ?> <?php if (!isset($n)): ?> <?php $n = 0 ?> <?php $single = true ?> <?php else: ?> <?php $single = false ?> <?php endif ?> <?php if (!isset($i)): ?> <?php $i = 'single' ?> <?php endif ?> <?php // From here on in we can use $single to check when we need to know whether ?> <?php // we're dealing with a single item (like editing an existing item or annotating ?> <?php // an embedded media upload) or we're just one of many. Test $item to determine ?> <?php // if the single item has already been saved in the past and we're just editing ?> <?php if ($single): ?> <?php // Editing one item, existing or otherwise ?> <form method="post" class="a-ui a-media-edit-form" id="a-media-edit-form-<?php echo $i ?>" enctype="multipart/form-data" action="<?php echo $formAction ?>"> <?php if ($editVideoSuccess): ?> <div class="a-media-editor a-even last"> <div class="a-ui a-media-item a-media-edit-form even"> <?php endif ?> <?php else: ?> <?php // This is one of several items in a larger form ?> <div class="a-ui a-media-item a-media-edit-form <?php echo ($n%2) ? "odd" : "even" ?>" id="a-media-item-<?php echo $i ?>"> <?php endif ?> <?php // Prepare to render an embed code even though this object hasn't been saved yet ?> <?php $embedValues = array() ?> <?php // Preview of image and/or embed code. We do not need this when we are editing an existing item via AJAX ?> <?php // because a preview is on the screen ?> <?php if (!$item): ?> <?php if (isset($form['embed']) && (!$form['embed']->hasError()) && strlen($form['embed']->getValue())): ?> <?php $embedValues['embed'] = $form['embed']->getValue() ?> <?php elseif (isset($form['service_url']) && strlen($form['service_url']->getValue())): ?> <?php $embedValues['service_url'] = $form['service_url']->getValue() ?> <?php endif ?> <?php if (count($embedValues)): ?> <?php $form->updateObject($embedValues) ?> <?php $constraints = aMediaTools::getOption('gallery_constraints') ?> <?php $width = $constraints['width'] ?> <?php $height = $constraints['height'] ?> <?php $embedCode = $form->getObject()->getEmbedCode($width, $height, 'c') ?> <?php endif ?> <?php if ($withPreview || isset($embedCode)): ?> <?php // This is how we get the preview and/or file extension outside of the widget. Jamming it into the widget made templating weird ?> <div class="a-form-row preview"> <?php if (isset($embedCode)): ?> <label class="full">Embed Preview</label> <div class="a-form-field"> <?php echo $embedCode ?> </div> <label class="full">Embed Thumbnail</label> <?php endif ?> <?php $widget = $form['file']->getWidget() ?> <?php $previewUrl = $widget->getPreviewUrl($form['file']->getValue(), aMediaTools::getOption('gallery_constraints')) ?> <div class="a-form-field"> <?php if ($previewUrl): ?> <?php echo image_tag($previewUrl) ?> <?php else: ?> <?php $format = $widget->getFormat($form['file']->getValue()) ?> <?php if ($format): ?> <span class="a-media-type <?php echo $format ?>" ><b><?php echo $format ?></b></span> <?php endif ?> <?php endif ?> </div> </div> <?php endif ?> <?php endif ?> <?php // Special handling for a new submission ?> <?php if (!$item): ?> <?php // * If there is an embed widget with an error put it on top ?> <?php // * If there is no value for the embed widget yet, put it on top ?> <?php // * Then mark it shown so it doesn't get displayed later in the form. ?> <?php if ((!$embedShown) && isset($form['embed']) && ($form['embed']->hasError() || (!$form['file']->getValue()))): ?> <div class="a-form-row embed a-ui"> <?php echo $form['embed']->renderLabel() ?> <?php echo $form['embed']->renderError() ?> <?php echo $form['embed']->render() ?> </div> <?php $embedShown = true ?> <?php endif ?> <?php // * If there is a file widget with an error put it on top ?> <?php // * If there is an embedded media form with no thumbnail yet, put it on top ?> <?php // * Then mark it shown so it doesn't get displayed later in the form. ?> <?php if ((!$fileShown) && isset($form['file']) && ($form['file']->hasError() || ($form instanceof BaseaMediaVideoForm && (!$form['file']->getValue())))): ?> <div class="a-form-row replace a-ui"> <?php echo $form['file']->renderLabel() ?> <?php echo $form['file']->renderError() ?> <?php echo $form['file']->render() ?> <?php if ((!$single) && (!$item)): ?> <a class="a-btn icon a-delete alt lite" href="#"><span class="icon"></span>Delete File</a> <?php a_js_call('apostrophe.mediaEnableRemoveButton(?)', $i) ?> <?php endif ?> </div> <?php $fileShown = true ?> <?php endif ?> <?php endif ?> <div class="a-form-row title"> <?php echo $form['title']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['title']->render() ?> </div> <?php if (!$firstPass): ?> <?php echo $form['title']->renderError() ?> <?php endif ?> </div> <div class="a-form-row description"> <?php // echo $form['description']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['description']->render() ?> </div> <?php echo $form['description']->renderError() ?> </div> <div class="a-form-row credit"> <?php echo $form['credit']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['credit']->render() ?> </div> <?php echo $form['credit']->renderError() ?> </div> <div class="a-form-row categories"> <?php echo $form['categories_list']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['categories_list']->render() ?> </div> <?php if ($item): ?> <?php $adminCategories = $item->getAdminCategories() ?> <?php if (count($adminCategories)): ?> <div class="a-form-field"> <?php echo 'Set by admin: ' . implode(',', $adminCategories) ?> </div> <?php endif ?> <?php endif ?> <?php if (!$firstPass): ?> <?php echo $form['categories_list']->renderError() ?> <?php endif ?> </div> <div class="a-form-row tags"> <?php echo $form['tags']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['tags']->render(array('id' => 'a-media-item-tags-input-'.$i, )) ?> <?php $options = array('popular-tags' => $popularTags, 'tags-label' => ' ', 'commit-selector' => $submitSelector, 'typeahead-url' => url_for('taggableComplete/complete')) ?> <?php if (sfConfig::get('app_a_all_tags', true)): ?> <?php $options['all-tags'] = $allTags ?> <?php endif ?> <?php a_js_call('pkInlineTaggableWidget(?, ?)', '#a-media-item-tags-input-'.$i, $options) ?> </div> <?php echo $form['tags']->renderError() ?> </div> <div class="a-form-row permissions"> <?php echo $form['view_is_secure']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['view_is_secure']->render() ?> </div> <?php echo $form['view_is_secure']->renderError() ?> <div class="a-help"> <!-- John, we'll want to do jake's new question mark floating help here instead. --> <?php echo __('Permissions: Hidden Photos can be used in photo slots, but are not displayed in the Media section.', null, 'apostrophe') ?> </div> </div> <?php // Let them replace an existing embed code. ?> <?php // TODO: have john wrap the "replace file" button or similar around this so it's not always in your face ?> <?php if ((!$embedShown) && isset($form['embed'])): ?> <div class="a-form-row embed a-ui"> <?php echo $form['embed']->renderLabel() ?> <?php echo $form['embed']->renderError() ?> <?php echo $form['embed']->render() ?> </div> <?php endif ?> <?php // Let them replace an existing file. ?> <?php if ((!$fileShown) && isset($form['file'])): ?> <div class="a-form-row replace a-ui"> <div class="a-options-container"> <a href="#replace-image" onclick="return false;" id="a-media-replace-image-<?php echo $i ?>" class="a-btn icon a-replace alt lite"><span class="icon"></span><?php echo $embeddable ? a_('Replace Thumbnail') : a_('Replace File') ?></a> <div class="a-ui a-options dropshadow"> <?php echo $form['file']->renderLabel() ?> <div class="a-form-field"> <?php echo $form['file']->render() ?> </div> <?php echo $form['file']->renderError() ?> </div> </div> <?php // In a multiple-upload context this is how we decide not to use one of the items after all ?> <?php if ((!$single) && (!$item)): ?> <a class="a-btn icon a-delete lite" href="#"><span class="icon"></span><?php echo a_('Delete File') ?></a> <?php a_js_call('apostrophe.mediaEnableRemoveButton(?)', $i) ?> <?php endif ?> <?php if ($item && $item->getDownloadable()): ?> <?php echo link_to(__("%buttonspan%Download Original", array('%buttonspan%' => "<span class='icon'></span>"), 'apostrophe'), "aMediaBackend/original?" .http_build_query(array("slug" => $item->getSlug(), "format" => $item->getFormat())), array("class"=>"a-btn icon a-download lite alt")) ?> <?php endif ?> </div> <?php endif ?> <?php if ($single): ?> <?php if ($editVideoSuccess): ?> </div> </div> <?php endif ?> <ul class="a-ui a-controls a-align-left bottom"> <?php if ($editVideoSuccess): ?> <li><?php echo a_button(a_('Cancel'), url_for('aMedia/resume'), array('icon','a-cancel', 'big')) ?></li> <li><?php echo a_anchor_submit_button(a_('Save Media'), array('big'), substr($submitSelector, 1)) ?></li> <?php else: ?> <li><?php echo a_anchor_submit_button(a_('Save'), array(), substr($submitSelector, 1)) ?></li> <li><?php echo a_button(a_('Cancel'), url_for('aMedia/resume'), array('icon','a-cancel')) ?></li> <?php endif ?> <?php if ($item): ?> <li> <?php echo link_to("<span class='icon'></span>".__("Delete", null, 'apostrophe'), "aMedia/delete?" . http_build_query( array("slug" => $item->slug)), array("confirm" => __("Are you sure you want to delete this item?", null, 'apostrophe'), "class"=>"a-btn icon a-delete no-label", 'title' => __('Delete', null, 'apostrophe'), ), array("target" => "_top")) ?> </li> <?php endif ?> </ul> <div class="a-form-row a-hidden"> <?php echo $form->renderHiddenFields() ?> </div> </form> <?php else: ?> </div> <?php endif ?> <?php if (!isset($itemFormScripts)): ?> <?php // TODO: When Categories and Tags are updated to use our inline JS widgets, these scripts can get removed ?> <?php include_partial('aMedia/itemFormScripts') ?> <?php endif ?> <?php a_js_call('apostrophe.menuToggle(?)', array('button' => '#a-media-replace-image-'.$i, 'classname' => '', 'overlay' => false)) ?> <?php a_js_call('apostrophe.mediaReplaceFileListener(?)', array('menu' => '#a-media-replace-image-'.$i, 'input' => '.a-form-row.replace input[type="file"]', 'message' => a_('This file will be replaced after you click save.'), 'fileLabel' => a_('New file: '))) ?> <?php if($sf_request->isXmlHttpRequest()): ?> <?php a_js_call('apostrophe.mediaAjaxSubmitListener(?)', array('form' => '#a-media-edit-form-'.$i, 'descId' => $form['description']->renderId(), 'url' => $formAction, 'update' => '#a-media-item-'.$item->getId().' .a-media-item-information')) ?> <?php endif ?> <?php a_js_call('apostrophe.radioToggleButton(?)', array('field' => '#a-media-editor-'.$i.' .a-form-row.permissions > .a-form-field', 'opt1Label' => 'public', 'opt2Label' => 'hidden')) ?> <?php // include pkTagahead for the taggable widget ?> <?php use_javascript('/sfDoctrineActAsTaggablePlugin/js/pkTagahead.js') ?>
jpasosa/parquelareja
plugins/apostrophePlugin/modules/aMedia/templates/_edit.php
PHP
mit
13,315
[ 30522, 1026, 1029, 25718, 1013, 1013, 11892, 2007, 16420, 1035, 13002, 30524, 1006, 1002, 2433, 1007, 1029, 1002, 16420, 1035, 2951, 1011, 1028, 2131, 2527, 2860, 1006, 1005, 2433, 1005, 1007, 1024, 19701, 1025, 1002, 1045, 1027, 26354, 338...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run'); /** * Tests Kohana_Security * * @group kohana * @group kohana.security * * @package Kohana * @category Tests */ class Kohana_SecurityTest extends Unittest_TestCase { /** * Provides test data for test_envode_php_tags() * * @return array Test data sets */ public function provider_encode_php_tags() { return array( array("&lt;?php echo 'helloo'; ?&gt;", "<?php echo 'helloo'; ?>"), ); } /** * Tests Security::encode_php_tags() * * @test * @dataProvider provider_encode_php_tags * @covers Security::encode_php_tags */ public function test_encode_php_tags($expected, $input) { $this->assertSame($expected, Security::encode_php_tags($input)); } /** * Provides test data for test_strip_image_tags() * * @return array Test data sets */ public function provider_strip_image_tags() { return array( array('foo', '<img src="foo" />'), ); } /** * Tests Security::strip_image_tags() * * @test * @dataProvider provider_strip_image_tags * @covers Security::strip_image_tags */ public function test_strip_image_tags($expected, $input) { $this->assertSame($expected, Security::strip_image_tags($input)); } /** * Provides test data for Security::token() * * @return array Test data sets */ public function provider_csrf_token() { $array = array(); for ($i = 0; $i <= 4; $i++) { Security::$token_name = 'token_'.$i; $array[] = array(Security::token(TRUE), Security::check(Security::token(FALSE)), $i); } return $array; } /** * Tests Security::token() * * @test * @dataProvider provider_csrf_token * @covers Security::token */ public function test_csrf_token($expected, $input, $iteration) { Security::$token_name = 'token_'.$iteration; $this->assertSame(TRUE, $input); $this->assertSame($expected, Security::token(FALSE)); Session::instance()->delete(Security::$token_name); } }
iHub/saidika
system/tests/kohana/SecurityTest.php
PHP
bsd-3-clause
1,997
[ 30522, 1026, 1029, 25718, 4225, 1006, 1005, 25353, 13102, 8988, 1005, 1007, 2030, 3280, 1006, 1005, 12849, 15788, 6879, 6494, 2361, 3791, 2000, 2022, 2443, 2077, 5852, 2448, 1005, 1007, 1025, 1013, 1008, 1008, 1008, 5852, 12849, 15788, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Help Information * [Common Pitfalls](#pitfalls) * [FAQs](#faqs) * * * <a name="pitfalls"></a> ## Common Pitfalls 1. [Failing to receive reply with `ReplyToMessage`](#reply-to-message) --- <a name="reply-to-message"></a> **Failing to receive reply with `ReplyToMessage`** The user has to **manually reply** to your message, by tapping on the bot's message and select *Reply*. Sources: * Issue #113: https://github.com/yagop/node-telegram-bot-api/issues/113 * * * <a name="faqs"></a> ## Frequently Asked Questions > Check out [all questions ever asked][questions] on our Github Issues. [questions]:https://github.com/yagop/node-telegram-bot-api/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20 1. [How do I send GIFs?](#gifs) 1. [Why and When do I need a certificate when using WebHooks?](#webhook-cert) 1. [How do I know when a user leaves a chat?](#leave-chat) 1. [What does this error mean?](#error-meanings) 1. [How do I know the selected option in reply keyboard?](#reply-keyboard) 1. [How do I send multiple message in correct sequence?](#ordered-sending) 1. [How do I run my bot behind a proxy?](#proxy) 1. [Can you add feature X to the library?](#new-feature) 1. [Is this scalable?](#scalable) --- <a name="gifs"></a> **How do I send GIFs?** You might be trying to send your animated GIFs using *TelegramBot#sendPhoto()*. The method mostly supports static images. As noted by the community, it seems you need to send them as documents, using *TelegramBot#sendDocument()*. ```js bot.sendDocument(chatId, "cat.gif"); ``` Sources: * Issue #11: https://github.com/yagop/node-telegram-bot-api/issues/11 --- <a name="webhook-cert"></a> **Why and When do I need a certificate when using WebHooks?** *Not Done. Send PR please!* Sources: * Issue #63: https://github.com/yagop/node-telegram-bot-api/issues/63 * Issue #125: https://github.com/yagop/node-telegram-bot-api/issues/125 --- <a name="leave-chat"></a> **How do I know when a user leaves a chat?** *Not Done. Send PR please!* Sources: * Issue #248: https://github.com/yagop/node-telegram-bot-api/issues/248 --- <a name="error-meanings"></a> **What does this error mean?** *Not Done. Send PR please!* Sources: * Issue #73: https://github.com/yagop/node-telegram-bot-api/issues/73 * Issue #99: https://github.com/yagop/node-telegram-bot-api/issues/99 * Issue #101: https://github.com/yagop/node-telegram-bot-api/issues/101 * Issue #107: https://github.com/yagop/node-telegram-bot-api/issues/107 * Issue #156: https://github.com/yagop/node-telegram-bot-api/issues/156 * Issue #170: https://github.com/yagop/node-telegram-bot-api/issues/170 * Issue #244: https://github.com/yagop/node-telegram-bot-api/issues/244 --- <a name="reply-keyboard"></a> **How do I know the selected option in reply keyboard?** *Not Done. Send PR please!* Sources: * Issue #108: https://github.com/yagop/node-telegram-bot-api/issues/108 --- <a name="ordered-sending"></a> **How do I send multiple message in correct sequence?** *Not Done. Send PR please!* Sources: * Issue #240: https://github.com/yagop/node-telegram-bot-api/issues/240 --- <a name="proxy"></a> **How do I run my bot behind a proxy?** *Not Done. Send PR please!* Sources: * Issue #122: https://github.com/yagop/node-telegram-bot-api/issues/122 * Issue #253: https://github.com/yagop/node-telegram-bot-api/issues/253 --- <a name="new-feature"></a> **Can you add feature X to the library?** *Not Done. Send PR please!* Sources: * Issue #238: https://github.com/yagop/node-telegram-bot-api/issues/238 --- <a name="scalable"></a> **Is this scalable?** *Not Done. Send PR please!* Sources: * Issue #219: https://github.com/yagop/node-telegram-bot-api/issues/219 ---
dottork/poppobot
node_modules/node-telegram-bot-api/doc/help.md
Markdown
gpl-3.0
3,784
[ 30522, 1001, 2393, 2592, 1008, 1031, 2691, 6770, 28067, 1033, 1006, 1001, 6770, 28067, 1007, 1008, 1031, 6904, 4160, 2015, 1033, 1006, 1001, 6904, 4160, 2015, 1007, 1008, 1008, 1008, 1026, 1037, 2171, 1027, 1000, 6770, 28067, 1000, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @license Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ /*jslint sloppy: true, plusplus: true */ /*global define, java, Packages, com */ define(['logger', 'env!env/file'], function (logger, file) { //Add .reduce to Rhino so UglifyJS can run in Rhino, //inspired by https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce //but rewritten for brevity, and to be good enough for use by UglifyJS. if (!Array.prototype.reduce) { Array.prototype.reduce = function (fn /*, initialValue */) { var i = 0, length = this.length, accumulator; if (arguments.length >= 2) { accumulator = arguments[1]; } else { if (length) { while (!(i in this)) { i++; } accumulator = this[i++]; } } for (; i < length; i++) { if (i in this) { accumulator = fn.call(undefined, accumulator, this[i], i, this); } } return accumulator; }; } var JSSourceFilefromCode, optimize, mapRegExp = /"file":"[^"]+"/; //Bind to Closure compiler, but if it is not available, do not sweat it. try { JSSourceFilefromCode = java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMethod('fromCode', [java.lang.String, java.lang.String]); } catch (e) {} //Helper for closure compiler, because of weird Java-JavaScript interactions. function closurefromCode(filename, content) { return JSSourceFilefromCode.invoke(null, [filename, content]); } function getFileWriter(fileName, encoding) { var outFile = new java.io.File(fileName), outWriter, parentDir; parentDir = outFile.getAbsoluteFile().getParentFile(); if (!parentDir.exists()) { if (!parentDir.mkdirs()) { throw "Could not create directory: " + parentDir.getAbsolutePath(); } } if (encoding) { outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile), encoding); } else { outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile)); } return new java.io.BufferedWriter(outWriter); } optimize = { closure: function (fileName, fileContents, outFileName, keepLines, config) { config = config || {}; var result, mappings, optimized, compressed, baseName, writer, outBaseName, outFileNameMap, outFileNameMapContent, srcOutFileName, concatNameMap, jscomp = Packages.com.google.javascript.jscomp, flags = Packages.com.google.common.flags, //Set up source input jsSourceFile = closurefromCode(String(fileName), String(fileContents)), sourceListArray = new java.util.ArrayList(), options, option, FLAG_compilation_level, compiler, Compiler = Packages.com.google.javascript.jscomp.Compiler, CommandLineRunner = Packages.com.google.javascript.jscomp.CommandLineRunner; logger.trace("Minifying file: " + fileName); baseName = (new java.io.File(fileName)).getName(); //Set up options options = new jscomp.CompilerOptions(); for (option in config.CompilerOptions) { // options are false by default and jslint wanted an if statement in this for loop if (config.CompilerOptions[option]) { options[option] = config.CompilerOptions[option]; } } options.prettyPrint = keepLines || options.prettyPrint; FLAG_compilation_level = jscomp.CompilationLevel[config.CompilationLevel || 'SIMPLE_OPTIMIZATIONS']; FLAG_compilation_level.setOptionsForCompilationLevel(options); if (config.generateSourceMaps) { mappings = new java.util.ArrayList(); mappings.add(new com.google.javascript.jscomp.SourceMap.LocationMapping(fileName, baseName + ".src.js")); options.setSourceMapLocationMappings(mappings); options.setSourceMapOutputPath(fileName + ".map"); } //Trigger the compiler Compiler.setLoggingLevel(Packages.java.util.logging.Level[config.loggingLevel || 'WARNING']); compiler = new Compiler(); //fill the sourceArrrayList; we need the ArrayList because the only overload of compile //accepting the getDefaultExterns return value (a List) also wants the sources as a List sourceListArray.add(jsSourceFile); result = compiler.compile(CommandLineRunner.getDefaultExterns(), sourceListArray, options); if (result.success) { optimized = String(compiler.toSource()); if (config.generateSourceMaps && result.sourceMap && outFileName) { outBaseName = (new java.io.File(outFileName)).getName(); srcOutFileName = outFileName + ".src.js"; outFileNameMap = outFileName + ".map"; //If previous .map file exists, move it to the ".src.js" //location. Need to update the sourceMappingURL part in the //src.js file too. if (file.exists(outFileNameMap)) { concatNameMap = outFileNameMap.replace(/\.map$/, '.src.js.map'); file.saveFile(concatNameMap, file.readFile(outFileNameMap)); file.saveFile(srcOutFileName, fileContents.replace(/\/\# sourceMappingURL=(.+).map/, '/# sourceMappingURL=$1.src.js.map')); } else { file.saveUtf8File(srcOutFileName, fileContents); } writer = getFileWriter(outFileNameMap, "utf-8"); result.sourceMap.appendTo(writer, outFileName); writer.close(); //Not sure how better to do this, but right now the .map file //leaks the full OS path in the "file" property. Manually //modify it to not do that. file.saveFile(outFileNameMap, file.readFile(outFileNameMap).replace(mapRegExp, '"file":"' + baseName + '"')); fileContents = optimized + "\n//# sourceMappingURL=" + outBaseName + ".map"; } else { fileContents = optimized; } return fileContents; } else { throw new Error('Cannot closure compile file: ' + fileName + '. Skipping it.'); } return fileContents; } }; return optimize; });
quantumlicht/collarbone
public/js/libs/rjs/build/jslib/rhino/optimize.js
JavaScript
mit
7,398
[ 30522, 1013, 1008, 1008, 1008, 1030, 6105, 9385, 1006, 1039, 1007, 2230, 30524, 2094, 6105, 1012, 1008, 2156, 1024, 8299, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 3781, 8569, 25074, 1013, 5478, 22578, 2005, 4751, 1008, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <a href="" onmouseover="facebook()">Facebook</a> <br> <a href="" onmouseover="google()">goggle</a> <br> <a href="" onmouseover="twitter()">twitter</a> <!--<div id="imgs"></div>--> <br> <img id="imgs" src="f.png"> <script type="text/javascript"> var imagen=document.getElementById("imgs"); function facebook(){ imagen.src="f.png"; } function google(){ imagen.src="g.jpg" } function twitter(){ imagen.src="t.jpg" } /* function facebook(){ imagen.innerHTML="<img src='f.png'>"; } function google(){ imagen.innerHTML="<img src='g.jpg'>" } function twitter(){ imagen.innerHTML="<img src='t.jpg'>" } */ </script> </body> </html>
david995/phpprojects
Ejercicios/javascript/img/onmousehover.html
HTML
mit
823
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 1026, 1013, 2516, 1028, 1026, 1013, 2132, 1028, 1026, 2303, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace StopCrop { public partial class SettingsForm : Form { public SettingsForm() { InitializeComponent(); } private void SettingsForm_Load(object sender, EventArgs e) { trayIcon.ShowBalloonTip(3000); Hide(); } private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { Show(); } private void menuExit_Click(object sender, EventArgs e) { Application.Exit(); } private void menuCropNow_Click(object sender, EventArgs e) { CaptureNow(); } private void CaptureNow() { (new OverlayWindow()).ShowDialog(); } private void trayIcon_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) CaptureNow(); } private void btnClose_Click(object sender, EventArgs e) { Hide(); } } }
somecallmechief/CaseTracker
projects/StopCrop/SettingsForm.cs
C#
unlicense
1,272
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 6922, 5302, 9247, 1025, 2478, 30524, 1012, 3645, 1012, 3596, 1025, 3415, 15327, 2644, 26775, 7361, 1063, 2270, 7704, 2465, 10906, 14192, 1024, 2433, 1063,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef _Discriminant_Pattern_Categories_h_ #define _Discriminant_Pattern_Categories_h_ /* Discriminant_Pattern_Categories.h * * Copyright (C) 2004-2011 David Weenink * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* djmw 20040422 Initial version djmw 20110307 Latest modification */ #ifndef _Discriminant_h_ #include "Discriminant.h" #endif #ifndef _Pattern_h_ #include "Pattern.h" #endif #ifndef _Categories_h_ #include "Categories.h" #endif Discriminant Pattern_and_Categories_to_Discriminant (Pattern me, Categories thee); Categories Discriminant_and_Pattern_to_Categories (Discriminant me, Pattern thee, int poolCovarianceMatrices,int useAprioriProbabilities); #endif /* _Discriminant_Pattern_Categories_h_ */
praaline/Praaline
libpraat/dwtools/Discriminant_Pattern_Categories.h
C
gpl-3.0
1,387
[ 30522, 1001, 2065, 13629, 2546, 1035, 5860, 20026, 3981, 3372, 1035, 5418, 1035, 7236, 1035, 1044, 1035, 1001, 9375, 1035, 5860, 20026, 3981, 3372, 1035, 5418, 1035, 7236, 1035, 1044, 1035, 1013, 1008, 5860, 20026, 3981, 3372, 1035, 5418, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // +----------------------------------------------------------------------+ // | PHP versions 4 and 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, | // | Stig. S. Bakken, Lukas Smith | // | All rights reserved. | // +----------------------------------------------------------------------+ // | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB | // | API as well as database abstraction for PHP applications. | // | This LICENSE is in the BSD license style. | // | | // | 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 Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, | // | Lukas Smith nor the names of his 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 | // | REGENTS 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. | // +----------------------------------------------------------------------+ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // // $Id: sqlite.php,v 1.8 2006/06/13 22:55:55 lsmith Exp $ // require_once 'MDB2/Driver/Function/Common.php'; /** * MDB2 SQLite driver for the function modules * * @package MDB2 * @category Database * @author Lukas Smith <smith@pooteeweet.org> */ class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common { // {{{ constructor /** * Constructor */ function __construct($db_index) { parent::__construct($db_index); // create all sorts of UDFs } // {{{ now() /** * Return string to call a variable with the current timestamp inside an SQL statement * There are three special variables for current date and time. * * @return string to call a variable with the current timestamp * @access public */ function now($type = 'timestamp') { switch ($type) { case 'time': return 'time(\'now\')'; case 'date': return 'date(\'now\')'; case 'timestamp': default: return 'datetime(\'now\')'; } } // }}} // {{{ substring() /** * return string to call a function to get a substring inside an SQL statement * * @return string to call a function to get a substring * @access public */ function substring($value, $position = 1, $length = null) { if (!is_null($length)) { return "substr($value,$position,$length)"; } return "substr($value,$position,length($value))"; } // }}} // {{{ random() /** * return string to call a function to get random value inside an SQL statement * * @return return string to generate float between 0 and 1 * @access public */ function random() { return '((RANDOM()+2147483648)/4294967296)'; } // }}} } ?>
danielmathiesen/hioa
wp-content/plugins/foliopress-wysiwyg/fckeditor/editor/plugins/kfm/includes/pear/MDB2/Driver/Function/sqlite.php
PHP
gpl-2.0
5,192
[ 30522, 1026, 1029, 25718, 1013, 1013, 1009, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>QUnit Test Suite</title> <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen"> <script type="text/javascript" src="qunit/qunit.js"></script> <!-- Your project file goes here --> <!-- script language="javascript" type="text/javascript" src="http://dev.rdbhost.com/js/easyxdm/easyXDM.debug.js"></script --> <script language="javascript" src="http://www.rdbhost.com/vendor/yepnope/1.5.4/yepnope.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <script type="text/javascript" src="js/jquery.rdbhost.js"></script> <script src="http://dev.rdbhost.com/vendor/angular/1.2/angular.js"></script> <script src="http://dev.rdbhost.com/vendor/angular/1.2/angular-route.js"></script> <script src="http://dev.rdbhost.com/vendor/angular/1.2/angular-resource.js"></script> <script type="text/javascript" src="../rdbhost-angular.js"></script> <script type="text/javascript" src="private.js"></script> <!-- Your tests file goes here --> <script type="text/javascript" src="myTests-angular.js"></script> </head> <body> <h1 id="qunit-header">QUnit Test Suite</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> </body> </html>
rdbhost/rdbhost-angular
test/test_runner_angular.html
HTML
mit
1,405
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 24209, 3490, 2102, 3231, 7621, 1026, 1013, 2516, 1028, 1026, 4957, 2128, 2140, 1027, 1000, 6782, 21030, 2102, 1000, 17850, 12879, 1027, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/bash QBIN=$(which qdyn5_r8) OK="(\033[0;32m OK \033[0m)" FAILED="(\033[0;31m FAILED \033[0m)" steps=( $(ls -1v *inp | sed 's/.inp//') ) for step in ${steps[@]} do echo "Running step ${step}" if ${QBIN} ${step}.inp > ${step}.log then echo -e "$OK" cp ${step}.re ${step}.re.rest else echo -e "$FAILED" echo "Check output (${step}.log) for more info." exit 1 fi done
mpurg/qtools
docs/tutorials/seminar_2017_03_08/data/2-fep/run_q_local.sh
Shell
mit
396
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 26171, 2378, 1027, 1002, 1006, 2029, 1053, 5149, 2078, 2629, 1035, 1054, 2620, 1007, 7929, 1027, 1000, 1006, 1032, 6021, 2509, 1031, 1014, 1025, 3590, 2213, 7929, 1032, 6021, 2509, 1031, 1014, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* // // BEGIN SONGBIRD GPL // // This file is part of the Songbird web player. // // Copyright(c) 2005-2008 POTI, Inc. // http://songbirdnest.com // // This file may be licensed under the terms of of the // GNU General Public License Version 2 (the "GPL"). // // Software distributed under the License is distributed // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either // express or implied. See the GPL for the specific language // governing rights and limitations. // // You should have received a copy of the GPL along with this // program. If not, go to http://www.gnu.org/licenses/gpl.html // or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // END SONGBIRD GPL // */ /** ******************************************************************************* SONGBIRD WIDGET STYLES Imports styles for all the Songbird XBL widgets. Songbird widgets, unlike Mozilla's, do not directly include their own styles. This allows easier overriding, as it is up to the feather to include the styles. We assume that most feathers will want the same layout, padding, and image rules for the Songbird widgets, and have therefore placed these styles in a common chrome://songbird-bindings/skin/ package. To override these rules, supply an alternate provider for this package (using your chrome.manifest), or selectively import the style sheets into your feathers. For more information, see: * http://developer.songbirdnest.com/ - The Songbird developer site * http://developer.mozilla.org/en/docs/Chrome_Registration - Chrome.manifest details ******************************************************************************* */ /** The global toolbar styles are not included by default **/ @import url(chrome://global/skin/toolbar.css); @import url(browsertoolbar.css); @import url(closableBox.css); @import url(device/deviceCapacity.css); @import url(device/deviceInfo.css); @import url(device/deviceProgress.css); @import url(device/deviceSync.css); @import url(device/deviceTools.css); @import url(displayPane.css); @import url(drawer.css); @import url(faceplate.css); @import url(filterlist.css); @import url(miniplayer.css); @import url(observesDataRemote.css); @import url(playerControls.css); @import url(playlist.css); @import url(playlistCommands.css); @import url(search.css); @import url(servicepane.css); @import url(smartsplitter.css); @import url(statusbar.css); @import url(syscontrols.css); @import url(tabbrowser.css); @import url(ratingsControl.css); @import url(equalizer.css); @import url(cdripMediaView.css);
freaktechnik/nightingale-hacking
app/skin/bindings/bindings.css
CSS
gpl-2.0
2,637
[ 30522, 1013, 1008, 1013, 1013, 1013, 1013, 4088, 2299, 9001, 14246, 2140, 1013, 1013, 1013, 1013, 2023, 5371, 2003, 2112, 1997, 1996, 2299, 9001, 4773, 2447, 1012, 1013, 1013, 1013, 1013, 9385, 1006, 1039, 1007, 2384, 1011, 2263, 8962, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
define(["require", "exports", "./base", "./layer", "./util", "./view"], function (require, exports, base_1, layer_1, util_1, view_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.COL_LABELS = base_1.COL_LABELS; class Board extends view_1.View { constructor(parent, position, layers) { super(); this.position = position; this.layers = []; if (typeof (parent) == 'string') { parent = util_1.getElement(parent); } this.elem = parent; this.backgroundColor = '#db6'; let canvas = document.createElement('canvas'); this.ctx = canvas.getContext('2d'); parent.appendChild(canvas); window.addEventListener('resize', () => { this.resizeCanvas(); this.draw(); }); this.resizeCanvas(); this.addLayer(new layer_1.Grid()); this.addLayers(layers); } resizeCanvas() { let pr = util_1.pixelRatio(); let canvas = this.ctx.canvas; let parent = canvas.parentElement; canvas.width = pr * (parent.offsetWidth); canvas.height = pr * (parent.offsetHeight); canvas.style.width = `${parent.offsetWidth}px`; canvas.style.height = `${parent.offsetHeight}px`; this.pointW = this.ctx.canvas.width / (base_1.N + 1); this.pointH = this.ctx.canvas.height / (base_1.N + 1); this.stoneRadius = 0.96 * Math.min(this.pointW, this.pointH) / 2; } newGame(rootPosition) { this.position = rootPosition; for (let layer of this.layers) { layer.clear(); } this.draw(); } addLayer(layer) { this.layers.push(layer); layer.addToBoard(this); } addLayers(layers) { for (let layer of layers) { this.addLayer(layer); } } setPosition(position) { if (this.position == position) { return; } this.position = position; let allProps = new Set(Object.keys(position)); for (let layer of this.layers) { layer.update(allProps); } this.draw(); } update(update) { let anythingChanged = false; let keys = new Set(Object.keys(update)); for (let layer of this.layers) { if (layer.update(keys)) { anythingChanged = true; } } if (anythingChanged) { this.draw(); } } drawImpl() { let ctx = this.ctx; ctx.fillStyle = this.backgroundColor; ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); for (let layer of this.layers) { if (layer.show) { layer.draw(); } } } getStone(p) { return this.position.stones[p.row * base_1.N + p.col]; } canvasToBoard(x, y, threshold) { let pr = util_1.pixelRatio(); x *= pr; y *= pr; let canvas = this.ctx.canvas; y = y * (base_1.N + 1) / canvas.height - 0.5; x = x * (base_1.N + 1) / canvas.width - 0.5; let row = Math.floor(y); let col = Math.floor(x); if (row < 0 || row >= base_1.N || col < 0 || col >= base_1.N) { return null; } if (threshold) { let fx = 0.5 - (x - col); let fy = 0.5 - (y - row); let disSqr = fx * fx + fy * fy; if (disSqr > threshold * threshold) { return null; } } return { row: row, col: col }; } boardToCanvas(row, col) { let canvas = this.ctx.canvas; return { x: canvas.width * (col + 1.0) / (base_1.N + 1), y: canvas.height * (row + 1.0) / (base_1.N + 1) }; } drawStones(ps, color, alpha) { if (ps.length == 0) { return; } let ctx = this.ctx; let pr = util_1.pixelRatio(); if (alpha == 1) { ctx.shadowBlur = 4 * pr; ctx.shadowOffsetX = 1.5 * pr; ctx.shadowOffsetY = 1.5 * pr; ctx.shadowColor = `rgba(0, 0, 0, ${color == base_1.Color.Black ? 0.4 : 0.3})`; } ctx.fillStyle = this.stoneFill(color, alpha); let r = this.stoneRadius; for (let p of ps) { let c = this.boardToCanvas(p.row, p.col); ctx.beginPath(); ctx.translate(c.x + 0.5, c.y + 0.5); ctx.arc(0, 0, r, 0, 2 * Math.PI); ctx.fill(); ctx.setTransform(1, 0, 0, 1, 0, 0); } if (alpha == 1) { ctx.shadowColor = 'rgba(0, 0, 0, 0)'; } } stoneFill(color, alpha) { let grad; if (color == base_1.Color.Black) { let ofs = -0.5 * this.stoneRadius; grad = this.ctx.createRadialGradient(ofs, ofs, 0, ofs, ofs, 2 * this.stoneRadius); grad.addColorStop(0, `rgba(68, 68, 68, ${alpha})`); grad.addColorStop(1, `rgba(16, 16, 16, ${alpha})`); } else if (color == base_1.Color.White) { let ofs = -0.2 * this.stoneRadius; grad = this.ctx.createRadialGradient(ofs, ofs, 0, ofs, ofs, 1.2 * this.stoneRadius); grad.addColorStop(0.4, `rgba(255, 255, 255, ${alpha})`); grad.addColorStop(1, `rgba(204, 204, 204, ${alpha})`); } else { throw new Error(`Invalid color ${color}`); } return grad; } } exports.Board = Board; class ClickableBoard extends Board { constructor(parent, position, layerDescs) { super(parent, position, layerDescs); this.enabled = false; this.listeners = []; this.ctx.canvas.addEventListener('mousemove', (e) => { let p = this.canvasToBoard(e.offsetX, e.offsetY, 0.45); if (p != null && this.getStone(p) != base_1.Color.Empty) { p = null; } let changed; if (p != null) { changed = this.p == null || this.p.row != p.row || this.p.col != p.col; } else { changed = this.p != null; } if (changed) { this.p = p; this.draw(); } }); this.ctx.canvas.addEventListener('mouseleave', (e) => { if (this.p != null) { this.p = null; this.draw(); } }); this.ctx.canvas.addEventListener('click', (e) => { if (!this.p || !this.enabled) { return; } for (let listener of this.listeners) { listener(this.p); } this.p = null; this.draw(); }); } onClick(cb) { this.listeners.push(cb); } setPosition(position) { if (position != this.position) { this.p = null; super.setPosition(position); } } drawImpl() { super.drawImpl(); let p = this.enabled ? this.p : null; this.ctx.canvas.style.cursor = p ? 'pointer' : ''; if (p) { this.drawStones([p], this.position.toPlay, 0.6); } } } exports.ClickableBoard = ClickableBoard; }); //# sourceMappingURL=board.js.map
tensorflow/minigo
minigui/static/board.js
JavaScript
apache-2.0
8,219
[ 30522, 9375, 1006, 1031, 1000, 5478, 1000, 1010, 1000, 14338, 1000, 1010, 1000, 1012, 1013, 2918, 1000, 1010, 1000, 1012, 1013, 6741, 1000, 1010, 1000, 1012, 1013, 21183, 4014, 1000, 1010, 1000, 1012, 1013, 3193, 1000, 1033, 1010, 3853, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
scratchlivedb ------------- scratchlivedb is a python module for reading and writing Scratch Live database and crate files. Simple example to print the filename of every track in the DB: import scratchlivedb db = scratchlivedb.ScratchDatabase("/path/to/my/database V2") for entry in db.entries: print entry.filebase scratchlivedb-tool ------------------ scratchlivedb-tool is a simple tool for performing some actions on a Scratch Live database file. Currently all it provides is a 'dump' subcommand for printing details about the database. Todo ---- * Crate support is limited. The format is basically: first entry: sort column : name=osrt, brev=1 (this is prob ascending/descending), tcvn="song" (name of the sort column) next entries: the visible columns : name=ovct, tvcn=column name, tcvw=some number, possibly width of column rest of entries: name=otrk, ptrk=filename ScratchCrate and ScratchDatabase should be changed to not expose the raw entries list, probably name that to songs. ScratchCrate would then have a sortcolumn member and a columns member. makenew() call would need to handle filetrack vs. filebase difference depending on crate vs. db. API should be tweaked to not make it all so awkward. * Only tested on a linux machine * Extend scratchlivedb-tool 'dump' with more output options
crobinso/scratchlivedb
README.md
Markdown
gpl-2.0
1,371
[ 30522, 11969, 3669, 7178, 2497, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 11969, 3669, 7178, 2497, 2003, 1037, 18750, 11336, 2005, 3752, 1998, 3015, 11969, 2444, 7809, 1998, 27297, 6764, 1012, 3722, 2742,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * @package Joomla * @copyright Copyright (C) Open Source Matters. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * @component Phoca Gallery * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ defined('_JEXEC') or die; $task = 'phocagallerycoimg'; JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); $r = new PhocaGalleryRenderAdminView(); $app = JFactory::getApplication(); $option = $app->input->get('option'); $OPT = strtoupper($option); ?> <script type="text/javascript"> Joomla.submitbutton = function(task) { if (task == '<?php echo $task ?>.cancel' || document.formvalidator.isValid(document.id('adminForm'))) { <?php echo $this->form->getField('comment')->save(); ?> Joomla.submitform(task, document.getElementById('adminForm')); } else { alert('<?php echo JText::_('JGLOBAL_VALIDATION_FORM_FAILED', true);?>'); } } </script><?php echo $r->startForm($option, $task, $this->item->id, 'adminForm', 'adminForm'); // First Column echo '<div class="span10 form-horizontal">'; $tabs = array ( 'general' => JText::_($OPT.'_GENERAL_OPTIONS'), 'publishing' => JText::_($OPT.'_PUBLISHING_OPTIONS')); echo $r->navigation($tabs); echo '<div class="tab-content">'. "\n"; echo '<div class="tab-pane active" id="general">'."\n"; $formArray = array ('title', 'usertitle', 'cattitle', 'imagetitle', 'ordering'); echo $r->group($this->form, $formArray); $formArray = array('comment'); echo $r->group($this->form, $formArray, 1); echo '</div>'. "\n"; echo '<div class="tab-pane" id="publishing">'."\n"; foreach($this->form->getFieldset('publish') as $field) { echo '<div class="control-group">'; if (!$field->hidden) { echo '<div class="control-label">'.$field->label.'</div>'; } echo '<div class="controls">'; echo $field->input; echo '</div></div>'; } echo '</div>'; // Second Column echo '<div class="span2"></div>';//end span2 echo $r->formInputs(); echo $r->endForm(); ?>
xbegault/clrh-idf
tmp/install_56542e012168b/views/phocagallerycoimg/tmpl/edit.php
PHP
gpl-2.0
2,124
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1030, 7427, 28576, 19968, 2050, 1008, 1030, 9385, 9385, 1006, 1039, 1007, 2330, 3120, 5609, 1012, 2035, 2916, 9235, 1012, 1008, 1030, 6105, 8299, 1024, 1013, 1013, 7479, 1012, 27004, 1012, 8917, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* UnaryOperator Copyright (C) 1998-2002 Jochen Hoenicke. * * This program 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, 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 Lesser General Public License * along with this program; see the file COPYING.LESSER. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: UnaryOperator.java,v 2.13.4.2 2002/05/28 17:34:06 hoenicke Exp $ */ package alterrs.jode.expr; import alterrs.jode.decompiler.Options; import alterrs.jode.decompiler.TabbedPrintWriter; import alterrs.jode.type.Type; public class UnaryOperator extends Operator { public UnaryOperator(Type type, int op) { super(type, op); initOperands(1); } public int getPriority() { return 700; } public Expression negate() { if (getOperatorIndex() == LOG_NOT_OP) { if (subExpressions != null) return subExpressions[0]; else return new NopOperator(Type.tBoolean); } return super.negate(); } public void updateSubTypes() { subExpressions[0].setType(Type.tSubType(type)); } public void updateType() { updateParentType(Type.tSuperType(subExpressions[0].getType())); } public boolean opEquals(Operator o) { return (o instanceof UnaryOperator) && o.operatorIndex == operatorIndex; } public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { writer.print(getOperatorString()); if ((Options.outputStyle & Options.GNU_SPACING) != 0) writer.print(" "); subExpressions[0].dumpExpression(writer, 700); } }
AlterRS/Deobfuscator
deps/alterrs/jode/expr/UnaryOperator.java
Java
mit
1,963
[ 30522, 1013, 1008, 14477, 2854, 25918, 8844, 9385, 1006, 1039, 1007, 2687, 1011, 2526, 8183, 8661, 7570, 18595, 19869, 1012, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Code generated by protoc-gen-go. // source: update.proto // DO NOT EDIT! package fgupdate import proto "code.google.com/p/goprotobuf/proto" import json "encoding/json" import math "math" // Reference proto, json, and math imports to suppress error if they are not otherwise used. var _ = proto.Marshal var _ = &json.SyntaxError{} var _ = math.Inf type UPDATE_MESSAGEID int32 const ( UPDATE_MESSAGEID_C2U_QUERY_UPDATE UPDATE_MESSAGEID = 0 UPDATE_MESSAGEID_U2C_REP_UPDATE UPDATE_MESSAGEID = 1 UPDATE_MESSAGEID_U2P_QUERY_VER_ISSUE_LIST UPDATE_MESSAGEID = 2 UPDATE_MESSAGEID_P2U_RSP_VER_ISSUE_LIST UPDATE_MESSAGEID = 3 UPDATE_MESSAGEID_P2U_REQ_DISABLE_VER_ISSUE UPDATE_MESSAGEID = 4 UPDATE_MESSAGEID_U2P_RSP_DISABLE_VER_ISSUE UPDATE_MESSAGEID = 5 UPDATE_MESSAGEID_P2U_REQ_DUMP_ALL_VER_ISSUE UPDATE_MESSAGEID = 6 UPDATE_MESSAGEID_U2P_RSP_DUMP_ALL_VER_ISSUE UPDATE_MESSAGEID = 7 ) var UPDATE_MESSAGEID_name = map[int32]string{ 0: "C2U_QUERY_UPDATE", 1: "U2C_REP_UPDATE", 2: "U2P_QUERY_VER_ISSUE_LIST", 3: "P2U_RSP_VER_ISSUE_LIST", 4: "P2U_REQ_DISABLE_VER_ISSUE", 5: "U2P_RSP_DISABLE_VER_ISSUE", 6: "P2U_REQ_DUMP_ALL_VER_ISSUE", 7: "U2P_RSP_DUMP_ALL_VER_ISSUE", } var UPDATE_MESSAGEID_value = map[string]int32{ "C2U_QUERY_UPDATE": 0, "U2C_REP_UPDATE": 1, "U2P_QUERY_VER_ISSUE_LIST": 2, "P2U_RSP_VER_ISSUE_LIST": 3, "P2U_REQ_DISABLE_VER_ISSUE": 4, "U2P_RSP_DISABLE_VER_ISSUE": 5, "P2U_REQ_DUMP_ALL_VER_ISSUE": 6, "U2P_RSP_DUMP_ALL_VER_ISSUE": 7, } func (x UPDATE_MESSAGEID) Enum() *UPDATE_MESSAGEID { p := new(UPDATE_MESSAGEID) *p = x return p } func (x UPDATE_MESSAGEID) String() string { return proto.EnumName(UPDATE_MESSAGEID_name, int32(x)) } func (x UPDATE_MESSAGEID) MarshalJSON() ([]byte, error) { return json.Marshal(x.String()) } func (x *UPDATE_MESSAGEID) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(UPDATE_MESSAGEID_value, data, "UPDATE_MESSAGEID") if err != nil { return err } *x = UPDATE_MESSAGEID(value) return nil } type UpdateType int32 const ( UpdateType_FORCE UpdateType = 0 UpdateType_OPTIONAL UpdateType = 1 UpdateType_KEEP UpdateType = 2 UpdateType_TIPS UpdateType = 3 ) var UpdateType_name = map[int32]string{ 0: "FORCE", 1: "OPTIONAL", 2: "KEEP", 3: "TIPS", } var UpdateType_value = map[string]int32{ "FORCE": 0, "OPTIONAL": 1, "KEEP": 2, "TIPS": 3, } func (x UpdateType) Enum() *UpdateType { p := new(UpdateType) *p = x return p } func (x UpdateType) String() string { return proto.EnumName(UpdateType_name, int32(x)) } func (x UpdateType) MarshalJSON() ([]byte, error) { return json.Marshal(x.String()) } func (x *UpdateType) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(UpdateType_value, data, "UpdateType") if err != nil { return err } *x = UpdateType(value) return nil } type AppInfoType int32 const ( AppInfo_DIFFER AppInfoType = 0 AppInfo_FULL AppInfoType = 1 ) var AppInfoType_name = map[int32]string{ 0: "DIFFER", 1: "FULL", } var AppInfoType_value = map[string]int32{ "DIFFER": 0, "FULL": 1, } func (x AppInfoType) Enum() *AppInfoType { p := new(AppInfoType) *p = x return p } func (x AppInfoType) String() string { return proto.EnumName(AppInfoType_name, int32(x)) } func (x AppInfoType) MarshalJSON() ([]byte, error) { return json.Marshal(x.String()) } func (x *AppInfoType) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(AppInfoType_value, data, "AppInfoType") if err != nil { return err } *x = AppInfoType(value) return nil } type QueryUpdate struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` DevType *string `protobuf:"bytes,3,req,name=dev_type" json:"dev_type,omitempty"` Mac *string `protobuf:"bytes,4,req,name=mac" json:"mac,omitempty"` GameId *string `protobuf:"bytes,5,req,name=game_id" json:"game_id,omitempty"` AppOsType *string `protobuf:"bytes,6,req,name=app_os_type" json:"app_os_type,omitempty"` AppOsVer *string `protobuf:"bytes,7,req,name=app_os_ver" json:"app_os_ver,omitempty"` AppResolution *string `protobuf:"bytes,8,req,name=app_resolution" json:"app_resolution,omitempty"` AppVer *string `protobuf:"bytes,9,req,name=app_ver" json:"app_ver,omitempty"` ResourceVer *string `protobuf:"bytes,10,req,name=resource_ver" json:"resource_ver,omitempty"` DistributorId *string `protobuf:"bytes,11,req,name=distributor_id" json:"distributor_id,omitempty"` IsDiffUpdate *bool `protobuf:"varint,12,req,name=is_diff_update" json:"is_diff_update,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *QueryUpdate) Reset() { *this = QueryUpdate{} } func (this *QueryUpdate) String() string { return proto.CompactTextString(this) } func (*QueryUpdate) ProtoMessage() {} func (this *QueryUpdate) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *QueryUpdate) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } func (this *QueryUpdate) GetDevType() string { if this != nil && this.DevType != nil { return *this.DevType } return "" } func (this *QueryUpdate) GetMac() string { if this != nil && this.Mac != nil { return *this.Mac } return "" } func (this *QueryUpdate) GetGameId() string { if this != nil && this.GameId != nil { return *this.GameId } return "" } func (this *QueryUpdate) GetAppOsType() string { if this != nil && this.AppOsType != nil { return *this.AppOsType } return "" } func (this *QueryUpdate) GetAppOsVer() string { if this != nil && this.AppOsVer != nil { return *this.AppOsVer } return "" } func (this *QueryUpdate) GetAppResolution() string { if this != nil && this.AppResolution != nil { return *this.AppResolution } return "" } func (this *QueryUpdate) GetAppVer() string { if this != nil && this.AppVer != nil { return *this.AppVer } return "" } func (this *QueryUpdate) GetResourceVer() string { if this != nil && this.ResourceVer != nil { return *this.ResourceVer } return "" } func (this *QueryUpdate) GetDistributorId() string { if this != nil && this.DistributorId != nil { return *this.DistributorId } return "" } func (this *QueryUpdate) GetIsDiffUpdate() bool { if this != nil && this.IsDiffUpdate != nil { return *this.IsDiffUpdate } return false } type AppInfo struct { XXX_unrecognized []byte `json:"-"` } func (this *AppInfo) Reset() { *this = AppInfo{} } func (this *AppInfo) String() string { return proto.CompactTextString(this) } func (*AppInfo) ProtoMessage() {} type ResponseUpdate struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` AppUpdateType *UpdateType `protobuf:"varint,2,req,name=app_update_type,enum=updatedmo.UpdateType" json:"app_update_type,omitempty"` ResourceUpdateType *UpdateType `protobuf:"varint,3,req,name=resource_update_type,enum=updatedmo.UpdateType" json:"resource_update_type,omitempty"` UpdateAppVersion *string `protobuf:"bytes,4,opt,name=update_app_version" json:"update_app_version,omitempty"` UpdateResourceVersion *string `protobuf:"bytes,5,opt,name=update_resource_version" json:"update_resource_version,omitempty"` AppSize *uint32 `protobuf:"varint,6,opt,name=app_size" json:"app_size,omitempty"` AppUrl []string `protobuf:"bytes,7,rep,name=app_url" json:"app_url,omitempty"` AppType *AppInfoType `protobuf:"varint,8,opt,name=app_type,enum=updatedmo.AppInfoType" json:"app_type,omitempty"` ResourceSize *uint64 `protobuf:"varint,9,opt,name=resource_size" json:"resource_size,omitempty"` ResourceUrl []string `protobuf:"bytes,10,rep,name=resource_url" json:"resource_url,omitempty"` TipsText *string `protobuf:"bytes,11,opt,name=tips_text" json:"tips_text,omitempty"` TipsUrl *string `protobuf:"bytes,12,opt,name=tips_url" json:"tips_url,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *ResponseUpdate) Reset() { *this = ResponseUpdate{} } func (this *ResponseUpdate) String() string { return proto.CompactTextString(this) } func (*ResponseUpdate) ProtoMessage() {} func (this *ResponseUpdate) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *ResponseUpdate) GetAppUpdateType() UpdateType { if this != nil && this.AppUpdateType != nil { return *this.AppUpdateType } return 0 } func (this *ResponseUpdate) GetResourceUpdateType() UpdateType { if this != nil && this.ResourceUpdateType != nil { return *this.ResourceUpdateType } return 0 } func (this *ResponseUpdate) GetUpdateAppVersion() string { if this != nil && this.UpdateAppVersion != nil { return *this.UpdateAppVersion } return "" } func (this *ResponseUpdate) GetUpdateResourceVersion() string { if this != nil && this.UpdateResourceVersion != nil { return *this.UpdateResourceVersion } return "" } func (this *ResponseUpdate) GetAppSize() uint32 { if this != nil && this.AppSize != nil { return *this.AppSize } return 0 } func (this *ResponseUpdate) GetAppUrl() []string { if this != nil { return this.AppUrl } return nil } func (this *ResponseUpdate) GetAppType() AppInfoType { if this != nil && this.AppType != nil { return *this.AppType } return 0 } func (this *ResponseUpdate) GetResourceSize() uint64 { if this != nil && this.ResourceSize != nil { return *this.ResourceSize } return 0 } func (this *ResponseUpdate) GetResourceUrl() []string { if this != nil { return this.ResourceUrl } return nil } func (this *ResponseUpdate) GetTipsText() string { if this != nil && this.TipsText != nil { return *this.TipsText } return "" } func (this *ResponseUpdate) GetTipsUrl() string { if this != nil && this.TipsUrl != nil { return *this.TipsUrl } return "" } type QueryVersionIssueList struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` GameId *string `protobuf:"bytes,3,req,name=game_id" json:"game_id,omitempty"` DistributorId *string `protobuf:"bytes,4,req,name=distributor_id" json:"distributor_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *QueryVersionIssueList) Reset() { *this = QueryVersionIssueList{} } func (this *QueryVersionIssueList) String() string { return proto.CompactTextString(this) } func (*QueryVersionIssueList) ProtoMessage() {} func (this *QueryVersionIssueList) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *QueryVersionIssueList) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } func (this *QueryVersionIssueList) GetGameId() string { if this != nil && this.GameId != nil { return *this.GameId } return "" } func (this *QueryVersionIssueList) GetDistributorId() string { if this != nil && this.DistributorId != nil { return *this.DistributorId } return "" } type RsqDumpAllIssueInfo struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *RsqDumpAllIssueInfo) Reset() { *this = RsqDumpAllIssueInfo{} } func (this *RsqDumpAllIssueInfo) String() string { return proto.CompactTextString(this) } func (*RsqDumpAllIssueInfo) ProtoMessage() {} func (this *RsqDumpAllIssueInfo) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *RsqDumpAllIssueInfo) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } type RspDumpAllIssueInfo struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` VerIssueFileInfo *string `protobuf:"bytes,2,req,name=ver_issue_file_info" json:"ver_issue_file_info,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *RspDumpAllIssueInfo) Reset() { *this = RspDumpAllIssueInfo{} } func (this *RspDumpAllIssueInfo) String() string { return proto.CompactTextString(this) } func (*RspDumpAllIssueInfo) ProtoMessage() {} func (this *RspDumpAllIssueInfo) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *RspDumpAllIssueInfo) GetVerIssueFileInfo() string { if this != nil && this.VerIssueFileInfo != nil { return *this.VerIssueFileInfo } return "" } type ResponseVersionIssueList struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` GameId *string `protobuf:"bytes,3,req,name=game_id" json:"game_id,omitempty"` DistributorId *string `protobuf:"bytes,4,req,name=distributor_id" json:"distributor_id,omitempty"` VerInfoList []*RspEnableVerInfo `protobuf:"bytes,5,rep,name=ver_info_list" json:"ver_info_list,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *ResponseVersionIssueList) Reset() { *this = ResponseVersionIssueList{} } func (this *ResponseVersionIssueList) String() string { return proto.CompactTextString(this) } func (*ResponseVersionIssueList) ProtoMessage() {} func (this *ResponseVersionIssueList) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *ResponseVersionIssueList) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } func (this *ResponseVersionIssueList) GetGameId() string { if this != nil && this.GameId != nil { return *this.GameId } return "" } func (this *ResponseVersionIssueList) GetDistributorId() string { if this != nil && this.DistributorId != nil { return *this.DistributorId } return "" } func (this *ResponseVersionIssueList) GetVerInfoList() []*RspEnableVerInfo { if this != nil { return this.VerInfoList } return nil } type ReqDisableVerIssue struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` VerInfoIssueId *int32 `protobuf:"varint,3,req,name=ver_info_issue_id" json:"ver_info_issue_id,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *ReqDisableVerIssue) Reset() { *this = ReqDisableVerIssue{} } func (this *ReqDisableVerIssue) String() string { return proto.CompactTextString(this) } func (*ReqDisableVerIssue) ProtoMessage() {} func (this *ReqDisableVerIssue) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *ReqDisableVerIssue) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } func (this *ReqDisableVerIssue) GetVerInfoIssueId() int32 { if this != nil && this.VerInfoIssueId != nil { return *this.VerInfoIssueId } return 0 } type RspDisableVerIssue struct { MsgId *int32 `protobuf:"varint,1,req,name=msg_id" json:"msg_id,omitempty"` ProtoVer *int32 `protobuf:"varint,2,req,name=proto_ver" json:"proto_ver,omitempty"` VerInfoIssueId *int32 `protobuf:"varint,3,req,name=ver_info_issue_id" json:"ver_info_issue_id,omitempty"` IsSucc *bool `protobuf:"varint,4,req,name=is_succ" json:"is_succ,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *RspDisableVerIssue) Reset() { *this = RspDisableVerIssue{} } func (this *RspDisableVerIssue) String() string { return proto.CompactTextString(this) } func (*RspDisableVerIssue) ProtoMessage() {} func (this *RspDisableVerIssue) GetMsgId() int32 { if this != nil && this.MsgId != nil { return *this.MsgId } return 0 } func (this *RspDisableVerIssue) GetProtoVer() int32 { if this != nil && this.ProtoVer != nil { return *this.ProtoVer } return 0 } func (this *RspDisableVerIssue) GetVerInfoIssueId() int32 { if this != nil && this.VerInfoIssueId != nil { return *this.VerInfoIssueId } return 0 } func (this *RspDisableVerIssue) GetIsSucc() bool { if this != nil && this.IsSucc != nil { return *this.IsSucc } return false } type RspEnableVerInfo struct { DevInfoIssueId *int32 `protobuf:"varint,1,req,name=dev_info_issue_id" json:"dev_info_issue_id,omitempty"` Priority *int32 `protobuf:"varint,2,req,name=priority" json:"priority,omitempty"` DevType *string `protobuf:"bytes,3,req,name=dev_type" json:"dev_type,omitempty"` AppOs *string `protobuf:"bytes,4,req,name=app_os" json:"app_os,omitempty"` AppOsVer *string `protobuf:"bytes,5,req,name=app_os_ver" json:"app_os_ver,omitempty"` AppResolution *string `protobuf:"bytes,6,req,name=app_resolution" json:"app_resolution,omitempty"` AppUpdateType *UpdateType `protobuf:"varint,7,req,name=app_update_type,enum=updatedmo.UpdateType" json:"app_update_type,omitempty"` AppVerBeforeUpdate *string `protobuf:"bytes,8,req,name=app_ver_before_update" json:"app_ver_before_update,omitempty"` AppVerAfterUpdate *string `protobuf:"bytes,9,opt,name=app_ver_after_update" json:"app_ver_after_update,omitempty"` AppUrlList []string `protobuf:"bytes,10,rep,name=app_url_list" json:"app_url_list,omitempty"` AppIsDiffUpdate *bool `protobuf:"varint,11,req,name=app_is_diff_update" json:"app_is_diff_update,omitempty"` ResourceUpdateType *UpdateType `protobuf:"varint,12,req,name=resource_update_type,enum=updatedmo.UpdateType" json:"resource_update_type,omitempty"` ResourceVerBeforeUpdate *string `protobuf:"bytes,13,opt,name=resource_ver_before_update" json:"resource_ver_before_update,omitempty"` ResourceVerAfterUpdate *string `protobuf:"bytes,14,opt,name=resource_ver_after_update" json:"resource_ver_after_update,omitempty"` ResourceUrlList []string `protobuf:"bytes,15,rep,name=resource_url_list" json:"resource_url_list,omitempty"` ResourceIsDiffUpdat *bool `protobuf:"varint,16,opt,name=resource_is_diff_updat" json:"resource_is_diff_updat,omitempty"` ValidTime *string `protobuf:"bytes,17,req,name=valid_time" json:"valid_time,omitempty"` TipsText *string `protobuf:"bytes,18,opt,name=tips_text" json:"tips_text,omitempty"` TipsUrl *string `protobuf:"bytes,19,opt,name=tips_url" json:"tips_url,omitempty"` XXX_unrecognized []byte `json:"-"` } func (this *RspEnableVerInfo) Reset() { *this = RspEnableVerInfo{} } func (this *RspEnableVerInfo) String() string { return proto.CompactTextString(this) } func (*RspEnableVerInfo) ProtoMessage() {} func (this *RspEnableVerInfo) GetDevInfoIssueId() int32 { if this != nil && this.DevInfoIssueId != nil { return *this.DevInfoIssueId } return 0 } func (this *RspEnableVerInfo) GetPriority() int32 { if this != nil && this.Priority != nil { return *this.Priority } return 0 } func (this *RspEnableVerInfo) GetDevType() string { if this != nil && this.DevType != nil { return *this.DevType } return "" } func (this *RspEnableVerInfo) GetAppOs() string { if this != nil && this.AppOs != nil { return *this.AppOs } return "" } func (this *RspEnableVerInfo) GetAppOsVer() string { if this != nil && this.AppOsVer != nil { return *this.AppOsVer } return "" } func (this *RspEnableVerInfo) GetAppResolution() string { if this != nil && this.AppResolution != nil { return *this.AppResolution } return "" } func (this *RspEnableVerInfo) GetAppUpdateType() UpdateType { if this != nil && this.AppUpdateType != nil { return *this.AppUpdateType } return 0 } func (this *RspEnableVerInfo) GetAppVerBeforeUpdate() string { if this != nil && this.AppVerBeforeUpdate != nil { return *this.AppVerBeforeUpdate } return "" } func (this *RspEnableVerInfo) GetAppVerAfterUpdate() string { if this != nil && this.AppVerAfterUpdate != nil { return *this.AppVerAfterUpdate } return "" } func (this *RspEnableVerInfo) GetAppUrlList() []string { if this != nil { return this.AppUrlList } return nil } func (this *RspEnableVerInfo) GetAppIsDiffUpdate() bool { if this != nil && this.AppIsDiffUpdate != nil { return *this.AppIsDiffUpdate } return false } func (this *RspEnableVerInfo) GetResourceUpdateType() UpdateType { if this != nil && this.ResourceUpdateType != nil { return *this.ResourceUpdateType } return 0 } func (this *RspEnableVerInfo) GetResourceVerBeforeUpdate() string { if this != nil && this.ResourceVerBeforeUpdate != nil { return *this.ResourceVerBeforeUpdate } return "" } func (this *RspEnableVerInfo) GetResourceVerAfterUpdate() string { if this != nil && this.ResourceVerAfterUpdate != nil { return *this.ResourceVerAfterUpdate } return "" } func (this *RspEnableVerInfo) GetResourceUrlList() []string { if this != nil { return this.ResourceUrlList } return nil } func (this *RspEnableVerInfo) GetResourceIsDiffUpdat() bool { if this != nil && this.ResourceIsDiffUpdat != nil { return *this.ResourceIsDiffUpdat } return false } func (this *RspEnableVerInfo) GetValidTime() string { if this != nil && this.ValidTime != nil { return *this.ValidTime } return "" } func (this *RspEnableVerInfo) GetTipsText() string { if this != nil && this.TipsText != nil { return *this.TipsText } return "" } func (this *RspEnableVerInfo) GetTipsUrl() string { if this != nil && this.TipsUrl != nil { return *this.TipsUrl } return "" } func init() { proto.RegisterEnum("updatedmo.UPDATE_MESSAGEID", UPDATE_MESSAGEID_name, UPDATE_MESSAGEID_value) proto.RegisterEnum("updatedmo.UpdateType", UpdateType_name, UpdateType_value) proto.RegisterEnum("updatedmo.AppInfoType", AppInfoType_name, AppInfoType_value) }
heartszhang/fgupdate
update.pb.go
GO
apache-2.0
22,456
[ 30522, 1013, 1013, 3642, 7013, 2011, 15053, 2278, 1011, 8991, 1011, 2175, 1012, 1013, 1013, 3120, 1024, 10651, 1012, 15053, 1013, 1013, 2079, 2025, 10086, 999, 7427, 1042, 12193, 17299, 3686, 12324, 15053, 1000, 3642, 1012, 8224, 1012, 4012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'collection_sorter/sorter' require 'collection_sorter/railtie' module CollectionSorter end
rbudiharso/collection_sorter
lib/collection_sorter.rb
Ruby
mit
100
[ 30522, 5478, 1005, 3074, 1035, 4066, 2121, 1013, 4066, 2121, 1005, 5478, 1005, 3074, 1035, 4066, 2121, 1013, 4334, 9515, 1005, 11336, 6407, 11589, 2121, 2203, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* KIARA - Middleware for efficient and QoS/Security-aware invocation of services and exchange of messages * * Copyright (C) 2014 German Research Center for Artificial Intelligence (DFKI) * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package de.dfki.kiara.tcp; import de.dfki.kiara.InvalidAddressException; import de.dfki.kiara.Transport; import de.dfki.kiara.TransportAddress; import java.net.InetAddress; import java.net.URI; import java.net.UnknownHostException; /** * * @author Dmitri Rubinstein <dmitri.rubinstein@dfki.de> */ public class TcpBlockAddress implements TransportAddress { private final TcpBlockTransport transport; private final String hostName; private final int port; private final InetAddress address; public TcpBlockAddress(TcpBlockTransport transport, URI uri) throws InvalidAddressException, UnknownHostException { if (transport == null) { throw new NullPointerException("transport"); } if (uri == null) { throw new NullPointerException("uri"); } if (!"tcp".equals(uri.getScheme()) && !"tcps".equals(uri.getScheme())) { throw new InvalidAddressException("only tcp and tcps scheme is allowed"); } this.transport = transport; this.hostName = uri.getHost(); this.port = uri.getPort(); this.address = InetAddress.getByName(this.hostName); } public TcpBlockAddress(TcpBlockTransport transport, String hostName, int port) throws UnknownHostException { if (transport == null) { throw new NullPointerException("transport"); } if (hostName == null) { throw new NullPointerException("hostName"); } this.transport = transport; this.hostName = hostName; this.port = port; this.address = InetAddress.getByName(hostName); } @Override public Transport getTransport() { return transport; } @Override public int getPort() { return port; } @Override public String getHostName() { return hostName; } @Override public boolean acceptsTransportConnection(TransportAddress transportAddress) { if (transportAddress == null) { throw new NullPointerException("transportAddress"); } if (!(transportAddress instanceof TcpBlockAddress)) { return false; } TcpBlockAddress other = (TcpBlockAddress) transportAddress; if (!other.address.equals(this.address)) { final String otherHostName = other.getHostName(); final String thisHostName = getHostName(); if (!otherHostName.equals(thisHostName) && !"0.0.0.0".equals(thisHostName)) { return false; } } if (other.getPort() != getPort()) { return false; } return true; } @Override public boolean acceptsConnection(TransportAddress transportAddress) { return acceptsTransportConnection(transportAddress); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof TcpBlockAddress)) { return false; } TcpBlockAddress other = (TcpBlockAddress) obj; // FIXME is following always correct ? if (other.getTransport() != getTransport()) { return false; } return (other.address.equals(this.address) || other.hostName.equals(this.hostName)) && other.port == this.port; } @Override public String toString() { // FIXME what to do with different flavors of tcp (tcp, tcps) ? return getTransport().getName() + "://" + hostName + ":" + port; } }
dmrub/kiara-java
KIARA/src/main/java/de/dfki/kiara/tcp/TcpBlockAddress.java
Java
gpl-3.0
4,424
[ 30522, 1013, 1008, 28870, 1011, 2690, 8059, 2005, 8114, 1998, 1053, 2891, 1013, 3036, 1011, 5204, 1999, 19152, 1997, 2578, 1998, 3863, 1997, 7696, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 2446, 2470, 2415, 2005, 7976, 4454, 1006, 1040, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Labels</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="title" content="Samples" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="icon" href="../common/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="../common/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" href="../common/css/style.css" type="text/css" media="screen" /> </head> <body > <div class="header"> <a class="logo" href="http://www.dhtmlx.com" title="DHTMLX homepage"></a> <div class="tittle-dhtmlx">DHTMLX Docs & Samples Explorer</div> <div class="search-field"> <form action="http://docs.dhtmlx.com/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><input class="button" type="submit" value=""><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form> </div> <div class="buttons"> <a class="doc_inact" href="../../../docsExplorer/index.html" title="DHTMLX Documentation homepage"></a> <a class="sample"></a> </div> </div> <div class="content"> <div class="navigation-div"> <a href="../../../docsExplorer/samples.html" class="navigation"><img src="../common/icons/file.gif" alt="" >All components</a> <div class="arrow"></div> <a href="../index.html" class="navigation"><img height="22" src="../common/icons/chart.gif" alt="" >dhtmlxChart</a> <div class="arrow"></div> <a href="./index.html" class="navigation"><img src="../common/icons/none.gif" alt="" >Bar Charts</a> </div> <div style="display:block;"> <h3>Labels</h3> </div> <div class="navigation-div"> <a href="#code" class="navigation view-source"><img src="../common/icons/source.gif" alt="" >View page source</a> </div> <script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css"> <script src="../common/testdata.js"></script> <div id="chartDiv" style="width:600px;height:250px;margin:20px"></div> <script> var chart = new dhtmlXChart({ view:"bar", container:"chartDiv", value:"#sales#", label:"#sales#", color:"#color#", radius:0, width:40, tooltip:{ template:"#sales#" }, xAxis:{ title:"Sales per year", template:"'#year#", lines: false }, padding:{ left:10, right:10, top:50 } }); chart.parse(dataset_colors,"json"); </script> </div> <div style="clear:both;"></div> <div class="source"> <div class="teg">Source</div> <div class="code" id="code"> <div class="hl-main"><pre><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/dhtmlxchart.js</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/javascript</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"> </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">link</span><span class="hl-code"> </span><span class="hl-var">rel</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">STYLESHEET</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/css</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">href</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../../codebase/dhtmlxchart.css</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code"> </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">src</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">../common/testdata.js</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"> </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">chartDiv</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">style</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">width:600px;height:250px;margin:20px</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span><span class="hl-code"> </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"><div class="hl-main"><pre><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">chart</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXChart</span><span class="hl-brackets">(</span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">view</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">bar</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">container</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">chartDiv</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">value</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">#sales#</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">label</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">#sales#</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">color</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">#color#</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">radius</span><span class="hl-code">: </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-identifier">width</span><span class="hl-code">: </span><span class="hl-number">40</span><span class="hl-code">, </span><span class="hl-identifier">tooltip</span><span class="hl-code">: </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">template</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">#sales#</span><span class="hl-quotes">&quot;</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-identifier">xAxis</span><span class="hl-code">: </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">title</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Sales per year</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">template</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">'#year#</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">lines</span><span class="hl-code">: </span><span class="hl-reserved">false</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code">, </span><span class="hl-identifier">padding</span><span class="hl-code">: </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">left</span><span class="hl-code">: </span><span class="hl-number">10</span><span class="hl-code">, </span><span class="hl-identifier">right</span><span class="hl-code">: </span><span class="hl-number">10</span><span class="hl-code">, </span><span class="hl-identifier">top</span><span class="hl-code">: </span><span class="hl-number">50</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">chart</span><span class="hl-code">.</span><span class="hl-identifier">parse</span><span class="hl-brackets">(</span><span class="hl-identifier">dataset_colors</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">json</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span></pre></div> </div> <div class="footer"> <div class="footer-logo"></div> <div class="copyright">Copyright &copy; 1998-2012 DHTMLX LTD.<br />All rights reserved.</div> </div> </body> </html>
ManageIQ/dhtmlx-rails
vendor/assets/dhtmlx/dhtmlxChart/samples/06_bar_chart/02_text.html
HTML
gpl-2.0
10,929
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 9384, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; namespace Nest { [JsonObject] [JsonConverter(typeof(ScriptTransformJsonConverter))] public interface IScriptTransform : ITransform { [JsonProperty("params")] [JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter<string, object>))] Dictionary<string, object> Params { get; set; } [JsonProperty("lang")] string Lang { get; set; } } public abstract class ScriptTransformBase : TransformBase, IScriptTransform { public Dictionary<string, object> Params { get; set; } public string Lang { get; set; } internal override void WrapInContainer(ITransformContainer container) => container.Script = this; } public abstract class ScriptTransformDescriptorBase<TDescriptor, TInterface> : DescriptorBase<TDescriptor, TInterface>, IScriptTransform where TDescriptor : ScriptTransformDescriptorBase<TDescriptor, TInterface>, TInterface, IScriptTransform where TInterface : class, IScriptTransform { Dictionary<string, object> IScriptTransform.Params { get; set; } string IScriptTransform.Lang { get; set; } public TDescriptor Params(Dictionary<string, object> scriptParams) => Assign(a => a.Params = scriptParams); public TDescriptor Params(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> paramsSelector) => Assign(a => a.Params = paramsSelector?.Invoke(new FluentDictionary<string, object>())); public TDescriptor Lang(string lang) => Assign(a => a.Lang = lang); } public class ScriptTransformDescriptor : DescriptorBase<ScriptTransformDescriptor, IDescriptor> { public FileScriptTransformDescriptor File(string file) => new FileScriptTransformDescriptor(file); public IndexedScriptTransformDescriptor Indexed(string id) => new IndexedScriptTransformDescriptor(id); public InlineScriptTransformDescriptor Inline(string script) => new InlineScriptTransformDescriptor(script); } internal class ScriptTransformJsonConverter : JsonConverter { public override bool CanWrite => false; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotSupportedException(); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var o = JObject.Load(reader); var dict = o.Properties().ToDictionary(p => p.Name, p => p.Value); if (!dict.HasAny()) return null; IScriptTransform scriptTransform = null; if (dict.ContainsKey("inline")) { var inline = dict["inline"].ToString(); scriptTransform = new InlineScriptTransform(inline); } if (dict.ContainsKey("file")) { var file = dict["file"].ToString(); scriptTransform = new FileScriptTransform(file); } if (dict.ContainsKey("id")) { var id = dict["id"].ToString(); scriptTransform = new IndexedScriptTransform(id); } if (scriptTransform == null) return null; if (dict.ContainsKey("lang")) scriptTransform.Lang = dict["lang"].ToString(); if (dict.ContainsKey("params")) scriptTransform.Params = dict["params"].ToObject<Dictionary<string, object>>(); return scriptTransform; } public override bool CanConvert(Type objectType) => true; } }
CSGOpenSource/elasticsearch-net
src/Nest/XPack/Watcher/Transform/ScriptTransformBase.cs
C#
apache-2.0
3,292
[ 30522, 2478, 8446, 6499, 6199, 1012, 1046, 3385, 1025, 2478, 30524, 1046, 3385, 16429, 20614, 1033, 1031, 1046, 3385, 8663, 16874, 2121, 1006, 2828, 11253, 1006, 5896, 6494, 3619, 14192, 22578, 2239, 8663, 16874, 2121, 1007, 1007, 1033, 227...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SPL_OBSERVER_H #define SPL_OBSERVER_H #include "php.h" #include "php_spl.h" extern PHPAPI zend_class_entry *spl_ce_SplObserver; extern PHPAPI zend_class_entry *spl_ce_SplSubject; extern PHPAPI zend_class_entry *spl_ce_SplObjectStorage; extern PHPAPI zend_class_entry *spl_ce_MultipleIterator; PHP_MINIT_FUNCTION(spl_observer); #endif /* SPL_OBSERVER_H */ /* * Local Variables: * c-basic-offset: 4 * tab-width: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */
elmoke/openshift-cartridge-php
usr/php-7.0.1/include/php/ext/spl/spl_observer.h
C
mit
1,645
[ 30522, 1013, 1008, 1009, 1011, 1011, 30524, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//======================================================================== // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. //======================================================================== // package org.xtuml.bp.debug.ui.model; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.Breakpoint; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.model.IWorkbenchAdapter; import org.xtuml.bp.core.Breakpoint_c; import org.xtuml.bp.core.Condition_c; import org.xtuml.bp.core.Gd_c; import org.xtuml.bp.core.Instance_c; import org.xtuml.bp.core.ModelClass_c; import org.xtuml.bp.core.Ooaofooa; import org.xtuml.bp.core.ProvidedOperation_c; import org.xtuml.bp.core.ProvidedSignal_c; import org.xtuml.bp.core.RequiredOperation_c; import org.xtuml.bp.core.RequiredSignal_c; import org.xtuml.bp.core.common.NonRootModelElement; import org.xtuml.bp.debug.ui.IBPDebugUIPluginConstants; import org.xtuml.bp.debug.ui.ModelElementLocation; public abstract class BPBreakpoint extends Breakpoint implements IBPBreakpoint, IWorkbenchAdapter { /** * List of active instance filters for this breakpoint * (list of <code>Instance_c</code>). */ protected List fInstanceFilters = null; /** * Empty instance filters array. */ protected static final Instance_c[] fgEmptyInstanceFilters = new Instance_c[0]; /** * Default constructor is required for the breakpoint manager * to re-create persisted breakpoints. After instantiating a breakpoint, * the <code>setMarker(...)</code> method is called to restore * this breakpoint's attributes. */ public BPBreakpoint() { } /** * @param resource file on which to set the breakpoint * @throws CoreException if unable to create the breakpoint */ public BPBreakpoint(final String markerType, NonRootModelElement nrme, final int flags_all) throws CoreException { IResource resource = (IResource)nrme.getModelRoot().getPersistenceFile(); init(resource, markerType, nrme, flags_all, "", 0); //$NON-NLS-1$ setHitCount(0); } protected void init(final IResource resource, final String markerType, NonRootModelElement nrme, final int flags_all, final String optionalAttribute, final int optionalAttrValue) throws DebugException { final String mr_id = nrme.getModelRoot().getId(); final String location = ModelElementLocation.getModelElementLocation(nrme); String ooa_id = String.valueOf(nrme.Get_ooa_id()); if(ooa_id.equals(Gd_c.Null_unique_id().toString())) { if(nrme instanceof RequiredOperation_c) { ooa_id = ((RequiredOperation_c) nrme).getId().toString(); } else if (nrme instanceof RequiredSignal_c) { ooa_id = ((RequiredSignal_c) nrme).getId().toString(); } else if (nrme instanceof ProvidedOperation_c) { ooa_id = ((ProvidedOperation_c) nrme).getId().toString(); } else if (nrme instanceof ProvidedSignal_c) { ooa_id = ((ProvidedSignal_c) nrme).getId().toString(); } } final String final_id = ooa_id; //final ModelElementID modelElementID = ModelAdapter.getModelElementAdapter(nrme).createModelElementID(nrme); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { IMarker marker = resource.createMarker(markerType); setMarker(marker); marker.setAttribute(IBreakpoint.ENABLED, true); marker.setAttribute(IBreakpoint.ID, getModelIdentifier()+"/" + location); marker.setAttribute(MODELROOT_ID, mr_id); marker.setAttribute(MODELELEMENT_ID, final_id); marker.setAttribute(LOCATION, location); marker.setAttribute(CONDITION, ""); marker.setAttribute(CONDITION_ENABLED, false); marker.setAttribute(FLAGS, flags_all); if ( !optionalAttribute.equals("") ) { //$NON-NLS-1$ marker.setAttribute(optionalAttribute, optionalAttrValue); } setHitCount(0); } }; run(getMarkerRule(resource), runnable); } public String getModelIdentifier() { return IBPDebugUIPluginConstants.PLUGIN_ID; } /* (non-Javadoc) * @see org.xtuml.bp.debug.ui.model.IBPBreakpoint#getTypeName() */ public String getTypeName() throws CoreException { return "Class:"; } public void setLocation(String location) throws CoreException { if (!location.equals(getCondition())) { setAttribute(LOCATION, location); } } public String getLocation() throws CoreException { return ensureMarker().getAttribute(LOCATION, ""); } /* (non-Javadoc) * @see org.xtuml.bp.debug.ui.model.IBPBreakpoint#setHitCount(int) */ public void setHitCount(int hitCount) throws CoreException { if (hitCount != getHitCount()) { setAttribute(HIT_COUNT, hitCount); if ( hitCount > 0 ) { String message = getLocation() + " [hit count: " + hitCount + "]"; ensureMarker().setAttribute(IMarker.MESSAGE, message); } else { String message = getLocation(); ensureMarker().setAttribute(IMarker.MESSAGE, message); } } } /* (non-Javadoc) * @see org.xtuml.bp.debug.ui.model.IBPBreakpoint#getHitCount() */ public int getHitCount() throws CoreException { return ensureMarker().getAttribute(HIT_COUNT, -1); } public void setCondition(String condition) throws CoreException { if (!condition.equals(getCondition())) { setAttribute(CONDITION, condition); } } public String getCondition() throws CoreException { return ensureMarker().getAttribute(CONDITION, ""); } public boolean isConditionEnabled() throws CoreException { return ensureMarker().getAttribute(CONDITION_ENABLED, false); } public void setConditionEnabled(boolean enableCondition) throws CoreException { if ( isConditionEnabled() != enableCondition ) { setAttribute(CONDITION_ENABLED, enableCondition); } } public boolean supportsCondition() { return false; } public boolean supportsHitCount() { return true; } public boolean getFlag(int flag, int all_flags, boolean defaultValue) { IMarker m = getMarker(); if (m != null) { int flags = m.getAttribute(FLAGS, all_flags); return (flags & flag) != 0; } return defaultValue; } public void setFlag(boolean condition, int flag, int all_flags) throws CoreException { IMarker m = getMarker(); if (m != null) { int flags = m.getAttribute(FLAGS, all_flags); if ( condition ) { flags = flags | flag; } else { flags = flags & ~flag; } m.setAttribute(FLAGS, flags); } } public String getText() { IMarker m = getMarker(); if (m != null) { return getTextDetail() + " " + m.getAttribute(IMarker.MESSAGE, ""); } return ""; } public boolean supportsInstanceFilters() { return false; } public Instance_c[] getInstanceFilters() { if (fInstanceFilters == null || fInstanceFilters.isEmpty()) { return fgEmptyInstanceFilters; } return (Instance_c[])fInstanceFilters.toArray(new Instance_c[fInstanceFilters.size()]); } public void clearInstanceFilters() { if (fInstanceFilters != null) { fInstanceFilters.clear(); fInstanceFilters = null; fireChanged(); } } public void addInstanceFilter(Instance_c object) { if (fInstanceFilters == null) { fInstanceFilters = new ArrayList(); } fInstanceFilters.add(object); fireChanged(); } /** * Change notification when there are no marker changes. If the marker * does not exist, do not fire a change notification (the marker may not * exist if the associated project was closed). */ protected void fireChanged() { if (markerExists()) { DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(this); } } public ModelClass_c[] getAllClasses() { IMarker m = getMarker(); if (m != null) { String mr_id = m.getAttribute(MODELROOT_ID, ""); //$NON_NLS-1$ Ooaofooa x = Ooaofooa.getInstance(mr_id); ModelClass_c [] ret_val = ModelClass_c.ModelClassInstances(x); return ret_val; } return new ModelClass_c[0]; } public Object[] getChildren(Object o) { return null; } public ImageDescriptor getImageDescriptor(Object object) { return null; } public String getLabel(Object o) { // more specific labels will be supplied by overrides in subtypes return "Breakpoint"; } public Object getParent(Object o) { return null; } protected boolean managerEnabled() { return DebugPlugin.getDefault().getBreakpointManager().isEnabled(); } public void modifyTargetBreakpoint(Breakpoint_c bp, String string, Object newAttr) { if ( string.equals(ENABLED) ) { boolean newValue = ((Boolean)newAttr).booleanValue(); if (!managerEnabled()) { newValue = false; } bp.setEnabled(newValue); } else if ( string.equals(HIT_COUNT) ) { int newValue = ((Integer)newAttr).intValue(); bp.setTarget_hit_count(newValue); } else if ( string.equals(CONDITION_ENABLED) ) { boolean newValue = ((Boolean)newAttr).booleanValue(); bp.setCondition_enabled(newValue); } else if ( string.equals(CONDITION) ) { String newValue = (String)newAttr; Condition_c cond = Condition_c.getOneBP_CONOnR3100(bp); if ( cond == null ) { cond = new Condition_c(bp.getModelRoot()); cond.relateAcrossR3100To(bp); } cond.setExpression(newValue); } } protected String getTextDetail() { // Subtypes should override this to provide more // detail than just the data stored in the Marker return ""; } /** * Deletes this breakpoint's underlying marker, and removes * this breakpoint from the breakpoint manager. * * @override * @exception CoreException if unable to delete this breakpoint's * underlying marker */ public void delete() throws CoreException { deleteTargetBreakpoint(); super.delete(); } }
rmulvey/bridgepoint
src/org.xtuml.bp.debug.ui/src/org/xtuml/bp/debug/ui/model/BPBreakpoint.java
Java
apache-2.0
10,881
[ 30522, 1013, 1013, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 30524, 1027, 1027, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Models app.SearchModel = Backbone.Model.extend({ idAttribute: "session_token", urlRoot: function() { var u = '/search/' + this.id; return u; } }); // Collections app.SearchCollection = Backbone.Collection.extend({ model: app.SearchModel, url: function() { if (typeof this.id === 'undefined') return '/search'; else return '/search/' + this.id; }, initialize: function(options) { if (typeof options != 'undefined') this.id = options.session_token; } }); // Views app.cardList = Backbone.View.extend({ el: '#cardList' }); app.cardView = Backbone.View.extend({ tagName: 'div', initialize: function(card) { this.card = card; }, template: _.template($("#card-template").html()), render: function(cardList) { this.$el.html(this.template({ card: this.card })); this.$el.addClass('card'); cardList.$el.append(this.el); return this; } });
GOPINATH-GS4/stock
public/lib/cards.js
JavaScript
apache-2.0
1,119
[ 30522, 1013, 1013, 4275, 10439, 1012, 3945, 5302, 9247, 1027, 21505, 1012, 2944, 1012, 7949, 1006, 1063, 16096, 4779, 3089, 8569, 2618, 1024, 1000, 5219, 1035, 19204, 1000, 1010, 24471, 20974, 17206, 1024, 3853, 1006, 1007, 1063, 13075, 105...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*FreeMind - A Program for creating and viewing Mindmaps *Copyright (C) 2000-2008 Joerg Mueller, Daniel Polansky, Christian Foltin and others. * *See COPYING for Details * *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. * * Created on 28.12.2008 */ package plugins.collaboration.socket; import freemind.common.NumberProperty; import freemind.common.StringProperty; import freemind.controller.actions.generated.instance.CollaborationGoodbye; import freemind.controller.actions.generated.instance.CollaborationUserInformation; import freemind.extensions.DontSaveMarker; import freemind.extensions.PermanentNodeHook; import freemind.main.Resources; import freemind.main.Tools; import freemind.main.XMLElement; import freemind.modes.MindMapNode; import freemind.modes.mindmapmode.MindMapController; import freemind.view.mindmapview.NodeView; import javax.swing.*; import java.io.IOException; import java.io.Writer; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketTimeoutException; import java.util.Vector; /** * @author foltin */ public class MindMapMaster extends SocketBasics implements PermanentNodeHook, DontSaveMarker { /** * */ public static final int SOCKET_TIMEOUT_IN_MILLIES = 500; MasterThread mListener = null; ServerSocket mServer; Vector mConnections = new Vector(); protected boolean mLockEnabled = false; private String mLockMutex = ""; private int mPort; private String mLockId; private long mLockedAt; private String mLockUserName; private boolean mMasterStarted; private class MasterThread extends TerminateableThread { private static final long TIME_BETWEEN_USER_INFORMATION_IN_MILLIES = 5000; private static final long TIME_FOR_ORPHANED_LOCK = 5000; private long mLastTimeUserInformationSent = 0; /** * @param pName */ public MasterThread() { super("Master"); } /* * (non-Javadoc) * * @see plugins.collaboration.socket.TerminateableThread#processAction() */ public boolean processAction() throws Exception { try { logger.finest("Waiting for message"); Socket client = mServer.accept(); logger.info("Received new client."); client.setSoTimeout(SOCKET_TIMEOUT_IN_MILLIES); ServerCommunication c = new ServerCommunication( MindMapMaster.this, client, getMindMapController()); c.start(); synchronized (mConnections) { mConnections.addElement(c); } } catch (SocketTimeoutException e) { } final long now = System.currentTimeMillis(); if (now - mLastTimeUserInformationSent > TIME_BETWEEN_USER_INFORMATION_IN_MILLIES) { mLastTimeUserInformationSent = now; CollaborationUserInformation userInfo = getMasterInformation(); synchronized (mConnections) { for (int i = 0; i < mConnections.size(); i++) { try { final ServerCommunication connection = (ServerCommunication) mConnections .elementAt(i); /* to each server, the IP address is chosen that belongs to this connection. * E.g. if the connection is routed over one of several network interfaces, * the address of this interface is reported. */ userInfo.setMasterIp(connection.getIpToSocket()); connection.send(userInfo); } catch (Exception e) { Resources.getInstance().logException( e); } } } } // timeout such that lock can't be held forever synchronized (mLockMutex) { if (mLockEnabled && now - mLockedAt > TIME_FOR_ORPHANED_LOCK) { logger.warning("Release lock " + mLockId + " held by " + mLockUserName); clearLock(); } } return true; } } public synchronized void removeConnection(ServerCommunication client) { synchronized (mConnections) { mConnections.remove(client); } // correct the map title, as we probably don't have clients anymore setTitle(); } protected void setTitle() { getMindMapController().getController().setTitle(); } public void startupMapHook() { super.startupMapHook(); // Restart check, as the startup command is given, even if the mindmap // is changed via // the tab bar. So, this method must be idempotent... if (mMasterStarted) { // we were already here, so return; } MindMapController controller = getMindMapController(); final StringProperty passwordProperty = new StringProperty( PASSWORD_DESCRIPTION, PASSWORD); final StringProperty passwordProperty2 = new StringProperty( PASSWORD_VERIFICATION_DESCRIPTION, PASSWORD_VERIFICATION); // StringProperty bindProperty = new StringProperty( // "IP address of the local machine, or 0.0.0.0 if ", "Host"); final NumberProperty portProperty = getPortProperty(); Vector controls = new Vector(); controls.add(passwordProperty); controls.add(passwordProperty2); // controls.add(bindProperty); controls.add(portProperty); FormDialog dialog = new FormDialog(controller); dialog.setUp(controls, new FormDialogValidator() { public boolean isValid() { logger.finest("Output valid?"); return Tools.safeEquals(passwordProperty.getValue(), passwordProperty2.getValue()); } }); if (!dialog.isSuccess()) { switchMeOff(); return; } /* Store port value in preferences. */ setPortProperty(portProperty); mPassword = passwordProperty.getValue(); // start server: logger.info("Start server..."); mMasterStarted = true; try { mPort = getPortProperty().getIntValue(); mServer = new ServerSocket(mPort); mServer.setSoTimeout(SOCKET_TIMEOUT_IN_MILLIES); mListener = new MasterThread(); mListener.start(); } catch (Exception e) { Resources.getInstance().logException(e); controller.getController().errorMessage( Resources.getInstance().format( SOCKET_CREATION_EXCEPTION_MESSAGE, new Object[]{portProperty.getValue(), e.getMessage()})); switchMeOff(); return; } registerFilter(); logger.info("Starting server. Done."); setTitle(); } public void switchMeOff() { final MindMapController mindMapController = getMindMapController(); // this is not nice, but in the starting phase of the hook, it can't be switched off. SwingUtilities.invokeLater(new Runnable() { public void run() { togglePermanentHook(mindMapController, MASTER_HOOK_LABEL); } }); } public void loadFrom(XMLElement pChild) { // this plugin should not be saved. } public void save(XMLElement pXml) { // this plugin should not be saved. // nothing to do. } public void shutdownMapHook() { deregisterFilter(); if (mListener != null) { signalEndOfSession(); mListener.commitSuicide(); } try { if (mServer != null) { mServer.close(); } } catch (IOException e) { Resources.getInstance().logException(e); } mMasterStarted = false; super.shutdownMapHook(); } /** * */ private void signalEndOfSession() { CollaborationGoodbye goodbye = new CollaborationGoodbye(); goodbye.setUserId(Tools.getUserName()); synchronized (mConnections) { for (int i = 0; i < mConnections.size(); i++) { final ServerCommunication serverCommunication = (ServerCommunication) mConnections .elementAt(i); try { serverCommunication.send(goodbye); serverCommunication.commitSuicide(); serverCommunication.close(); } catch (IOException e) { Resources.getInstance().logException(e); } } mConnections.clear(); } } public void onAddChild(MindMapNode pAddedChildNode) { } public void onAddChildren(MindMapNode pAddedChild) { } public void onLostFocusNode(NodeView pNodeView) { } public void onNewChild(MindMapNode pNewChildNode) { } public void onRemoveChild(MindMapNode pOldChildNode) { } public void onRemoveChildren(MindMapNode pOldChildNode, MindMapNode pOldDad) { } public void onFocusNode(NodeView pNodeView) { } public void onUpdateChildrenHook(MindMapNode pUpdatedNode) { } public void onUpdateNodeHook() { } public void onViewCreatedHook(NodeView pNodeView) { } public void onViewRemovedHook(NodeView pNodeView) { } public Integer getRole() { return ROLE_MASTER; } /* * (non-Javadoc) * * @see plugins.collaboration.socket.SocketBasics#getPort() */ public int getPort() { return mPort; } /* * (non-Javadoc) * * @see plugins.collaboration.socket.SocketBasics#lock() */ protected String lock(String pUserName) throws UnableToGetLockException, InterruptedException { synchronized (mLockMutex) { if (mLockEnabled) { throw new UnableToGetLockException(); } mLockEnabled = true; String lockId = "Lock_" + Math.random(); mLockId = lockId; mLockedAt = System.currentTimeMillis(); mLockUserName = pUserName; logger.info("New lock " + lockId + " by " + mLockUserName); return lockId; } } /* * (non-Javadoc) * * @see * plugins.collaboration.socket.SocketBasics#sendCommand(java.lang.String, * java.lang.String, java.lang.String) */ protected void broadcastCommand(String pDoAction, String pUndoAction, String pLockId) throws Exception { synchronized (mConnections) { for (int i = 0; i < mConnections.size(); i++) { ((ServerCommunication) mConnections.elementAt(i)).sendCommand( pDoAction, pUndoAction, pLockId); } } } /* * (non-Javadoc) * * @see plugins.collaboration.socket.SocketBasics#unlock() */ protected void unlock() { synchronized (mLockMutex) { if (!mLockEnabled) { throw new IllegalStateException(); } logger.fine("Release lock " + mLockId + " held by " + mLockUserName); clearLock(); } } public void clearLock() { mLockEnabled = false; mLockId = "none"; mLockUserName = null; } /* * (non-Javadoc) * * @see plugins.collaboration.socket.SocketBasics#shutdown() */ public void shutdown() { // TODO Auto-generated method stub } public String getLockId() { synchronized (mLockMutex) { if (!mLockEnabled) { throw new IllegalStateException(); } return mLockId; } } /* * (non-Javadoc) * * @see plugins.collaboration.socket.SocketBasics#getUsers() */ public String getUsers() { StringBuffer users = new StringBuffer(Tools.getUserName()); synchronized (mConnections) { for (int i = 0; i < mConnections.size(); i++) { users.append(','); users.append(' '); users.append(((ServerCommunication) mConnections.elementAt(i)) .getName()); } } return users.toString(); } public CollaborationUserInformation getMasterInformation() { CollaborationUserInformation userInfo = new CollaborationUserInformation(); userInfo.setUserIds(getUsers()); userInfo.setMasterHostname(Tools.getHostName()); userInfo.setMasterPort(getPort()); userInfo.setMasterIp(Tools.getHostIpAsString()); return userInfo; } public void processUnfinishedLinks() { } /* (non-Javadoc) * @see freemind.extensions.PermanentNodeHook#saveHtml(java.io.Writer) */ public void saveHtml(Writer pFileout) { } }
d4span/freemindfx
src/main/java/plugins/collaboration/socket/MindMapMaster.java
Java
gpl-2.0
13,982
[ 30522, 1013, 1008, 2489, 23356, 1011, 1037, 2565, 2005, 4526, 1998, 10523, 2568, 2863, 4523, 1008, 9385, 1006, 1039, 1007, 2456, 1011, 2263, 3533, 10623, 26774, 1010, 3817, 14955, 6962, 4801, 1010, 3017, 1042, 27914, 2378, 1998, 2500, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; describe("Calling the fromTo-function of a moment", function(){ moment.period .add({name: 'fromTo15Minutes', count: 15, unit: 'minute'}) .add({name: 'fromTo1Month', count: 1, unit: 'month'}); it("should create an object with properties for from and to", function(){ expect(moment().fromTo().from).toBeDefined(); expect(moment().fromTo().to).toBeDefined(); }); it("should return a fromTo where from and to are same as moment if no period is defined", function(){ var testMoment = moment(); expect(testMoment.isSame(testMoment.fromTo().from)).toBe(true); expect(testMoment.isSame(testMoment.fromTo().to)).toBe(true); }); it("should return the start and the end of the period of a moment", function() { var testMoment = moment.utc({ years :2010, months :5, date :5, hours :5, minutes :8, seconds :3, milliseconds : 9 }).period('fromTo15Minutes'); expect(testMoment.clone().period(true).isSame(testMoment.fromTo().from)).toBe(true); expect(testMoment.clone().period(false).isSame(testMoment.fromTo().to)).toBe(true); }); it("should return the start and the end of a named period for a moment", function() { var testMoment = moment.utc({ years :2010, months :5, date :5, hours :5, minutes :8, seconds :3, milliseconds : 9 }).period('fromTo15Minutes'); expect(testMoment.clone().period('fromTo1Month').period(true).isSame(testMoment.fromTo('fromTo1Month').from)).toBe(true); expect(testMoment.clone().period('fromTo1Month').period(false).isSame(testMoment.fromTo('fromTo1Month').to)).toBe(true); }); });
smartin85/moment-period
tests/period-from-to.spec.js
JavaScript
mit
1,661
[ 30522, 1005, 2224, 9384, 1005, 1025, 6235, 1006, 1000, 4214, 1996, 2013, 3406, 1011, 3853, 1997, 1037, 2617, 1000, 1010, 3853, 1006, 1007, 1063, 2617, 1012, 2558, 1012, 5587, 1006, 1063, 2171, 1024, 1005, 2013, 3406, 16068, 10020, 10421, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding:utf8 -*- from fabric.api import task, run, local, cd, hosts, env import time from oozappa.config import get_config, procure_common_functions _settings = get_config() procure_common_functions() import sys from common_multiple_fabric_environment import _deploy_template_sample_a test_host = ('192.168.0.110',) #FIXME @task def ls(): u'''run ls command on local machine.''' local('ls -la') @task def ps(): u'''run ls command on local machine.''' local('ps ax') @task def sys_path(): import sys print(sys.path) @task def sleep(): u'''sleep 5 second.''' print('stop 5 sec...') time.sleep(5) print('5 sec... passed') @task def printsetting(): u'''print setting from staging.vars and common.vars''' print(_settings) @task @hosts(test_host) def deploy_template_sample_a(): _deploy_template_sample_a(_settings.sample_template_vars.sample_a) @task def launch_instance_from_app_a_image(): u'''eg. launch instance from app a image.''' print('launch_instance_from_app_a_image') @task def set_env_latest_app_a(): u'''eg. search latest app type a instance and set fabric env.''' print('set_env_latest_app_a') @task def set_env_latest_app_b(): u'''eg. search latest app type b instance and set fabric env.''' print('set_env_latest_app_b') @task def launch_instance_from_app_b_image(): u'''eg. launch instance from app b image.''' print('launch_instance_from_app_b_image') @task def production_specific_setting(): u'''eg. production specific setting''' print('production_specific_setting')
frkwy/oozappa
sample/ops/staging/fabfile/__init__.py
Python
mit
1,594
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 2620, 1011, 1008, 1011, 2013, 8313, 1012, 17928, 12324, 4708, 1010, 2448, 1010, 2334, 1010, 3729, 1010, 6184, 1010, 4372, 2615, 12324, 2051, 2013, 1051, 25036, 13944, 1012, 9530, 8873...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from kolibri.auth.api import KolibriAuthPermissions, KolibriAuthPermissionsFilter from kolibri.content.api import OptionalPageNumberPagination from rest_framework import filters, viewsets from .models import ContentRatingLog, ContentSessionLog, ContentSummaryLog, UserSessionLog from .serializers import ContentRatingLogSerializer, ContentSessionLogSerializer, ContentSummaryLogSerializer, UserSessionLogSerializer class ContentSessionLogFilter(filters.FilterSet): class Meta: model = ContentSessionLog fields = ['user_id', 'content_id'] class ContentSessionLogViewSet(viewsets.ModelViewSet): permission_classes = (KolibriAuthPermissions,) filter_backends = (KolibriAuthPermissionsFilter, filters.DjangoFilterBackend) queryset = ContentSessionLog.objects.all() serializer_class = ContentSessionLogSerializer pagination_class = OptionalPageNumberPagination filter_class = ContentSessionLogFilter class ContentSummaryFilter(filters.FilterSet): class Meta: model = ContentSummaryLog fields = ['user_id', 'content_id'] class ContentSummaryLogViewSet(viewsets.ModelViewSet): permission_classes = (KolibriAuthPermissions,) filter_backends = (KolibriAuthPermissionsFilter, filters.DjangoFilterBackend) queryset = ContentSummaryLog.objects.all() serializer_class = ContentSummaryLogSerializer pagination_class = OptionalPageNumberPagination filter_class = ContentSummaryFilter class ContentRatingLogViewSet(viewsets.ModelViewSet): permission_classes = (KolibriAuthPermissions,) filter_backends = (KolibriAuthPermissionsFilter,) queryset = ContentRatingLog.objects.all() serializer_class = ContentRatingLogSerializer pagination_class = OptionalPageNumberPagination class UserSessionLogViewSet(viewsets.ModelViewSet): permission_classes = (KolibriAuthPermissions,) filter_backends = (KolibriAuthPermissionsFilter,) queryset = UserSessionLog.objects.all() serializer_class = UserSessionLogSerializer pagination_class = OptionalPageNumberPagination
ralphiee22/kolibri
kolibri/logger/api.py
Python
mit
2,079
[ 30522, 2013, 12849, 29521, 3089, 1012, 8740, 2705, 1012, 17928, 12324, 12849, 29521, 4360, 14317, 4842, 25481, 2015, 1010, 12849, 29521, 4360, 14317, 4842, 25481, 22747, 4014, 3334, 2013, 12849, 29521, 3089, 1012, 4180, 1012, 17928, 12324, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. 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 AJAX.ORG B.V. 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. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("../lib/dom"); var oop = require("../lib/oop"); var lang = require("../lib/lang"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var Gutter = function(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_gutter-layer"; parentEl.appendChild(this.element); this.setShowFoldWidgets(this.$showFoldWidgets); this.gutterWidth = 0; this.$annotations = []; this.$updateAnnotations = this.$updateAnnotations.bind(this); }; (function() { oop.implement(this, EventEmitter); this.setSession = function(session) { if (this.session) this.session.removeEventListener("change", this.$updateAnnotations); this.session = session; session.on("change", this.$updateAnnotations); }; this.addGutterDecoration = function(row, className){ if (window.console) console.warn && console.warn("deprecated use session.addGutterDecoration"); this.session.addGutterDecoration(row, className); }; this.removeGutterDecoration = function(row, className){ if (window.console) console.warn && console.warn("deprecated use session.removeGutterDecoration"); this.session.removeGutterDecoration(row, className); }; this.setAnnotations = function(annotations) { // iterate over sparse array this.$annotations = [] var rowInfo, row; for (var i = 0; i < annotations.length; i++) { var annotation = annotations[i]; var row = annotation.row; var rowInfo = this.$annotations[row]; if (!rowInfo) rowInfo = this.$annotations[row] = {text: []}; var annoText = annotation.text; annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; if (rowInfo.text.indexOf(annoText) === -1) rowInfo.text.push(annoText); var type = annotation.type; if (type == "error") rowInfo.className = " ace_error"; else if (type == "warning" && rowInfo.className != " ace_error") rowInfo.className = " ace_warning"; else if (type == "info" && (!rowInfo.className)) rowInfo.className = " ace_info"; } }; this.$updateAnnotations = function (e) { if (!this.$annotations.length) return; var delta = e.data; var range = delta.range; var firstRow = range.start.row; var len = range.end.row - firstRow; if (len === 0) { // do nothing } else if (delta.action == "removeText" || delta.action == "removeLines") { this.$annotations.splice(firstRow, len + 1, null); } else { var args = Array(len + 1); args.unshift(firstRow, 1); this.$annotations.splice.apply(this.$annotations, args); } }; this.update = function(config) { var emptyAnno = {className: ""}; var html = []; var i = config.firstRow; var lastRow = config.lastRow; var fold = this.session.getNextFoldLine(i); var foldStart = fold ? fold.start.row : Infinity; var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets; var breakpoints = this.session.$breakpoints; var decorations = this.session.$decorations; var firstLineNumber = this.session.$firstLineNumber; var lastLineNumber = 0; while (true) { if(i > foldStart) { i = fold.end.row + 1; fold = this.session.getNextFoldLine(i, fold); foldStart = fold ?fold.start.row :Infinity; } if(i > lastRow) break; var annotation = this.$annotations[i] || emptyAnno; html.push( "<div class='ace_gutter-cell ", breakpoints[i] || "", decorations[i] || "", annotation.className, "' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", lastLineNumber = i + firstLineNumber ); if (foldWidgets) { var c = foldWidgets[i]; // check if cached value is invalidated and we need to recompute if (c == null) c = foldWidgets[i] = this.session.getFoldWidget(i); if (c) html.push( "<span class='ace_fold-widget ace_", c, c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open", "' style='height:", config.lineHeight, "px", "'></span>" ); } html.push("</div>"); i++; } this.element = dom.setInnerHtml(this.element, html.join("")); this.element.style.height = config.minHeight + "px"; if (this.session.$useWrapMode) lastLineNumber = this.session.getLength(); var gutterWidth = ("" + lastLineNumber).length * config.characterWidth; var padding = this.$padding || this.$computePadding(); gutterWidth += padding.left + padding.right; if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { this.gutterWidth = gutterWidth; this.element.style.width = Math.ceil(this.gutterWidth) + "px"; this._emit("changeGutterWidth", gutterWidth); } }; this.$showFoldWidgets = true; this.setShowFoldWidgets = function(show) { if (show) dom.addCssClass(this.element, "ace_folding-enabled"); else dom.removeCssClass(this.element, "ace_folding-enabled"); this.$showFoldWidgets = show; this.$padding = null; }; this.getShowFoldWidgets = function() { return this.$showFoldWidgets; }; this.$computePadding = function() { if (!this.element.firstChild) return {left: 0, right: 0}; var style = dom.computedStyle(this.element.firstChild); this.$padding = {}; this.$padding.left = parseInt(style.paddingLeft) + 1 || 0; this.$padding.right = parseInt(style.paddingRight) || 0; return this.$padding; }; this.getRegion = function(point) { var padding = this.$padding || this.$computePadding(); var rect = this.element.getBoundingClientRect(); if (point.x < padding.left + rect.left) return "markers"; if (this.$showFoldWidgets && point.x > rect.right - padding.right) return "foldWidgets"; }; }).call(Gutter.prototype); exports.Gutter = Gutter; });
newrelic/ace
lib/ace/layer/gutter.js
JavaScript
bsd-3-clause
8,543
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 4088, 6105, 3796, 1008, 1008, 1008, 1008, 1008, 1008, 5500, 2104, 1996, 18667, 2094, 6105, 1024, 1008, 1008, 9385, 1006, 1039, 1007, 2230, 1010, 18176, 1012, 8917, 1038, 1012, 1058, 1012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
.ext-home { padding-top: 20px; padding-bottom: 20px; } .ext-home .t3-sl-1 { padding: 0; } .ext-home .resp-accordion { clear: both; border: 1px solid #c1c1c1; } .ext-home .resp-tab-content { float: left; width: 100% !important; border: none !important; padding: 10px 0 !important; } .ext-home .resp-tab-content img { max-width: 100%; } .ext-home .resp-tab-active { border: none !important; background: #5d2e74 !important; color: #fff; } .ext-home .resp-tabs-list { margin-left: 15px !important; } .ext-home .resp-tabs-list li { padding: 8px 15px !important; } .ext-home .resp-arrow { border-top: none; } .ext-home .resp-tab-active { background: #5d2e74 !important; color: #fff; } .ext-home .resp-tab-active .resp-arrow { border-bottom: none; }
platinum-joomla-templates/pkg_ext_my_micro
source/tpl_ext_my_micro/css/home.css
CSS
gpl-2.0
783
[ 30522, 1012, 4654, 2102, 1011, 2188, 1063, 11687, 4667, 1011, 2327, 1024, 2322, 2361, 2595, 1025, 11687, 4667, 1011, 3953, 1024, 2322, 2361, 2595, 1025, 1065, 1012, 4654, 2102, 1011, 2188, 1012, 1056, 2509, 1011, 22889, 1011, 1015, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/bash -ev # # Installation Script # Written by: Tommy Lincoln <pajamapants3000@gmail.com> # Github: https://github.com/pajamapants3000 # Legal: See LICENSE in parent directory # DATE=$(date +%Y%m%d) TIME=$(date +%H%M%S) # # If executed with command line options, then instead of running installer #+the arguments should be used to modify the variables. if [ ${#} -gt 1 ]; then sed -i "s:^${1}=.*$:${1}=${2}:" exit 0 fi # # Preparation #************* source ${HOME}/.blfs_profile source loadqt4 # # For packages that don't support or do well with parallel build #PARALLEL=1 # # Name of program, with version and package/archive type PROG=homerun VERSION=1.2.5 ARCHIVE=tar.xz MD5=86ebece69eae72c548adf40da02aa354 # WORKING_DIR=$PWD SRCDIR=${WORKING_DIR}/${PROG}-${VERSION} # # Downloads; obtain and verify package(s) DL_URL=http://download.kde.org/stable DL_ALT=http://kde.mirrors.hoobly.com/stable # Prepare sources PATCHDIR=${WORKING_DIR}/patches PATCH= # Configure; prepare build PREFICKS=/opt/kde SYSCONFDER=/etc LOCALST8DER=/var # CONFIGURE: ./configure, cmake, qmake, ./autogen.sh, or other/undefined CONFIGURE="cmake" CONFIG_FLAGS="" MAKE="make" MAKE_FLAGS="" TEST= TEST_FLAGS="-k" INSTALL="install" INSTALL_FLAGS="" # # Additional/optional configurations: bootscript, group, user, ... BOOTSCRIPT= PROGGROUP= PROGUSER= USRCMNT= # #****************************************************************************# ################ No variable settings below this line! ####################### #****************************************************************************# # # Standard configuration settings: ./configure, cmake, qmake, ./autogen.sh if [ "x${CONFIGURE:$((${#CONFIGURE}-5)):5}" = "xcmake" ]; then CONFIG_FLAGS="-DCMAKE_INSTALL_PREFIX=${PREFICKS} \ -DCMAKE_BUILD_TYPE=Release \ -Wno-dev ${CONFIG_FLAGS} ${CMAKE_SRC_ROOT}" elif [ "x${CONFIGURE:$((${#CONFIGURE}-11)):11}" = "x./configure" ]; then CFG_PREFIX_FLAG="--prefix" CFG_SYSCONFDIR_FLAG="--sysconfdir" CFG_LOCALSTATEDIR_FLAG="--localstatedir" CONFIG_FLAGS="${CFG_PREFIX_FLAG}=${PREFICKS} \ ${CFG_SYSCONFDIR_FLAG}=${SYSCONFDER} \ ${CFG_LOCALSTATEDIR_FLAG}=${LOCALST8DER} \ ${CONFIG_FLAGS}" # Leave place for other possible configuration utilities to set up # For now, just do-nothing placeholder command elif [ "x${CONFIGURE:$((${#CONFIGURE}-5)):5}" = "xqmake" ]; then CONFIG_FLAGS="${CONFIG_FLAGS}" elif [ "x${CONFIGURE:$((${#CONFIGURE}-12)):12}" = "x./autogen.sh" ]; then CONFIG_FLAGS="${CONFIG_FLAGS}" else CONFIG_FLAGS="${CONFIG_FLAGS}" fi # # Default make flags MAKE_FLAGS="-j${PARALLEL} ${MAKE_FLAGS}" TEST_FLAGS="-j${PARALLEL} ${TEST_FLAGS}" INSTALL_FLAGS="-j${PARALLEL} ${INSTALL_FLAGS}" # # Add group/user if [ $PROGGROUP ]; then if ! (cat /etc/group | grep $PROGGROUP > /dev/null); then pathappend /usr/sbin as_root groupadd -g 18 $PROGGROUP fi if [ $PROGUSER ]; then if ! (cat /etc/passwd | grep $PROGUSER > /dev/null); then as_root useradd -c "${USRCMNT}" -d /var/run/${PROGUSER} \ -u 18 -g $PROGGROUP -s /bin/false $PROGUSER pathremove /usr/sbin fi fi elif [ $PROGUSER ]; then if ! (cat /etc/passwd | grep $PROGUSER > /dev/null); then as_root useradd -c "${USRCMNT}" -d /var/run/${PROGUSER} \ -u 18 -s /bin/false $PROGUSER pathremove /usr/sbin fi fi # # Installation #************** # Check for previous installation: PROCEED="yes" REINSTALL=0 grep "${PROG}-" /list-$CHRISTENED"-"$SURNAME > /dev/null && ((\!$?)) &&\ REINSTALL=1 && echo "Previous installation detected, proceed?" && read PROCEED [ $PROCEED = "yes" ] || [ $PROCEED = "y" ] || exit 0 # Download: if ! [ -f ${PROG}-${VERSION}.${ARCHIVE} ]; then wget ${DL_URL}/${PROG}/src/${PROG}-${VERSION}.${ARCHIVE} \ -O ${PROG}-${VERSION}.${ARCHIVE} || FAIL_DL=1 # FTP/alt Download: if (($FAIL_DL)) && [ $DL_ALT ]; then wget ${DL_ALT}/${PROG}/src//${PROG}-${VERSION}.${ARCHIVE} \ -O ${PROG}-${VERSION}.${ARCHIVE} || FAIL_DL=2 fi if [ $FAIL_DL == 1 ]; then echo "Download failed! Find alternate link and try again." exit 1 elif (($FAIL_DL)); then echo "${FAIL_DL} downloads failed! Find alternate link and try again." exit 1 fi fi # # md5sum: echo "${MD5} ${PROG}-${VERSION}.${ARCHIVE}" | md5sum -c ;\ ( exit ${PIPESTATUS[0]} ) # num=1 while [ -d ${PROG}-${VERSION}${INC} ]; do INC="-${num}" ((num++)) done if [ ${num} -gt 1 ]; then as_root mv ${PROG}-${VERSION} ${PROG}-${VERSION}${INC} fi # mkdir -v ${PROG}-${VERSION} tar -xf ${PROG}-${VERSION}.${ARCHIVE} -C ${PROG}-${VERSION} --strip-components=1 pushd ${PROG}-${VERSION} [ ${PATCH} ] && patch -Np1 < ${PATCHDIR}/${PATCH} # ##cmake child build #mkdir -v build && cd build ##cmake parabuild #mkdir ../{PROG}-build && cd ../${PROG}-build ##autogen first #./autogen.sh # ${CONFIGURE} ${CONFIG_FLAGS} # ${MAKE} ${MAKE_FLAGS} # # Test: if [ $TEST ]; then ${MAKE} ${TEST_FLAGS} ${TEST} 2>&1 | \ tee ../logs/${PROG}-${VERSION}-${DATE}.check; \ STAT=${PIPESTATUS[0]}; ( exit 0 ) if (( STAT )); then echo "Some tests failed; log in ../$(basename $0)-log" echo "Pull up another terminal and check the output" echo "Shall we proceed? (say "'"yes"'" or "'"y"'" to proceed)" read PROCEED [ "$PROCEED" = "y" ] || [ "$PROCEED" = "yes" ] fi fi # as_root ${MAKE} ${INSTALL_FLAGS} ${INSTALL} popd as_root rm -rf ${PROG}-${VERSION} ##cmake parabuild #as_root rm -rf ${PROG}-build # # Add to installed list for this computer: echo "${PROG}-${VERSION}" >> /list-${CHRISTENED}-${SURNAME} # (($REINSTALL)) && exit 0 || (exit 0) ################################################### # # Init Script #************* if [ $BOOTSCRIPT ]; then cd blfs-bootscripts-${BLFS_BOOTSCRIPTS_VER} as_root make install-${BOOTSCRIPT} cd .. fi # ################################################### # # Configuration #*************** # ###################################################
pajamapants3000/BLFS_scripts_etc
scripts/homerun-1.2.5.sh
Shell
mit
6,181
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 1011, 23408, 1001, 1001, 8272, 5896, 1001, 2517, 2011, 1024, 6838, 5367, 1026, 6643, 3900, 2863, 27578, 14142, 8889, 1030, 20917, 4014, 1012, 4012, 1028, 1001, 21025, 2705, 12083, 1024, 16770, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id$ */ #if HAVE_CONFIG_H #include "config.h" #endif #include "devfs.h" int devFS_node_type( rtems_filesystem_location_info_t *pathloc ) { /* * There is only one type of node: device */ return RTEMS_FILESYSTEM_DEVICE; }
t-crest/rtems
cpukit/libfs/src/devfs/devfs_node_type.c
C
gpl-2.0
409
[ 30522, 1013, 1008, 1008, 1996, 6105, 1998, 4353, 3408, 2005, 2023, 5371, 2089, 2022, 1008, 2179, 1999, 1996, 5371, 6105, 1999, 2023, 4353, 2030, 2012, 1008, 8299, 1024, 1013, 1013, 7479, 1012, 20375, 5244, 1012, 4012, 1013, 6105, 1013, 61...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * RSSAggregatingPage lets a CMS Authors aggregate and filter a number of RSS feed. */ class RSSAggregatingPage extends Page { static $db = array ( "NumberOfItems" => "Int" ); static $has_many = array( "SourceFeeds" => "RSSAggSource", "Entries" => "RSSAggEntry" ); private static $moderation_required = false; function getCMSFields() { $fields = parent::getCMSFields(); if(!isset($_REQUEST['executeForm'])) $this->updateRSS(); $fields->addFieldToTab("Root.Content.Sources", new TableField("SourceFeeds", "RSSAggSource", array( "RSSFeed" => "RSS Feed URL", "Title" => "Feed Title" ), array( "RSSFeed" => "TextField", "Title" => "ReadonlyField", ), "PageID", round($this->ID), true, "RSSFeed" )); global $number_of_items_list; // Insert Items as the first tab $fields->addFieldToTab("Root.Content", new Tab("Items"), "Main"); if ( !self::get_moderation_required() ) { $fields->addFieldToTab("Root.Content.Items", new DropdownField('NumberOfItems','Number Of Items', $number_of_items_list)); } $fields->addFieldToTab("Root.Content.Items", $entries = new TableField("Entries", "RSSAggEntry", array( "Displayed" => "Show", "DateNice" => "Date", "SourceNice" => "Source", "Title" => "Title", ), array( "Displayed" => "CheckboxField", "DateNice" => "ReadonlyField", "SourceNice" => "ReadonlyField", "Title" => "ReadonlyField", ), "PageID", round($this->ID), true, "Date DESC" )); $entries->setPermissions(array("edit")); return $fields; } /** * Use SimplePie to get all the RSS feeds and agregate them into Entries */ function updateRSS() { require_once(Director::baseFolder() . '/rssaggregator/thirdparty/simplepie/simplepie.inc'); if(!is_numeric($this->ID)) return; $goodSourceIDs = array(); foreach($this->SourceFeeds() as $sourceFeed) { $goodSourceIDs[] = $sourceFeed->ID; if(isset($_REQUEST['flush']) || strtotime($sourceFeed->LastChecked) < time() - 3600) { $simplePie = new SimplePie($sourceFeed->RSSFeed); /*$simplePie->enable_caching(false); $simplePie->enable_xmldump(true);*/ $simplePie->init(); $sourceFeed->Title = $simplePie->get_title(); $sourceFeed->LastChecked = date('Y-m-d H:i:s'); $sourceFeed->write(); $idClause = ''; $goodIDs = array(); $items = $simplePie->get_items(); //if(!$items) user_error("RSS Error: $simplePie->error", E_USER_WARNING); if($items) foreach($items as $item) { $entry = new RSSAggEntry(); $entry->Permalink = $item->get_permalink(); $entry->Date = $item->get_date('Y-m-d H:i:s'); $entry->Title = Convert::xml2raw($item->get_title()); $entry->Title = str_replace(array( '&nbsp;', '&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;', '&amp;', '&apos;' ), array( '&#160;', "'", "'", '"', '"', '&', '`' ), $entry->Title); $entry->Content = str_replace(array( '&nbsp;', '&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;', '&amp;', '&apos;' ), array( '&#160;', "'", "'", '"', '"', '&', '`' ), $item->get_description()); $entry->PageID = $this->ID; $entry->SourceID = $sourceFeed->ID; if($enclosure = $item->get_enclosure()) { $entry->EnclosureURL = $enclosure->get_link(); } $SQL_permalink = Convert::raw2sql($entry->Permalink); $existingID = DB::query("SELECT \"ID\" FROM \"RSSAggEntry\" WHERE \"Permalink\" = '$SQL_permalink' AND \"SourceID\" = $entry->SourceID AND \"PageID\" = $entry->PageID")->value(); if($existingID) $entry->ID = $existingID; $entry->write(); $goodIDs[] = $entry->ID; } if($goodIDs) { $list_goodIDs = implode(', ', $goodIDs); $idClause = "AND \"ID\" NOT IN ($list_goodIDs)"; } DB::query("DELETE FROM \"RSSAggEntry\" WHERE \"SourceID\" = $sourceFeed->ID AND \"PageID\" = $this->ID $idClause"); } } if($goodSourceIDs) { $list_goodSourceIDs = implode(', ', $goodSourceIDs); $sourceIDClause = " AND \"SourceID\" NOT IN ($list_goodSourceIDs)"; } else { $sourceIDClause = ''; } DB::query("DELETE FROM \"RSSAggEntry\" WHERE \"PageID\" = $this->ID $sourceIDClause"); } function Children() { $this->updateRSS(); // Tack the RSS feed children to the end of the children provided by the RSS feed $c1 = DataObject::get("SiteTree", "\"ParentID\" = '$this->ID'"); $c2 = DataObject::get("RSSAggEntry", "\"PageID\" = $this->ID AND \"Displayed\" = 1", "\"Date\" ASC"); if($c1) { if($c2) $c1->merge($c2); return $c1; } else { return $c2; } } /* * Set moderation mode * On (true) admin manually controls which items to display * Off (false) new imported feed item is set to display automatically * @param boolean */ static function set_moderation_required($required) { self::$moderation_required = $required; } /* * Get feed moderation mode * @return boolean */ static function get_moderation_required() { return self::$moderation_required; } } class RSSAggregatingPage_Controller extends Page_Controller { } ?>
sminnee/silverstripe-rssaggregator
code/RSSAggregatingPage.php
PHP
bsd-3-clause
5,295
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 12667, 3736, 13871, 2890, 16961, 13704, 11082, 1037, 4642, 2015, 6048, 9572, 1998, 11307, 1037, 2193, 1997, 12667, 2015, 5438, 1012, 1008, 1013, 2465, 12667, 3736, 13871, 2890, 16961, 13704, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.9.1"/> <title>V8 API Reference Guide for io.js v2.0.0: Class Members - Functions</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">V8 API Reference Guide for io.js v2.0.0 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.9.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li class="current"><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="navrow3" class="tabs2"> <ul class="tablist"> <li><a href="functions.html"><span>All</span></a></li> <li class="current"><a href="functions_func.html"><span>Functions</span></a></li> <li><a href="functions_vars.html"><span>Variables</span></a></li> <li><a href="functions_type.html"><span>Typedefs</span></a></li> <li><a href="functions_enum.html"><span>Enumerations</span></a></li> </ul> </div> <div id="navrow4" class="tabs3"> <ul class="tablist"> <li><a href="functions_func.html#index_a"><span>a</span></a></li> <li><a href="functions_func_b.html#index_b"><span>b</span></a></li> <li><a href="functions_func_c.html#index_c"><span>c</span></a></li> <li><a href="functions_func_d.html#index_d"><span>d</span></a></li> <li><a href="functions_func_e.html#index_e"><span>e</span></a></li> <li><a href="functions_func_f.html#index_f"><span>f</span></a></li> <li><a href="functions_func_g.html#index_g"><span>g</span></a></li> <li><a href="functions_func_h.html#index_h"><span>h</span></a></li> <li><a href="functions_func_i.html#index_i"><span>i</span></a></li> <li><a href="functions_func_j.html#index_j"><span>j</span></a></li> <li><a href="functions_func_l.html#index_l"><span>l</span></a></li> <li><a href="functions_func_m.html#index_m"><span>m</span></a></li> <li><a href="functions_func_n.html#index_n"><span>n</span></a></li> <li><a href="functions_func_o.html#index_o"><span>o</span></a></li> <li><a href="functions_func_p.html#index_p"><span>p</span></a></li> <li class="current"><a href="functions_func_r.html#index_r"><span>r</span></a></li> <li><a href="functions_func_s.html#index_s"><span>s</span></a></li> <li><a href="functions_func_t.html#index_t"><span>t</span></a></li> <li><a href="functions_func_u.html#index_u"><span>u</span></a></li> <li><a href="functions_func_v.html#index_v"><span>v</span></a></li> <li><a href="functions_func_w.html#index_w"><span>w</span></a></li> <li><a href="functions_func_~.html#index_~"><span>~</span></a></li> </ul> </div> </div><!-- top --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="contents"> &#160; <h3><a class="anchor" id="index_r"></a>- r -</h3><ul> <li>ReadOnlyPrototype() : <a class="el" href="classv8_1_1_function_template.html#a91d2e0643e8c5a53ab1d75f7766c2422">v8::FunctionTemplate</a> </li> <li>Release() : <a class="el" href="classv8_1_1_persistent_value_map_base.html#ae4e89289ea520ab3ad6b069ddff77ed5">v8::PersistentValueMapBase&lt; K, V, Traits &gt;</a> </li> <li>Remove() : <a class="el" href="classv8_1_1_persistent_value_map_base.html#a7d458c99e84d61d8a2e63442c0c2b979">v8::PersistentValueMapBase&lt; K, V, Traits &gt;</a> </li> <li>RemoveCallCompletedCallback() : <a class="el" href="classv8_1_1_isolate.html#a46f0a5d35f8b29030922bdb433c0dc4f">v8::Isolate</a> </li> <li>RemoveGCEpilogueCallback() : <a class="el" href="classv8_1_1_isolate.html#a277144482f5fefd58d822c22a173b01a">v8::Isolate</a> , <a class="el" href="classv8_1_1_v8.html#aee4cfeb1a6153e2e6488fb8e3c1ac6ce">v8::V8</a> </li> <li>RemoveGCPrologueCallback() : <a class="el" href="classv8_1_1_isolate.html#a7902b8b58f3c85bac9b7dd1086fa81ce">v8::Isolate</a> , <a class="el" href="classv8_1_1_v8.html#ae2b102e4db324cf06a92fd9acdd6b112">v8::V8</a> </li> <li>RemoveMemoryAllocationCallback() : <a class="el" href="classv8_1_1_isolate.html#a99349e062c11085eeb63a0d825226487">v8::Isolate</a> , <a class="el" href="classv8_1_1_v8.html#a2e188bdc8a4afccad8e326e2a43e582e">v8::V8</a> </li> <li>RemoveMessageListeners() : <a class="el" href="classv8_1_1_isolate.html#a0319e55b26ba3ac51d867b37b917a21f">v8::Isolate</a> , <a class="el" href="classv8_1_1_v8.html#a103099e00d03c714261e00d75f0d745a">v8::V8</a> </li> <li>RemovePrototype() : <a class="el" href="classv8_1_1_function_template.html#a4a184aca244174c7fe52d58871d3129e">v8::FunctionTemplate</a> </li> <li>ReportProgressValue() : <a class="el" href="classv8_1_1_activity_control.html#a1300f10611306a3e8f79239e057eb0bf">v8::ActivityControl</a> </li> <li>RequestGarbageCollectionForTesting() : <a class="el" href="classv8_1_1_isolate.html#a59fe893ed7e9df52cef2d59b2d98ab23">v8::Isolate</a> </li> <li>RequestInterrupt() : <a class="el" href="classv8_1_1_isolate.html#a971b6094ecc6c7f55eb6f58a71a8afd3">v8::Isolate</a> </li> <li>ReserveCapacity() : <a class="el" href="classv8_1_1_persistent_value_vector.html#ad4cccfee3a275986578276efe0c78510">v8::PersistentValueVector&lt; V, Traits &gt;</a> </li> <li>Reset() : <a class="el" href="classv8_1_1_persistent_base.html#a037c3a1b62263b2c2bb2096a6fba1c47">v8::PersistentBase&lt; T &gt;</a> , <a class="el" href="classv8_1_1_try_catch.html#a3aae8acab4c99b374b7d782763d4c8e1">v8::TryCatch</a> </li> <li>Resolve() : <a class="el" href="classv8_1_1_promise_1_1_resolver.html#aa1f7f6883d57879a7956e84e63b2d935">v8::Promise::Resolver</a> </li> <li>ResourceIsEmbedderDebugScript() : <a class="el" href="classv8_1_1_script_origin.html#aa4e6fedf782dd605dc2cee4c8486a894">v8::ScriptOrigin</a> </li> <li>ReThrow() : <a class="el" href="classv8_1_1_try_catch.html#a4a7506617800bbc49c3c08bbfefb9c2d">v8::TryCatch</a> </li> <li>Run() : <a class="el" href="classv8_1_1_script.html#a5f43b29d40bd51ebad2cc275ba3898a1">v8::Script</a> </li> <li>RunMicrotasks() : <a class="el" href="classv8_1_1_isolate.html#ac3cbe2a1632eb863912640dcfc98b6c8">v8::Isolate</a> </li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Aug 11 2015 23:49:51 for V8 API Reference Guide for io.js v2.0.0 by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.9.1 </small></address> </body> </html>
v8-dox/v8-dox.github.io
509b59e/html/functions_func_r.html
HTML
mit
9,336
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Service_Rackspace * @subpackage Files * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ require_once 'Zend/Service/Rackspace/Files.php'; class Zend_Service_Rackspace_Files_Object { /** * The service that has created the object * * @var Zend_Service_Rackspace_Files */ protected $service; /** * Name of the object * * @var string */ protected $name; /** * MD5 value of the object's content * * @var string */ protected $hash; /** * Size in bytes of the object's content * * @var integer */ protected $size; /** * Content type of the object's content * * @var string */ protected $contentType; /** * Date of the last modified of the object * * @var string */ protected $lastModified; /** * Object content * * @var string */ protected $content; /** * Name of the container where the object is stored * * @var string */ protected $container; /** * Constructor * * You must pass the Zend_Service_Rackspace_Files object of the caller and an associative * array with the keys "name", "container", "hash", "bytes", "content_type", * "last_modified", "file" where: * name= name of the object * container= name of the container where the object is stored * hash= the MD5 of the object's content * bytes= size in bytes of the object's content * content_type= content type of the object's content * last_modified= date of the last modified of the object * content= content of the object * * @param Zend_Service_Rackspace_Files $service * @param array $data */ public function __construct($service,$data) { if (!($service instanceof Zend_Service_Rackspace_Files) || !is_array($data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass a RackspaceFiles and an array"); } if (!array_key_exists('name', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the name of the object in the array (name)"); } if (!array_key_exists('container', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the container of the object in the array (container)"); } if (!array_key_exists('hash', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the hash of the object in the array (hash)"); } if (!array_key_exists('bytes', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the byte size of the object in the array (bytes)"); } if (!array_key_exists('content_type', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the content type of the object in the array (content_type)"); } if (!array_key_exists('last_modified', $data)) { require_once 'Zend/Service/Rackspace/Files/Exception.php'; throw new Zend_Service_Rackspace_Files_Exception("You must pass the last modified data of the object in the array (last_modified)"); } $this->name= $data['name']; $this->container= $data['container']; $this->hash= $data['hash']; $this->size= $data['bytes']; $this->contentType= $data['content_type']; $this->lastModified= $data['last_modified']; if (!empty($data['content'])) { $this->content= $data['content']; } $this->service= $service; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Get the name of the container * * @return string */ public function getContainer() { return $this->container; } /** * Get the MD5 of the object's content * * @return string|boolean */ public function getHash() { return $this->hash; } /** * Get the size (in bytes) of the object's content * * @return integer|boolean */ public function getSize() { return $this->size; } /** * Get the content type of the object's content * * @return string */ public function getContentType() { return $this->contentType; } /** * Get the data of the last modified of the object * * @return string */ public function getLastModified() { return $this->lastModified; } /** * Get the content of the object * * @return string */ public function getContent() { return $this->content; } /** * Get the metadata of the object * If you don't pass the $key it returns the entire array of metadata value * * @param string $key * @return string|array|boolean */ public function getMetadata($key=null) { $result= $this->service->getMetadataObject($this->container,$this->name); if (!empty($result)) { if (empty($key)) { return $result['metadata']; } if (isset($result['metadata'][$key])) { return $result['metadata'][$key]; } } return false; } /** * Set the metadata value * The old metadata values are replaced with the new one * * @param array $metadata * @return boolean */ public function setMetadata($metadata) { return $this->service->setMetadataObject($this->container,$this->name,$metadata); } /** * Copy the object to another container * You can add metadata information to the destination object, change the * content_type and the name of the object * * @param string $container_dest * @param string $name_dest * @param array $metadata * @param string $content_type * @return boolean */ public function copyTo($container_dest,$name_dest,$metadata=array(),$content_type=null) { return $this->service->copyObject($this->container,$this->name,$container_dest,$name_dest,$metadata,$content_type); } /** * Get the CDN URL of the object * * @return string */ public function getCdnUrl() { $result= $this->service->getInfoCdnContainer($this->container); if ($result!==false) { if ($result['cdn_enabled']) { return $result['cdn_uri'].'/'.$this->name; } } return false; } /** * Get the CDN SSL URL of the object * * @return string */ public function getCdnUrlSsl() { $result= $this->service->getInfoCdnContainer($this->container); if ($result!==false) { if ($result['cdn_enabled']) { return $result['cdn_uri_ssl'].'/'.$this->name; } } return false; } }
mattsimpson/entrada-1x
www-root/core/library/Zend/Service/Rackspace/Files/Object.php
PHP
gpl-3.0
8,137
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 16729, 2094, 7705, 1008, 1008, 6105, 1008, 1008, 2023, 3120, 5371, 2003, 3395, 2000, 1996, 2047, 18667, 2094, 6105, 2008, 2003, 24378, 1008, 2007, 2023, 7427, 1999, 1996, 5371, 6105, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class Kubeprod < Formula desc "Installer for the Bitnami Kubernetes Production Runtime (BKPR)" homepage "https://kubeprod.io" url "https://github.com/bitnami/kube-prod-runtime/archive/v1.6.1.tar.gz" sha256 "fdf5b82ea274033488af2c2c6057507e601366f61b2f888b33bee767e4000d77" license "Apache-2.0" bottle do sha256 cellar: :any_skip_relocation, arm64_big_sur: "a65d7ea7bfd9b2d2fbd6606440ea83c6b0003fbbdccaa47bb50bac7499d842df" sha256 cellar: :any_skip_relocation, big_sur: "ea49a918a879287e50d1b4161113efd395bd0c80afc0394f6453f9d70af9e60d" sha256 cellar: :any_skip_relocation, catalina: "72b78c5b8393d7fe37d9b1ec1e53f32a34162f4a6379ddd2250bbe5680c53d3e" sha256 cellar: :any_skip_relocation, mojave: "75fc89249f53f9b8fe8e09bf3970c11ddc2aaa417f49735c2ac79b0d468dca3e" sha256 cellar: :any_skip_relocation, high_sierra: "bf0f97d8da14fd61c43cf1844eb4899f81073719c233aaaa0856f971e0dfc048" end depends_on "go" => :build def install cd "kubeprod" do system "go", "build", *std_go_args, "-ldflags", "-X main.version=v#{version}", "-mod=vendor" end end test do version_output = shell_output("#{bin}/kubeprod version") assert_match "Installer version: v#{version}", version_output (testpath/"kube-config").write <<~EOS apiVersion: v1 clusters: - cluster: certificate-authority-data: test server: http://127.0.0.1:8080 name: test contexts: - context: cluster: test user: test name: test current-context: test kind: Config preferences: {} users: - name: test user: token: test EOS authz_domain = "castle-black.com" project = "white-walkers" oauth_client_id = "jon-snow" oauth_client_secret = "king-of-the-north" contact_email = "jon@castle-black.com" ENV["KUBECONFIG"] = testpath/"kube-config" system "#{bin}/kubeprod", "install", "gke", "--authz-domain", authz_domain, "--project", project, "--oauth-client-id", oauth_client_id, "--oauth-client-secret", oauth_client_secret, "--email", contact_email, "--only-generate" json = File.read("kubeprod-autogen.json") assert_match "\"authz_domain\": \"#{authz_domain}\"", json assert_match "\"client_id\": \"#{oauth_client_id}\"", json assert_match "\"client_secret\": \"#{oauth_client_secret}\"", json assert_match "\"contactEmail\": \"#{contact_email}\"", json jsonnet = File.read("kubeprod-manifest.jsonnet") assert_match "https://releases.kubeprod.io/files/v#{version}/manifests/platforms/gke.jsonnet", jsonnet end end
dsXLII/homebrew-core
Formula/kubeprod.rb
Ruby
bsd-2-clause
2,823
[ 30522, 2465, 13970, 4783, 21572, 2094, 1026, 5675, 4078, 2278, 1000, 16500, 2121, 2005, 1996, 2978, 28987, 13970, 5677, 7159, 2229, 2537, 2448, 7292, 1006, 23923, 18098, 1007, 1000, 2188, 13704, 1000, 16770, 1024, 1013, 1013, 13970, 4783, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: Op Sabbat De Wijnpersen Treden date: 11/12/2019 --- `Lees Nehemia 13:15-16. Welk probleem spreekt Nehemia hier aan?` Het is niet gemakkelijk voor God op te komen als je in de minderheid bent. God had gezegd dat de sabbat een heilige dag moest zijn waarop niemand enig werk zou verrichten en daarom had Nehemia zich voorgenomen dat hij alles zou doen wat nodig was om ervoor te zorgen dat dit gebod in Jeruzalem werd nageleefd. Hij zal ongetwijfeld de morele verplichting hebben gevoeld om hiervoor te staan en in overeenstemming daarmee te handelen. De sabbat was het hoogtepunt van de scheppingsweek. De mens kan op die speciale dag nieuwe energie opdoen en zich ontspannen door de omgang met God. Daarvoor hebben ze in het dagelijks leven geen tijd door hun werk of door andere wereldse bezigheden. Er wordt weleens gezegd dat ‘de sabbat eerder Israël bijeen heeft gehouden dan dat Israël de sabbat heeft gehouden’. Het punt is dat de sabbat een krachtig middel was en is om het geloof te versterken van hen die door Gods genade ernaar streven de zevende dag te houden en te genieten van de fysieke en geestelijke voordelen die het ons biedt. `Lees Nehemia 13:17-22. Wat doet Nehemia om het ‘kopen en verkopen’ op sabbat een halt toe te roepen?` Hij was aangesteld als de gouverneur van Juda en daarom zag Nehemia het als zijn taak de regels te handhaven. Die waren in Juda gebaseerd op Gods wet en daarom werd hij de beschermer van die wet en dus ook van de sabbat. Als de welgestelden in Juda de corruptie hadden aangepakt waaraan de hogepriester zich schuldig maakte, dan had Nehemia zich niet in deze situatie bevonden. De leidinggevenden en vooraanstaande burgers koesterden misschien zelf ook wel een wrok tegen Nehemia omdat hij hun voorheen had opgedragen geld terug te geven aan de armen. Ze leken daarom ook geen bezwaar te maken tegen de veranderingen die Eljasib en Tobia aanbrachten. De terechtwijzingen van Nehemia zijn allereerst gericht tegen deze vooraanstaande burgers. Daarna geeft hij opdracht de poorten te sluiten en zet hij zijn mannen erbij om die te bewaken. Als de markt als gevolg daarvan niet meer binnen de stad plaatsvond maar erbuiten, nam hij nog drastischer maatregelen. Hij dreigde de kooplieden op de volgende sabbat in te rekenen. Nehemia moet een man van zijn woord zijn geweest, want de handelaren begrepen het maar al te goed en bleven vanaf dat moment weg.
PrJared/sabbath-school-lessons
src/nl/2019-04/11/05.md
Markdown
mit
2,427
[ 30522, 1011, 1011, 1011, 2516, 1024, 6728, 7842, 22414, 2102, 2139, 15536, 22895, 7347, 2368, 29461, 4181, 3058, 1024, 2340, 1013, 2260, 1013, 10476, 1011, 1011, 1011, 1036, 3389, 2015, 11265, 29122, 2401, 2410, 1024, 2321, 1011, 2385, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /********************************************************* * All important data * * @package TwitterAPI-PHP-AJAX * @author Bastien Pederencino <bpderencino@legtux.org> * @license GNU General Public License 2 * @version 0.1.0 * @link http://github.com/ZeromusSoftware/RPi3500 ********************************************************/ session_start(); /*---------------- From http://apps.twitter.com---------*/ $consumer_key = "MOOfGGz2nNNp787ck7fmpJJ6T"; $consumer_secret = "o3qc94zRF94nMiDXvA2m4QqbYzDY4JAC6dTHlAFZvccDuqYF42"; $oauth_token = "736545163393257473-g2jSwHygNDRhkeY7eKAbdrEaQ3B1Uk1"; $oauth_token_secret = "3X0N3m7r5aJq6AVqCBQIgmoGGs69libl3BcLtA8kwRflV"; $settings = array( 'oauth_access_token' => $oauth_token, 'oauth_access_token_secret' => $oauth_token_secret, 'consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret ); /*---- From https://github.com/J7mbo/twitter-api-php ---*/ require_once('TwitterAPIExchange.php'); ?>
ZeromusSoftware/RPi3500
apiweb/twitterAPI-PHP-AJAX/post_info6.php
PHP
gpl-2.0
999
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * duena functions and definitions * * @package duena */ /** * Set the content width based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 900; /* pixels */ // The excerpt based on words if ( !function_exists('duena_string_limit_words') ) { function duena_string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); $res = implode(' ', $words); $res = trim ($res); $res = preg_replace("/[.]+$/", "", $res); if ( '' != $res) { return $res . '... '; } else { return $res; } } } /* * Load Files. */ //Loading options.php for theme customizer include_once( get_template_directory() . '/options.php'); //Loads the Options Panel if ( !function_exists( 'optionsframework_init' ) ) { define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/options/' ); include_once( get_template_directory() . '/options/options-framework.php' ); } /* * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.php' ); if ( ! function_exists( 'duena_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. */ function duena_setup() { $defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults ); /** * Custom functions that act independently of the theme templates */ require( get_template_directory() . '/inc/extras.php' ); /** * Customizer additions */ require( get_template_directory() . '/inc/customizer.php' ); /** * Make theme available for translation * Translations can be filed in the /languages/ directory * If you're building a theme based on duena, use a find and replace * to change 'duena' to the name of your theme in all the template files */ load_theme_textdomain( 'duena', get_template_directory() . '/languages' ); /** * Add editor styles */ add_editor_style( 'css/editor-style.css' ); /** * Add default posts and comments RSS feed links to head */ add_theme_support( 'automatic-feed-links' ); /** * This theme uses wp_nav_menu() in two locations. */ register_nav_menus( array( 'primary' => __( 'Primary Menu', 'duena' ), 'footer' => __( 'Footer Menu', 'duena' ) ) ); /* * This theme supports all available post formats. * See http://codex.wordpress.org/Post_Formats * * Structured post formats are formats where Twenty Thirteen handles the * output instead of the default core HTML output. */ add_theme_support( 'structured-post-formats', array( 'link', 'video' ) ); add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'quote', 'status' ) ); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); /** * Add image sizes */ if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9 add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 750, 290, true ); // Normal post thumbnails add_image_size( 'slider-post-thumbnail', 1140, 440, true ); // Slider Thumbnail add_image_size( 'image_post_format', 750, 440, true ); // Image Post Format output add_image_size( 'related-thumb', 160, 160, true ); // Realted Post Image output add_image_size( 'portfolio-large-th', 550, 210, true ); // 2 cols portfolio image add_image_size( 'portfolio-small-th', 265, 100, true ); // 4 cols portfolio image } } endif; // duena_setup add_action( 'after_setup_theme', 'duena_setup' ); /** * Register widgetized area and update sidebar with default widgets */ function duena_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'duena' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } //add_action( 'widgets_init', 'duena_widgets_init' ); /** * Enqueue scripts and styles */ function duena_styles() { global $wp_styles; // Bootstrap styles wp_register_style( 'duena-bootstrap', get_template_directory_uri() . '/bootstrap/css/bootstrap.css'); wp_enqueue_style( 'duena-bootstrap' ); // Slider styles wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css'); wp_enqueue_style( 'flexslider' ); // Popup styles wp_register_style( 'magnific', get_template_directory_uri() . '/css/magnific-popup.css'); wp_enqueue_style( 'magnific' ); // FontAwesome stylesheet wp_register_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css', '', '4.0.3'); wp_enqueue_style( 'font-awesome' ); // Main stylesheet wp_enqueue_style( 'duena-style', get_stylesheet_uri() ); // Add inline styles from theme options $duena_user_css = duena_get_user_colors(); wp_add_inline_style( 'duena-style', $duena_user_css ); // Loads the Internet Explorer specific stylesheet. wp_enqueue_style( 'duena_ie', get_template_directory_uri() . '/css/ie.css' ); $wp_styles->add_data( 'duena_ie', 'conditional', 'lt IE 9' ); } function duena_scripts() { wp_enqueue_script( 'duena-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'duena-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'duena-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } // Menu scripts wp_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), '1.4.8', true); wp_enqueue_script('mobilemenu', get_template_directory_uri() . '/js/jquery.mobilemenu.js', array('jquery'), '1.0', true); wp_enqueue_script('sf_Touchscreen', get_template_directory_uri() . '/js/sfmenu-touch.js', array('jquery'), '1.0', true); // Slider wp_enqueue_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array('jquery'), '2.1', true); // PopUp wp_enqueue_script('magnific', get_template_directory_uri() . '/js/jquery.magnific-popup.js', array('jquery'), '0.8.9', true); // Bootstrap JS wp_enqueue_script('bootstrap-custom', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '1.0', true); // Custom Script File wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0', true); } add_action( 'wp_enqueue_scripts', 'duena_scripts', 10 ); add_action( 'wp_enqueue_scripts', 'duena_styles', 10 ); /** * Include additional assests for admin area */ function duena_admin_assets() { $screen = get_current_screen(); if ( isset( $screen ) && 'page' == $screen->post_type ) { // scripts wp_enqueue_script( 'duena-admin-script', get_template_directory_uri() . '/js/admin-scripts.js', array('jquery'), '1.0', true ); // styles wp_enqueue_style( 'duena-admin-style', get_template_directory_uri() . '/css/admin-style.css', '', '1.0' ); } } add_action( 'admin_enqueue_scripts', 'duena_admin_assets' ); /** * Adding class 'active' to current menu item */ add_filter( 'nav_menu_css_class', 'duena_active_item_classes', 10, 2 ); function duena_active_item_classes($classes = array(), $menu_item = false){ if(in_array('current-menu-item', $menu_item->classes)){ $classes[] = 'active'; } return $classes; } /** * Load localization */ load_theme_textdomain( 'duena', get_template_directory() . '/languages' ); /*-----------------------------------------------------------------------------------*/ /* Custom Gallery /*-----------------------------------------------------------------------------------*/ if ( ! function_exists( 'duena_featured_gallery' ) ) : function duena_featured_gallery() { $pattern = get_shortcode_regex(); if ( preg_match( "/$pattern/s", get_the_content(), $match ) && 'gallery' == $match[2] ) { add_filter( 'shortcode_atts_gallery', 'duena_gallery_atts' ); echo do_shortcode_tag( $match ); } } endif; function duena_gallery_atts( $atts ) { $atts['size'] = 'large'; return $atts; } /*-----------------------------------------------------------------------------------*/ /* Get link URL for link post type /*-----------------------------------------------------------------------------------*/ function duena_get_link_url() { $has_url = get_the_post_format_url(); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } /*-----------------------------------------------------------------------------------*/ /* Breabcrumbs /*-----------------------------------------------------------------------------------*/ if (! function_exists( 'duena_breadcrumb' )) { function duena_breadcrumb() { $showOnHome = 0; // 1 - show "breadcrumbs" on home page, 0 - hide $delimiter = '<li class="divider">/</li>'; // divider $home = 'Home'; // text for link "Home" $showCurrent = 1; // 1 - show title current post/page, 0 - hide $before = '<li class="active">'; // open tag for active breadcrumb $after = '</li>'; // close tag for active breadcrumb global $post; $homeLink = home_url(); if (is_front_page()) { if ($showOnHome == 1) echo '<ul class="breadcrumb breadcrumb__t"><li><a href="' . $homeLink . '">' . $home . '</a><li></ul>'; } else { echo '<ul class="breadcrumb breadcrumb__t"><li><a href="' . $homeLink . '">' . $home . '</a></li> ' . $delimiter . ' '; if ( is_home() ) { echo $before . 'Blog' . $after; } elseif ( is_category() ) { $thisCat = get_category(get_query_var('cat'), false); if ($thisCat->parent != 0) echo get_category_parents($thisCat->parent, TRUE, ' ' . $delimiter . ' '); echo $before . 'Category Archives: "' . single_cat_title('', false) . '"' . $after; } elseif ( is_search() ) { echo $before . 'Search for: "' . get_search_query() . '"' . $after; } elseif ( is_day() ) { echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li> ' . $delimiter . ' '; echo '<li><a href="' . get_month_link(get_the_time('Y'),get_the_time('m')) . '">' . get_the_time('F') . '</a></li> ' . $delimiter . ' '; echo $before . get_the_time('d') . $after; } elseif ( is_month() ) { echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li> ' . $delimiter . ' '; echo $before . get_the_time('F') . $after; } elseif ( is_year() ) { echo $before . get_the_time('Y') . $after; } elseif ( is_single() && !is_attachment() ) { if ( get_post_type() != 'post' ) { $post_name = get_post_type(); $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '<li><a href="' . $homeLink . '/' . $post_name . '/">' . $post_type->labels->singular_name . '</a></li>'; if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; $cats = get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); if ($showCurrent == 0) $cats = preg_replace("#^(.+)\s$delimiter\s$#", "$1", $cats); echo $cats; if ($showCurrent == 1) echo $before . get_the_title() . $after; } } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo '<li><a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a></li>'; if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { if ($showCurrent == 1) echo $before . get_the_title() . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<li><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></li>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs)-1) echo ' ' . $delimiter . ' '; } if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after; } elseif ( is_tag() ) { echo $before . 'Tag Archives: "' . single_tag_title('', false) . '"' . $after; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $before . 'by ' . $userdata->display_name . $after; } elseif ( is_404() ) { echo $before . '404' . $after; } /* if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' ('; echo __(' Page') . ' ' . get_query_var('paged'); if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')'; } */ echo '</ul>'; } } // end breadcrumbs() } /*-----------------------------------------------------------------------------------*/ /* Author Bio /*-----------------------------------------------------------------------------------*/ add_action( 'before_sidebar', 'duena_show_author_bio', 10 ); function duena_show_author_bio() { if ( 'no' != of_get_option('g_author_bio') ) { ?> <div class="author_bio_sidebar"> <div class="social_box"> <?php if ( '' != of_get_option('g_author_bio_social_twitter') ) { echo "<a href='".esc_url( of_get_option('g_author_bio_social_twitter') )."' target='_blank'><i class='fa fa-twitter'></i></a>\n"; } if ( '' != of_get_option('g_author_bio_social_facebook') ) { echo "<a href='".esc_url( of_get_option('g_author_bio_social_facebook') )."' target='_blank'><i class='fa fa-facebook'></i></a>\n"; } if ( '' != of_get_option('g_author_bio_social_google') ) { echo "<a href='".esc_url( of_get_option('g_author_bio_social_google') )."' target='_blank'><i class='fa fa-google-plus'></i></a>\n"; } if ( '' != of_get_option('g_author_bio_social_linked') ) { echo "<a href='".esc_url( of_get_option('g_author_bio_social_linked') )."' target='_blank'><i class='fa fa-linkedin'></i></a>\n"; } if ( '' != of_get_option('g_author_bio_social_rss') ) { echo "<a href='".esc_url( of_get_option('g_author_bio_social_rss') )."' target='_blank'><i class='fa fa-rss'></i></a>\n"; } ?> </div> <?php if (( '' != of_get_option('g_author_bio_title') ) || ('' != of_get_option('g_author_bio_img')) || ('' != of_get_option('g_author_bio_message')) ) { ?> <div class="content_box"> <?php if ( '' != of_get_option('g_author_bio_title') ) { echo "<h2>".of_get_option('g_author_bio_title')."</h2>\n"; } if ( '' != of_get_option('g_author_bio_img') ) { if ( '' != of_get_option('g_author_bio_title') ) { $img_alt = of_get_option('g_author_bio_title'); } else { $img_alt = get_bloginfo( 'name' ); } echo "<figure class='author_bio_img'><img src='".esc_url( of_get_option('g_author_bio_img') )."' alt='".esc_attr( $img_alt )."'></figure>\n"; } if ( '' != of_get_option('g_author_bio_message') ) { echo "<div class='author_bio_message'>".of_get_option('g_author_bio_message')."</div>\n"; } ?> </div> <?php } ?> </div> <?php } } /*-----------------------------------------------------------------------------------*/ /* Pagination (based on Twenty Fourteen pagination function) /*-----------------------------------------------------------------------------------*/ function duena_pagination() { global $wp_query, $wp_rewrite; if ( $wp_query->max_num_pages < 2 ) { return; } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%'; // Set up paginated links. $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_text' => __( '&larr; Previous', 'duena' ), 'next_text' => __( 'Next &rarr;', 'duena' ), 'type' => 'list' ) ); if ( $links ) { ?> <div class="page_nav_wrap"> <div class="post_nav"> <?php echo $links; ?> </div><!-- .pagination --> </div><!-- .navigation --> <?php } } /*-----------------------------------------------------------------------------------*/ /* Custom Comments Structure /*-----------------------------------------------------------------------------------*/ function duena_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>" class="clearfix"> <div id="comment-<?php comment_ID(); ?>" class="comment-body clearfix"> <div class="clearfix"> <div class="comment-author vcard"> <?php echo get_avatar( $comment->comment_author_email, 65 ); ?> <?php printf(__('<span class="author fn">%1$s</span>' ), get_comment_author_link()) ?> </div> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.', 'cherry') ?></em> <?php endif; ?> <div class="extra-wrap"> <?php comment_text() ?> </div> </div> <div class="clearfix comment-footer"> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> <div class="comment-meta commentmetadata"><?php printf(__('%1$s', 'cherry' ), get_comment_date('F j, Y')) ?></div> </div> </div> <?php } if (!function_exists('img_html_to_post_id')) { function img_html_to_post_id( $html, &$matched_html = null ) { $attachment_id = 0; // Look for an <img /> tag if ( ! preg_match( '#' . get_tag_regex( 'img' ) . '#i', $html, $matches ) || empty( $matches ) ) return $attachment_id; $matched_html = $matches[0]; // Look for attributes. if ( ! preg_match_all( '#(src|class)=([\'"])(.+?)\2#is', $matched_html, $matches ) || empty( $matches ) ) return $attachment_id; $attr = array(); foreach ( $matches[1] as $key => $attribute_name ) $attr[ $attribute_name ] = $matches[3][ $key ]; if ( ! empty( $attr['class'] ) && false !== strpos( $attr['class'], 'wp-image-' ) ) if ( preg_match( '#wp-image-([0-9]+)#i', $attr['class'], $matches ) ) $attachment_id = absint( $matches[1] ); if ( ! $attachment_id && ! empty( $attr['src'] ) ) $attachment_id = attachment_url_to_postid( $attr['src'] ); return $attachment_id; } } if (!function_exists('duena_footer_js')) { function duena_footer_js() { $sf_delay = esc_attr( of_get_option('sf_delay') ); $sf_f_animation = esc_attr( of_get_option('sf_f_animation') ); $sf_sl_animation = esc_attr( of_get_option('sf_sl_animation') ); $sf_speed = esc_attr( of_get_option('sf_speed') ); $sf_arrows = esc_attr( of_get_option('sf_arrows') ); if ('' == $sf_delay) {$sf_delay = 1000;} if ('' == $sf_f_animation) {$sf_f_animation = 'show';} if ('' == $sf_sl_animation) {$sf_sl_animation = 'show';} if ('' == $sf_speed) {$sf_speed = 'normal';} if ('' == $sf_arrows) {$sf_arrows = 'false';} ?> <script type="text/javascript"> // initialise plugins jQuery(function(){ // main navigation init jQuery('.navbar_inner > ul').superfish({ delay: <?php echo $sf_delay; ?>, // one second delay on mouseout animation: {opacity:"<?php echo $sf_f_animation; ?>", height:"<?php echo $sf_sl_animation; ?>"}, // fade-in and slide-down animation speed: '<?php echo $sf_speed; ?>', // faster animation speed autoArrows: <?php echo $sf_arrows; ?>, // generation of arrow mark-up (for submenu) dropShadows: false }); jQuery('.navbar_inner > div > ul').superfish({ delay: <?php echo $sf_delay; ?>, // one second delay on mouseout animation: {opacity:"<?php echo $sf_f_animation; ?>", height:"<?php echo $sf_sl_animation; ?>"}, // fade-in and slide-down animation speed: '<?php echo $sf_speed; ?>', // faster animation speed autoArrows: <?php echo $sf_arrows; ?>, // generation of arrow mark-up (for submenu) dropShadows: false }); }); jQuery(function(){ var ismobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) if(ismobile){ jQuery('.navbar_inner > ul').sftouchscreen(); jQuery('.navbar_inner > div > ul').sftouchscreen(); } }); </script> <!--[if (gt IE 9)|!(IE)]><!--> <script type="text/javascript"> jQuery(function(){ jQuery('.navbar_inner > ul').mobileMenu(); jQuery('.navbar_inner > div > ul').mobileMenu(); }) </script> <!--<![endif]--> <?php } add_action( 'wp_footer', 'duena_footer_js', 20, 1 ); }
werner/78publicity
wp-content/themes/duena/functions.php
PHP
gpl-2.0
23,364
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 2349, 2532, 4972, 1998, 15182, 1008, 1008, 1030, 7427, 2349, 2532, 1008, 1013, 1013, 1008, 1008, 1008, 2275, 1996, 4180, 9381, 2241, 2006, 1996, 4323, 1005, 1055, 2640, 1998, 6782, 21030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright 2005-2014 Intel Corporation. All Rights Reserved. This file is part of Threading Building Blocks. Threading Building Blocks 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. Threading Building Blocks 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 Threading Building Blocks; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA As a special exception, you may use this file as part of a free software library without restriction. Specifically, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other files to produce an executable, this file does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ #define NOMINMAX #include "harness_defs.h" #include "tbb/concurrent_queue.h" #include "tbb/tick_count.h" #include "harness.h" #include "harness_allocator.h" #include <vector> static tbb::atomic<long> FooConstructed; static tbb::atomic<long> FooDestroyed; enum state_t{ LIVE=0x1234, DEAD=0xDEAD }; class Foo { state_t state; public: int thread_id; int serial; Foo() : state(LIVE), thread_id(0), serial(0) { ++FooConstructed; } Foo( const Foo& item ) : state(LIVE) { ASSERT( item.state==LIVE, NULL ); ++FooConstructed; thread_id = item.thread_id; serial = item.serial; } ~Foo() { ASSERT( state==LIVE, NULL ); ++FooDestroyed; state=DEAD; thread_id=DEAD; serial=DEAD; } void operator=( const Foo& item ) { ASSERT( item.state==LIVE, NULL ); ASSERT( state==LIVE, NULL ); thread_id = item.thread_id; serial = item.serial; } bool is_const() {return false;} bool is_const() const {return true;} static void clear_counters() { FooConstructed = 0; FooDestroyed = 0; } static long get_n_constructed() { return FooConstructed; } static long get_n_destroyed() { return FooDestroyed; } }; // problem size static const int N = 50000; // # of bytes #if TBB_USE_EXCEPTIONS //! Exception for concurrent_queue class Foo_exception : public std::bad_alloc { public: virtual const char *what() const throw() { return "out of Foo limit"; } virtual ~Foo_exception() throw() {} }; static tbb::atomic<long> FooExConstructed; static tbb::atomic<long> FooExDestroyed; static tbb::atomic<long> serial_source; static long MaxFooCount = 0; static const long Threshold = 400; class FooEx { state_t state; public: int serial; FooEx() : state(LIVE) { ++FooExConstructed; serial = serial_source++; } FooEx( const FooEx& item ) : state(LIVE) { ASSERT( item.state == LIVE, NULL ); ++FooExConstructed; if( MaxFooCount && (FooExConstructed-FooExDestroyed) >= MaxFooCount ) // in push() throw Foo_exception(); serial = item.serial; } ~FooEx() { ASSERT( state==LIVE, NULL ); ++FooExDestroyed; state=DEAD; serial=DEAD; } void operator=( FooEx& item ) { ASSERT( item.state==LIVE, NULL ); ASSERT( state==LIVE, NULL ); serial = item.serial; if( MaxFooCount==2*Threshold && (FooExConstructed-FooExDestroyed) <= MaxFooCount/4 ) // in pop() throw Foo_exception(); } #if __TBB_CPP11_RVALUE_REF_PRESENT void operator=( FooEx&& item ) { operator=( item ); item.serial = 0; } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ } ; #endif /* TBB_USE_EXCEPTIONS */ const size_t MAXTHREAD = 256; static int Sum[MAXTHREAD]; //! Count of various pop operations /** [0] = pop_if_present that failed [1] = pop_if_present that succeeded [2] = pop */ static tbb::atomic<long> PopKind[3]; const int M = 10000; #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT && __TBB_CPP11_RVALUE_REF_PRESENT const size_t push_selector_variants = 3; #elif __TBB_CPP11_RVALUE_REF_PRESENT const size_t push_selector_variants = 2; #else const size_t push_selector_variants = 1; #endif template<typename CQ, typename ValueType, typename CounterType> void push( CQ& q, ValueType v, CounterType i ) { switch( i % push_selector_variants ) { case 0: q.push( v ); break; #if __TBB_CPP11_RVALUE_REF_PRESENT case 1: q.push( std::move(v) ); break; #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT case 2: q.emplace( v ); break; #endif #endif default: ASSERT( false, NULL ); break; } } template<typename CQ,typename T> struct Body: NoAssign { CQ* queue; const int nthread; Body( int nthread_ ) : nthread(nthread_) {} void operator()( int thread_id ) const { long pop_kind[3] = {0,0,0}; int serial[MAXTHREAD+1]; memset( serial, 0, nthread*sizeof(int) ); ASSERT( thread_id<nthread, NULL ); long sum = 0; for( long j=0; j<M; ++j ) { T f; f.thread_id = DEAD; f.serial = DEAD; bool prepopped = false; if( j&1 ) { prepopped = queue->try_pop( f ); ++pop_kind[prepopped]; } T g; g.thread_id = thread_id; g.serial = j+1; push( *queue, g, j ); if( !prepopped ) { while( !(queue)->try_pop(f) ) __TBB_Yield(); ++pop_kind[2]; } ASSERT( f.thread_id<=nthread, NULL ); ASSERT( f.thread_id==nthread || serial[f.thread_id]<f.serial, "partial order violation" ); serial[f.thread_id] = f.serial; sum += f.serial-1; } Sum[thread_id] = sum; for( int k=0; k<3; ++k ) PopKind[k] += pop_kind[k]; } }; // Define wrapper classes to test tbb::concurrent_queue<T> template<typename T, typename A = tbb::cache_aligned_allocator<T> > class ConcQWithSizeWrapper : public tbb::concurrent_queue<T, A> { public: ConcQWithSizeWrapper() {} ConcQWithSizeWrapper( const ConcQWithSizeWrapper& q ) : tbb::concurrent_queue<T, A>( q ) {} ConcQWithSizeWrapper(const A& a) : tbb::concurrent_queue<T, A>( a ) {} #if __TBB_CPP11_RVALUE_REF_PRESENT ConcQWithSizeWrapper(ConcQWithSizeWrapper&& q) : tbb::concurrent_queue<T>( std::move(q) ) {} ConcQWithSizeWrapper(ConcQWithSizeWrapper&& q, const A& a) : tbb::concurrent_queue<T, A>( std::move(q), a ) { } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ template<typename InputIterator> ConcQWithSizeWrapper( InputIterator begin, InputIterator end, const A& a = A()) : tbb::concurrent_queue<T, A>(begin,end,a) {} size_t size() const { return this->unsafe_size(); } }; template<typename T> class ConcQPushPopWrapper : public tbb::concurrent_queue<T> { public: ConcQPushPopWrapper() : my_capacity( size_t(-1)/(sizeof(void*)+sizeof(T)) ) {} size_t size() const { return this->unsafe_size(); } void set_capacity( const ptrdiff_t n ) { my_capacity = n; } bool try_push( const T& source ) { return this->push( source ); } bool try_pop( T& dest ) { return this->tbb::concurrent_queue<T>::try_pop( dest ); } size_t my_capacity; }; template<typename T> class ConcQWithCapacity : public tbb::concurrent_queue<T> { public: ConcQWithCapacity() : my_capacity( size_t(-1)/(sizeof(void*)+sizeof(T)) ) {} size_t size() const { return this->unsafe_size(); } size_t capacity() const { return my_capacity; } void set_capacity( const int n ) { my_capacity = n; } bool try_push( const T& source ) { this->push( source ); return (size_t)source.serial<my_capacity; } bool try_pop( T& dest ) { this->tbb::concurrent_queue<T>::try_pop( dest ); return (size_t)dest.serial<my_capacity; } size_t my_capacity; }; template <typename Queue> void AssertEquality(Queue &q, const std::vector<typename Queue::value_type> &vec) { ASSERT(q.size() == typename Queue::size_type(vec.size()), NULL); ASSERT(std::equal(q.unsafe_begin(), q.unsafe_end(), vec.begin(), Harness::IsEqual()), NULL); } template <typename Queue> void AssertEmptiness(Queue &q) { ASSERT(q.empty(), NULL); ASSERT(!q.size(), NULL); typename Queue::value_type elem; ASSERT(!q.try_pop(elem), NULL); } enum push_t { push_op, try_push_op }; template<push_t push_op> struct pusher { #if __TBB_CPP11_RVALUE_REF_PRESENT template<typename CQ, typename VType> static bool push( CQ& queue, VType&& val ) { queue.push( std::forward<VType>( val ) ); return true; } #else template<typename CQ, typename VType> static bool push( CQ& queue, const VType& val ) { queue.push( val ); return true; } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ }; template<> struct pusher< try_push_op > { #if __TBB_CPP11_RVALUE_REF_PRESENT template<typename CQ, typename VType> static bool push( CQ& queue, VType&& val ) { return queue.try_push( std::forward<VType>( val ) ); } #else template<typename CQ, typename VType> static bool push( CQ& queue, const VType& val ) { return queue.try_push( val ); } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ }; enum pop_t { pop_op, try_pop_op }; template<pop_t pop_op> struct popper { #if __TBB_CPP11_RVALUE_REF_PRESENT template<typename CQ, typename VType> static bool pop( CQ& queue, VType&& val ) { if( queue.empty() ) return false; queue.pop( std::forward<VType>( val ) ); return true; } #else template<typename CQ, typename VType> static bool pop( CQ& queue, VType& val ) { if( queue.empty() ) return false; queue.pop( val ); return true; } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ }; template<> struct popper< try_pop_op > { #if __TBB_CPP11_RVALUE_REF_PRESENT template<typename CQ, typename VType> static bool pop( CQ& queue, VType&& val ) { return queue.try_pop( std::forward<VType>( val ) ); } #else template<typename CQ, typename VType> static bool pop( CQ& queue, VType& val ) { return queue.try_pop( val ); } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ }; template <push_t push_op, typename Queue> void FillTest(Queue &q, const std::vector<typename Queue::value_type> &vec) { for (typename std::vector<typename Queue::value_type>::const_iterator it = vec.begin(); it != vec.end(); ++it) ASSERT(pusher<push_op>::push(q, *it), NULL); AssertEquality(q, vec); } template <pop_t pop_op, typename Queue> void EmptyTest(Queue &q, const std::vector<typename Queue::value_type> &vec) { typedef typename Queue::value_type value_type; value_type elem; typename std::vector<value_type>::const_iterator it = vec.begin(); while (popper<pop_op>::pop(q, elem)) { ASSERT(Harness::IsEqual()(elem, *it), NULL); ++it; } ASSERT(it == vec.end(), NULL); AssertEmptiness(q); } template <typename T, typename A> void bounded_queue_specific_test(tbb::concurrent_queue<T, A> &, const std::vector<T> &) { /* do nothing */ } template <typename T, typename A> void bounded_queue_specific_test(tbb::concurrent_bounded_queue<T, A> &q, const std::vector<T> &vec) { typedef typename tbb::concurrent_bounded_queue<T, A>::size_type size_type; FillTest<try_push_op>(q, vec); tbb::concurrent_bounded_queue<T, A> q2 = q; EmptyTest<pop_op>(q, vec); // capacity q2.set_capacity(size_type(vec.size())); ASSERT(q2.capacity() == size_type(vec.size()), NULL); ASSERT(q2.size() == size_type(vec.size()), NULL); ASSERT(!q2.try_push(vec[0]), NULL); #if TBB_USE_EXCEPTIONS q.abort(); #endif } template<typename CQ, typename T> void TestPushPop( size_t prefill, ptrdiff_t capacity, int nthread ) { ASSERT( nthread>0, "nthread must be positive" ); ptrdiff_t signed_prefill = ptrdiff_t(prefill); if( signed_prefill+1>=capacity ) return; bool success = false; for( int k=0; k<3; ++k ) PopKind[k] = 0; for( int trial=0; !success; ++trial ) { T::clear_counters(); Body<CQ,T> body(nthread); CQ queue; queue.set_capacity( capacity ); body.queue = &queue; for( size_t i=0; i<prefill; ++i ) { T f; f.thread_id = nthread; f.serial = 1+int(i); push(queue, f, i); ASSERT( unsigned(queue.size())==i+1, NULL ); ASSERT( !queue.empty(), NULL ); } tbb::tick_count t0 = tbb::tick_count::now(); NativeParallelFor( nthread, body ); tbb::tick_count t1 = tbb::tick_count::now(); double timing = (t1-t0).seconds(); REMARK("prefill=%d capacity=%d threads=%d time = %g = %g nsec/operation\n", int(prefill), int(capacity), nthread, timing, timing/(2*M*nthread)*1.E9); int sum = 0; for( int k=0; k<nthread; ++k ) sum += Sum[k]; int expected = int(nthread*((M-1)*M/2) + ((prefill-1)*prefill)/2); for( int i=int(prefill); --i>=0; ) { ASSERT( !queue.empty(), NULL ); T f; bool result = queue.try_pop(f); ASSERT( result, NULL ); ASSERT( int(queue.size())==i, NULL ); sum += f.serial-1; } ASSERT( queue.empty(), "The queue should be empty" ); ASSERT( queue.size()==0, "The queue should have zero size" ); if( sum!=expected ) REPORT("sum=%d expected=%d\n",sum,expected); ASSERT( T::get_n_constructed()==T::get_n_destroyed(), NULL ); // TODO: checks by counting allocators success = true; if( nthread>1 && prefill==0 ) { // Check that pop_if_present got sufficient exercise for( int k=0; k<2; ++k ) { #if (_WIN32||_WIN64) // The TBB library on Windows seems to have a tough time generating // the desired interleavings for pop_if_present, so the code tries longer, and settles // for fewer desired interleavings. const int max_trial = 100; const int min_requirement = 20; #else const int min_requirement = 100; const int max_trial = 20; #endif /* _WIN32||_WIN64 */ if( PopKind[k]<min_requirement ) { if( trial>=max_trial ) { if( Verbose ) REPORT("Warning: %d threads had only %ld pop_if_present operations %s after %d trials (expected at least %d). " "This problem may merely be unlucky scheduling. " "Investigate only if it happens repeatedly.\n", nthread, long(PopKind[k]), k==0?"failed":"succeeded", max_trial, min_requirement); else REPORT("Warning: the number of %s pop_if_present operations is less than expected for %d threads. Investigate if it happens repeatedly.\n", k==0?"failed":"succeeded", nthread ); } else { success = false; } } } } } } class Bar { state_t state; public: static size_t construction_num, destruction_num; ptrdiff_t my_id; Bar() : state(LIVE), my_id(-1) {} Bar(size_t _i) : state(LIVE), my_id(_i) { construction_num++; } Bar( const Bar& a_bar ) : state(LIVE) { ASSERT( a_bar.state==LIVE, NULL ); my_id = a_bar.my_id; construction_num++; } ~Bar() { ASSERT( state==LIVE, NULL ); state = DEAD; my_id = DEAD; destruction_num++; } void operator=( const Bar& a_bar ) { ASSERT( a_bar.state==LIVE, NULL ); ASSERT( state==LIVE, NULL ); my_id = a_bar.my_id; } friend bool operator==(const Bar& bar1, const Bar& bar2 ) ; } ; size_t Bar::construction_num = 0; size_t Bar::destruction_num = 0; bool operator==(const Bar& bar1, const Bar& bar2) { ASSERT( bar1.state==LIVE, NULL ); ASSERT( bar2.state==LIVE, NULL ); return bar1.my_id == bar2.my_id; } class BarIterator { Bar* bar_ptr; BarIterator(Bar* bp_) : bar_ptr(bp_) {} public: ~BarIterator() {} BarIterator& operator=( const BarIterator& other ) { bar_ptr = other.bar_ptr; return *this; } Bar& operator*() const { return *bar_ptr; } BarIterator& operator++() { ++bar_ptr; return *this; } Bar* operator++(int) { Bar* result = &operator*(); operator++(); return result; } friend bool operator==(const BarIterator& bia, const BarIterator& bib) ; friend bool operator!=(const BarIterator& bia, const BarIterator& bib) ; template<typename CQ, typename T, typename TIter, typename CQ_EX, typename T_EX> friend void TestConstructors (); } ; bool operator==(const BarIterator& bia, const BarIterator& bib) { return bia.bar_ptr==bib.bar_ptr; } bool operator!=(const BarIterator& bia, const BarIterator& bib) { return bia.bar_ptr!=bib.bar_ptr; } #if TBB_USE_EXCEPTIONS class Bar_exception : public std::bad_alloc { public: virtual const char *what() const throw() { return "making the entry invalid"; } virtual ~Bar_exception() throw() {} }; class BarEx { static int count; public: state_t state; typedef enum { PREPARATION, COPY_CONSTRUCT } mode_t; static mode_t mode; ptrdiff_t my_id; ptrdiff_t my_tilda_id; static int button; BarEx() : state(LIVE), my_id(-1), my_tilda_id(-1) {} BarEx(size_t _i) : state(LIVE), my_id(_i), my_tilda_id(my_id^(-1)) {} BarEx( const BarEx& a_bar ) : state(LIVE) { ASSERT( a_bar.state==LIVE, NULL ); my_id = a_bar.my_id; if( mode==PREPARATION ) if( !( ++count % 100 ) ) throw Bar_exception(); my_tilda_id = a_bar.my_tilda_id; } ~BarEx() { ASSERT( state==LIVE, NULL ); state = DEAD; my_id = DEAD; } static void set_mode( mode_t m ) { mode = m; } void operator=( const BarEx& a_bar ) { ASSERT( a_bar.state==LIVE, NULL ); ASSERT( state==LIVE, NULL ); my_id = a_bar.my_id; my_tilda_id = a_bar.my_tilda_id; } friend bool operator==(const BarEx& bar1, const BarEx& bar2 ) ; } ; int BarEx::count = 0; BarEx::mode_t BarEx::mode = BarEx::PREPARATION; bool operator==(const BarEx& bar1, const BarEx& bar2) { ASSERT( bar1.state==LIVE, NULL ); ASSERT( bar2.state==LIVE, NULL ); ASSERT( (bar1.my_id ^ bar1.my_tilda_id) == -1, NULL ); ASSERT( (bar2.my_id ^ bar2.my_tilda_id) == -1, NULL ); return bar1.my_id==bar2.my_id && bar1.my_tilda_id==bar2.my_tilda_id; } #endif /* TBB_USE_EXCEPTIONS */ template<typename CQ, typename T, typename TIter, typename CQ_EX, typename T_EX> void TestConstructors () { CQ src_queue; typename CQ::const_iterator dqb; typename CQ::const_iterator dqe; typename CQ::const_iterator iter; for( size_t size=0; size<1001; ++size ) { for( size_t i=0; i<size; ++i ) src_queue.push(T(i+(i^size))); typename CQ::const_iterator sqb( src_queue.unsafe_begin() ); typename CQ::const_iterator sqe( src_queue.unsafe_end() ); CQ dst_queue(sqb, sqe); ASSERT(src_queue.size()==dst_queue.size(), "different size"); src_queue.clear(); } T bar_array[1001]; for( size_t size=0; size<1001; ++size ) { for( size_t i=0; i<size; ++i ) bar_array[i] = T(i+(i^size)); const TIter sab(bar_array+0); const TIter sae(bar_array+size); CQ dst_queue2(sab, sae); ASSERT( size==unsigned(dst_queue2.size()), NULL ); ASSERT( sab==TIter(bar_array+0), NULL ); ASSERT( sae==TIter(bar_array+size), NULL ); dqb = dst_queue2.unsafe_begin(); dqe = dst_queue2.unsafe_end(); TIter v_iter(sab); for( ; dqb != dqe; ++dqb, ++v_iter ) ASSERT( *dqb == *v_iter, "unexpected element" ); ASSERT( v_iter==sae, "different size?" ); } src_queue.clear(); CQ dst_queue3( src_queue ); ASSERT( src_queue.size()==dst_queue3.size(), NULL ); ASSERT( 0==dst_queue3.size(), NULL ); int k=0; for( size_t i=0; i<1001; ++i ) { T tmp_bar; src_queue.push(T(++k)); src_queue.push(T(++k)); src_queue.try_pop(tmp_bar); CQ dst_queue4( src_queue ); ASSERT( src_queue.size()==dst_queue4.size(), NULL ); dqb = dst_queue4.unsafe_begin(); dqe = dst_queue4.unsafe_end(); iter = src_queue.unsafe_begin(); for( ; dqb != dqe; ++dqb, ++iter ) ASSERT( *dqb == *iter, "unexpected element" ); ASSERT( iter==src_queue.unsafe_end(), "different size?" ); } CQ dst_queue5( src_queue ); ASSERT( src_queue.size()==dst_queue5.size(), NULL ); dqb = dst_queue5.unsafe_begin(); dqe = dst_queue5.unsafe_end(); iter = src_queue.unsafe_begin(); for( ; dqb != dqe; ++dqb, ++iter ) ASSERT( *dqb == *iter, "unexpected element" ); for( size_t i=0; i<100; ++i) { T tmp_bar; src_queue.push(T(i+1000)); src_queue.push(T(i+1000)); src_queue.try_pop(tmp_bar); dst_queue5.push(T(i+1000)); dst_queue5.push(T(i+1000)); dst_queue5.try_pop(tmp_bar); } ASSERT( src_queue.size()==dst_queue5.size(), NULL ); dqb = dst_queue5.unsafe_begin(); dqe = dst_queue5.unsafe_end(); iter = src_queue.unsafe_begin(); for( ; dqb != dqe; ++dqb, ++iter ) ASSERT( *dqb == *iter, "unexpected element" ); ASSERT( iter==src_queue.unsafe_end(), "different size?" ); #if __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN || __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN REPORT("Known issue: part of the constructor test is skipped.\n"); #elif TBB_USE_EXCEPTIONS k = 0; typename CQ_EX::size_type n_elements=0; CQ_EX src_queue_ex; for( size_t size=0; size<1001; ++size ) { T_EX tmp_bar_ex; typename CQ_EX::size_type n_successful_pushes=0; T_EX::set_mode( T_EX::PREPARATION ); try { src_queue_ex.push(T_EX(k+(k^size))); ++n_successful_pushes; } catch (...) { } ++k; try { src_queue_ex.push(T_EX(k+(k^size))); ++n_successful_pushes; } catch (...) { } ++k; src_queue_ex.try_pop(tmp_bar_ex); n_elements += (n_successful_pushes - 1); ASSERT( src_queue_ex.size()==n_elements, NULL); T_EX::set_mode( T_EX::COPY_CONSTRUCT ); CQ_EX dst_queue_ex( src_queue_ex ); ASSERT( src_queue_ex.size()==dst_queue_ex.size(), NULL ); typename CQ_EX::const_iterator dqb_ex = dst_queue_ex.unsafe_begin(); typename CQ_EX::const_iterator dqe_ex = dst_queue_ex.unsafe_end(); typename CQ_EX::const_iterator iter_ex = src_queue_ex.unsafe_begin(); for( ; dqb_ex != dqe_ex; ++dqb_ex, ++iter_ex ) ASSERT( *dqb_ex == *iter_ex, "unexpected element" ); ASSERT( iter_ex==src_queue_ex.unsafe_end(), "different size?" ); } #endif /* TBB_USE_EXCEPTIONS */ #if __TBB_CPP11_RVALUE_REF_PRESENT // Testing work of move constructors src_queue.clear(); typedef typename CQ::size_type qsize_t; for( qsize_t size = 0; size < 1001; ++size ) { for( qsize_t i = 0; i < size; ++i ) src_queue.push( T(i + (i ^ size)) ); std::vector<const T*> locations(size); typename CQ::const_iterator qit = src_queue.unsafe_begin(); for( qsize_t i = 0; i < size; ++i, ++qit ) locations[i] = &(*qit); qsize_t size_of_queue = src_queue.size(); CQ dst_queue( std::move(src_queue) ); ASSERT( src_queue.empty() && src_queue.size() == 0, "not working move constructor?" ); ASSERT( size == size_of_queue && size_of_queue == dst_queue.size(), "not working move constructor?" ); qit = dst_queue.unsafe_begin(); for( qsize_t i = 0; i < size; ++i, ++qit ) ASSERT( locations[i] == &(*qit), "there was data movement during move constructor" ); for( qsize_t i = 0; i < size; ++i ) { T test(i + (i ^ size)); T popped; bool pop_result = dst_queue.try_pop( popped ); ASSERT( pop_result, NULL ); ASSERT( test == popped, NULL ); } } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ } #if __TBB_CPP11_RVALUE_REF_PRESENT template<class T> class allocator: public tbb::cache_aligned_allocator<T> { public: size_t m_unique_id; allocator() : m_unique_id( 0 ) {} allocator(size_t unique_id) { m_unique_id = unique_id; } template<typename U> allocator(const allocator<U>& a) throw() { m_unique_id = a.m_unique_id; } template<typename U> struct rebind { typedef allocator<U> other; }; friend bool operator==(const allocator& lhs, const allocator& rhs) { return lhs.m_unique_id == rhs.m_unique_id; } }; // Checks operability of the queue the data was moved from template<typename T, typename CQ> void TestQueueOperabilityAfterDataMove( CQ& queue ) { const size_t size = 10; std::vector<T> v(size); for( size_t i = 0; i < size; ++i ) v[i] = T( i * i + i ); FillTest<push_op>(queue, v); EmptyTest<try_pop_op>(queue, v); bounded_queue_specific_test(queue, v); } template<class CQ, class T> void TestMoveConstructors() { T::construction_num = T::destruction_num = 0; CQ src_queue( allocator<T>(0) ); const size_t size = 10; for( size_t i = 0; i < size; ++i ) src_queue.push( T(i + (i ^ size)) ); ASSERT( T::construction_num == 2 * size, NULL ); ASSERT( T::destruction_num == size, NULL ); const T* locations[size]; typename CQ::const_iterator qit = src_queue.unsafe_begin(); for( size_t i = 0; i < size; ++i, ++qit ) locations[i] = &(*qit); // Ensuring allocation operation takes place during move when allocators are different CQ dst_queue( std::move(src_queue), allocator<T>(1) ); ASSERT( T::construction_num == 2 * size + size, NULL ); ASSERT( T::destruction_num == 2 * size + size, NULL ); TestQueueOperabilityAfterDataMove<T>( src_queue ); qit = dst_queue.unsafe_begin(); for( size_t i = 0; i < size; ++i, ++qit ) { ASSERT( locations[i] != &(*qit), "item was not moved" ); locations[i] = &(*qit); } T::construction_num = T::destruction_num = 0; // Ensuring there is no allocation operation during move with equal allocators CQ dst_queue2( std::move(dst_queue), allocator<T>(1) ); ASSERT( T::construction_num == 0, NULL ); ASSERT( T::destruction_num == 0, NULL ); TestQueueOperabilityAfterDataMove<T>( dst_queue ); qit = dst_queue2.unsafe_begin(); for( size_t i = 0; i < size; ++i, ++qit ) { ASSERT( locations[i] == &(*qit), "item was moved" ); } for( size_t i = 0; i < size; ++i) { T test(i + (i ^ size)); T popped; bool pop_result = dst_queue2.try_pop( popped ); ASSERT( pop_result, NULL ); ASSERT( test == popped, NULL ); } ASSERT( dst_queue2.empty(), NULL ); ASSERT( dst_queue2.size() == 0, NULL ); } void TestMoveConstruction() { REMARK("Testing move constructors with specified allocators..."); TestMoveConstructors< ConcQWithSizeWrapper< Bar, allocator<Bar> >, Bar >(); TestMoveConstructors< tbb::concurrent_bounded_queue< Bar, allocator<Bar> >, Bar >(); REMARK(" work\n"); } #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ template<typename Iterator1, typename Iterator2> void TestIteratorAux( Iterator1 i, Iterator2 j, int size ) { // Now test iteration Iterator1 old_i; for( int k=0; k<size; ++k ) { ASSERT( i!=j, NULL ); ASSERT( !(i==j), NULL ); Foo f; if( k&1 ) { // Test pre-increment f = *old_i++; // Test assignment i = old_i; } else { // Test post-increment f=*i++; if( k<size-1 ) { // Test "->" ASSERT( k+2==i->serial, NULL ); } // Test assignment old_i = i; } ASSERT( k+1==f.serial, NULL ); } ASSERT( !(i!=j), NULL ); ASSERT( i==j, NULL ); } template<typename Iterator1, typename Iterator2> void TestIteratorAssignment( Iterator2 j ) { Iterator1 i(j); ASSERT( i==j, NULL ); ASSERT( !(i!=j), NULL ); Iterator1 k; k = j; ASSERT( k==j, NULL ); ASSERT( !(k!=j), NULL ); } template<typename Iterator, typename T> void TestIteratorTraits() { AssertSameType( static_cast<typename Iterator::difference_type*>(0), static_cast<ptrdiff_t*>(0) ); AssertSameType( static_cast<typename Iterator::value_type*>(0), static_cast<T*>(0) ); AssertSameType( static_cast<typename Iterator::pointer*>(0), static_cast<T**>(0) ); AssertSameType( static_cast<typename Iterator::iterator_category*>(0), static_cast<std::forward_iterator_tag*>(0) ); T x; typename Iterator::reference xr = x; typename Iterator::pointer xp = &x; ASSERT( &xr==xp, NULL ); } //! Test the iterators for concurrent_queue template<typename CQ> void TestIterator() { CQ queue; const CQ& const_queue = queue; for( int j=0; j<500; ++j ) { TestIteratorAux( queue.unsafe_begin() , queue.unsafe_end() , j ); TestIteratorAux( const_queue.unsafe_begin(), const_queue.unsafe_end(), j ); TestIteratorAux( const_queue.unsafe_begin(), queue.unsafe_end() , j ); TestIteratorAux( queue.unsafe_begin() , const_queue.unsafe_end(), j ); Foo f; f.serial = j+1; queue.push(f); } TestIteratorAssignment<typename CQ::const_iterator>( const_queue.unsafe_begin() ); TestIteratorAssignment<typename CQ::const_iterator>( queue.unsafe_begin() ); TestIteratorAssignment<typename CQ::iterator>( queue.unsafe_begin() ); TestIteratorTraits<typename CQ::const_iterator, const Foo>(); TestIteratorTraits<typename CQ::iterator, Foo>(); } template<typename CQ> void TestConcurrentQueueType() { AssertSameType( typename CQ::value_type(), Foo() ); Foo f; const Foo g; typename CQ::reference r = f; ASSERT( &r==&f, NULL ); ASSERT( !r.is_const(), NULL ); typename CQ::const_reference cr = g; ASSERT( &cr==&g, NULL ); ASSERT( cr.is_const(), NULL ); } template<typename CQ, typename T> void TestEmptyQueue() { const CQ queue; ASSERT( queue.size()==0, NULL ); ASSERT( queue.capacity()>0, NULL ); ASSERT( size_t(queue.capacity())>=size_t(-1)/(sizeof(void*)+sizeof(T)), NULL ); } template<typename CQ,typename T> void TestFullQueue() { for( int n=0; n<10; ++n ) { T::clear_counters(); CQ queue; queue.set_capacity(n); for( int i=0; i<=n; ++i ) { T f; f.serial = i; bool result = queue.try_push( f ); ASSERT( result==(i<n), NULL ); } for( int i=0; i<=n; ++i ) { T f; bool result = queue.try_pop( f ); ASSERT( result==(i<n), NULL ); ASSERT( !result || f.serial==i, NULL ); } ASSERT( T::get_n_constructed()==T::get_n_destroyed(), NULL ); } } template<typename CQ> void TestClear() { FooConstructed = 0; FooDestroyed = 0; const unsigned int n=5; CQ queue; const int q_capacity=10; queue.set_capacity(q_capacity); for( size_t i=0; i<n; ++i ) { Foo f; f.serial = int(i); queue.push( f ); } ASSERT( unsigned(queue.size())==n, NULL ); queue.clear(); ASSERT( queue.size()==0, NULL ); for( size_t i=0; i<n; ++i ) { Foo f; f.serial = int(i); queue.push( f ); } ASSERT( unsigned(queue.size())==n, NULL ); queue.clear(); ASSERT( queue.size()==0, NULL ); for( size_t i=0; i<n; ++i ) { Foo f; f.serial = int(i); queue.push( f ); } ASSERT( unsigned(queue.size())==n, NULL ); } template<typename T> struct TestNegativeQueueBody: NoAssign { tbb::concurrent_bounded_queue<T>& queue; const int nthread; TestNegativeQueueBody( tbb::concurrent_bounded_queue<T>& q, int n ) : queue(q), nthread(n) {} void operator()( int k ) const { if( k==0 ) { int number_of_pops = nthread-1; // Wait for all pops to pend. while( queue.size()>-number_of_pops ) { __TBB_Yield(); } for( int i=0; ; ++i ) { ASSERT( queue.size()==i-number_of_pops, NULL ); ASSERT( queue.empty()==(queue.size()<=0), NULL ); if( i==number_of_pops ) break; // Satisfy another pop queue.push( T() ); } } else { // Pop item from queue T item; queue.pop(item); } } }; //! Test a queue with a negative size. template<typename T> void TestNegativeQueue( int nthread ) { tbb::concurrent_bounded_queue<T> queue; NativeParallelFor( nthread, TestNegativeQueueBody<T>(queue,nthread) ); } #if TBB_USE_EXCEPTIONS template<typename CQ,typename A1,typename A2,typename T> void TestExceptionBody() { enum methods { m_push = 0, m_pop }; REMARK("Testing exception safety\n"); MaxFooCount = 5; // verify 'clear()' on exception; queue's destructor calls its clear() // Do test on queues of two different types at the same time to // catch problem with incorrect sharing between templates. { CQ queue0; tbb::concurrent_queue<int,A1> queue1; for( int i=0; i<2; ++i ) { bool caught = false; try { A2::init_counters(); A2::set_limits(N/2); for( int k=0; k<N; k++ ) { if( i==0 ) push(queue0, T(), i); else queue1.push( k ); } } catch (...) { caught = true; } ASSERT( caught, "call to push should have thrown exception" ); } } REMARK("... queue destruction test passed\n"); try { int n_pushed=0, n_popped=0; for(int t = 0; t <= 1; t++)// exception type -- 0 : from allocator(), 1 : from Foo's constructor { CQ queue_test; for( int m=m_push; m<=m_pop; m++ ) { // concurrent_queue internally rebinds the allocator to one with 'char' A2::init_counters(); if(t) MaxFooCount = MaxFooCount + 400; else A2::set_limits(N/2); try { switch(m) { case m_push: for( int k=0; k<N; k++ ) { push( queue_test, T(), k ); n_pushed++; } break; case m_pop: n_popped=0; for( int k=0; k<n_pushed; k++ ) { T elt; queue_test.try_pop( elt ); n_popped++; } n_pushed = 0; A2::set_limits(); break; } if( !t && m==m_push ) ASSERT(false, "should throw an exception"); } catch ( Foo_exception & ) { switch(m) { case m_push: { ASSERT( ptrdiff_t(queue_test.size())==n_pushed, "incorrect queue size" ); long tc = MaxFooCount; MaxFooCount = 0; for( int k=0; k<(int)tc; k++ ) { push( queue_test, T(), k ); n_pushed++; } MaxFooCount = tc; } break; case m_pop: MaxFooCount = 0; // disable exception n_pushed -= (n_popped+1); // including one that threw an exception ASSERT( n_pushed>=0, "n_pushed cannot be less than 0" ); for( int k=0; k<1000; k++ ) { push( queue_test, T(), k ); n_pushed++; } ASSERT( !queue_test.empty(), "queue must not be empty" ); ASSERT( ptrdiff_t(queue_test.size())==n_pushed, "queue size must be equal to n pushed" ); for( int k=0; k<n_pushed; k++ ) { T elt; queue_test.try_pop( elt ); } ASSERT( queue_test.empty(), "queue must be empty" ); ASSERT( queue_test.size()==0, "queue must be empty" ); break; } } catch ( std::bad_alloc & ) { A2::set_limits(); // disable exception from allocator size_t size = queue_test.size(); switch(m) { case m_push: ASSERT( size>0, "incorrect queue size"); break; case m_pop: if( !t ) ASSERT( false, "should not throw an exceptin" ); break; } } REMARK("... for t=%d and m=%d, exception test passed\n", t, m); } } } catch(...) { ASSERT(false, "unexpected exception"); } } #endif /* TBB_USE_EXCEPTIONS */ void TestExceptions() { #if __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN REPORT("Known issue: exception safety test is skipped.\n"); #elif TBB_USE_EXCEPTIONS typedef static_counting_allocator<std::allocator<FooEx>, size_t> allocator_t; typedef static_counting_allocator<std::allocator<char>, size_t> allocator_char_t; TestExceptionBody<ConcQWithSizeWrapper<FooEx, allocator_t>,allocator_t,allocator_char_t,FooEx>(); TestExceptionBody<tbb::concurrent_bounded_queue<FooEx, allocator_t>,allocator_t,allocator_char_t,FooEx>(); #endif /* TBB_USE_EXCEPTIONS */ } template<typename CQ, typename T> struct TestQueueElements: NoAssign { CQ& queue; const int nthread; TestQueueElements( CQ& q, int n ) : queue(q), nthread(n) {} void operator()( int k ) const { for( int i=0; i<1000; ++i ) { if( (i&0x1)==0 ) { ASSERT( T(k)<T(nthread), NULL ); queue.push( T(k) ); } else { // Pop item from queue T item = 0; queue.try_pop(item); ASSERT( item<=T(nthread), NULL ); } } } }; //! Test concurrent queue with primitive data type template<typename CQ, typename T> void TestPrimitiveTypes( int nthread, T exemplar ) { CQ queue; for( int i=0; i<100; ++i ) queue.push( exemplar ); NativeParallelFor( nthread, TestQueueElements<CQ,T>(queue,nthread) ); } #include "harness_m128.h" #if HAVE_m128 || HAVE_m256 //! Test concurrent queue with vector types /** Type Queue should be a queue of ClassWithSSE/ClassWithAVX. */ template<typename ClassWithVectorType, typename Queue> void TestVectorTypes() { Queue q1; for( int i=0; i<100; ++i ) { // VC8 does not properly align a temporary value; to work around, use explicit variable ClassWithVectorType bar(i); q1.push(bar); } // Copy the queue Queue q2 = q1; // Check that elements of the copy are correct typename Queue::const_iterator ci = q2.unsafe_begin(); for( int i=0; i<100; ++i ) { ClassWithVectorType foo = *ci; ClassWithVectorType bar(i); ASSERT( *ci==bar, NULL ); ++ci; } for( int i=0; i<101; ++i ) { ClassWithVectorType tmp; bool b = q1.try_pop( tmp ); ASSERT( b==(i<100), NULL ); ClassWithVectorType bar(i); ASSERT( !b || tmp==bar, NULL ); } } #endif /* HAVE_m128 || HAVE_m256 */ void TestEmptiness() { REMARK(" Test Emptiness\n"); TestEmptyQueue<ConcQWithCapacity<char>, char>(); TestEmptyQueue<ConcQWithCapacity<Foo>, Foo>(); TestEmptyQueue<tbb::concurrent_bounded_queue<char>, char>(); TestEmptyQueue<tbb::concurrent_bounded_queue<Foo>, Foo>(); } void TestFullness() { REMARK(" Test Fullness\n"); TestFullQueue<ConcQWithCapacity<Foo>,Foo>(); TestFullQueue<tbb::concurrent_bounded_queue<Foo>,Foo>(); } void TestClearWorks() { REMARK(" Test concurrent_queue::clear() works\n"); TestClear<ConcQWithCapacity<Foo> >(); TestClear<tbb::concurrent_bounded_queue<Foo> >(); } void TestQueueTypeDeclaration() { REMARK(" Test concurrent_queue's types work\n"); TestConcurrentQueueType<tbb::concurrent_queue<Foo> >(); TestConcurrentQueueType<tbb::concurrent_bounded_queue<Foo> >(); } void TestQueueIteratorWorks() { REMARK(" Test concurrent_queue's iterators work\n"); TestIterator<tbb::concurrent_queue<Foo> >(); TestIterator<tbb::concurrent_bounded_queue<Foo> >(); } #if TBB_USE_EXCEPTIONS #define BAR_EX BarEx #else #define BAR_EX Empty /* passed as template arg but should not be used */ #endif class Empty; void TestQueueConstructors() { REMARK(" Test concurrent_queue's constructors work\n"); TestConstructors<ConcQWithSizeWrapper<Bar>,Bar,BarIterator,ConcQWithSizeWrapper<BAR_EX>,BAR_EX>(); TestConstructors<tbb::concurrent_bounded_queue<Bar>,Bar,BarIterator,tbb::concurrent_bounded_queue<BAR_EX>,BAR_EX>(); } void TestQueueWorksWithPrimitiveTypes() { REMARK(" Test concurrent_queue works with primitive types\n"); TestPrimitiveTypes<tbb::concurrent_queue<char>, char>( MaxThread, (char)1 ); TestPrimitiveTypes<tbb::concurrent_queue<int>, int>( MaxThread, (int)-12 ); TestPrimitiveTypes<tbb::concurrent_queue<float>, float>( MaxThread, (float)-1.2f ); TestPrimitiveTypes<tbb::concurrent_queue<double>, double>( MaxThread, (double)-4.3 ); TestPrimitiveTypes<tbb::concurrent_bounded_queue<char>, char>( MaxThread, (char)1 ); TestPrimitiveTypes<tbb::concurrent_bounded_queue<int>, int>( MaxThread, (int)-12 ); TestPrimitiveTypes<tbb::concurrent_bounded_queue<float>, float>( MaxThread, (float)-1.2f ); TestPrimitiveTypes<tbb::concurrent_bounded_queue<double>, double>( MaxThread, (double)-4.3 ); } void TestQueueWorksWithSSE() { REMARK(" Test concurrent_queue works with SSE data\n"); #if HAVE_m128 TestVectorTypes<ClassWithSSE, tbb::concurrent_queue<ClassWithSSE> >(); TestVectorTypes<ClassWithSSE, tbb::concurrent_bounded_queue<ClassWithSSE> >(); #endif /* HAVE_m128 */ #if HAVE_m256 if( have_AVX() ) { TestVectorTypes<ClassWithAVX, tbb::concurrent_queue<ClassWithAVX> >(); TestVectorTypes<ClassWithAVX, tbb::concurrent_bounded_queue<ClassWithAVX> >(); } #endif /* HAVE_m256 */ } void TestConcurrentPushPop() { REMARK(" Test concurrent_queue's concurrent push and pop\n"); for( int nthread=MinThread; nthread<=MaxThread; ++nthread ) { REMARK(" Testing with %d thread(s)\n", nthread ); TestNegativeQueue<Foo>(nthread); for( size_t prefill=0; prefill<64; prefill+=(1+prefill/3) ) { TestPushPop<ConcQPushPopWrapper<Foo>,Foo>(prefill,ptrdiff_t(-1),nthread); TestPushPop<ConcQPushPopWrapper<Foo>,Foo>(prefill,ptrdiff_t(1),nthread); TestPushPop<ConcQPushPopWrapper<Foo>,Foo>(prefill,ptrdiff_t(2),nthread); TestPushPop<ConcQPushPopWrapper<Foo>,Foo>(prefill,ptrdiff_t(10),nthread); TestPushPop<ConcQPushPopWrapper<Foo>,Foo>(prefill,ptrdiff_t(100),nthread); } for( size_t prefill=0; prefill<64; prefill+=(1+prefill/3) ) { TestPushPop<tbb::concurrent_bounded_queue<Foo>,Foo>(prefill,ptrdiff_t(-1),nthread); TestPushPop<tbb::concurrent_bounded_queue<Foo>,Foo>(prefill,ptrdiff_t(1),nthread); TestPushPop<tbb::concurrent_bounded_queue<Foo>,Foo>(prefill,ptrdiff_t(2),nthread); TestPushPop<tbb::concurrent_bounded_queue<Foo>,Foo>(prefill,ptrdiff_t(10),nthread); TestPushPop<tbb::concurrent_bounded_queue<Foo>,Foo>(prefill,ptrdiff_t(100),nthread); } } } #if TBB_USE_EXCEPTIONS tbb::atomic<size_t> num_pushed; tbb::atomic<size_t> num_popped; tbb::atomic<size_t> failed_pushes; tbb::atomic<size_t> failed_pops; class SimplePushBody { tbb::concurrent_bounded_queue<int>* q; int max; public: SimplePushBody(tbb::concurrent_bounded_queue<int>* _q, int hi_thr) : q(_q), max(hi_thr) {} void operator()(int thread_id) const { if (thread_id == max) { Harness::Sleep(50); q->abort(); return; } try { q->push(42); ++num_pushed; } catch ( tbb::user_abort& ) { ++failed_pushes; } } }; class SimplePopBody { tbb::concurrent_bounded_queue<int>* q; int max; public: SimplePopBody(tbb::concurrent_bounded_queue<int>* _q, int hi_thr) : q(_q), max(hi_thr) {} void operator()(int thread_id) const { int e; if (thread_id == max) { Harness::Sleep(50); q->abort(); return; } try { q->pop(e); ++num_popped; } catch ( tbb::user_abort& ) { ++failed_pops; } } }; #endif /* TBB_USE_EXCEPTIONS */ void TestAbort() { #if TBB_USE_EXCEPTIONS for (int nthreads=MinThread; nthreads<=MaxThread; ++nthreads) { REMARK("Testing Abort on %d thread(s).\n", nthreads); REMARK("...testing pushing to zero-sized queue\n"); tbb::concurrent_bounded_queue<int> iq1; iq1.set_capacity(0); for (int i=0; i<10; ++i) { num_pushed = num_popped = failed_pushes = failed_pops = 0; SimplePushBody my_push_body1(&iq1, nthreads); NativeParallelFor( nthreads+1, my_push_body1 ); ASSERT(num_pushed == 0, "no elements should have been pushed to zero-sized queue"); ASSERT((int)failed_pushes == nthreads, "All threads should have failed to push an element to zero-sized queue"); } REMARK("...testing pushing to small-sized queue\n"); tbb::concurrent_bounded_queue<int> iq2; iq2.set_capacity(2); for (int i=0; i<10; ++i) { num_pushed = num_popped = failed_pushes = failed_pops = 0; SimplePushBody my_push_body2(&iq2, nthreads); NativeParallelFor( nthreads+1, my_push_body2 ); ASSERT(num_pushed <= 2, "at most 2 elements should have been pushed to queue of size 2"); if (nthreads >= 2) ASSERT((int)failed_pushes == nthreads-2, "nthreads-2 threads should have failed to push an element to queue of size 2"); int e; while (iq2.try_pop(e)) ; } REMARK("...testing popping from small-sized queue\n"); tbb::concurrent_bounded_queue<int> iq3; iq3.set_capacity(2); for (int i=0; i<10; ++i) { num_pushed = num_popped = failed_pushes = failed_pops = 0; iq3.push(42); iq3.push(42); SimplePopBody my_pop_body(&iq3, nthreads); NativeParallelFor( nthreads+1, my_pop_body); ASSERT(num_popped <= 2, "at most 2 elements should have been popped from queue of size 2"); if (nthreads >= 2) ASSERT((int)failed_pops == nthreads-2, "nthreads-2 threads should have failed to pop an element from queue of size 2"); else { int e; iq3.pop(e); } } REMARK("...testing pushing and popping from small-sized queue\n"); tbb::concurrent_bounded_queue<int> iq4; int cap = nthreads/2; if (!cap) cap=1; iq4.set_capacity(cap); for (int i=0; i<10; ++i) { num_pushed = num_popped = failed_pushes = failed_pops = 0; SimplePushBody my_push_body2(&iq4, nthreads); NativeParallelFor( nthreads+1, my_push_body2 ); ASSERT((int)num_pushed <= cap, "at most cap elements should have been pushed to queue of size cap"); if (nthreads >= cap) ASSERT((int)failed_pushes == nthreads-cap, "nthreads-cap threads should have failed to push an element to queue of size cap"); SimplePopBody my_pop_body(&iq4, nthreads); NativeParallelFor( nthreads+1, my_pop_body); ASSERT((int)num_popped <= cap, "at most cap elements should have been popped from queue of size cap"); if (nthreads >= cap) ASSERT((int)failed_pops == nthreads-cap, "nthreads-cap threads should have failed to pop an element from queue of size cap"); else { int e; while (iq4.try_pop(e)) ; } } } #endif } #if __TBB_CPP11_RVALUE_REF_PRESENT struct MoveOperationTracker { static size_t copy_constructor_called_times; static size_t move_constructor_called_times; static size_t copy_assignment_called_times; static size_t move_assignment_called_times; MoveOperationTracker() {} MoveOperationTracker(const MoveOperationTracker&) { ++copy_constructor_called_times; } MoveOperationTracker(MoveOperationTracker&&) { ++move_constructor_called_times; } MoveOperationTracker& operator=(MoveOperationTracker const&) { ++copy_assignment_called_times; return *this; } MoveOperationTracker& operator=(MoveOperationTracker&&) { ++move_assignment_called_times; return *this; } }; size_t MoveOperationTracker::copy_constructor_called_times = 0; size_t MoveOperationTracker::move_constructor_called_times = 0; size_t MoveOperationTracker::copy_assignment_called_times = 0; size_t MoveOperationTracker::move_assignment_called_times = 0; template <class CQ, push_t push_op, pop_t pop_op> void TestMoveSupport() { size_t &mcct = MoveOperationTracker::move_constructor_called_times; size_t &ccct = MoveOperationTracker::copy_constructor_called_times; size_t &cact = MoveOperationTracker::copy_assignment_called_times; size_t &mact = MoveOperationTracker::move_assignment_called_times; mcct = ccct = cact = mact = 0; CQ q; ASSERT(mcct == 0, "Value must be zero-initialized"); ASSERT(ccct == 0, "Value must be zero-initialized"); ASSERT(pusher<push_op>::push( q, MoveOperationTracker() ), NULL); ASSERT(mcct == 1, "Not working push(T&&) or try_push(T&&)?"); ASSERT(ccct == 0, "Copying of arg occurred during push(T&&) or try_push(T&&)"); MoveOperationTracker ob; ASSERT(pusher<push_op>::push( q, std::move(ob) ), NULL); ASSERT(mcct == 2, "Not working push(T&&) or try_push(T&&)?"); ASSERT(ccct == 0, "Copying of arg occurred during push(T&&) or try_push(T&&)"); ASSERT(cact == 0, "Copy assignment called during push(T&&) or try_push(T&&)"); ASSERT(mact == 0, "Move assignment called during push(T&&) or try_push(T&&)"); bool result = popper<pop_op>::pop( q, ob ); ASSERT(result, NULL); ASSERT(cact == 0, "Copy assignment called during try_pop(T&&)"); ASSERT(mact == 1, "Move assignment was not called during try_pop(T&&)"); } void TestMoveSupportInPushPop() { REMARK("Testing Move Support in Push/Pop..."); TestMoveSupport< tbb::concurrent_queue<MoveOperationTracker>, push_op, try_pop_op >(); TestMoveSupport< tbb::concurrent_bounded_queue<MoveOperationTracker>, push_op, pop_op >(); TestMoveSupport< tbb::concurrent_bounded_queue<MoveOperationTracker>, try_push_op, try_pop_op >(); REMARK(" works.\n"); } #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT class NonTrivialConstructorType { public: NonTrivialConstructorType( int a = 0 ) : m_a( a ), m_str( "" ) {} NonTrivialConstructorType( const std::string& str ) : m_a( 0 ), m_str( str ) {} NonTrivialConstructorType( int a, const std::string& str ) : m_a( a ), m_str( str ) {} int get_a() const { return m_a; } std::string get_str() const { return m_str; } private: int m_a; std::string m_str; }; enum emplace_t { emplace_op, try_emplace_op }; template< emplace_t emplace_op > struct emplacer { template< typename CQ, typename... Args> static void emplace( CQ& queue, Args&&... val ) { queue.emplace( std::forward<Args>( val )... ); } }; template<> struct emplacer< try_emplace_op > { template<typename CQ, typename... Args> static void emplace( CQ& queue, Args&&... val ) { bool result = queue.try_emplace( std::forward<Args>( val )... ); ASSERT( result, "try_emplace error\n" ); } }; template<typename CQ, emplace_t emplace_op> void TestEmplaceInQueue() { CQ cq; std::string test_str = "I'm being emplaced!"; { emplacer<emplace_op>::emplace( cq, 5 ); ASSERT( cq.size() == 1, NULL ); NonTrivialConstructorType popped( -1 ); bool result = cq.try_pop( popped ); ASSERT( result, NULL ); ASSERT( popped.get_a() == 5, NULL ); ASSERT( popped.get_str() == std::string( "" ), NULL ); } ASSERT( cq.empty(), NULL ); { NonTrivialConstructorType popped( -1 ); emplacer<emplace_op>::emplace( cq, std::string(test_str) ); bool result = cq.try_pop( popped ); ASSERT( result, NULL ); ASSERT( popped.get_a() == 0, NULL ); ASSERT( popped.get_str() == test_str, NULL ); } ASSERT( cq.empty(), NULL ); { NonTrivialConstructorType popped( -1, "" ); emplacer<emplace_op>::emplace( cq, 5, std::string(test_str) ); bool result = cq.try_pop( popped ); ASSERT( result, NULL ); ASSERT( popped.get_a() == 5, NULL ); ASSERT( popped.get_str() == test_str, NULL ); } } void TestEmplace() { REMARK("Testing support for 'emplace' method..."); TestEmplaceInQueue< ConcQWithSizeWrapper<NonTrivialConstructorType>, emplace_op >(); TestEmplaceInQueue< tbb::concurrent_bounded_queue<NonTrivialConstructorType>, emplace_op >(); TestEmplaceInQueue< tbb::concurrent_bounded_queue<NonTrivialConstructorType>, try_emplace_op >(); REMARK(" works.\n"); } #endif /* __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT */ #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ template <typename Queue> void Examine(Queue q, const std::vector<typename Queue::value_type> &vec) { typedef typename Queue::value_type value_type; AssertEquality(q, vec); const Queue cq = q; AssertEquality(cq, vec); q.clear(); AssertEmptiness(q); FillTest<push_op>(q, vec); EmptyTest<try_pop_op>(q, vec); bounded_queue_specific_test(q, vec); typename Queue::allocator_type a = q.get_allocator(); value_type *ptr = a.allocate(1); ASSERT(ptr, NULL); a.deallocate(ptr, 1); } template <typename Queue, typename QueueDebugAlloc> void TypeTester(const std::vector<typename Queue::value_type> &vec) { typedef typename std::vector<typename Queue::value_type>::const_iterator iterator; ASSERT(vec.size() >= 5, "Array should have at least 5 elements"); // Construct an empty queue. Queue q1; for (iterator it = vec.begin(); it != vec.end(); ++it) q1.push(*it); Examine(q1, vec); // Copying constructor. Queue q3(q1); Examine(q3, vec); // Construct with non-default allocator. QueueDebugAlloc q4; for (iterator it = vec.begin(); it != vec.end(); ++it) q4.push(*it); Examine(q4, vec); // Copying constructor with the same allocator type. QueueDebugAlloc q5(q4); Examine(q5, vec); // Construction with given allocator instance. typename QueueDebugAlloc::allocator_type a; QueueDebugAlloc q6(a); for (iterator it = vec.begin(); it != vec.end(); ++it) q6.push(*it); Examine(q6, vec); // Construction with copying iteration range and given allocator instance. QueueDebugAlloc q7(q1.unsafe_begin(), q1.unsafe_end(), a); Examine<QueueDebugAlloc>(q7, vec); } template <typename value_type> void TestTypes(const std::vector<value_type> &vec) { TypeTester< ConcQWithSizeWrapper<value_type>, ConcQWithSizeWrapper<value_type, debug_allocator<value_type> > >(vec); TypeTester< tbb::concurrent_bounded_queue<value_type>, tbb::concurrent_bounded_queue<value_type, debug_allocator<value_type> > >(vec); } void TestTypes() { const int NUMBER = 10; std::vector<int> arrInt; for (int i = 0; i < NUMBER; ++i) arrInt.push_back(i); std::vector< tbb::atomic<int> > arrTbb; for (int i = 0; i < NUMBER; ++i) { tbb::atomic<int> a; a = i; arrTbb.push_back(a); } TestTypes(arrInt); TestTypes(arrTbb); #if __TBB_CPP11_SMART_POINTERS_PRESENT std::vector< std::shared_ptr<int> > arrShr; for (int i = 0; i < NUMBER; ++i) arrShr.push_back(std::make_shared<int>(i)); std::vector< std::weak_ptr<int> > arrWk; std::copy(arrShr.begin(), arrShr.end(), std::back_inserter(arrWk)); TestTypes(arrShr); TestTypes(arrWk); #else REPORT("Known issue: C++11 smart pointer tests are skipped.\n"); #endif /* __TBB_CXX11_TYPES_PRESENT */ } int TestMain () { TestEmptiness(); TestFullness(); TestClearWorks(); TestQueueTypeDeclaration(); TestQueueIteratorWorks(); TestQueueConstructors(); TestQueueWorksWithPrimitiveTypes(); TestQueueWorksWithSSE(); // Test concurrent operations TestConcurrentPushPop(); TestExceptions(); TestAbort(); #if __TBB_CPP11_RVALUE_REF_PRESENT TestMoveSupportInPushPop(); TestMoveConstruction(); #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT TestEmplace(); #endif /* __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT */ #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */ TestTypes(); return Harness::Done; }
rutgers-apl/TaskProf
tprof-tbb-lib/src/test/test_concurrent_queue.cpp
C++
mit
59,098
[ 30522, 1013, 1008, 9385, 2384, 1011, 2297, 13420, 3840, 1012, 2035, 2916, 9235, 1012, 2023, 5371, 2003, 2112, 1997, 11689, 2075, 2311, 5991, 1012, 11689, 2075, 2311, 5991, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: post title: ChUG - The Chembl User Group date: '2010-07-27T16:31:00.000+01:00' author: John Overington tags: - Humour (maybe) - ChUG modified_time: '2010-07-27T16:31:48.755+01:00' thumbnail: http://4.bp.blogspot.com/_SlPG9DIz_AA/TE72uS3yBzI/AAAAAAAAA0Y/biebl4nkdWc/s72-c/59-linkedin-logo.jpg blogger_id: tag:blogger.com,1999:blog-2546008714740235720.post-3036320586202238280 blogger_orig_url: http://chembl.blogspot.com/2010/07/chug-chembl-user-group.html --- <div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_SlPG9DIz_AA/TE72uS3yBzI/AAAAAAAAA0Y/biebl4nkdWc/s1600/59-linkedin-logo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://4.bp.blogspot.com/_SlPG9DIz_AA/TE72uS3yBzI/AAAAAAAAA0Y/biebl4nkdWc/s200/59-linkedin-logo.jpg" width="200" /></a></div><br /> <br /> We have set up a <a href="http://www.linkedin.com/">LinkedIn</a>&nbsp;group for the&nbsp;<a href="http://www.linkedin.com/groups?mostPopular=&amp;gid=3252575">Chembl User Group</a>. Feel free to join if you are interested in connecting up with like-minded scientists,interested in applying ChEMBL to various Life Science problems, hearing about user group meetings, <i>etc</i>. If you are not a member of LinkedIn, have a look around...<br /> <br /> I always feel a little bit inadequate when I read some LinkedIn profiles, and some of the elite groups that have been set up; so, as an aside, for when you have a glass of aged port in one hand, a handsome cigar and a fine laptop in the other, try <a href="http://blog.okcupid.com/index.php/the-biggest-lies-in-online-dating/">this link</a> for an interesting analysis of how people describe themselves on on-line forums and the comparison to cold harsh reality.
chembl/chembl.github.io
_posts/2010-07-27-chug-chembl-user-group.html
HTML
mit
1,794
[ 30522, 1011, 1011, 1011, 9621, 1024, 2695, 2516, 1024, 14684, 2290, 1011, 1996, 18178, 14905, 2140, 5310, 2177, 3058, 1024, 1005, 2230, 1011, 5718, 1011, 2676, 2102, 16048, 1024, 2861, 1024, 4002, 1012, 2199, 1009, 5890, 1024, 4002, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Scanning_keluar_Edit Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Scanning_keluar_Edit)) Me.LBLNama = New System.Windows.Forms.Label Me.ListView1 = New System.Windows.Forms.ListView Me.FileName = New System.Windows.Forms.ColumnHeader Me.Lokasi = New System.Windows.Forms.ColumnHeader Me.BTNScan = New System.Windows.Forms.Button Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.BTNHapus = New System.Windows.Forms.Button Me.BTNSImpan = New System.Windows.Forms.Button Me.Label1 = New System.Windows.Forms.Label Me._twain32 = New Saraff.Twain.Twain32(Me.components) Me.Label12 = New System.Windows.Forms.Label Me.Label23 = New System.Windows.Forms.Label Me.GroupBox3 = New System.Windows.Forms.GroupBox Me.BTNTutup = New System.Windows.Forms.Button Me.picboxDeleteAll = New System.Windows.Forms.PictureBox Me.picboxDelete = New System.Windows.Forms.PictureBox Me.PictureBox1 = New System.Windows.Forms.PictureBox Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) Me.GroupBox1.SuspendLayout() Me.GroupBox3.SuspendLayout() CType(Me.picboxDeleteAll, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.picboxDelete, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'LBLNama ' Me.LBLNama.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.LBLNama.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.LBLNama.Location = New System.Drawing.Point(94, 34) Me.LBLNama.Name = "LBLNama" Me.LBLNama.Size = New System.Drawing.Size(133, 23) Me.LBLNama.TabIndex = 5 Me.ToolTip1.SetToolTip(Me.LBLNama, "Nama File") ' 'ListView1 ' Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.FileName, Me.Lokasi}) Me.ListView1.Dock = System.Windows.Forms.DockStyle.Bottom Me.ListView1.Location = New System.Drawing.Point(3, 19) Me.ListView1.Name = "ListView1" Me.ListView1.Size = New System.Drawing.Size(230, 151) Me.ListView1.TabIndex = 0 Me.ListView1.UseCompatibleStateImageBehavior = False Me.ListView1.View = System.Windows.Forms.View.Details ' 'FileName ' Me.FileName.Text = "Nama File" ' 'Lokasi ' Me.Lokasi.Text = "Lokasi" ' 'BTNScan ' Me.BTNScan.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BTNScan.Location = New System.Drawing.Point(65, 74) Me.BTNScan.Name = "BTNScan" Me.BTNScan.Size = New System.Drawing.Size(122, 43) Me.BTNScan.TabIndex = 6 Me.BTNScan.Text = "Scan" Me.ToolTip1.SetToolTip(Me.BTNScan, "Scan") Me.BTNScan.UseVisualStyleBackColor = True ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.BTNScan) Me.GroupBox1.Controls.Add(Me.BTNHapus) Me.GroupBox1.Controls.Add(Me.LBLNama) Me.GroupBox1.Controls.Add(Me.BTNSImpan) Me.GroupBox1.Controls.Add(Me.Label1) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(347, 11) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(236, 184) Me.GroupBox1.TabIndex = 169 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Scanning" ' 'BTNHapus ' Me.BTNHapus.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BTNHapus.Location = New System.Drawing.Point(128, 136) Me.BTNHapus.Name = "BTNHapus" Me.BTNHapus.Size = New System.Drawing.Size(99, 31) Me.BTNHapus.TabIndex = 7 Me.BTNHapus.Text = "Hapus" Me.ToolTip1.SetToolTip(Me.BTNHapus, "Hapus Hasil Scan") Me.BTNHapus.UseVisualStyleBackColor = True ' 'BTNSImpan ' Me.BTNSImpan.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BTNSImpan.Location = New System.Drawing.Point(21, 136) Me.BTNSImpan.Name = "BTNSImpan" Me.BTNSImpan.Size = New System.Drawing.Size(93, 31) Me.BTNSImpan.TabIndex = 6 Me.BTNSImpan.Text = "Simpan" Me.ToolTip1.SetToolTip(Me.BTNSImpan, "Simpan Hasil Scan") Me.BTNSImpan.UseVisualStyleBackColor = True ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(18, 38) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(70, 16) Me.Label1.TabIndex = 4 Me.Label1.Text = "Nama File" ' '_twain32 ' Me._twain32.AppProductName = "Saraff.Twain" Me._twain32.Parent = Nothing ' 'Label12 ' Me.Label12.AutoSize = True Me.Label12.BackColor = System.Drawing.Color.WhiteSmoke Me.Label12.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label12.Location = New System.Drawing.Point(363, 387) Me.Label12.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label12.Name = "Label12" Me.Label12.Size = New System.Drawing.Size(106, 15) Me.Label12.TabIndex = 171 Me.Label12.Text = "Delete && Delete All" ' 'Label23 ' Me.Label23.AutoSize = True Me.Label23.Location = New System.Drawing.Point(472, 198) Me.Label23.Name = "Label23" Me.Label23.Size = New System.Drawing.Size(45, 13) Me.Label23.TabIndex = 174 Me.Label23.Text = "Label23" Me.Label23.Visible = False ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.ListView1) Me.GroupBox3.Location = New System.Drawing.Point(347, 211) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(236, 173) Me.GroupBox3.TabIndex = 170 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Daftar Gambar" ' 'BTNTutup ' Me.BTNTutup.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.BTNTutup.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BTNTutup.Location = New System.Drawing.Point(489, 405) Me.BTNTutup.Name = "BTNTutup" Me.BTNTutup.Size = New System.Drawing.Size(91, 34) Me.BTNTutup.TabIndex = 168 Me.BTNTutup.Text = "Selesai" Me.ToolTip1.SetToolTip(Me.BTNTutup, "Selesai") Me.BTNTutup.UseVisualStyleBackColor = True ' 'picboxDeleteAll ' Me.picboxDeleteAll.Image = Global.SIMARSIP.My.Resources.Resources.picboxDeleteAll_Leave Me.picboxDeleteAll.Location = New System.Drawing.Point(412, 405) Me.picboxDeleteAll.Name = "picboxDeleteAll" Me.picboxDeleteAll.Size = New System.Drawing.Size(61, 36) Me.picboxDeleteAll.TabIndex = 173 Me.picboxDeleteAll.TabStop = False Me.picboxDeleteAll.Tag = "Delete All" Me.ToolTip1.SetToolTip(Me.picboxDeleteAll, "Hapus Semua") ' 'picboxDelete ' Me.picboxDelete.Image = Global.SIMARSIP.My.Resources.Resources.picboxDelete_Leave Me.picboxDelete.Location = New System.Drawing.Point(353, 405) Me.picboxDelete.Name = "picboxDelete" Me.picboxDelete.Size = New System.Drawing.Size(60, 36) Me.picboxDelete.TabIndex = 172 Me.picboxDelete.TabStop = False Me.picboxDelete.Tag = "Delete Current Image" Me.ToolTip1.SetToolTip(Me.picboxDelete, "Hapus") ' 'PictureBox1 ' Me.PictureBox1.BackColor = System.Drawing.SystemColors.ControlDark Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.PictureBox1.ImageLocation = "" Me.PictureBox1.Location = New System.Drawing.Point(13, 13) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(316, 429) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom Me.PictureBox1.TabIndex = 167 Me.PictureBox1.TabStop = False ' 'Scanning_keluar_Edit ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.CancelButton = Me.BTNTutup Me.ClientSize = New System.Drawing.Size(596, 452) Me.ControlBox = False Me.Controls.Add(Me.picboxDeleteAll) Me.Controls.Add(Me.picboxDelete) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.Label12) Me.Controls.Add(Me.Label23) Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.BTNTutup) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "Scanning_keluar_Edit" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Scanning" Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.GroupBox3.ResumeLayout(False) CType(Me.picboxDeleteAll, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.picboxDelete, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents LBLNama As System.Windows.Forms.Label Private WithEvents picboxDeleteAll As System.Windows.Forms.PictureBox Private WithEvents picboxDelete As System.Windows.Forms.PictureBox Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents ListView1 As System.Windows.Forms.ListView Friend WithEvents FileName As System.Windows.Forms.ColumnHeader Friend WithEvents Lokasi As System.Windows.Forms.ColumnHeader Friend WithEvents BTNScan As System.Windows.Forms.Button Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents BTNHapus As System.Windows.Forms.Button Friend WithEvents BTNSImpan As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents _twain32 As Saraff.Twain.Twain32 Private WithEvents Label12 As System.Windows.Forms.Label Friend WithEvents Label23 As System.Windows.Forms.Label Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents BTNTutup As System.Windows.Forms.Button Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip End Class
anakpantai/busus
SIMARSIP/Arsip Keluar/Scanning Keluar Edit.Designer.vb
Visual Basic
apache-2.0
12,990
[ 30522, 1026, 3795, 1012, 7513, 1012, 5107, 22083, 2594, 1012, 21624, 8043, 7903, 2229, 1012, 5859, 6914, 16848, 1006, 1007, 1028, 1035, 7704, 2465, 13722, 1035, 17710, 7630, 2906, 1035, 10086, 22490, 2015, 2291, 1012, 3645, 1012, 3596, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package ooo.purity.unwatermark.gui; import ooo.purity.unwatermark.Mode; import ooo.purity.unwatermark.ModeFactory; import ooo.purity.unwatermark.mode.MFSA; import javax.swing.*; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.image.BufferedImage; import java.awt.print.PrinterException; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; class ViewFrame extends JFrame { private static final long serialVersionUID = -908237280313491890L; private final JFileChooser openChooser = new JFileChooser(); private final JFileChooser saveChooser = new JFileChooser(); private final ImagePanel imagePanel = new ImagePanel(); private final JScrollPane scrollPane = new JScrollPane(imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); private final DefaultListModel<Document> listModel = new DefaultListModel<>(); final JList<Document> list = new JList<>(listModel); private class Document { private final File file; private BufferedImage image; private Mode mode = ModeFactory.create(MFSA.NAME); private Document(final File file) throws IOException { this.file = file; image = mode.apply(file); } private void show() { imagePanel.setName(file.getName()); imagePanel.setImage(image); imagePanel.setBounds(0, 0, scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth(), scrollPane.getHeight() - scrollPane.getHorizontalScrollBar().getHeight()); imagePanel.setVisible(true); imagePanel.repaint(); } @Override public String toString() { return file.getName(); } } private class ViewTransferHandler extends TransferHandler { private static final long serialVersionUID = 2695692501459052660L; @Override public boolean canImport(final TransferSupport support) { if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { return false; } final boolean copySupported = (COPY & support.getSourceDropActions()) == COPY; if (!copySupported) { return false; } support.setDropAction(COPY); return true; } @Override @SuppressWarnings({"unchecked", "serial"}) public boolean importData(final TransferSupport support) { if (!canImport(support)) { return false; } final Transferable transferable = support.getTransferable(); try { final java.util.List<File> fileList = (java.util.List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor); return unwatermark(fileList.toArray(new File[fileList.size()])); } catch (final UnsupportedFlavorException | IOException e) { return false; } } } ViewFrame() { super("Unwatermark"); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, list, scrollPane); splitPane.setDividerLocation(120); getContentPane().add(splitPane); list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(e -> { if (e.getValueIsAdjusting()) { return; } final Document document = list.getSelectedValue(); if (document != null) { document.show(); } }); final TransferHandler transferHandler = new ViewTransferHandler(); setTransferHandler(transferHandler); setBackground(Color.LIGHT_GRAY); imagePanel.setTransferHandler(transferHandler); imagePanel.setLayout(new BorderLayout()); imagePanel.setBackground(Color.LIGHT_GRAY); scrollPane.setBackground(Color.LIGHT_GRAY); scrollPane.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent e) { imagePanel.setBounds(0, 0, scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth(), scrollPane.getHeight() - scrollPane.getHorizontalScrollBar().getHeight()); } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } }); pack(); initialiseMenuBar(); openChooser.setMultiSelectionEnabled(true); openChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); saveChooser.setMultiSelectionEnabled(false); } private void initialiseMenuBar() { final JMenuBar menuBar = new JMenuBar(); JMenu menu; menu = new JMenu("File"); menu.add(new JMenuItem("Open...")).addActionListener(e -> { if (openChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { unwatermark(openChooser.getSelectedFiles()); } }); menu.add(new JMenuItem("Save...")).addActionListener(e -> { Document document = list.getSelectedValue(); if (null == document && listModel.size() > 0) { document = listModel.getElementAt(0); } if (null == document) { return; } saveChooser.setSelectedFile(document.file); if (saveChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { unwatermark(document, saveChooser.getSelectedFile()); } }); menu.add(new JMenuItem("Print")).addActionListener(e -> { Document document = list.getSelectedValue(); if (null == document && listModel.size() > 0) { document = listModel.getElementAt(0); } if (null == document) { return; } try { document.mode.print(document.file); } catch (final IOException | PrinterException exc) { displayException(exc); } }); menuBar.add(menu); menu = new JMenu("Help"); menu.add(new JMenuItem("About")).addActionListener(e -> { JOptionPane.showMessageDialog(imagePanel, "Unwatermark\nmattcg@gmail.com"); }); menuBar.add(menu); setJMenuBar(menuBar); } private boolean unwatermark(final File... files) { try { Document document = null; for (File file : files) { document = new Document(file); listModel.add(listModel.size(), document); } if (null != document) { document.show(); } } catch (final IOException e) { displayException(e); return false; } return true; } private void unwatermark(final Document input, final File output) { try { input.mode.apply(input.file, output); } catch (final IOException e) { displayException(e); } } @SuppressWarnings("serial") private void displayException(final Exception e) { final JPanel panel = new JPanel(); final JPanel labelPanel = new JPanel(new BorderLayout()); final StringWriter writer = new StringWriter(); labelPanel.add(new JLabel("Unable to unwatermark.")); panel.add(labelPanel); panel.add(Box.createVerticalStrut(10)); e.printStackTrace(new PrintWriter(writer)); panel.add(new JScrollPane(new JTextArea(writer.toString())){ @Override public Dimension getPreferredSize() { return new Dimension(480, 320); } }); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); JOptionPane.showMessageDialog(imagePanel, panel, "Error", JOptionPane.ERROR_MESSAGE); } }
purityooo/unwatermark
src/main/java/ooo/purity/unwatermark/gui/ViewFrame.java
Java
mit
7,117
[ 30522, 7427, 1051, 9541, 1012, 18433, 1012, 4895, 5880, 10665, 1012, 26458, 1025, 12324, 1051, 9541, 1012, 18433, 1012, 4895, 5880, 10665, 1012, 5549, 1025, 12324, 1051, 9541, 1012, 18433, 1012, 4895, 5880, 10665, 1012, 5549, 21450, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# AUTOGENERATED FILE FROM balenalib/hummingboard-ubuntu:xenial-build ENV NODE_VERSION 10.24.1 ENV YARN_VERSION 1.22.4 RUN for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ done \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && echo "5b156bbd04adfaad2184b4d1e8324b21b546b40fb46e7105fa39f5ad2f34ddf3 node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && mkdir -p /opt/yarn \ && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && npm config set unsafe-perm true -g --unsafe-perm \ && rm -rf /tmp/* CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \ && echo "Running test-stack@node" \ && chmod +x test-stack@node.sh \ && bash test-stack@node.sh \ && rm -rf test-stack@node.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Ubuntu xenial \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v10.24.1, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
nghiant2710/base-images
balena-base-images/node/hummingboard/ubuntu/xenial/10.24.1/build/Dockerfile
Dockerfile
apache-2.0
2,765
[ 30522, 1001, 8285, 6914, 16848, 5371, 2013, 28352, 8189, 29521, 1013, 20364, 6277, 1011, 1057, 8569, 3372, 2226, 1024, 1060, 19825, 2140, 1011, 3857, 4372, 2615, 13045, 1035, 2544, 2184, 1012, 2484, 1012, 1015, 4372, 2615, 27158, 1035, 2544...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Builtin "git tag" * * Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>, * Carlos Rica <jasampler@gmail.com> * Based on git-tag.sh and mktag.c by Linus Torvalds. */ #include "cache.h" #include "builtin.h" #include "refs.h" #include "tag.h" #include "run-command.h" #include "parse-options.h" #include "diff.h" #include "revision.h" #include "gpg-interface.h" #include "sha1-array.h" #include "column.h" #include "ref-filter.h" static const char * const git_tag_usage[] = { N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <tagname> [<head>]"), N_("git tag -d <tagname>..."), N_("git tag -l [-n[<num>]] [--contains <commit>] [--points-at <object>]" "\n\t\t[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]"), N_("git tag -v <tagname>..."), NULL }; static unsigned int colopts; static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, const char *format) { struct ref_array array; char *to_free = NULL; int i; memset(&array, 0, sizeof(array)); if (filter->lines == -1) filter->lines = 0; if (!format) { if (filter->lines) { to_free = xstrfmt("%s %%(contents:lines=%d)", "%(align:15)%(refname:strip=2)%(end)", filter->lines); format = to_free; } else format = "%(refname:strip=2)"; } verify_ref_format(format); filter->with_commit_tag_algo = 1; filter_refs(&array, filter, FILTER_REFS_TAGS); ref_array_sort(sorting, &array); for (i = 0; i < array.nr; i++) show_ref_array_item(array.items[i], format, 0); ref_array_clear(&array); free(to_free); return 0; } typedef int (*each_tag_name_fn)(const char *name, const char *ref, const unsigned char *sha1); static int for_each_tag_name(const char **argv, each_tag_name_fn fn) { const char **p; char ref[PATH_MAX]; int had_error = 0; unsigned char sha1[20]; for (p = argv; *p; p++) { if (snprintf(ref, sizeof(ref), "refs/tags/%s", *p) >= sizeof(ref)) { error(_("tag name too long: %.*s..."), 50, *p); had_error = 1; continue; } if (read_ref(ref, sha1)) { error(_("tag '%s' not found."), *p); had_error = 1; continue; } if (fn(*p, ref, sha1)) had_error = 1; } return had_error; } static int delete_tag(const char *name, const char *ref, const unsigned char *sha1) { if (delete_ref(ref, sha1, 0)) return 1; printf(_("Deleted tag '%s' (was %s)\n"), name, find_unique_abbrev(sha1, DEFAULT_ABBREV)); return 0; } static int verify_tag(const char *name, const char *ref, const unsigned char *sha1) { const char *argv_verify_tag[] = {"verify-tag", "-v", "SHA1_HEX", NULL}; argv_verify_tag[2] = sha1_to_hex(sha1); if (run_command_v_opt(argv_verify_tag, RUN_GIT_CMD)) return error(_("could not verify the tag '%s'"), name); return 0; } static int do_sign(struct strbuf *buffer) { return sign_buffer(buffer, buffer, get_signing_key()); } static const char tag_template[] = N_("\nWrite a message for tag:\n %s\n" "Lines starting with '%c' will be ignored.\n"); static const char tag_template_nocleanup[] = N_("\nWrite a message for tag:\n %s\n" "Lines starting with '%c' will be kept; you may remove them" " yourself if you want to.\n"); /* Parse arg given and add it the ref_sorting array */ static int parse_sorting_string(const char *arg, struct ref_sorting **sorting_tail) { struct ref_sorting *s; int len; s = xcalloc(1, sizeof(*s)); s->next = *sorting_tail; *sorting_tail = s; if (*arg == '-') { s->reverse = 1; arg++; } if (skip_prefix(arg, "version:", &arg) || skip_prefix(arg, "v:", &arg)) s->version = 1; len = strlen(arg); s->atom = parse_ref_filter_atom(arg, arg+len); return 0; } static int git_tag_config(const char *var, const char *value, void *cb) { int status; struct ref_sorting **sorting_tail = (struct ref_sorting **)cb; if (!strcmp(var, "tag.sort")) { if (!value) return config_error_nonbool(var); parse_sorting_string(value, sorting_tail); return 0; } status = git_gpg_config(var, value, cb); if (status) return status; if (starts_with(var, "column.")) return git_column_config(var, value, "tag", &colopts); return git_default_config(var, value, cb); } static void write_tag_body(int fd, const unsigned char *sha1) { unsigned long size; enum object_type type; char *buf, *sp; buf = read_sha1_file(sha1, &type, &size); if (!buf) return; /* skip header */ sp = strstr(buf, "\n\n"); if (!sp || !size || type != OBJ_TAG) { free(buf); return; } sp += 2; /* skip the 2 LFs */ write_or_die(fd, sp, parse_signature(sp, buf + size - sp)); free(buf); } static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result) { if (sign && do_sign(buf) < 0) return error(_("unable to sign the tag")); if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0) return error(_("unable to write tag file")); return 0; } struct create_tag_options { unsigned int message_given:1; unsigned int sign; enum { CLEANUP_NONE, CLEANUP_SPACE, CLEANUP_ALL } cleanup_mode; }; static void create_tag(const unsigned char *object, const char *tag, struct strbuf *buf, struct create_tag_options *opt, unsigned char *prev, unsigned char *result) { enum object_type type; char header_buf[1024]; int header_len; char *path = NULL; type = sha1_object_info(object, NULL); if (type <= OBJ_NONE) die(_("bad object type.")); header_len = snprintf(header_buf, sizeof(header_buf), "object %s\n" "type %s\n" "tag %s\n" "tagger %s\n\n", sha1_to_hex(object), typename(type), tag, git_committer_info(IDENT_STRICT)); if (header_len > sizeof(header_buf) - 1) die(_("tag header too big.")); if (!opt->message_given) { int fd; /* write the template message before editing: */ path = git_pathdup("TAG_EDITMSG"); fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600); if (fd < 0) die_errno(_("could not create file '%s'"), path); if (!is_null_sha1(prev)) { write_tag_body(fd, prev); } else { struct strbuf buf = STRBUF_INIT; strbuf_addch(&buf, '\n'); if (opt->cleanup_mode == CLEANUP_ALL) strbuf_commented_addf(&buf, _(tag_template), tag, comment_line_char); else strbuf_commented_addf(&buf, _(tag_template_nocleanup), tag, comment_line_char); write_or_die(fd, buf.buf, buf.len); strbuf_release(&buf); } close(fd); if (launch_editor(path, buf, NULL)) { fprintf(stderr, _("Please supply the message using either -m or -F option.\n")); exit(1); } } if (opt->cleanup_mode != CLEANUP_NONE) strbuf_stripspace(buf, opt->cleanup_mode == CLEANUP_ALL); if (!opt->message_given && !buf->len) die(_("no tag message?")); strbuf_insert(buf, 0, header_buf, header_len); if (build_tag_object(buf, opt->sign, result) < 0) { if (path) fprintf(stderr, _("The tag message has been left in %s\n"), path); exit(128); } if (path) { unlink_or_warn(path); free(path); } } struct msg_arg { int given; struct strbuf buf; }; static int parse_msg_arg(const struct option *opt, const char *arg, int unset) { struct msg_arg *msg = opt->value; if (!arg) return -1; if (msg->buf.len) strbuf_addstr(&(msg->buf), "\n\n"); strbuf_addstr(&(msg->buf), arg); msg->given = 1; return 0; } static int strbuf_check_tag_ref(struct strbuf *sb, const char *name) { if (name[0] == '-') return -1; strbuf_reset(sb); strbuf_addf(sb, "refs/tags/%s", name); return check_refname_format(sb->buf, 0); } int cmd_tag(int argc, const char **argv, const char *prefix) { struct strbuf buf = STRBUF_INIT; struct strbuf ref = STRBUF_INIT; unsigned char object[20], prev[20]; const char *object_ref, *tag; struct create_tag_options opt; char *cleanup_arg = NULL; int create_reflog = 0; int annotate = 0, force = 0; int cmdmode = 0; const char *msgfile = NULL, *keyid = NULL; struct msg_arg msg = { 0, STRBUF_INIT }; struct ref_transaction *transaction; struct strbuf err = STRBUF_INIT; struct ref_filter filter; static struct ref_sorting *sorting = NULL, **sorting_tail = &sorting; const char *format = NULL; struct option options[] = { OPT_CMDMODE('l', "list", &cmdmode, N_("list tag names"), 'l'), { OPTION_INTEGER, 'n', NULL, &filter.lines, N_("n"), N_("print <n> lines of each tag message"), PARSE_OPT_OPTARG, NULL, 1 }, OPT_CMDMODE('d', "delete", &cmdmode, N_("delete tags"), 'd'), OPT_CMDMODE('v', "verify", &cmdmode, N_("verify tags"), 'v'), OPT_GROUP(N_("Tag creation options")), OPT_BOOL('a', "annotate", &annotate, N_("annotated tag, needs a message")), OPT_CALLBACK('m', "message", &msg, N_("message"), N_("tag message"), parse_msg_arg), OPT_FILENAME('F', "file", &msgfile, N_("read message from file")), OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")), OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"), N_("how to strip spaces and #comments from message")), OPT_STRING('u', "local-user", &keyid, N_("key-id"), N_("use another key to sign the tag")), OPT__FORCE(&force, N_("replace the tag if exists")), OPT_BOOL(0, "create-reflog", &create_reflog, N_("create a reflog")), OPT_GROUP(N_("Tag listing options")), OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")), OPT_CONTAINS(&filter.with_commit, N_("print only tags that contain the commit")), OPT_WITH(&filter.with_commit, N_("print only tags that contain the commit")), OPT_MERGED(&filter, N_("print only tags that are merged")), OPT_NO_MERGED(&filter, N_("print only tags that are not merged")), OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"), N_("field name to sort on"), &parse_opt_ref_sorting), { OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"), N_("print only tags of the object"), 0, parse_opt_object_name }, OPT_STRING( 0 , "format", &format, N_("format"), N_("format to use for the output")), OPT_END() }; git_config(git_tag_config, sorting_tail); memset(&opt, 0, sizeof(opt)); memset(&filter, 0, sizeof(filter)); filter.lines = -1; argc = parse_options(argc, argv, prefix, options, git_tag_usage, 0); if (keyid) { opt.sign = 1; set_signing_key(keyid); } if (opt.sign) annotate = 1; if (argc == 0 && !cmdmode) cmdmode = 'l'; if ((annotate || msg.given || msgfile || force) && (cmdmode != 0)) usage_with_options(git_tag_usage, options); finalize_colopts(&colopts, -1); if (cmdmode == 'l' && filter.lines != -1) { if (explicitly_enable_column(colopts)) die(_("--column and -n are incompatible")); colopts = 0; } if (!sorting) sorting = ref_default_sorting(); if (cmdmode == 'l') { int ret; if (column_active(colopts)) { struct column_options copts; memset(&copts, 0, sizeof(copts)); copts.padding = 2; run_column_filter(colopts, &copts); } filter.name_patterns = argv; ret = list_tags(&filter, sorting, format); if (column_active(colopts)) stop_column_filter(); return ret; } if (filter.lines != -1) die(_("-n option is only allowed with -l.")); if (filter.with_commit) die(_("--contains option is only allowed with -l.")); if (filter.points_at.nr) die(_("--points-at option is only allowed with -l.")); if (filter.merge_commit) die(_("--merged and --no-merged option are only allowed with -l")); if (cmdmode == 'd') return for_each_tag_name(argv, delete_tag); if (cmdmode == 'v') return for_each_tag_name(argv, verify_tag); if (msg.given || msgfile) { if (msg.given && msgfile) die(_("only one -F or -m option is allowed.")); annotate = 1; if (msg.given) strbuf_addbuf(&buf, &(msg.buf)); else { if (!strcmp(msgfile, "-")) { if (strbuf_read(&buf, 0, 1024) < 0) die_errno(_("cannot read '%s'"), msgfile); } else { if (strbuf_read_file(&buf, msgfile, 1024) < 0) die_errno(_("could not open or read '%s'"), msgfile); } } } tag = argv[0]; object_ref = argc == 2 ? argv[1] : "HEAD"; if (argc > 2) die(_("too many params")); if (get_sha1(object_ref, object)) die(_("Failed to resolve '%s' as a valid ref."), object_ref); if (strbuf_check_tag_ref(&ref, tag)) die(_("'%s' is not a valid tag name."), tag); if (read_ref(ref.buf, prev)) hashclr(prev); else if (!force) die(_("tag '%s' already exists"), tag); opt.message_given = msg.given || msgfile; if (!cleanup_arg || !strcmp(cleanup_arg, "strip")) opt.cleanup_mode = CLEANUP_ALL; else if (!strcmp(cleanup_arg, "verbatim")) opt.cleanup_mode = CLEANUP_NONE; else if (!strcmp(cleanup_arg, "whitespace")) opt.cleanup_mode = CLEANUP_SPACE; else die(_("Invalid cleanup mode %s"), cleanup_arg); if (annotate) create_tag(object, tag, &buf, &opt, prev, object); transaction = ref_transaction_begin(&err); if (!transaction || ref_transaction_update(transaction, ref.buf, object, prev, create_reflog ? REF_FORCE_CREATE_REFLOG : 0, NULL, &err) || ref_transaction_commit(transaction, &err)) die("%s", err.buf); ref_transaction_free(transaction); if (force && !is_null_sha1(prev) && hashcmp(prev, object)) printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV)); strbuf_release(&err); strbuf_release(&buf); strbuf_release(&ref); return 0; }
TigerKid001/git
builtin/tag.c
C
gpl-2.0
13,238
[ 30522, 1013, 1008, 1008, 2328, 2378, 1000, 21025, 2102, 6415, 1000, 1008, 1008, 9385, 1006, 1039, 1007, 2289, 19031, 10772, 1044, 16415, 5620, 4059, 1026, 1047, 25032, 1030, 2417, 12707, 1012, 4012, 1028, 1010, 1008, 5828, 11509, 1026, 1485...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/bash ./scripts/info.sh "Exporting archive" ./scripts/xcbuild-safe.sh -exportArchive \ -archivePath "ios/build/Products/BountyLandApp.xcarchive" \ -exportOptionsPlist "ios/signing/exportOptions.plist" \ -exportPath "ios/build/Products"
fullstack-zmrdi/bounty-land-app
scripts/export-archive-ios.sh
Shell
gpl-3.0
248
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 1012, 1013, 14546, 1013, 18558, 1012, 14021, 1000, 9167, 2075, 8756, 1000, 1012, 1013, 14546, 1013, 1060, 27421, 19231, 2094, 1011, 3647, 1012, 14021, 1011, 9167, 2906, 5428, 3726, 1032, 1011, 8756...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * NETLINK Generic Netlink Family * * Authors: Jamal Hadi Salim * Thomas Graf <tgraf@suug.ch> * Johannes Berg <johannes@sipsolutions.net> */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> #include <linux/string.h> #include <linux/skbuff.h> #include <linux/mutex.h> #include <linux/bitmap.h> #include <net/sock.h> #include <net/genetlink.h> static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ void genl_lock(void) { mutex_lock(&genl_mutex); } EXPORT_SYMBOL(genl_lock); void genl_unlock(void) { mutex_unlock(&genl_mutex); } EXPORT_SYMBOL(genl_unlock); #define GENL_FAM_TAB_SIZE 16 #define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1) static struct list_head family_ht[GENL_FAM_TAB_SIZE]; /* * Bitmap of multicast groups that are currently in use. * * To avoid an allocation at boot of just one unsigned long, * declare it global instead. * Bit 0 is marked as already used since group 0 is invalid. */ static unsigned long mc_group_start = 0x1; static unsigned long *mc_groups = &mc_group_start; static unsigned long mc_groups_longs = 1; static int genl_ctrl_event(int event, void *data); static inline unsigned int genl_family_hash(unsigned int id) { return id & GENL_FAM_TAB_MASK; } static inline struct list_head *genl_family_chain(unsigned int id) { return &family_ht[genl_family_hash(id)]; } static struct genl_family *genl_family_find_byid(unsigned int id) { struct genl_family *f; list_for_each_entry(f, genl_family_chain(id), family_list) if (f->id == id) return f; return NULL; } static struct genl_family *genl_family_find_byname(char *name) { struct genl_family *f; int i; for (i = 0; i < GENL_FAM_TAB_SIZE; i++) list_for_each_entry(f, genl_family_chain(i), family_list) if (strcmp(f->name, name) == 0) return f; return NULL; } static struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family) { struct genl_ops *ops; list_for_each_entry(ops, &family->ops_list, ops_list) if (ops->cmd == cmd) return ops; return NULL; } /* Of course we are going to have problems once we hit * 2^16 alive types, but that can only happen by year 2K */ static inline u16 genl_generate_id(void) { static u16 id_gen_idx = GENL_MIN_ID; int i; for (i = 0; i <= GENL_MAX_ID - GENL_MIN_ID; i++) { if (!genl_family_find_byid(id_gen_idx)) return id_gen_idx; if (++id_gen_idx > GENL_MAX_ID) id_gen_idx = GENL_MIN_ID; } return 0; } static struct genl_multicast_group notify_grp; /** * genl_register_mc_group - register a multicast group * * Registers the specified multicast group and notifies userspace * about the new group. * * Returns 0 on success or a negative error code. * * @family: The generic netlink family the group shall be registered for. * @grp: The group to register, must have a name. */ int genl_register_mc_group(struct genl_family *family, struct genl_multicast_group *grp) { int id; unsigned long *new_groups; int err = 0; BUG_ON(grp->name[0] == '\0'); BUG_ON(memchr(grp->name, '\0', GENL_NAMSIZ) == NULL); genl_lock(); /* special-case our own group */ if (grp == &notify_grp) id = GENL_ID_CTRL; else id = find_first_zero_bit(mc_groups, mc_groups_longs * BITS_PER_LONG); if (id >= mc_groups_longs * BITS_PER_LONG) { size_t nlen = (mc_groups_longs + 1) * sizeof(unsigned long); if (mc_groups == &mc_group_start) { new_groups = kzalloc(nlen, GFP_KERNEL); if (!new_groups) { err = -ENOMEM; goto out; } mc_groups = new_groups; *mc_groups = mc_group_start; } else { new_groups = krealloc(mc_groups, nlen, GFP_KERNEL); if (!new_groups) { err = -ENOMEM; goto out; } mc_groups = new_groups; mc_groups[mc_groups_longs] = 0; } mc_groups_longs++; } if (family->netnsok) { struct net *net; netlink_table_grab(); rcu_read_lock(); for_each_net_rcu(net) { err = __netlink_change_ngroups(net->genl_sock, mc_groups_longs * BITS_PER_LONG); if (err) { /* * No need to roll back, can only fail if * memory allocation fails and then the * number of _possible_ groups has been * increased on some sockets which is ok. */ rcu_read_unlock(); netlink_table_ungrab(); goto out; } } rcu_read_unlock(); netlink_table_ungrab(); } else { err = netlink_change_ngroups(init_net.genl_sock, mc_groups_longs * BITS_PER_LONG); if (err) goto out; } grp->id = id; set_bit(id, mc_groups); list_add_tail(&grp->list, &family->mcast_groups); grp->family = family; genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp); out: genl_unlock(); return err; } EXPORT_SYMBOL(genl_register_mc_group); static void __genl_unregister_mc_group(struct genl_family *family, struct genl_multicast_group *grp) { struct net *net; BUG_ON(grp->family != family); netlink_table_grab(); rcu_read_lock(); for_each_net_rcu(net) __netlink_clear_multicast_users(net->genl_sock, grp->id); rcu_read_unlock(); netlink_table_ungrab(); clear_bit(grp->id, mc_groups); list_del(&grp->list); genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp); grp->id = 0; grp->family = NULL; } /** * genl_unregister_mc_group - unregister a multicast group * * Unregisters the specified multicast group and notifies userspace * about it. All current listeners on the group are removed. * * Note: It is not necessary to unregister all multicast groups before * unregistering the family, unregistering the family will cause * all assigned multicast groups to be unregistered automatically. * * @family: Generic netlink family the group belongs to. * @grp: The group to unregister, must have been registered successfully * previously. */ void genl_unregister_mc_group(struct genl_family *family, struct genl_multicast_group *grp) { genl_lock(); __genl_unregister_mc_group(family, grp); genl_unlock(); } EXPORT_SYMBOL(genl_unregister_mc_group); static void genl_unregister_mc_groups(struct genl_family *family) { struct genl_multicast_group *grp, *tmp; list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list) __genl_unregister_mc_group(family, grp); } /** * genl_register_ops - register generic netlink operations * @family: generic netlink family * @ops: operations to be registered * * Registers the specified operations and assigns them to the specified * family. Either a doit or dumpit callback must be specified or the * operation will fail. Only one operation structure per command * identifier may be registered. * * See include/net/genetlink.h for more documenation on the operations * structure. * * Returns 0 on success or a negative error code. */ int genl_register_ops(struct genl_family *family, struct genl_ops *ops) { int err = -EINVAL; if (ops->dumpit == NULL && ops->doit == NULL) goto errout; if (genl_get_cmd(ops->cmd, family)) { err = -EEXIST; goto errout; } if (ops->dumpit) ops->flags |= GENL_CMD_CAP_DUMP; if (ops->doit) ops->flags |= GENL_CMD_CAP_DO; if (ops->policy) ops->flags |= GENL_CMD_CAP_HASPOL; genl_lock(); list_add_tail(&ops->ops_list, &family->ops_list); genl_unlock(); genl_ctrl_event(CTRL_CMD_NEWOPS, ops); err = 0; errout: return err; } EXPORT_SYMBOL(genl_register_ops); /** * genl_unregister_ops - unregister generic netlink operations * @family: generic netlink family * @ops: operations to be unregistered * * Unregisters the specified operations and unassigns them from the * specified family. The operation blocks until the current message * processing has finished and doesn't start again until the * unregister process has finished. * * Note: It is not necessary to unregister all operations before * unregistering the family, unregistering the family will cause * all assigned operations to be unregistered automatically. * * Returns 0 on success or a negative error code. */ int genl_unregister_ops(struct genl_family *family, struct genl_ops *ops) { struct genl_ops *rc; genl_lock(); list_for_each_entry(rc, &family->ops_list, ops_list) { if (rc == ops) { list_del(&ops->ops_list); genl_unlock(); genl_ctrl_event(CTRL_CMD_DELOPS, ops); return 0; } } genl_unlock(); return -ENOENT; } EXPORT_SYMBOL(genl_unregister_ops); /** * genl_register_family - register a generic netlink family * @family: generic netlink family * * Registers the specified family after validating it first. Only one * family may be registered with the same family name or identifier. * The family id may equal GENL_ID_GENERATE causing an unique id to * be automatically generated and assigned. * * Return 0 on success or a negative error code. */ int genl_register_family(struct genl_family *family) { int err = -EINVAL; if (family->id && family->id < GENL_MIN_ID) goto errout; if (family->id > GENL_MAX_ID) goto errout; INIT_LIST_HEAD(&family->ops_list); INIT_LIST_HEAD(&family->mcast_groups); genl_lock(); if (genl_family_find_byname(family->name)) { err = -EEXIST; goto errout_locked; } if (family->id == GENL_ID_GENERATE) { u16 newid = genl_generate_id(); if (!newid) { err = -ENOMEM; goto errout_locked; } family->id = newid; } else if (genl_family_find_byid(family->id)) { err = -EEXIST; goto errout_locked; } if (family->maxattr) { family->attrbuf = kmalloc((family->maxattr+1) * sizeof(struct nlattr *), GFP_KERNEL); if (family->attrbuf == NULL) { err = -ENOMEM; goto errout_locked; } } else family->attrbuf = NULL; list_add_tail(&family->family_list, genl_family_chain(family->id)); genl_unlock(); genl_ctrl_event(CTRL_CMD_NEWFAMILY, family); return 0; errout_locked: genl_unlock(); errout: return err; } EXPORT_SYMBOL(genl_register_family); /** * genl_register_family_with_ops - register a generic netlink family * @family: generic netlink family * @ops: operations to be registered * @n_ops: number of elements to register * * Registers the specified family and operations from the specified table. * Only one family may be registered with the same family name or identifier. * * The family id may equal GENL_ID_GENERATE causing an unique id to * be automatically generated and assigned. * * Either a doit or dumpit callback must be specified for every registered * operation or the function will fail. Only one operation structure per * command identifier may be registered. * * See include/net/genetlink.h for more documenation on the operations * structure. * * This is equivalent to calling genl_register_family() followed by * genl_register_ops() for every operation entry in the table taking * care to unregister the family on error path. * * Return 0 on success or a negative error code. */ int genl_register_family_with_ops(struct genl_family *family, struct genl_ops *ops, size_t n_ops) { int err, i; err = genl_register_family(family); if (err) return err; for (i = 0; i < n_ops; ++i, ++ops) { err = genl_register_ops(family, ops); if (err) goto err_out; } return 0; err_out: genl_unregister_family(family); return err; } EXPORT_SYMBOL(genl_register_family_with_ops); /** * genl_unregister_family - unregister generic netlink family * @family: generic netlink family * * Unregisters the specified family. * * Returns 0 on success or a negative error code. */ int genl_unregister_family(struct genl_family *family) { struct genl_family *rc; genl_lock(); genl_unregister_mc_groups(family); list_for_each_entry(rc, genl_family_chain(family->id), family_list) { if (family->id != rc->id || strcmp(rc->name, family->name)) continue; list_del(&rc->family_list); INIT_LIST_HEAD(&family->ops_list); genl_unlock(); kfree(family->attrbuf); genl_ctrl_event(CTRL_CMD_DELFAMILY, family); return 0; } genl_unlock(); return -ENOENT; } EXPORT_SYMBOL(genl_unregister_family); /** * genlmsg_put - Add generic netlink header to netlink message * @skb: socket buffer holding the message * @pid: netlink pid the message is addressed to * @seq: sequence number (usually the one of the sender) * @family: generic netlink family * @flags netlink message flags * @cmd: generic netlink command * * Returns pointer to user specific header */ void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, struct genl_family *family, int flags, u8 cmd) { struct nlmsghdr *nlh; struct genlmsghdr *hdr; nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN + family->hdrsize, flags); if (nlh == NULL) return NULL; hdr = nlmsg_data(nlh); hdr->cmd = cmd; hdr->version = family->version; hdr->reserved = 0; return (char *) hdr + GENL_HDRLEN; } EXPORT_SYMBOL(genlmsg_put); static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) { struct genl_ops *ops; struct genl_family *family; struct net *net = sock_net(skb->sk); struct genl_info info; struct genlmsghdr *hdr = nlmsg_data(nlh); int hdrlen, err; family = genl_family_find_byid(nlh->nlmsg_type); if (family == NULL) return -ENOENT; /* this family doesn't exist in this netns */ if (!family->netnsok && !net_eq(net, &init_net)) return -ENOENT; hdrlen = GENL_HDRLEN + family->hdrsize; if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) return -EINVAL; ops = genl_get_cmd(hdr->cmd, family); if (ops == NULL) return -EOPNOTSUPP; if ((ops->flags & GENL_ADMIN_PERM) && !capable(CAP_NET_ADMIN)) return -EPERM; if (nlh->nlmsg_flags & NLM_F_DUMP) { if (ops->dumpit == NULL) return -EOPNOTSUPP; genl_unlock(); { struct netlink_dump_control c = { .dump = ops->dumpit, .done = ops->done, }; err = netlink_dump_start(net->genl_sock, skb, nlh, &c); } genl_lock(); return err; } if (ops->doit == NULL) return -EOPNOTSUPP; if (family->attrbuf) { err = nlmsg_parse(nlh, hdrlen, family->attrbuf, family->maxattr, ops->policy); if (err < 0) return err; } info.snd_seq = nlh->nlmsg_seq; info.snd_pid = NETLINK_CB(skb).pid; info.nlhdr = nlh; info.genlhdr = nlmsg_data(nlh); info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN; info.attrs = family->attrbuf; genl_info_net_set(&info, net); memset(&info.user_ptr, 0, sizeof(info.user_ptr)); if (family->pre_doit) { err = family->pre_doit(ops, skb, &info); if (err) return err; } err = ops->doit(skb, &info); if (family->post_doit) family->post_doit(ops, skb, &info); return err; } static void genl_rcv(struct sk_buff *skb) { genl_lock(); netlink_rcv_skb(skb, &genl_rcv_msg); genl_unlock(); } /************************************************************************** * Controller **************************************************************************/ static struct genl_family genl_ctrl = { .id = GENL_ID_CTRL, .name = "nlctrl", .version = 0x2, .maxattr = CTRL_ATTR_MAX, .netnsok = true, }; static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq, u32 flags, struct sk_buff *skb, u8 cmd) { void *hdr; hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd); if (hdr == NULL) return -1; NLA_PUT_STRING(skb, CTRL_ATTR_FAMILY_NAME, family->name); NLA_PUT_U16(skb, CTRL_ATTR_FAMILY_ID, family->id); NLA_PUT_U32(skb, CTRL_ATTR_VERSION, family->version); NLA_PUT_U32(skb, CTRL_ATTR_HDRSIZE, family->hdrsize); NLA_PUT_U32(skb, CTRL_ATTR_MAXATTR, family->maxattr); if (!list_empty(&family->ops_list)) { struct nlattr *nla_ops; struct genl_ops *ops; int idx = 1; nla_ops = nla_nest_start(skb, CTRL_ATTR_OPS); if (nla_ops == NULL) goto nla_put_failure; list_for_each_entry(ops, &family->ops_list, ops_list) { struct nlattr *nest; nest = nla_nest_start(skb, idx++); if (nest == NULL) goto nla_put_failure; NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd); NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags); nla_nest_end(skb, nest); } nla_nest_end(skb, nla_ops); } if (!list_empty(&family->mcast_groups)) { struct genl_multicast_group *grp; struct nlattr *nla_grps; int idx = 1; nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS); if (nla_grps == NULL) goto nla_put_failure; list_for_each_entry(grp, &family->mcast_groups, list) { struct nlattr *nest; nest = nla_nest_start(skb, idx++); if (nest == NULL) goto nla_put_failure; NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id); NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME, grp->name); nla_nest_end(skb, nest); } nla_nest_end(skb, nla_grps); } return genlmsg_end(skb, hdr); nla_put_failure: genlmsg_cancel(skb, hdr); return -EMSGSIZE; } static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid, u32 seq, u32 flags, struct sk_buff *skb, u8 cmd) { void *hdr; struct nlattr *nla_grps; struct nlattr *nest; hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd); if (hdr == NULL) return -1; NLA_PUT_STRING(skb, CTRL_ATTR_FAMILY_NAME, grp->family->name); NLA_PUT_U16(skb, CTRL_ATTR_FAMILY_ID, grp->family->id); nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS); if (nla_grps == NULL) goto nla_put_failure; nest = nla_nest_start(skb, 1); if (nest == NULL) goto nla_put_failure; NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id); NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME, grp->name); nla_nest_end(skb, nest); nla_nest_end(skb, nla_grps); return genlmsg_end(skb, hdr); nla_put_failure: genlmsg_cancel(skb, hdr); return -EMSGSIZE; } static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) { int i, n = 0; struct genl_family *rt; struct net *net = sock_net(skb->sk); int chains_to_skip = cb->args[0]; int fams_to_skip = cb->args[1]; for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) { n = 0; list_for_each_entry(rt, genl_family_chain(i), family_list) { if (!rt->netnsok && !net_eq(net, &init_net)) continue; if (++n < fams_to_skip) continue; if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, NLM_F_MULTI, skb, CTRL_CMD_NEWFAMILY) < 0) goto errout; } fams_to_skip = 0; } errout: cb->args[0] = i; cb->args[1] = n; return skb->len; } static struct sk_buff *ctrl_build_family_msg(struct genl_family *family, u32 pid, int seq, u8 cmd) { struct sk_buff *skb; int err; skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (skb == NULL) return ERR_PTR(-ENOBUFS); err = ctrl_fill_info(family, pid, seq, 0, skb, cmd); if (err < 0) { nlmsg_free(skb); return ERR_PTR(err); } return skb; } static struct sk_buff *ctrl_build_mcgrp_msg(struct genl_multicast_group *grp, u32 pid, int seq, u8 cmd) { struct sk_buff *skb; int err; skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (skb == NULL) return ERR_PTR(-ENOBUFS); err = ctrl_fill_mcgrp_info(grp, pid, seq, 0, skb, cmd); if (err < 0) { nlmsg_free(skb); return ERR_PTR(err); } return skb; } static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = { [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING, .len = GENL_NAMSIZ - 1 }, }; static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) { struct sk_buff *msg; struct genl_family *res = NULL; int err = -EINVAL; if (info->attrs[CTRL_ATTR_FAMILY_ID]) { u16 id = nla_get_u16(info->attrs[CTRL_ATTR_FAMILY_ID]); res = genl_family_find_byid(id); err = -ENOENT; } if (info->attrs[CTRL_ATTR_FAMILY_NAME]) { char *name; name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]); res = genl_family_find_byname(name); err = -ENOENT; } if (res == NULL) return err; if (!res->netnsok && !net_eq(genl_info_net(info), &init_net)) { /* family doesn't exist here */ return -ENOENT; } msg = ctrl_build_family_msg(res, info->snd_pid, info->snd_seq, CTRL_CMD_NEWFAMILY); if (IS_ERR(msg)) return PTR_ERR(msg); return genlmsg_reply(msg, info); } static int genl_ctrl_event(int event, void *data) { struct sk_buff *msg; struct genl_family *family; struct genl_multicast_group *grp; /* genl is still initialising */ if (!init_net.genl_sock) return 0; switch (event) { case CTRL_CMD_NEWFAMILY: case CTRL_CMD_DELFAMILY: family = data; msg = ctrl_build_family_msg(family, 0, 0, event); break; case CTRL_CMD_NEWMCAST_GRP: case CTRL_CMD_DELMCAST_GRP: grp = data; family = grp->family; msg = ctrl_build_mcgrp_msg(data, 0, 0, event); break; default: return -EINVAL; } if (IS_ERR(msg)) return PTR_ERR(msg); if (!family->netnsok) { genlmsg_multicast_netns(&init_net, msg, 0, GENL_ID_CTRL, GFP_KERNEL); } else { rcu_read_lock(); genlmsg_multicast_allns(msg, 0, GENL_ID_CTRL, GFP_ATOMIC); rcu_read_unlock(); } return 0; } static struct genl_ops genl_ctrl_ops = { .cmd = CTRL_CMD_GETFAMILY, .doit = ctrl_getfamily, .dumpit = ctrl_dumpfamily, .policy = ctrl_policy, }; static struct genl_multicast_group notify_grp = { .name = "notify", }; static int __net_init genl_pernet_init(struct net *net) { struct netlink_kernel_cfg cfg = { .input = genl_rcv, .cb_mutex = &genl_mutex, }; /* we'll bump the group number right afterwards */ net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, &cfg); if (!net->genl_sock && net_eq(net, &init_net)) panic("GENL: Cannot initialize generic netlink\n"); if (!net->genl_sock) return -ENOMEM; return 0; } static void __net_exit genl_pernet_exit(struct net *net) { netlink_kernel_release(net->genl_sock); net->genl_sock = NULL; } static struct pernet_operations genl_pernet_ops = { .init = genl_pernet_init, .exit = genl_pernet_exit, }; static int __init genl_init(void) { int i, err; for (i = 0; i < GENL_FAM_TAB_SIZE; i++) INIT_LIST_HEAD(&family_ht[i]); err = genl_register_family_with_ops(&genl_ctrl, &genl_ctrl_ops, 1); if (err < 0) goto problem; netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); err = register_pernet_subsys(&genl_pernet_ops); if (err) goto problem; err = genl_register_mc_group(&genl_ctrl, &notify_grp); if (err < 0) goto problem; return 0; problem: panic("GENL: Cannot register controller: %d\n", err); } subsys_initcall(genl_init); static int genlmsg_mcast(struct sk_buff *skb, u32 pid, unsigned long group, gfp_t flags) { struct sk_buff *tmp; struct net *net, *prev = NULL; int err; for_each_net_rcu(net) { if (prev) { tmp = skb_clone(skb, flags); if (!tmp) { err = -ENOMEM; goto error; } err = nlmsg_multicast(prev->genl_sock, tmp, pid, group, flags); if (err) goto error; } prev = net; } return nlmsg_multicast(prev->genl_sock, skb, pid, group, flags); error: kfree_skb(skb); return err; } int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, unsigned int group, gfp_t flags) { return genlmsg_mcast(skb, pid, group, flags); } EXPORT_SYMBOL(genlmsg_multicast_allns);
Alucard24/Dorimanx-SG2-I9100-Kernel
net/netlink/genetlink.c
C
gpl-2.0
22,938
[ 30522, 1013, 1008, 1008, 5658, 13767, 12391, 5658, 13767, 2155, 1008, 1008, 6048, 1024, 24132, 2018, 2072, 27490, 1008, 2726, 22160, 1026, 1056, 17643, 2546, 1030, 10514, 15916, 1012, 10381, 1028, 1008, 12470, 15214, 1026, 12470, 1030, 10668,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*******************************************ÉêÃ÷*************************************** ±¾Ç¶Èëʽ²Ù×÷ϵͳδ¾­ÊÚȨ£¬½ûÖ¹Ó¦ÓÃÓÚÈκÎÉÌÒµÓÃ; °æÈ¨ËùÓУ¬ÇÖȨ±Ø¾¿ http://www.trtos.com/ **************************************************************************************/ #include <Include.h> #include <..\USER\Prj_CXHeftSensor\ADC_Driver.h> volatile uint16 ADC_Value[ADC_BUFSize][ADC_CHN]; uint16 ADCBuffer[3]; static void ADC3_GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_GPIOA, ENABLE); GPIO_InitStructure.GPIO_Pin =GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOA, &GPIO_InitStructure); // PC1,ÊäÈëʱ²»ÓÃÉèÖÃËÙÂÊ } static void ADC3_Mode_Config() { ADC_InitTypeDef ADC_InitStructure; DMA_InitTypeDef DMA_InitStructure; ADC_DeInit(ADC1); //½«ÍâÉè ADC1 µÄÈ«²¿¼Ä´æÆ÷ÖØÉèΪȱʡֵ ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC¹¤×÷ģʽ:ADC1ºÍADC2¹¤×÷ÔÚ¶ÀÁ¢Ä£Ê½ ADC_InitStructure.ADC_ScanConvMode =ENABLE; //Ä£Êýת»»¹¤×÷ÔÚɨÃèģʽ ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; //Ä£Êýת»»¹¤×÷ÔÚÁ¬Ðø×ª»»Ä£Ê½ ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; //Íⲿ´¥·¢×ª»»¹Ø±Õ ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADCÊý¾ÝÓÒ¶ÔÆë ADC_InitStructure.ADC_NbrOfChannel =ADC_CHN; //˳Ðò½øÐйæÔòת»»µÄADCͨµÀµÄÊýÄ¿ ADC_Init(ADC1, &ADC_InitStructure); //¸ù¾ÝADC_InitStructÖÐÖ¸¶¨µÄ²ÎÊý³õʼ»¯ÍâÉèADCxµÄ¼Ä´æÆ÷ ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_239Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 2, ADC_SampleTime_239Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 3, ADC_SampleTime_239Cycles5); ADC_Cmd(ADC1, ENABLE); //ʹÄÜÖ¸¶¨µÄADC1 ADC_ResetCalibration(ADC1); //¸´Î»Ö¸¶¨µÄADC1µÄУ׼¼Ä´æÆ÷ while(ADC_GetResetCalibrationStatus(ADC1)); //»ñÈ¡ADC1¸´Î»Ð£×¼¼Ä´æÆ÷µÄ״̬,ÉèÖÃ״̬ÔòµÈ´ý ADC_StartCalibration(ADC1); //¿ªÊ¼Ö¸¶¨ADC1µÄУ׼״̬ while(ADC_GetCalibrationStatus(ADC1)); //»ñȡָ¶¨ADC1µÄУ׼³ÌÐò,ÉèÖÃ״̬ÔòµÈ´ý DMA_DeInit(DMA1_Channel1); //½«DMAµÄͨµÀ1¼Ä´æÆ÷ÖØÉèΪȱʡֵ DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&ADC1->DR; //DMAÍâÉèADC»ùµØÖ· DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_Value; //DMAÄÚ´æ»ùµØÖ· DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //ÄÚ´æ×÷ΪÊý¾Ý´«ÊäµÄÄ¿µÄµØ DMA_InitStructure.DMA_BufferSize = ADC_BUFSize*ADC_CHN; //DMAͨµÀµÄDMA»º´æµÄ´óС DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //ÍâÉèµØÖ·¼Ä´æÆ÷²»±ä DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //ÄÚ´æµØÖ·¼Ä´æÆ÷µÝÔö DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //Êý¾Ý¿í¶ÈΪ16λ DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //Êý¾Ý¿í¶ÈΪ16λ DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //¹¤×÷ÔÚÑ­»·»º´æÄ£Ê½ DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMAͨµÀ xÓµÓиßÓÅÏȼ¶ DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //DMAͨµÀxûÓÐÉèÖÃΪÄÚ´æµ½ÄÚ´æ´«Êä DMA_Init(DMA1_Channel1, &DMA_InitStructure); //¸ù¾ÝDMA_InitStructÖÐÖ¸¶¨µÄ²ÎÊý³õʼ»¯DMAµÄͨµÀ ADC_SoftwareStartConvCmd(ADC1, ENABLE); DMA_Cmd(DMA1_Channel1, ENABLE); DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE); ADC_DMACmd(ADC1, ENABLE); } void ADCForTankHand_Init() { ADC3_GPIO_Config(); ADC3_Mode_Config(); } uint16 ADCFormlx91204_ReadFitel(uint8 CH) { uint8 i; uint32 Pool=0; for(i=0;i<ADC_BUFSize;i++)Pool+=ADC_Value[i][CH]; return Pool/ADC_BUFSize; } void Task_ADCFitel(void *Tags) { uint8 i=0; ADCForTankHand_Init(); while(1) { ADCBuffer[i]=ADCFormlx91204_ReadFitel(i); if(i++>3)i=0; Tos_TaskDelay(100); } }
tongjinlv/trtos
USER/Prj_WJ4_3/ADC_Driver.c
C
apache-2.0
3,801
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<script> var visibilityChanged = function() { steroids.logger.log("FROM PRELOADED VIEW window.location: " + window.location.href + ", document.visibilityState == " + document.visibilityState + " && document.hidden ==" + document.hidden); alert("FROM PRELOADED VIEW window.location: " + window.location.href + ", document.visibilityState == " + document.visibilityState + " && document.hidden ==" + document.hidden); } steroids.on("ready", function() { document.addEventListener("visibilitychange", visibilityChanged); }); </script> <h2>hi i have eventlisteners on visibilitychange</h2>
AppGyver/steroids-js
testApp/app/views/visibilitychange/preloadThatSetsVisibilityChanges.html
HTML
mit
607
[ 30522, 1026, 5896, 1028, 13075, 16476, 22305, 2098, 1027, 3853, 1006, 1007, 1063, 26261, 29514, 1012, 8833, 4590, 1012, 8833, 1006, 1000, 2013, 3653, 17468, 3193, 3332, 1012, 3295, 1024, 1000, 1009, 3332, 1012, 3295, 1012, 17850, 12879, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
.redux-container-switch { /*disable text selection*/ } .redux-container-switch .switch-options { min-height: 30px; margin-right: 10px; } .redux-container-switch .switch-options label { cursor: pointer; } .redux-container-switch .switch-options input { display: none; } .redux-container-switch .cb-enable span, .redux-container-switch .cb-disable span { -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; -ms-user-select: none; user-select: none; } .redux-container-switch .cb-enable, .redux-container-switch .cb-disable, .redux-container-switch .cb-enable span, .redux-container-switch .cb-disable span { display: block; float: left; } .redux-container-switch .cb-enable span, .redux-container-switch .cb-disable span { line-height: 30px; display: block; font-weight: 700; } .redux-container-switch .cb-enable, .redux-container-switch .cb-disable { padding: 0 10px; border-width: 1px; border-style: solid; -webkit-appearance: none; professional-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .redux-container-switch .cb-enable { border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; } .redux-container-switch .cb-disable { border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; } .redux-container-switch .cb-disable.selected { color: #fff; } .redux-container-switch .cb-enable.selected { color: #fff; }
iGeneralStore/wordpress
wp-content/themes/professional/assets/frameworks/redux/admin/redux-framework/ReduxCore/inc/fields/switch/field_switch.css
CSS
gpl-2.0
1,616
[ 30522, 1012, 2417, 5602, 1011, 11661, 1011, 6942, 1063, 1013, 1008, 4487, 19150, 3793, 4989, 1008, 1013, 1065, 1012, 2417, 5602, 1011, 11661, 1011, 6942, 1012, 6942, 1011, 7047, 1063, 8117, 1011, 4578, 1024, 2382, 2361, 2595, 1025, 7785, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. */ var global = require('./global'), config = process.mainModule.exports.config, commonUtils = require('../utils/common.utils'), logutils = require('../utils/log.utils'); var serviceRespData = {}; var webuiIP = null; function checkIfServiceRespDataExists (service, data) { try { var serviceType = service['serviceType']; var svcData = serviceRespData[serviceType]['data'][serviceType]; if (null == svcData) { return false; } var svcCnt = svcData.length; var dataCnt = data[serviceType].length; if (svcCnt != dataCnt) { return false; } for (var i = 0; i < svcCnt; i++) { if (svcData[i]['ip-address'] != data[serviceType][i]['ip-address']) { return false; } if (svcData[i]['port'] != data[serviceType][i]['port']) { return false; } } } catch(e) { return false; } return true; } function storeServiceRespData (service, data) { if ((null == service) || (null == data) || (null == data['ttl'])) { return; } var serviceType = service['serviceType']; if (null == serviceRespData[serviceType]) { serviceRespData[serviceType] = {}; } if (false == checkIfServiceRespDataExists(service, data)) { /* Log Only if change happens */ logutils.logger.debug("DiscService Response Updated by process:" + process.pid + " " + JSON.stringify(data)); } serviceRespData[serviceType]['service'] = service; serviceRespData[serviceType]['data'] = data; } function getServiceRespDataList () { return serviceRespData; } /* Function: getDiscServiceByServiceType This function uses load balancing internally Always it returns the first server IP/Port combination in the service list and pushes that at the end, such that next time when new request comes then this server should be requested at last, as we have already sent the request to this server. */ function getDiscServiceByServiceType (serviceType) { if (null != serviceRespData[serviceType]) { try { var service = serviceRespData[serviceType]['data'][serviceType].shift(); serviceRespData[serviceType]['data'][serviceType].push(service); return service; } catch(e) { } } //logutils.logger.error("Unknown Service Type Request Rxed in " + // "getDiscServiceByServiceType(): " + serviceType); return null; } function getDiscServiceByApiServerType (apiServerType) { var service = null; var serviceType = null; var respObj = []; switch (apiServerType) { case global.label.OPS_API_SERVER: case global.label.OPSERVER: serviceType = global.DISC_SERVICE_TYPE_OP_SERVER; break; case global.label.VNCONFIG_API_SERVER: case global.label.API_SERVER: serviceType = global.DISC_SERVICE_TYPE_API_SERVER; break; case global.label.DNS_SERVER: serviceType = global.DISC_SERVICE_TYPE_DNS_SERVER; break; default: // logutils.logger.debug("Unknown Discovery Server Service Type:" + // apiServerType); return null; } return getDiscServiceByServiceType(serviceType); } function processDiscoveryServiceResponseMsg (msg) { if (null == msg) { return; } msg = JSON.parse(msg.toString()); if (msg && msg['serviceResponse']) { storeServiceRespData(msg['serviceResponse']['service'], msg['serviceResponse']['data']); } } function getServerTypeByServerName (serverName) { switch (serverName) { case global.label.OPS_API_SERVER: return global.DISC_SERVICE_TYPE_OP_SERVER; case global.label.OPS_API_SERVER: case global.label.VNCONFIG_API_SERVER: return global.DISC_SERVICE_TYPE_API_SERVER; case global.label.DNS_SERVER: return global.DISC_SERVICE_TYPE_DNS_SERVER; default: return null; } } function sendWebServerReadyMessage () { var data = {}; data['jobType'] = global.STR_MAIN_WEB_SERVER_READY; data = JSON.stringify(data); var msg = { cmd: global.STR_SEND_TO_JOB_SERVER, reqData: data }; process.send(msg); } function sendDiscSubscribeMsgToJobServer (serverType) { var data = {}; data['jobType'] = global.STR_DISC_SUBSCRIBE_MSG; data['serverType'] = serverType; data = JSON.stringify(data); var msg = { cmd: global.STR_SEND_TO_JOB_SERVER, reqData: data }; process.send(msg); } function sendDiscSubMessageOnDemand (apiName) { var myId = process.mainModule.exports['myIdentity']; var servType = getServerTypeByServerName(apiName); if (null == servType) { logutils.logger.error("Unknown Discovery serviceType in " + "sendDiscSubMessageOnDemand() : " + servType); return; } if (global.service.MAINSEREVR == myId) { sendDiscSubscribeMsgToJobServer(servType); } else { try { discServ = require('../jobs/core/discoveryservice.api'); discServ.subscribeDiscoveryServiceOnDemand(servType); } catch(e) { logutils.logger.error('Module discoveryservice.api can not be ' + 'found'); } } } function resetServicesByParams (params, apiName) { var serviceType = getServerTypeByServerName(apiName); if (null == serviceType) { return null; } try { var servData = serviceRespData[serviceType]['data'][serviceType]; var servCnt = servData.length; if (servCnt <= 1) { /* Only one/no server, so no need to do any params update, as no other * server available */ return null; } for (var i = 0; i < servCnt; i++) { if ((servData[i]['ip-address'] == params['url']) && (servData[i]['port'] == params['port'])) { serviceRespData[serviceType]['data'][serviceType].splice(i, 1); break; } } params['url'] = serviceRespData[serviceType]['data'][serviceType][0]['ip-address']; params['port'] = serviceRespData[serviceType]['data'][serviceType][0]['port']; } catch(e) { logutils.logger.error("In resetServicesByParams(): exception occurred" + " " + e); return null; } return params; } function getDiscServiceRespDataList (req, res, appData) { commonUtils.handleJSONResponse(null, res, getServiceRespDataList()); } function setWebUINodeIP (ip) { if (null != ip) { webuiIP = ip; } } function getWebUINodeIP (ip) { return webuiIP; } exports.resetServicesByParams = resetServicesByParams; exports.storeServiceRespData = storeServiceRespData; exports.getServiceRespDataList = getServiceRespDataList; exports.getDiscServiceByApiServerType = getDiscServiceByApiServerType; exports.getDiscServiceByServiceType = getDiscServiceByServiceType; exports.processDiscoveryServiceResponseMsg = processDiscoveryServiceResponseMsg; exports.sendWebServerReadyMessage = sendWebServerReadyMessage; exports.sendDiscSubMessageOnDemand = sendDiscSubMessageOnDemand; exports.getDiscServiceRespDataList = getDiscServiceRespDataList; exports.setWebUINodeIP = setWebUINodeIP; exports.getWebUINodeIP = getWebUINodeIP;
vishnuvv/contrail-web-core
src/serverroot/common/discoveryclient.api.js
JavaScript
apache-2.0
7,665
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 29425, 6125, 1010, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 1013, 13075, 3795, 1027, 5478, 1006, 1005, 1012, 1013, 3795, 1005, 1007, 1010, 9530, 8873, 2290, 1027, 2832, 1012, 2364, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ********************************************************************************************************* * uC/OS-II * The Real-Time Kernel * * (c) Copyright 1992-2013, Micrium, Weston, FL * All Rights Reserved * * File : uCOS_II.H * By : Jean J. Labrosse * Version : V2.92.10 * * LICENSING TERMS: * --------------- * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research. * If you plan on using uC/OS-II in a commercial product you need to contact Micrium to properly license * its use in your product. We provide ALL the source code for your convenience and to help you experience * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a * licensing fee. ********************************************************************************************************* */ #ifndef OS_uCOS_II_H #define OS_uCOS_II_H #ifdef __cplusplus extern "C" { #endif /* ********************************************************************************************************* * uC/OS-II VERSION NUMBER ********************************************************************************************************* */ #define OS_VERSION 29210u /* Version of uC/OS-II (Vx.yy mult. by 10000) */ /* ********************************************************************************************************* * INCLUDE HEADER FILES ********************************************************************************************************* */ #include <app_cfg.h> #include <os_cfg.h> #include <os_cpu.h> /* ********************************************************************************************************* * MISCELLANEOUS ********************************************************************************************************* */ #ifdef OS_GLOBALS #define OS_EXT #else #define OS_EXT extern #endif #ifndef OS_FALSE #define OS_FALSE 0u #endif #ifndef OS_TRUE #define OS_TRUE 1u #endif #define OS_ASCII_NUL (INT8U)0 #define OS_PRIO_SELF 0xFFu /* Indicate SELF priority */ #define OS_PRIO_MUTEX_CEIL_DIS 0xFFu /* Disable mutex priority ceiling promotion */ #if OS_TASK_STAT_EN > 0u #define OS_N_SYS_TASKS 2u /* Number of system tasks */ #else #define OS_N_SYS_TASKS 1u #endif #define OS_TASK_STAT_PRIO (OS_LOWEST_PRIO - 1u) /* Statistic task priority */ #define OS_TASK_IDLE_PRIO (OS_LOWEST_PRIO) /* IDLE task priority */ #if OS_LOWEST_PRIO <= 63u #define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of event table */ #define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 8u + 1u) /* Size of ready table */ #else #define OS_EVENT_TBL_SIZE ((OS_LOWEST_PRIO) / 16u + 1u)/* Size of event table */ #define OS_RDY_TBL_SIZE ((OS_LOWEST_PRIO) / 16u + 1u)/* Size of ready table */ #endif #define OS_TASK_IDLE_ID 65535u /* ID numbers for Idle, Stat and Timer tasks */ #define OS_TASK_STAT_ID 65534u #define OS_TASK_TMR_ID 65533u #define OS_EVENT_EN (((OS_Q_EN > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u) || (OS_SEM_EN > 0u) || (OS_MUTEX_EN > 0u)) #define OS_TCB_RESERVED ((OS_TCB *)1) /*$PAGE*/ /* ********************************************************************************************************* * TASK STATUS (Bit definition for OSTCBStat) ********************************************************************************************************* */ #define OS_STAT_RDY 0x00u /* Ready to run */ #define OS_STAT_SEM 0x01u /* Pending on semaphore */ #define OS_STAT_MBOX 0x02u /* Pending on mailbox */ #define OS_STAT_Q 0x04u /* Pending on queue */ #define OS_STAT_SUSPEND 0x08u /* Task is suspended */ #define OS_STAT_MUTEX 0x10u /* Pending on mutual exclusion semaphore */ #define OS_STAT_FLAG 0x20u /* Pending on event flag group */ #define OS_STAT_MULTI 0x80u /* Pending on multiple events */ #define OS_STAT_PEND_ANY (OS_STAT_SEM | OS_STAT_MBOX | OS_STAT_Q | OS_STAT_MUTEX | OS_STAT_FLAG) /* ********************************************************************************************************* * TASK PEND STATUS (Status codes for OSTCBStatPend) ********************************************************************************************************* */ #define OS_STAT_PEND_OK 0u /* Pending status OK, not pending, or pending complete */ #define OS_STAT_PEND_TO 1u /* Pending timed out */ #define OS_STAT_PEND_ABORT 2u /* Pending aborted */ /* ********************************************************************************************************* * OS_EVENT types ********************************************************************************************************* */ #define OS_EVENT_TYPE_UNUSED 0u #define OS_EVENT_TYPE_MBOX 1u #define OS_EVENT_TYPE_Q 2u #define OS_EVENT_TYPE_SEM 3u #define OS_EVENT_TYPE_MUTEX 4u #define OS_EVENT_TYPE_FLAG 5u #define OS_TMR_TYPE 100u /* Used to identify Timers ... */ /* ... (Must be different value than OS_EVENT_TYPE_xxx) */ /* ********************************************************************************************************* * EVENT FLAGS ********************************************************************************************************* */ #define OS_FLAG_WAIT_CLR_ALL 0u /* Wait for ALL the bits specified to be CLR (i.e. 0) */ #define OS_FLAG_WAIT_CLR_AND 0u #define OS_FLAG_WAIT_CLR_ANY 1u /* Wait for ANY of the bits specified to be CLR (i.e. 0) */ #define OS_FLAG_WAIT_CLR_OR 1u #define OS_FLAG_WAIT_SET_ALL 2u /* Wait for ALL the bits specified to be SET (i.e. 1) */ #define OS_FLAG_WAIT_SET_AND 2u #define OS_FLAG_WAIT_SET_ANY 3u /* Wait for ANY of the bits specified to be SET (i.e. 1) */ #define OS_FLAG_WAIT_SET_OR 3u #define OS_FLAG_CONSUME 0x80u /* Consume the flags if condition(s) satisfied */ #define OS_FLAG_CLR 0u #define OS_FLAG_SET 1u /* ********************************************************************************************************* * Values for OSTickStepState * * Note(s): This feature is used by uC/OS-View. ********************************************************************************************************* */ #if OS_TICK_STEP_EN > 0u #define OS_TICK_STEP_DIS 0u /* Stepping is disabled, tick runs as normal */ #define OS_TICK_STEP_WAIT 1u /* Waiting for uC/OS-View to set OSTickStepState to _ONCE */ #define OS_TICK_STEP_ONCE 2u /* Process tick once and wait for next cmd from uC/OS-View */ #endif /* ********************************************************************************************************* * Possible values for 'opt' argument of OSSemDel(), OSMboxDel(), OSQDel() and OSMutexDel() ********************************************************************************************************* */ #define OS_DEL_NO_PEND 0u #define OS_DEL_ALWAYS 1u /* ********************************************************************************************************* * OS???Pend() OPTIONS * * These #defines are used to establish the options for OS???PendAbort(). ********************************************************************************************************* */ #define OS_PEND_OPT_NONE 0u /* NO option selected */ #define OS_PEND_OPT_BROADCAST 1u /* Broadcast action to ALL tasks waiting */ /* ********************************************************************************************************* * OS???PostOpt() OPTIONS * * These #defines are used to establish the options for OSMboxPostOpt() and OSQPostOpt(). ********************************************************************************************************* */ #define OS_POST_OPT_NONE 0x00u /* NO option selected */ #define OS_POST_OPT_BROADCAST 0x01u /* Broadcast message to ALL tasks waiting */ #define OS_POST_OPT_FRONT 0x02u /* Post to highest priority task waiting */ #define OS_POST_OPT_NO_SCHED 0x04u /* Do not call the scheduler if this option is selected */ /* ********************************************************************************************************* * TASK OPTIONS (see OSTaskCreateExt()) ********************************************************************************************************* */ #define OS_TASK_OPT_NONE 0x0000u /* NO option selected */ #define OS_TASK_OPT_STK_CHK 0x0001u /* Enable stack checking for the task */ #define OS_TASK_OPT_STK_CLR 0x0002u /* Clear the stack when the task is create */ #define OS_TASK_OPT_SAVE_FP 0x0004u /* Save the contents of any floating-point registers */ #define OS_TASK_OPT_NO_TLS 0x0008u /* Specify that task doesn't needs TLS */ /* ********************************************************************************************************* * TIMER OPTIONS (see OSTmrStart() and OSTmrStop()) ********************************************************************************************************* */ #define OS_TMR_OPT_NONE 0u /* No option selected */ #define OS_TMR_OPT_ONE_SHOT 1u /* Timer will not automatically restart when it expires */ #define OS_TMR_OPT_PERIODIC 2u /* Timer will automatically restart when it expires */ #define OS_TMR_OPT_CALLBACK 3u /* OSTmrStop() option to call 'callback' w/ timer arg. */ #define OS_TMR_OPT_CALLBACK_ARG 4u /* OSTmrStop() option to call 'callback' w/ new arg. */ /* ********************************************************************************************************* * TIMER STATES ********************************************************************************************************* */ #define OS_TMR_STATE_UNUSED 0u #define OS_TMR_STATE_STOPPED 1u #define OS_TMR_STATE_COMPLETED 2u #define OS_TMR_STATE_RUNNING 3u /* ********************************************************************************************************* * ERROR CODES ********************************************************************************************************* */ #define OS_ERR_NONE 0u #define OS_ERR_EVENT_TYPE 1u #define OS_ERR_PEND_ISR 2u #define OS_ERR_POST_NULL_PTR 3u #define OS_ERR_PEVENT_NULL 4u #define OS_ERR_POST_ISR 5u #define OS_ERR_QUERY_ISR 6u #define OS_ERR_INVALID_OPT 7u #define OS_ERR_ID_INVALID 8u #define OS_ERR_PDATA_NULL 9u #define OS_ERR_TIMEOUT 10u #define OS_ERR_EVENT_NAME_TOO_LONG 11u #define OS_ERR_PNAME_NULL 12u #define OS_ERR_PEND_LOCKED 13u #define OS_ERR_PEND_ABORT 14u #define OS_ERR_DEL_ISR 15u #define OS_ERR_CREATE_ISR 16u #define OS_ERR_NAME_GET_ISR 17u #define OS_ERR_NAME_SET_ISR 18u #define OS_ERR_ILLEGAL_CREATE_RUN_TIME 19u #define OS_ERR_MBOX_FULL 20u #define OS_ERR_Q_FULL 30u #define OS_ERR_Q_EMPTY 31u #define OS_ERR_PRIO_EXIST 40u #define OS_ERR_PRIO 41u #define OS_ERR_PRIO_INVALID 42u #define OS_ERR_SCHED_LOCKED 50u #define OS_ERR_SEM_OVF 51u #define OS_ERR_TASK_CREATE_ISR 60u #define OS_ERR_TASK_DEL 61u #define OS_ERR_TASK_DEL_IDLE 62u #define OS_ERR_TASK_DEL_REQ 63u #define OS_ERR_TASK_DEL_ISR 64u #define OS_ERR_TASK_NAME_TOO_LONG 65u #define OS_ERR_TASK_NO_MORE_TCB 66u #define OS_ERR_TASK_NOT_EXIST 67u #define OS_ERR_TASK_NOT_SUSPENDED 68u #define OS_ERR_TASK_OPT 69u #define OS_ERR_TASK_RESUME_PRIO 70u #define OS_ERR_TASK_SUSPEND_IDLE 71u #define OS_ERR_TASK_SUSPEND_PRIO 72u #define OS_ERR_TASK_WAITING 73u #define OS_ERR_TIME_NOT_DLY 80u #define OS_ERR_TIME_INVALID_MINUTES 81u #define OS_ERR_TIME_INVALID_SECONDS 82u #define OS_ERR_TIME_INVALID_MS 83u #define OS_ERR_TIME_ZERO_DLY 84u #define OS_ERR_TIME_DLY_ISR 85u #define OS_ERR_MEM_INVALID_PART 90u #define OS_ERR_MEM_INVALID_BLKS 91u #define OS_ERR_MEM_INVALID_SIZE 92u #define OS_ERR_MEM_NO_FREE_BLKS 93u #define OS_ERR_MEM_FULL 94u #define OS_ERR_MEM_INVALID_PBLK 95u #define OS_ERR_MEM_INVALID_PMEM 96u #define OS_ERR_MEM_INVALID_PDATA 97u #define OS_ERR_MEM_INVALID_ADDR 98u #define OS_ERR_MEM_NAME_TOO_LONG 99u #define OS_ERR_NOT_MUTEX_OWNER 100u #define OS_ERR_FLAG_INVALID_PGRP 110u #define OS_ERR_FLAG_WAIT_TYPE 111u #define OS_ERR_FLAG_NOT_RDY 112u #define OS_ERR_FLAG_INVALID_OPT 113u #define OS_ERR_FLAG_GRP_DEPLETED 114u #define OS_ERR_FLAG_NAME_TOO_LONG 115u #define OS_ERR_PCP_LOWER 120u #define OS_ERR_TMR_INVALID_DLY 130u #define OS_ERR_TMR_INVALID_PERIOD 131u #define OS_ERR_TMR_INVALID_OPT 132u #define OS_ERR_TMR_INVALID_NAME 133u #define OS_ERR_TMR_NON_AVAIL 134u #define OS_ERR_TMR_INACTIVE 135u #define OS_ERR_TMR_INVALID_DEST 136u #define OS_ERR_TMR_INVALID_TYPE 137u #define OS_ERR_TMR_INVALID 138u #define OS_ERR_TMR_ISR 139u #define OS_ERR_TMR_NAME_TOO_LONG 140u #define OS_ERR_TMR_INVALID_STATE 141u #define OS_ERR_TMR_STOPPED 142u #define OS_ERR_TMR_NO_CALLBACK 143u #define OS_ERR_NO_MORE_ID_AVAIL 150u #define OS_ERR_TLS_NO_MORE_AVAIL 160u #define OS_ERR_TLS_ID_INVALID 161u #define OS_ERR_TLS_NOT_EN 162u #define OS_ERR_TLS_DESTRUCT_ASSIGNED 163u #define OS_ERR_OS_NOT_RUNNING 164u /*$PAGE*/ /* ********************************************************************************************************* * THREAD LOCAL STORAGE (TLS) ********************************************************************************************************* */ #if OS_TASK_CREATE_EXT_EN > 0u #if defined(OS_TLS_TBL_SIZE) && (OS_TLS_TBL_SIZE > 0u) typedef void *OS_TLS; typedef INT8U OS_TLS_ID; #endif #endif /* ********************************************************************************************************* * EVENT CONTROL BLOCK ********************************************************************************************************* */ #if OS_LOWEST_PRIO <= 63u typedef INT8U OS_PRIO; #else typedef INT16U OS_PRIO; #endif #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u) typedef struct os_event { INT8U OSEventType; /* Type of event control block (see OS_EVENT_TYPE_xxxx) */ void *OSEventPtr; /* Pointer to message or queue structure */ INT16U OSEventCnt; /* Semaphore Count (not used if other EVENT type) */ OS_PRIO OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */ #if OS_EVENT_NAME_EN > 0u INT8U *OSEventName; #endif } OS_EVENT; #endif /* ********************************************************************************************************* * EVENT FLAGS CONTROL BLOCK ********************************************************************************************************* */ #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u) #if OS_FLAGS_NBITS == 8u /* Determine the size of OS_FLAGS (8, 16 or 32 bits) */ typedef INT8U OS_FLAGS; #endif #if OS_FLAGS_NBITS == 16u typedef INT16U OS_FLAGS; #endif #if OS_FLAGS_NBITS == 32u typedef INT32U OS_FLAGS; #endif typedef struct os_flag_grp { /* Event Flag Group */ INT8U OSFlagType; /* Should be set to OS_EVENT_TYPE_FLAG */ void *OSFlagWaitList; /* Pointer to first NODE of task waiting on event flag */ OS_FLAGS OSFlagFlags; /* 8, 16 or 32 bit flags */ #if OS_FLAG_NAME_EN > 0u INT8U *OSFlagName; #endif } OS_FLAG_GRP; typedef struct os_flag_node { /* Event Flag Wait List Node */ void *OSFlagNodeNext; /* Pointer to next NODE in wait list */ void *OSFlagNodePrev; /* Pointer to previous NODE in wait list */ void *OSFlagNodeTCB; /* Pointer to TCB of waiting task */ void *OSFlagNodeFlagGrp; /* Pointer to Event Flag Group */ OS_FLAGS OSFlagNodeFlags; /* Event flag to wait on */ INT8U OSFlagNodeWaitType; /* Type of wait: */ /* OS_FLAG_WAIT_AND */ /* OS_FLAG_WAIT_ALL */ /* OS_FLAG_WAIT_OR */ /* OS_FLAG_WAIT_ANY */ } OS_FLAG_NODE; #endif /*$PAGE*/ /* ********************************************************************************************************* * MESSAGE MAILBOX DATA ********************************************************************************************************* */ #if OS_MBOX_EN > 0u typedef struct os_mbox_data { void *OSMsg; /* Pointer to message in mailbox */ OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */ OS_PRIO OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ } OS_MBOX_DATA; #endif /* ********************************************************************************************************* * MEMORY PARTITION DATA STRUCTURES ********************************************************************************************************* */ #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u) typedef struct os_mem { /* MEMORY CONTROL BLOCK */ void *OSMemAddr; /* Pointer to beginning of memory partition */ void *OSMemFreeList; /* Pointer to list of free memory blocks */ INT32U OSMemBlkSize; /* Size (in bytes) of each block of memory */ INT32U OSMemNBlks; /* Total number of blocks in this partition */ INT32U OSMemNFree; /* Number of memory blocks remaining in this partition */ #if OS_MEM_NAME_EN > 0u INT8U *OSMemName; /* Memory partition name */ #endif } OS_MEM; typedef struct os_mem_data { void *OSAddr; /* Ptr to the beginning address of the memory partition */ void *OSFreeList; /* Ptr to the beginning of the free list of memory blocks */ INT32U OSBlkSize; /* Size (in bytes) of each memory block */ INT32U OSNBlks; /* Total number of blocks in the partition */ INT32U OSNFree; /* Number of memory blocks free */ INT32U OSNUsed; /* Number of memory blocks used */ } OS_MEM_DATA; #endif /*$PAGE*/ /* ********************************************************************************************************* * MUTUAL EXCLUSION SEMAPHORE DATA ********************************************************************************************************* */ #if OS_MUTEX_EN > 0u typedef struct os_mutex_data { OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */ OS_PRIO OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ BOOLEAN OSValue; /* Mutex value (OS_FALSE = used, OS_TRUE = available) */ INT8U OSOwnerPrio; /* Mutex owner's task priority or 0xFF if no owner */ INT8U OSMutexPCP; /* Priority Ceiling Priority or 0xFF if PCP disabled */ } OS_MUTEX_DATA; #endif /* ********************************************************************************************************* * MESSAGE QUEUE DATA ********************************************************************************************************* */ #if OS_Q_EN > 0u typedef struct os_q { /* QUEUE CONTROL BLOCK */ struct os_q *OSQPtr; /* Link to next queue control block in list of free blocks */ void **OSQStart; /* Ptr to start of queue data */ void **OSQEnd; /* Ptr to end of queue data */ void **OSQIn; /* Ptr to where next message will be inserted in the Q */ void **OSQOut; /* Ptr to where next message will be extracted from the Q */ INT16U OSQSize; /* Size of queue (maximum number of entries) */ INT16U OSQEntries; /* Current number of entries in the queue */ } OS_Q; typedef struct os_q_data { void *OSMsg; /* Pointer to next message to be extracted from queue */ INT16U OSNMsgs; /* Number of messages in message queue */ INT16U OSQSize; /* Size of message queue */ OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */ OS_PRIO OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ } OS_Q_DATA; #endif /* ********************************************************************************************************* * SEMAPHORE DATA ********************************************************************************************************* */ #if OS_SEM_EN > 0u typedef struct os_sem_data { INT16U OSCnt; /* Semaphore count */ OS_PRIO OSEventTbl[OS_EVENT_TBL_SIZE]; /* List of tasks waiting for event to occur */ OS_PRIO OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ } OS_SEM_DATA; #endif /* ********************************************************************************************************* * TASK STACK DATA ********************************************************************************************************* */ #if OS_TASK_CREATE_EXT_EN > 0u typedef struct os_stk_data { INT32U OSFree; /* Number of free entries on the stack */ INT32U OSUsed; /* Number of entries used on the stack */ } OS_STK_DATA; #endif /*$PAGE*/ /* ********************************************************************************************************* * TASK CONTROL BLOCK ********************************************************************************************************* */ typedef struct os_tcb { OS_STK *OSTCBStkPtr; /* Pointer to current top of stack */ #if OS_TASK_CREATE_EXT_EN > 0u void *OSTCBExtPtr; /* Pointer to user definable data for TCB extension */ OS_STK *OSTCBStkBottom; /* Pointer to bottom of stack */ INT32U OSTCBStkSize; /* Size of task stack (in number of stack elements) */ INT16U OSTCBOpt; /* Task options as passed by OSTaskCreateExt() */ INT16U OSTCBId; /* Task ID (0..65535) */ #endif struct os_tcb *OSTCBNext; /* Pointer to next TCB in the TCB list */ struct os_tcb *OSTCBPrev; /* Pointer to previous TCB in the TCB list */ #if OS_TASK_CREATE_EXT_EN > 0u #if defined(OS_TLS_TBL_SIZE) && (OS_TLS_TBL_SIZE > 0u) OS_TLS OSTCBTLSTbl[OS_TLS_TBL_SIZE]; #endif #endif #if (OS_EVENT_EN) OS_EVENT *OSTCBEventPtr; /* Pointer to event control block */ #endif #if (OS_EVENT_EN) && (OS_EVENT_MULTI_EN > 0u) OS_EVENT **OSTCBEventMultiPtr; /* Pointer to multiple event control blocks */ #endif #if ((OS_Q_EN > 0u) && (OS_MAX_QS > 0u)) || (OS_MBOX_EN > 0u) void *OSTCBMsg; /* Message received from OSMboxPost() or OSQPost() */ #endif #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u) #if OS_TASK_DEL_EN > 0u OS_FLAG_NODE *OSTCBFlagNode; /* Pointer to event flag node */ #endif OS_FLAGS OSTCBFlagsRdy; /* Event flags that made task ready to run */ #endif INT32U OSTCBDly; /* Nbr ticks to delay task or, timeout waiting for event */ INT8U OSTCBStat; /* Task status */ INT8U OSTCBStatPend; /* Task PEND status */ INT8U OSTCBPrio; /* Task priority (0 == highest) */ INT8U OSTCBX; /* Bit position in group corresponding to task priority */ INT8U OSTCBY; /* Index into ready table corresponding to task priority */ OS_PRIO OSTCBBitX; /* Bit mask to access bit position in ready table */ OS_PRIO OSTCBBitY; /* Bit mask to access bit position in ready group */ #if OS_TASK_DEL_EN > 0u INT8U OSTCBDelReq; /* Indicates whether a task needs to delete itself */ #endif #if OS_TASK_PROFILE_EN > 0u INT32U OSTCBCtxSwCtr; /* Number of time the task was switched in */ INT32U OSTCBCyclesTot; /* Total number of clock cycles the task has been running */ INT32U OSTCBCyclesStart; /* Snapshot of cycle counter at start of task resumption */ OS_STK *OSTCBStkBase; /* Pointer to the beginning of the task stack */ INT32U OSTCBStkUsed; /* Number of bytes used from the stack */ #endif #if OS_TASK_NAME_EN > 0u INT8U *OSTCBTaskName; #endif #if OS_TASK_REG_TBL_SIZE > 0u INT32U OSTCBRegTbl[OS_TASK_REG_TBL_SIZE]; #endif } OS_TCB; /*$PAGE*/ /* ********************************************************************************************************* * TIMER DATA TYPES ********************************************************************************************************* */ #if OS_TMR_EN > 0u typedef void (*OS_TMR_CALLBACK)(void *ptmr, void *parg); typedef struct os_tmr { INT8U OSTmrType; /* Should be set to OS_TMR_TYPE */ OS_TMR_CALLBACK OSTmrCallback; /* Function to call when timer expires */ void *OSTmrCallbackArg; /* Argument to pass to function when timer expires */ void *OSTmrNext; /* Double link list pointers */ void *OSTmrPrev; INT32U OSTmrMatch; /* Timer expires when OSTmrTime == OSTmrMatch */ INT32U OSTmrDly; /* Delay time before periodic update starts */ INT32U OSTmrPeriod; /* Period to repeat timer */ #if OS_TMR_CFG_NAME_EN > 0u INT8U *OSTmrName; /* Name to give the timer */ #endif INT8U OSTmrOpt; /* Options (see OS_TMR_OPT_xxx) */ INT8U OSTmrState; /* Indicates the state of the timer: */ /* OS_TMR_STATE_UNUSED */ /* OS_TMR_STATE_RUNNING */ /* OS_TMR_STATE_STOPPED */ } OS_TMR; typedef struct os_tmr_wheel { OS_TMR *OSTmrFirst; /* Pointer to first timer in linked list */ INT16U OSTmrEntries; } OS_TMR_WHEEL; #endif /*$PAGE*/ /* ********************************************************************************************************* * THREAD LOCAL STORAGE (TLS) ********************************************************************************************************* */ #if OS_TASK_CREATE_EXT_EN > 0u #if defined(OS_TLS_TBL_SIZE) && (OS_TLS_TBL_SIZE > 0u) typedef void (*OS_TLS_DESTRUCT_PTR)(OS_TCB *ptcb, OS_TLS_ID id, OS_TLS value); #endif #endif /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ OS_EXT INT32U OSCtxSwCtr; /* Counter of number of context switches */ #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u) OS_EXT OS_EVENT *OSEventFreeList; /* Pointer to list of free EVENT control blocks */ OS_EXT OS_EVENT OSEventTbl[OS_MAX_EVENTS];/* Table of EVENT control blocks */ #endif #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u) OS_EXT OS_FLAG_GRP OSFlagTbl[OS_MAX_FLAGS]; /* Table containing event flag groups */ OS_EXT OS_FLAG_GRP *OSFlagFreeList; /* Pointer to free list of event flag groups */ #endif #if OS_TASK_STAT_EN > 0u OS_EXT INT8U OSCPUUsage; /* Percentage of CPU used */ OS_EXT INT32U OSIdleCtrMax; /* Max. value that idle ctr can take in 1 sec. */ OS_EXT INT32U OSIdleCtrRun; /* Val. reached by idle ctr at run time in 1 sec. */ OS_EXT BOOLEAN OSStatRdy; /* Flag indicating that the statistic task is rdy */ OS_EXT OS_STK OSTaskStatStk[OS_TASK_STAT_STK_SIZE]; /* Statistics task stack */ #endif OS_EXT INT8U OSIntNesting; /* Interrupt nesting level */ OS_EXT INT8U OSLockNesting; /* Multitasking lock nesting level */ OS_EXT INT8U OSPrioCur; /* Priority of current task */ OS_EXT INT8U OSPrioHighRdy; /* Priority of highest priority task */ OS_EXT OS_PRIO OSRdyGrp; /* Ready list group */ OS_EXT OS_PRIO OSRdyTbl[OS_RDY_TBL_SIZE]; /* Table of tasks which are ready to run */ OS_EXT BOOLEAN OSRunning; /* Flag indicating that kernel is running */ OS_EXT INT8U OSTaskCtr; /* Number of tasks created */ OS_EXT volatile INT32U OSIdleCtr; /* Idle counter */ #ifdef OS_SAFETY_CRITICAL_IEC61508 OS_EXT BOOLEAN OSSafetyCriticalStartFlag; #endif OS_EXT OS_STK OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE]; /* Idle task stack */ OS_EXT OS_TCB *OSTCBCur; /* Pointer to currently running TCB */ OS_EXT OS_TCB *OSTCBFreeList; /* Pointer to list of free TCBs */ OS_EXT OS_TCB *OSTCBHighRdy; /* Pointer to highest priority TCB R-to-R */ OS_EXT OS_TCB *OSTCBList; /* Pointer to doubly linked list of TCBs */ OS_EXT OS_TCB *OSTCBPrioTbl[OS_LOWEST_PRIO + 1u]; /* Table of pointers to created TCBs */ OS_EXT OS_TCB OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS]; /* Table of TCBs */ #if OS_TICK_STEP_EN > 0u OS_EXT INT8U OSTickStepState; /* Indicates the state of the tick step feature */ #endif #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u) OS_EXT OS_MEM *OSMemFreeList; /* Pointer to free list of memory partitions */ OS_EXT OS_MEM OSMemTbl[OS_MAX_MEM_PART];/* Storage for memory partition manager */ #endif #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u) OS_EXT OS_Q *OSQFreeList; /* Pointer to list of free QUEUE control blocks */ OS_EXT OS_Q OSQTbl[OS_MAX_QS]; /* Table of QUEUE control blocks */ #endif #if OS_TASK_REG_TBL_SIZE > 0u OS_EXT INT8U OSTaskRegNextAvailID; /* Next available Task register ID */ #endif #if OS_TIME_GET_SET_EN > 0u OS_EXT volatile INT32U OSTime; /* Current value of system time (in ticks) */ #endif #if OS_TMR_EN > 0u OS_EXT INT16U OSTmrFree; /* Number of free entries in the timer pool */ OS_EXT INT16U OSTmrUsed; /* Number of timers used */ OS_EXT INT32U OSTmrTime; /* Current timer time */ OS_EXT OS_EVENT *OSTmrSem; /* Sem. used to gain exclusive access to timers */ OS_EXT OS_EVENT *OSTmrSemSignal; /* Sem. used to signal the update of timers */ OS_EXT OS_TMR OSTmrTbl[OS_TMR_CFG_MAX]; /* Table containing pool of timers */ OS_EXT OS_TMR *OSTmrFreeList; /* Pointer to free list of timers */ OS_EXT OS_STK OSTmrTaskStk[OS_TASK_TMR_STK_SIZE]; OS_EXT OS_TMR_WHEEL OSTmrWheelTbl[OS_TMR_CFG_WHEEL_SIZE]; #endif extern INT8U const OSUnMapTbl[256]; /* Priority->Index lookup table */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * (Target Independent Functions) ********************************************************************************************************* */ /* ********************************************************************************************************* * MISCELLANEOUS ********************************************************************************************************* */ #if (OS_EVENT_EN) #if (OS_EVENT_NAME_EN > 0u) INT8U OSEventNameGet (OS_EVENT *pevent, INT8U **pname, INT8U *perr); void OSEventNameSet (OS_EVENT *pevent, INT8U *pname, INT8U *perr); #endif #if (OS_EVENT_MULTI_EN > 0u) INT16U OSEventPendMulti (OS_EVENT **pevents_pend, OS_EVENT **pevents_rdy, void **pmsgs_rdy, INT32U timeout, INT8U *perr); #endif #endif /* ********************************************************************************************************* * TASK LOCAL STORAGE (TLS) SUPPORT ********************************************************************************************************* */ #if OS_TASK_CREATE_EXT_EN > 0u #if defined(OS_TLS_TBL_SIZE) && (OS_TLS_TBL_SIZE > 0u) OS_TLS_ID OS_TLS_GetID (INT8U *perr); OS_TLS OS_TLS_GetValue (OS_TCB *ptcb, OS_TLS_ID id, INT8U *perr); void OS_TLS_Init (INT8U *perr); void OS_TLS_SetValue (OS_TCB *ptcb, OS_TLS_ID id, OS_TLS value, INT8U *perr); void OS_TLS_SetDestruct (OS_TLS_ID id, OS_TLS_DESTRUCT_PTR pdestruct, INT8U *perr); void OS_TLS_TaskCreate (OS_TCB *ptcb); void OS_TLS_TaskDel (OS_TCB *ptcb); void OS_TLS_TaskSw (void); #endif #endif /*$PAGE*/ /* ********************************************************************************************************* * EVENT FLAGS MANAGEMENT ********************************************************************************************************* */ #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u) #if OS_FLAG_ACCEPT_EN > 0u OS_FLAGS OSFlagAccept (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *perr); #endif OS_FLAG_GRP *OSFlagCreate (OS_FLAGS flags, INT8U *perr); #if OS_FLAG_DEL_EN > 0u OS_FLAG_GRP *OSFlagDel (OS_FLAG_GRP *pgrp, INT8U opt, INT8U *perr); #endif #if (OS_FLAG_EN > 0u) && (OS_FLAG_NAME_EN > 0u) INT8U OSFlagNameGet (OS_FLAG_GRP *pgrp, INT8U **pname, INT8U *perr); void OSFlagNameSet (OS_FLAG_GRP *pgrp, INT8U *pname, INT8U *perr); #endif OS_FLAGS OSFlagPend (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT32U timeout, INT8U *perr); OS_FLAGS OSFlagPendGetFlagsRdy (void); OS_FLAGS OSFlagPost (OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U opt, INT8U *perr); #if OS_FLAG_QUERY_EN > 0u OS_FLAGS OSFlagQuery (OS_FLAG_GRP *pgrp, INT8U *perr); #endif #endif /* ********************************************************************************************************* * MESSAGE MAILBOX MANAGEMENT ********************************************************************************************************* */ #if OS_MBOX_EN > 0u #if OS_MBOX_ACCEPT_EN > 0u void *OSMboxAccept (OS_EVENT *pevent); #endif OS_EVENT *OSMboxCreate (void *pmsg); #if OS_MBOX_DEL_EN > 0u OS_EVENT *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif void *OSMboxPend (OS_EVENT *pevent, INT32U timeout, INT8U *perr); #if OS_MBOX_PEND_ABORT_EN > 0u INT8U OSMboxPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif #if OS_MBOX_POST_EN > 0u INT8U OSMboxPost (OS_EVENT *pevent, void *pmsg); #endif #if OS_MBOX_POST_OPT_EN > 0u INT8U OSMboxPostOpt (OS_EVENT *pevent, void *pmsg, INT8U opt); #endif #if OS_MBOX_QUERY_EN > 0u INT8U OSMboxQuery (OS_EVENT *pevent, OS_MBOX_DATA *p_mbox_data); #endif #endif /* ********************************************************************************************************* * MEMORY MANAGEMENT ********************************************************************************************************* */ #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u) OS_MEM *OSMemCreate (void *addr, INT32U nblks, INT32U blksize, INT8U *perr); void *OSMemGet (OS_MEM *pmem, INT8U *perr); #if OS_MEM_NAME_EN > 0u INT8U OSMemNameGet (OS_MEM *pmem, INT8U **pname, INT8U *perr); void OSMemNameSet (OS_MEM *pmem, INT8U *pname, INT8U *perr); #endif INT8U OSMemPut (OS_MEM *pmem, void *pblk); #if OS_MEM_QUERY_EN > 0u INT8U OSMemQuery (OS_MEM *pmem, OS_MEM_DATA *p_mem_data); #endif #endif /* ********************************************************************************************************* * MUTUAL EXCLUSION SEMAPHORE MANAGEMENT ********************************************************************************************************* */ #if OS_MUTEX_EN > 0u #if OS_MUTEX_ACCEPT_EN > 0u BOOLEAN OSMutexAccept (OS_EVENT *pevent, INT8U *perr); #endif OS_EVENT *OSMutexCreate (INT8U prio, INT8U *perr); #if OS_MUTEX_DEL_EN > 0u OS_EVENT *OSMutexDel (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif void OSMutexPend (OS_EVENT *pevent, INT32U timeout, INT8U *perr); INT8U OSMutexPost (OS_EVENT *pevent); #if OS_MUTEX_QUERY_EN > 0u INT8U OSMutexQuery (OS_EVENT *pevent, OS_MUTEX_DATA *p_mutex_data); #endif #endif /*$PAGE*/ /* ********************************************************************************************************* * MESSAGE QUEUE MANAGEMENT ********************************************************************************************************* */ #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u) #if OS_Q_ACCEPT_EN > 0u void *OSQAccept (OS_EVENT *pevent, INT8U *perr); #endif OS_EVENT *OSQCreate (void **start, INT16U size); #if OS_Q_DEL_EN > 0u OS_EVENT *OSQDel (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif #if OS_Q_FLUSH_EN > 0u INT8U OSQFlush (OS_EVENT *pevent); #endif void *OSQPend (OS_EVENT *pevent, INT32U timeout, INT8U *perr); #if OS_Q_PEND_ABORT_EN > 0u INT8U OSQPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif #if OS_Q_POST_EN > 0u INT8U OSQPost (OS_EVENT *pevent, void *pmsg); #endif #if OS_Q_POST_FRONT_EN > 0u INT8U OSQPostFront (OS_EVENT *pevent, void *pmsg); #endif #if OS_Q_POST_OPT_EN > 0u INT8U OSQPostOpt (OS_EVENT *pevent, void *pmsg, INT8U opt); #endif #if OS_Q_QUERY_EN > 0u INT8U OSQQuery (OS_EVENT *pevent, OS_Q_DATA *p_q_data); #endif #endif /*$PAGE*/ /* ********************************************************************************************************* * SEMAPHORE MANAGEMENT ********************************************************************************************************* */ #if OS_SEM_EN > 0u #if OS_SEM_ACCEPT_EN > 0u INT16U OSSemAccept (OS_EVENT *pevent); #endif OS_EVENT *OSSemCreate (INT16U cnt); #if OS_SEM_DEL_EN > 0u OS_EVENT *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif void OSSemPend (OS_EVENT *pevent, INT32U timeout, INT8U *perr); #if OS_SEM_PEND_ABORT_EN > 0u INT8U OSSemPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr); #endif INT8U OSSemPost (OS_EVENT *pevent); #if OS_SEM_QUERY_EN > 0u INT8U OSSemQuery (OS_EVENT *pevent, OS_SEM_DATA *p_sem_data); #endif #if OS_SEM_SET_EN > 0u void OSSemSet (OS_EVENT *pevent, INT16U cnt, INT8U *perr); #endif #endif /*$PAGE*/ /* ********************************************************************************************************* * TASK MANAGEMENT ********************************************************************************************************* */ #if OS_TASK_CHANGE_PRIO_EN > 0u INT8U OSTaskChangePrio (INT8U oldprio, INT8U newprio); #endif #if OS_TASK_CREATE_EN > 0u INT8U OSTaskCreate (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio); #endif #if OS_TASK_CREATE_EXT_EN > 0u INT8U OSTaskCreateExt (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio, INT16U id, OS_STK *pbos, INT32U stk_size, void *pext, INT16U opt); #endif #if OS_TASK_DEL_EN > 0u INT8U OSTaskDel (INT8U prio); INT8U OSTaskDelReq (INT8U prio); #endif #if OS_TASK_NAME_EN > 0u INT8U OSTaskNameGet (INT8U prio, INT8U **pname, INT8U *perr); void OSTaskNameSet (INT8U prio, INT8U *pname, INT8U *perr); #endif #if OS_TASK_SUSPEND_EN > 0u INT8U OSTaskResume (INT8U prio); INT8U OSTaskSuspend (INT8U prio); #endif #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u) INT8U OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data); #endif #if OS_TASK_QUERY_EN > 0u INT8U OSTaskQuery (INT8U prio, OS_TCB *p_task_data); #endif #if OS_TASK_REG_TBL_SIZE > 0u INT32U OSTaskRegGet (INT8U prio, INT8U id, INT8U *perr); INT8U OSTaskRegGetID (INT8U *perr); void OSTaskRegSet (INT8U prio, INT8U id, INT32U value, INT8U *perr); #endif /*$PAGE*/ /* ********************************************************************************************************* * TIME MANAGEMENT ********************************************************************************************************* */ void OSTimeDly (INT32U ticks); #if OS_TIME_DLY_HMSM_EN > 0u INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U ms); #endif #if OS_TIME_DLY_RESUME_EN > 0u INT8U OSTimeDlyResume (INT8U prio); #endif #if OS_TIME_GET_SET_EN > 0u INT32U OSTimeGet (void); void OSTimeSet (INT32U ticks); #endif void OSTimeTick (void); /* ********************************************************************************************************* * TIMER MANAGEMENT ********************************************************************************************************* */ #if OS_TMR_EN > 0u OS_TMR *OSTmrCreate (INT32U dly, INT32U period, INT8U opt, OS_TMR_CALLBACK callback, void *callback_arg, INT8U *pname, INT8U *perr); BOOLEAN OSTmrDel (OS_TMR *ptmr, INT8U *perr); #if OS_TMR_CFG_NAME_EN > 0u INT8U OSTmrNameGet (OS_TMR *ptmr, INT8U **pdest, INT8U *perr); #endif INT32U OSTmrRemainGet (OS_TMR *ptmr, INT8U *perr); INT8U OSTmrStateGet (OS_TMR *ptmr, INT8U *perr); BOOLEAN OSTmrStart (OS_TMR *ptmr, INT8U *perr); BOOLEAN OSTmrStop (OS_TMR *ptmr, INT8U opt, void *callback_arg, INT8U *perr); INT8U OSTmrSignal (void); #endif /* ********************************************************************************************************* * MISCELLANEOUS ********************************************************************************************************* */ void OSInit (void); void OSIntEnter (void); void OSIntExit (void); #ifdef OS_SAFETY_CRITICAL_IEC61508 void OSSafetyCriticalStart (void); #endif #if OS_SCHED_LOCK_EN > 0u void OSSchedLock (void); void OSSchedUnlock (void); #endif void OSStart (void); void OSStatInit (void); INT16U OSVersion (void); /*$PAGE*/ /* ********************************************************************************************************* * INTERNAL FUNCTION PROTOTYPES * (Your application MUST NOT call these functions) ********************************************************************************************************* */ #if OS_TASK_DEL_EN > 0u void OS_Dummy (void); #endif #if (OS_EVENT_EN) INT8U OS_EventTaskRdy (OS_EVENT *pevent, void *pmsg, INT8U msk, INT8U pend_stat); void OS_EventTaskWait (OS_EVENT *pevent); void OS_EventTaskRemove (OS_TCB *ptcb, OS_EVENT *pevent); #if (OS_EVENT_MULTI_EN > 0u) void OS_EventTaskWaitMulti (OS_EVENT **pevents_wait); void OS_EventTaskRemoveMulti (OS_TCB *ptcb, OS_EVENT **pevents_multi); #endif void OS_EventWaitListInit (OS_EVENT *pevent); #endif #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u) void OS_FlagInit (void); void OS_FlagUnlink (OS_FLAG_NODE *pnode); #endif void OS_MemClr (INT8U *pdest, INT16U size); void OS_MemCopy (INT8U *pdest, INT8U *psrc, INT16U size); #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u) void OS_MemInit (void); #endif #if OS_Q_EN > 0u void OS_QInit (void); #endif void OS_Sched (void); #if (OS_EVENT_NAME_EN > 0u) || (OS_FLAG_NAME_EN > 0u) || (OS_MEM_NAME_EN > 0u) || (OS_TASK_NAME_EN > 0u) INT8U OS_StrLen (INT8U *psrc); #endif void OS_TaskIdle (void *p_arg); void OS_TaskReturn (void); #if OS_TASK_STAT_EN > 0u void OS_TaskStat (void *p_arg); #endif #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u) void OS_TaskStkClr (OS_STK *pbos, INT32U size, INT16U opt); #endif #if (OS_TASK_STAT_STK_CHK_EN > 0u) && (OS_TASK_CREATE_EXT_EN > 0u) void OS_TaskStatStkChk (void); #endif INT8U OS_TCBInit (INT8U prio, OS_STK *ptos, OS_STK *pbos, INT16U id, INT32U stk_size, void *pext, INT16U opt); #if OS_TMR_EN > 0u void OSTmr_Init (void); #endif /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * (Target Specific Functions) ********************************************************************************************************* */ #if OS_DEBUG_EN > 0u void OSDebugInit (void); #endif void OSInitHookBegin (void); void OSInitHookEnd (void); void OSTaskCreateHook (OS_TCB *ptcb); void OSTaskDelHook (OS_TCB *ptcb); void OSTaskIdleHook (void); void OSTaskReturnHook (OS_TCB *ptcb); void OSTaskStatHook (void); OS_STK *OSTaskStkInit (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT16U opt); #if OS_TASK_SW_HOOK_EN > 0u void OSTaskSwHook (void); #endif void OSTCBInitHook (OS_TCB *ptcb); #if OS_TIME_TICK_HOOK_EN > 0u void OSTimeTickHook (void); #endif /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * (Application Specific Functions) ********************************************************************************************************* */ #if OS_APP_HOOKS_EN > 0u void App_TaskCreateHook (OS_TCB *ptcb); void App_TaskDelHook (OS_TCB *ptcb); void App_TaskIdleHook (void); void App_TaskReturnHook (OS_TCB *ptcb); void App_TaskStatHook (void); #if OS_TASK_SW_HOOK_EN > 0u void App_TaskSwHook (void); #endif void App_TCBInitHook (OS_TCB *ptcb); #if OS_TIME_TICK_HOOK_EN > 0u void App_TimeTickHook (void); #endif #endif /* ********************************************************************************************************* * FUNCTION PROTOTYPES * * IMPORTANT: These prototypes MUST be placed in OS_CPU.H ********************************************************************************************************* */ #if 0 void OSStartHighRdy (void); void OSIntCtxSw (void); void OSCtxSw (void); #endif /*$PAGE*/ /* ********************************************************************************************************* * LOOK FOR MISSING #define CONSTANTS * * This section is used to generate ERROR messages at compile time if certain #define constants are * MISSING in OS_CFG.H. This allows you to quickly determine the source of the error. * * You SHOULD NOT change this section UNLESS you would like to add more comments as to the source of the * compile time error. ********************************************************************************************************* */ /* ********************************************************************************************************* * EVENT FLAGS ********************************************************************************************************* */ #ifndef OS_FLAG_EN #error "OS_CFG.H, Missing OS_FLAG_EN: Enable (1) or Disable (0) code generation for Event Flags" #else #ifndef OS_MAX_FLAGS #error "OS_CFG.H, Missing OS_MAX_FLAGS: Max. number of Event Flag Groups in your application" #else #if OS_MAX_FLAGS > 65500u #error "OS_CFG.H, OS_MAX_FLAGS must be <= 65500" #endif #endif #ifndef OS_FLAGS_NBITS #error "OS_CFG.H, Missing OS_FLAGS_NBITS: Determine #bits used for event flags, MUST be either 8, 16 or 32" #endif #ifndef OS_FLAG_WAIT_CLR_EN #error "OS_CFG.H, Missing OS_FLAG_WAIT_CLR_EN: Include code for Wait on Clear EVENT FLAGS" #endif #ifndef OS_FLAG_ACCEPT_EN #error "OS_CFG.H, Missing OS_FLAG_ACCEPT_EN: Include code for OSFlagAccept()" #endif #ifndef OS_FLAG_DEL_EN #error "OS_CFG.H, Missing OS_FLAG_DEL_EN: Include code for OSFlagDel()" #endif #ifndef OS_FLAG_NAME_EN #error "OS_CFG.H, Missing OS_FLAG_NAME_EN: Enable flag group names" #endif #ifndef OS_FLAG_QUERY_EN #error "OS_CFG.H, Missing OS_FLAG_QUERY_EN: Include code for OSFlagQuery()" #endif #endif /* ********************************************************************************************************* * MESSAGE MAILBOXES ********************************************************************************************************* */ #ifndef OS_MBOX_EN #error "OS_CFG.H, Missing OS_MBOX_EN: Enable (1) or Disable (0) code generation for MAILBOXES" #else #ifndef OS_MBOX_ACCEPT_EN #error "OS_CFG.H, Missing OS_MBOX_ACCEPT_EN: Include code for OSMboxAccept()" #endif #ifndef OS_MBOX_DEL_EN #error "OS_CFG.H, Missing OS_MBOX_DEL_EN: Include code for OSMboxDel()" #endif #ifndef OS_MBOX_PEND_ABORT_EN #error "OS_CFG.H, Missing OS_MBOX_PEND_ABORT_EN: Include code for OSMboxPendAbort()" #endif #ifndef OS_MBOX_POST_EN #error "OS_CFG.H, Missing OS_MBOX_POST_EN: Include code for OSMboxPost()" #endif #ifndef OS_MBOX_POST_OPT_EN #error "OS_CFG.H, Missing OS_MBOX_POST_OPT_EN: Include code for OSMboxPostOpt()" #endif #ifndef OS_MBOX_QUERY_EN #error "OS_CFG.H, Missing OS_MBOX_QUERY_EN: Include code for OSMboxQuery()" #endif #endif /* ********************************************************************************************************* * MEMORY MANAGEMENT ********************************************************************************************************* */ #ifndef OS_MEM_EN #error "OS_CFG.H, Missing OS_MEM_EN: Enable (1) or Disable (0) code generation for MEMORY MANAGER" #else #ifndef OS_MAX_MEM_PART #error "OS_CFG.H, Missing OS_MAX_MEM_PART: Max. number of memory partitions" #else #if OS_MAX_MEM_PART > 65500u #error "OS_CFG.H, OS_MAX_MEM_PART must be <= 65500" #endif #endif #ifndef OS_MEM_NAME_EN #error "OS_CFG.H, Missing OS_MEM_NAME_EN: Enable memory partition names" #endif #ifndef OS_MEM_QUERY_EN #error "OS_CFG.H, Missing OS_MEM_QUERY_EN: Include code for OSMemQuery()" #endif #endif /* ********************************************************************************************************* * MUTUAL EXCLUSION SEMAPHORES ********************************************************************************************************* */ #ifndef OS_MUTEX_EN #error "OS_CFG.H, Missing OS_MUTEX_EN: Enable (1) or Disable (0) code generation for MUTEX" #else #ifndef OS_MUTEX_ACCEPT_EN #error "OS_CFG.H, Missing OS_MUTEX_ACCEPT_EN: Include code for OSMutexAccept()" #endif #ifndef OS_MUTEX_DEL_EN #error "OS_CFG.H, Missing OS_MUTEX_DEL_EN: Include code for OSMutexDel()" #endif #ifndef OS_MUTEX_QUERY_EN #error "OS_CFG.H, Missing OS_MUTEX_QUERY_EN: Include code for OSMutexQuery()" #endif #endif /* ********************************************************************************************************* * MESSAGE QUEUES ********************************************************************************************************* */ #ifndef OS_Q_EN #error "OS_CFG.H, Missing OS_Q_EN: Enable (1) or Disable (0) code generation for QUEUES" #else #ifndef OS_MAX_QS #error "OS_CFG.H, Missing OS_MAX_QS: Max. number of queue control blocks" #else #if OS_MAX_QS > 65500u #error "OS_CFG.H, OS_MAX_QS must be <= 65500" #endif #endif #ifndef OS_Q_ACCEPT_EN #error "OS_CFG.H, Missing OS_Q_ACCEPT_EN: Include code for OSQAccept()" #endif #ifndef OS_Q_DEL_EN #error "OS_CFG.H, Missing OS_Q_DEL_EN: Include code for OSQDel()" #endif #ifndef OS_Q_FLUSH_EN #error "OS_CFG.H, Missing OS_Q_FLUSH_EN: Include code for OSQFlush()" #endif #ifndef OS_Q_PEND_ABORT_EN #error "OS_CFG.H, Missing OS_Q_PEND_ABORT_EN: Include code for OSQPendAbort()" #endif #ifndef OS_Q_POST_EN #error "OS_CFG.H, Missing OS_Q_POST_EN: Include code for OSQPost()" #endif #ifndef OS_Q_POST_FRONT_EN #error "OS_CFG.H, Missing OS_Q_POST_FRONT_EN: Include code for OSQPostFront()" #endif #ifndef OS_Q_POST_OPT_EN #error "OS_CFG.H, Missing OS_Q_POST_OPT_EN: Include code for OSQPostOpt()" #endif #ifndef OS_Q_QUERY_EN #error "OS_CFG.H, Missing OS_Q_QUERY_EN: Include code for OSQQuery()" #endif #endif /* ********************************************************************************************************* * SEMAPHORES ********************************************************************************************************* */ #ifndef OS_SEM_EN #error "OS_CFG.H, Missing OS_SEM_EN: Enable (1) or Disable (0) code generation for SEMAPHORES" #else #ifndef OS_SEM_ACCEPT_EN #error "OS_CFG.H, Missing OS_SEM_ACCEPT_EN: Include code for OSSemAccept()" #endif #ifndef OS_SEM_DEL_EN #error "OS_CFG.H, Missing OS_SEM_DEL_EN: Include code for OSSemDel()" #endif #ifndef OS_SEM_PEND_ABORT_EN #error "OS_CFG.H, Missing OS_SEM_PEND_ABORT_EN: Include code for OSSemPendAbort()" #endif #ifndef OS_SEM_QUERY_EN #error "OS_CFG.H, Missing OS_SEM_QUERY_EN: Include code for OSSemQuery()" #endif #ifndef OS_SEM_SET_EN #error "OS_CFG.H, Missing OS_SEM_SET_EN: Include code for OSSemSet()" #endif #endif /* ********************************************************************************************************* * TASK MANAGEMENT ********************************************************************************************************* */ #ifndef OS_MAX_TASKS #error "OS_CFG.H, Missing OS_MAX_TASKS: Max. number of tasks in your application" #else #if OS_MAX_TASKS < 2u #error "OS_CFG.H, OS_MAX_TASKS must be >= 2" #endif #if OS_MAX_TASKS > ((OS_LOWEST_PRIO - OS_N_SYS_TASKS) + 1u) #error "OS_CFG.H, OS_MAX_TASKS must be <= OS_LOWEST_PRIO - OS_N_SYS_TASKS + 1" #endif #endif #if OS_LOWEST_PRIO > 254u #error "OS_CFG.H, OS_LOWEST_PRIO must be <= 254 in V2.8x and higher" #endif #ifndef OS_TASK_IDLE_STK_SIZE #error "OS_CFG.H, Missing OS_TASK_IDLE_STK_SIZE: Idle task stack size" #endif #ifndef OS_TASK_STAT_EN #error "OS_CFG.H, Missing OS_TASK_STAT_EN: Enable (1) or Disable(0) the statistics task" #endif #ifndef OS_TASK_STAT_STK_SIZE #error "OS_CFG.H, Missing OS_TASK_STAT_STK_SIZE: Statistics task stack size" #endif #ifndef OS_TASK_STAT_STK_CHK_EN #error "OS_CFG.H, Missing OS_TASK_STAT_STK_CHK_EN: Check task stacks from statistics task" #endif #ifndef OS_TASK_CHANGE_PRIO_EN #error "OS_CFG.H, Missing OS_TASK_CHANGE_PRIO_EN: Include code for OSTaskChangePrio()" #endif #ifndef OS_TASK_CREATE_EN #error "OS_CFG.H, Missing OS_TASK_CREATE_EN: Include code for OSTaskCreate()" #endif #ifndef OS_TASK_CREATE_EXT_EN #error "OS_CFG.H, Missing OS_TASK_CREATE_EXT_EN: Include code for OSTaskCreateExt()" #else #if (OS_TASK_CREATE_EXT_EN == 0u) && (OS_TASK_CREATE_EN == 0u) #error "OS_CFG.H, OS_TASK_CREATE_EXT_EN or OS_TASK_CREATE_EN must be Enable (1)" #endif #endif #ifndef OS_TASK_DEL_EN #error "OS_CFG.H, Missing OS_TASK_DEL_EN: Include code for OSTaskDel()" #endif #ifndef OS_TASK_NAME_EN #error "OS_CFG.H, Missing OS_TASK_NAME_EN: Enable task names" #endif #ifndef OS_TASK_SUSPEND_EN #error "OS_CFG.H, Missing OS_TASK_SUSPEND_EN: Include code for OSTaskSuspend() and OSTaskResume()" #endif #ifndef OS_TASK_QUERY_EN #error "OS_CFG.H, Missing OS_TASK_QUERY_EN: Include code for OSTaskQuery()" #endif #ifndef OS_TASK_REG_TBL_SIZE #error "OS_CFG.H, Missing OS_TASK_REG_TBL_SIZE: Include code for task specific registers" #else #if OS_TASK_REG_TBL_SIZE > 255u #error "OS_CFG.H, OS_TASK_REG_TBL_SIZE must be <= 255" #endif #endif /* ********************************************************************************************************* * TIME MANAGEMENT ********************************************************************************************************* */ #ifndef OS_TICKS_PER_SEC #error "OS_CFG.H, Missing OS_TICKS_PER_SEC: Sets the number of ticks in one second" #endif #ifndef OS_TIME_DLY_HMSM_EN #error "OS_CFG.H, Missing OS_TIME_DLY_HMSM_EN: Include code for OSTimeDlyHMSM()" #endif #ifndef OS_TIME_DLY_RESUME_EN #error "OS_CFG.H, Missing OS_TIME_DLY_RESUME_EN: Include code for OSTimeDlyResume()" #endif #ifndef OS_TIME_GET_SET_EN #error "OS_CFG.H, Missing OS_TIME_GET_SET_EN: Include code for OSTimeGet() and OSTimeSet()" #endif /* ********************************************************************************************************* * TIMER MANAGEMENT ********************************************************************************************************* */ #ifndef OS_TMR_EN #error "OS_CFG.H, Missing OS_TMR_EN: When (1) enables code generation for Timer Management" #elif OS_TMR_EN > 0u #if OS_SEM_EN == 0u #error "OS_CFG.H, Semaphore management is required (set OS_SEM_EN to 1) when enabling Timer Management." #error " Timer management require TWO semaphores." #endif #ifndef OS_TMR_CFG_MAX #error "OS_CFG.H, Missing OS_TMR_CFG_MAX: Determines the total number of timers in an application (2 .. 65500)" #else #if OS_TMR_CFG_MAX < 2u #error "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500" #endif #if OS_TMR_CFG_MAX > 65500u #error "OS_CFG.H, OS_TMR_CFG_MAX should be between 2 and 65500" #endif #endif #ifndef OS_TMR_CFG_WHEEL_SIZE #error "OS_CFG.H, Missing OS_TMR_CFG_WHEEL_SIZE: Sets the size of the timer wheel (1 .. 1023)" #else #if OS_TMR_CFG_WHEEL_SIZE < 2u #error "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024" #endif #if OS_TMR_CFG_WHEEL_SIZE > 1024u #error "OS_CFG.H, OS_TMR_CFG_WHEEL_SIZE should be between 2 and 1024" #endif #endif #ifndef OS_TMR_CFG_NAME_EN #error "OS_CFG.H, Missing OS_TMR_CFG_NAME_EN: Enable Timer names" #endif #ifndef OS_TMR_CFG_TICKS_PER_SEC #error "OS_CFG.H, Missing OS_TMR_CFG_TICKS_PER_SEC: Determines the rate at which the timer management task will run (Hz)" #endif #ifndef OS_TASK_TMR_STK_SIZE #error "OS_CFG.H, Missing OS_TASK_TMR_STK_SIZE: Determines the size of the Timer Task's stack" #endif #endif /* ********************************************************************************************************* * MISCELLANEOUS ********************************************************************************************************* */ #ifndef OS_ARG_CHK_EN #error "OS_CFG.H, Missing OS_ARG_CHK_EN: Enable (1) or Disable (0) argument checking" #endif #ifndef OS_CPU_HOOKS_EN #error "OS_CFG.H, Missing OS_CPU_HOOKS_EN: uC/OS-II hooks are found in the processor port files when 1" #endif #ifndef OS_APP_HOOKS_EN #error "OS_CFG.H, Missing OS_APP_HOOKS_EN: Application-defined hooks are called from the uC/OS-II hooks" #endif #ifndef OS_DEBUG_EN #error "OS_CFG.H, Missing OS_DEBUG_EN: Allows you to include variables for debugging or not" #endif #ifndef OS_LOWEST_PRIO #error "OS_CFG.H, Missing OS_LOWEST_PRIO: Defines the lowest priority that can be assigned" #endif #ifndef OS_MAX_EVENTS #error "OS_CFG.H, Missing OS_MAX_EVENTS: Max. number of event control blocks in your application" #else #if OS_MAX_EVENTS > 65500u #error "OS_CFG.H, OS_MAX_EVENTS must be <= 65500" #endif #endif #ifndef OS_SCHED_LOCK_EN #error "OS_CFG.H, Missing OS_SCHED_LOCK_EN: Include code for OSSchedLock() and OSSchedUnlock()" #endif #ifndef OS_EVENT_MULTI_EN #error "OS_CFG.H, Missing OS_EVENT_MULTI_EN: Include code for OSEventPendMulti()" #endif #ifndef OS_TASK_PROFILE_EN #error "OS_CFG.H, Missing OS_TASK_PROFILE_EN: Include data structure for run-time task profiling" #endif #ifndef OS_TASK_SW_HOOK_EN #error "OS_CFG.H, Missing OS_TASK_SW_HOOK_EN: Allows you to include the code for OSTaskSwHook() or not" #endif #ifndef OS_TICK_STEP_EN #error "OS_CFG.H, Missing OS_TICK_STEP_EN: Allows to 'step' one tick at a time with uC/OS-View" #endif #ifndef OS_TIME_TICK_HOOK_EN #error "OS_CFG.H, Missing OS_TIME_TICK_HOOK_EN: Allows you to include the code for OSTimeTickHook() or not" #endif /* ********************************************************************************************************* * SAFETY CRITICAL USE ********************************************************************************************************* */ #ifdef SAFETY_CRITICAL_RELEASE #if OS_ARG_CHK_EN < 1u #error "OS_CFG.H, OS_ARG_CHK_EN must be enabled for safety-critical release code" #endif #if OS_APP_HOOKS_EN > 0u #error "OS_CFG.H, OS_APP_HOOKS_EN must be disabled for safety-critical release code" #endif #if OS_DEBUG_EN > 0u #error "OS_CFG.H, OS_DEBUG_EN must be disabled for safety-critical release code" #endif #ifdef CANTATA #error "OS_CFG.H, CANTATA must be disabled for safety-critical release code" #endif #ifdef OS_SCHED_LOCK_EN #error "OS_CFG.H, OS_SCHED_LOCK_EN must be disabled for safety-critical release code" #endif #ifdef VSC_VALIDATION_MODE #error "OS_CFG.H, VSC_VALIDATION_MODE must be disabled for safety-critical release code" #endif #if OS_TASK_STAT_EN > 0u #error "OS_CFG.H, OS_TASK_STAT_EN must be disabled for safety-critical release code" #endif #if OS_TICK_STEP_EN > 0u #error "OS_CFG.H, OS_TICK_STEP_EN must be disabled for safety-critical release code" #endif #if OS_FLAG_EN > 0u #if OS_FLAG_DEL_EN > 0 #error "OS_CFG.H, OS_FLAG_DEL_EN must be disabled for safety-critical release code" #endif #endif #if OS_MBOX_EN > 0u #if OS_MBOX_DEL_EN > 0u #error "OS_CFG.H, OS_MBOX_DEL_EN must be disabled for safety-critical release code" #endif #endif #if OS_MUTEX_EN > 0u #if OS_MUTEX_DEL_EN > 0u #error "OS_CFG.H, OS_MUTEX_DEL_EN must be disabled for safety-critical release code" #endif #endif #if OS_Q_EN > 0u #if OS_Q_DEL_EN > 0u #error "OS_CFG.H, OS_Q_DEL_EN must be disabled for safety-critical release code" #endif #endif #if OS_SEM_EN > 0u #if OS_SEM_DEL_EN > 0u #error "OS_CFG.H, OS_SEM_DEL_EN must be disabled for safety-critical release code" #endif #endif #if OS_TASK_DEL_EN > 0u #error "OS_CFG.H, OS_TASK_DEL_EN must be disabled for safety-critical release code" #endif #if OS_CRITICAL_METHOD != 3u #error "OS_CPU.H, OS_CRITICAL_METHOD must be type 3 for safety-critical release code" #endif #endif /* ------------------------ SAFETY_CRITICAL_RELEASE ------------------------ */ #ifdef __cplusplus } #endif #endif
sh-chris110/chris
aMan_ucos/uCosII_Source/ucos_ii.h
C
gpl-2.0
80,488
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<section id="main"> <a href="./#/mocks"><- Back to mocks list</a> <nav id="secondary" class="main-nav"> <div class="mock-picture"> <div class="avatar"> <img ng-show="mock" src="img/mocks/{{mock.Mock.mockId}}.png" /> <img ng-show="mock" src="img/flags/{{mock.Mock.nationality}}.png" /><br/> {{mock.mock.givenName}} {{mock.mock.familyName}} </div> </div> <div class="mock-status"> Country: {{mock.mock.nationality}} <br/> Team: {{mock.Constructors[0].name}}<br/> Birth: {{mock.mock.dateOfBirth}}<br/> <a href="{{mock.Mock.url}}" target="_blank">Biography</a> </div> </nav> <div class="main-content"> <table class="result-table"> <thead> <tr><th colspan="5">Formula 1 2013 Results</th></tr> </thead> <tbody> <tr> <td>Round</td> <td>Grand Prix</td> <td>Team</td> <td>Grid</td> <td>Race</td> </tr> <tr ng-repeat="race in races"> <td>{{race.round}}</td> <td><img src="img/flags/{{race.Circuit.Location.country}}.png" />{{race.raceName}}</td> <td>{{race.Results[0].Constructor.name}}</td> <td>{{race.Results[0].grid}}</td> <td>{{race.Results[0].position}}</td> </tr> </tbody> </table> </div> </section>
yonred/MockApp
app/partials/result.html
HTML
mit
1,318
[ 30522, 1026, 2930, 8909, 1027, 1000, 2364, 1000, 1028, 1026, 1037, 17850, 12879, 1027, 1000, 1012, 1013, 1001, 1013, 12934, 2015, 1000, 1028, 1026, 1011, 2067, 2000, 12934, 2015, 2862, 1026, 1013, 1037, 1028, 1026, 6583, 2615, 8909, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace TCPCW\DB\WowWorldBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Waypoints * * @ORM\Table(name="waypoints") * @ORM\Entity */ class Waypoints { /** * @var float * * @ORM\Column(name="position_x", type="float", precision=10, scale=0, nullable=false) */ private $positionX = '0'; /** * @var float * * @ORM\Column(name="position_y", type="float", precision=10, scale=0, nullable=false) */ private $positionY = '0'; /** * @var float * * @ORM\Column(name="position_z", type="float", precision=10, scale=0, nullable=false) */ private $positionZ = '0'; /** * @var string * * @ORM\Column(name="point_comment", type="text", length=65535, nullable=true) */ private $pointComment; /** * @var integer * * @ORM\Column(name="entry", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") */ private $entry; /** * @var integer * * @ORM\Column(name="pointid", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") */ private $pointid; /** * Set positionX * * @param float $positionX * * @return Waypoints */ public function setPositionX($positionX) { $this->positionX = $positionX; return $this; } /** * Get positionX * * @return float */ public function getPositionX() { return $this->positionX; } /** * Set positionY * * @param float $positionY * * @return Waypoints */ public function setPositionY($positionY) { $this->positionY = $positionY; return $this; } /** * Get positionY * * @return float */ public function getPositionY() { return $this->positionY; } /** * Set positionZ * * @param float $positionZ * * @return Waypoints */ public function setPositionZ($positionZ) { $this->positionZ = $positionZ; return $this; } /** * Get positionZ * * @return float */ public function getPositionZ() { return $this->positionZ; } /** * Set pointComment * * @param string $pointComment * * @return Waypoints */ public function setPointComment($pointComment) { $this->pointComment = $pointComment; return $this; } /** * Get pointComment * * @return string */ public function getPointComment() { return $this->pointComment; } /** * Set entry * * @param integer $entry * * @return Waypoints */ public function setEntry($entry) { $this->entry = $entry; return $this; } /** * Get entry * * @return integer */ public function getEntry() { return $this->entry; } /** * Set pointid * * @param integer $pointid * * @return Waypoints */ public function setPointid($pointid) { $this->pointid = $pointid; return $this; } /** * Get pointid * * @return integer */ public function getPointid() { return $this->pointid; } }
hidabe/trinity-core-proControlWeb
src/TCPCW/DB/WowWorldBundle/Entity/Waypoints.php
PHP
gpl-3.0
3,387
[ 30522, 1026, 1029, 25718, 3415, 15327, 22975, 15042, 2860, 1032, 16962, 1032, 10166, 11108, 27265, 2571, 1032, 9178, 1025, 2224, 8998, 1032, 2030, 2213, 1032, 12375, 2004, 2030, 2213, 1025, 1013, 1008, 1008, 1008, 2126, 26521, 1008, 1008, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package de.lampware.racing.istats.cli; /** * TODO JavaDoc */ @FunctionalInterface public interface IstatsCLIRunner extends Runnable { }
saschalamp/istats
cli/src/main/java/de/lampware/racing/istats/cli/IstatsCLIRunner.java
Java
apache-2.0
140
[ 30522, 7427, 2139, 1012, 10437, 8059, 1012, 3868, 1012, 21541, 11149, 1012, 18856, 2072, 1025, 1013, 1008, 1008, 1008, 28681, 2080, 9262, 3527, 2278, 1008, 1013, 1030, 8360, 18447, 2121, 12172, 2270, 8278, 21541, 11149, 20464, 4313, 4609, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#pragma once #include <QAbstractItemModel> #include <memory> class ProfFile; class ProfTreeItem; class ProfTreeModel : public QAbstractItemModel { public: ProfTreeModel(const std::shared_ptr<ProfFile>& ctx); virtual ~ProfTreeModel(); QVariant data(const QModelIndex& index, int role) const override; Qt::ItemFlags flags(const QModelIndex& index) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex& index) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent = QModelIndex()) const override; const QVector<std::shared_ptr<ProfTreeItem>>& roots() const { return mFiles; } private: void setupData(); QVector<std::shared_ptr<ProfTreeItem>> mFiles; std::shared_ptr<ProfFile> mContext; };
PearCoding/PearRay
src/tools/diagnostic/prof/ProfTreeModel.h
C
mit
996
[ 30522, 1001, 10975, 8490, 2863, 2320, 1001, 2421, 1026, 1053, 7875, 20528, 6593, 4221, 7382, 10244, 2140, 1028, 1001, 2421, 1026, 3638, 1028, 2465, 11268, 8873, 2571, 1025, 2465, 11268, 13334, 4221, 2213, 1025, 2465, 11268, 13334, 5302, 924...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Net.Http.Formatting; using System.Web; using System.Web.Hosting; using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using NLog; using NLog.Config; using NLog.Targets; using RceDoorzoeker.Configuration; using RceDoorzoeker.Services.Mappers; namespace RceDoorzoeker { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class MvcApplication : HttpApplication { private static readonly Logger s_logger = LogManager.GetCurrentClassLogger(); public static bool ReleaseBuild { get { #if DEBUG return false; #else return true; #endif } } protected void Application_Start() { InitializeConfiguration(); InitLogging(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); AreaRegistration.RegisterAllAreas(); BundleTable.EnableOptimizations = ReleaseBuild; BundleConfig.RegisterBundles(BundleTable.Bundles); RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); WebApiConfig.Register(GlobalConfiguration.Configuration); RouteConfig.RegisterRoutes(RouteTable.Routes); DoorzoekerModelMapper.ConfigureMapper(); var config = GlobalConfiguration.Configuration; config.Formatters.Clear(); var jsonMediaTypeFormatter = new JsonMediaTypeFormatter { SerializerSettings = { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore } }; config.Formatters.Add(jsonMediaTypeFormatter); s_logger.Info("Application started."); } private void InitLogging() { var cfg = new LoggingConfiguration(); var fileTarget = new FileTarget() { FileName = string.Format("${{basedir}}/App_Data/NLog-{0}.log", Instance.Current.Name), Layout = "${longdate} ${level} ${logger} ${message} ${exception:format=tostring}", ArchiveAboveSize = 2000000, ArchiveNumbering = ArchiveNumberingMode.Sequence, ArchiveEvery = FileArchivePeriod.Month, MaxArchiveFiles = 10, ConcurrentWrites = false, KeepFileOpen = true, EnableFileDelete = true, ArchiveFileName = string.Format("${{basedir}}/App_Data/NLog-{0}_archive_{{###}}.log", Instance.Current.Name) }; var traceTarget = new TraceTarget() { Layout = "${level} ${logger} ${message} ${exception:format=tostring}" }; cfg.AddTarget("instancefile", fileTarget); cfg.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, fileTarget)); cfg.AddTarget("trace", traceTarget); cfg.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, traceTarget)); LogManager.Configuration = cfg; } private static void InitializeConfiguration() { var instanceConfig = InstanceRegistry.Current.GetBySiteName(HostingEnvironment.SiteName); if (instanceConfig == null) throw new ApplicationException("Can't find instance configuration for site " + HostingEnvironment.SiteName); Instance.Current = instanceConfig; DoorzoekerConfig.Current = DoorzoekerConfig.Load(instanceConfig.Config); } protected void Application_End() { s_logger.Info("Application ended"); } } }
Joppe-A/rce-doorzoeker
RceDoorzoeker/Global.asax.cs
C#
apache-2.0
3,311
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 5658, 1012, 8299, 1012, 4289, 3436, 1025, 2478, 2291, 1012, 4773, 1025, 2478, 2291, 1012, 4773, 1012, 9936, 1025, 2478, 2291, 1012, 4773, 1012, 8299, 1025, 2478, 2291, 1012, 4773, 1012, 19842, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} module PontariusService.Types where import Control.Applicative import Control.Lens import Control.Monad.Reader import DBus import DBus.Signal import DBus.Types import Data.ByteString (ByteString) import Data.Set (Set) import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as Text import Data.Time.Clock (UTCTime) import Data.Time.Clock.POSIX as Time import Data.Typeable import Data.UUID (UUID) import qualified Data.UUID as UUID import Data.Word import qualified Network.Xmpp as Xmpp type SSID = ByteString data BatchLink = BatchLinkIgnore | BatchLinkExisting UUID | BatchLinkNewContact Text instance Representable BatchLink where type RepType BatchLink = 'TypeStruct '[ 'DBusSimpleType 'TypeByte , 'DBusSimpleType 'TypeString] toRep BatchLinkIgnore = DBVStruct (StructCons (DBVByte 0) (StructSingleton (DBVString ""))) toRep (BatchLinkExisting uuid) = DBVStruct (StructCons (DBVByte 1) (StructSingleton (toRep uuid))) toRep (BatchLinkNewContact name) = DBVStruct (StructCons (DBVByte 2) (StructSingleton (toRep name))) fromRep (DBVStruct (StructCons (DBVByte 0) (StructSingleton _))) = Just BatchLinkIgnore fromRep (DBVStruct (StructCons (DBVByte 1) (StructSingleton uuid))) = BatchLinkExisting <$> (fromRep uuid) fromRep (DBVStruct (StructCons (DBVByte 2) (StructSingleton (DBVString name)))) = Just $ BatchLinkNewContact name data PontariusState = CredentialsUnset | IdentityNotFound | IdentitiesAvailable | CreatingIdentity | Disabled | Authenticating | Authenticated | AuthenticationDenied deriving (Show, Eq) data AccountState = AccountEnabled | AccountDisabled deriving (Show, Eq) data PeerStatus = Unavailable | Available deriving (Show, Eq) instance Representable UTCTime where type RepType UTCTime = 'DBusSimpleType 'TypeUInt32 toRep = DBVUInt32 . round . utcTimeToPOSIXSeconds fromRep (DBVUInt32 x) = Just . posixSecondsToUTCTime $ fromIntegral x instance DBus.Representable Xmpp.Jid where type RepType Xmpp.Jid = 'DBusSimpleType 'TypeString toRep = DBus.DBVString . Xmpp.jidToText fromRep (DBus.DBVString s) = Xmpp.jidFromText s instance (Ord a, DBus.Representable a) => DBus.Representable (Set a) where type RepType (Set a) = RepType [a] toRep = toRep . Set.toList fromRep = fmap Set.fromList . fromRep instance Representable (Maybe KeyID) where type RepType (Maybe KeyID) = RepType KeyID toRep Nothing = toRep Text.empty toRep (Just k) = toRep k fromRep v = case fromRep v of Nothing -> Nothing Just v' | Text.null v' -> Just Nothing | otherwise -> Just (Just v') instance Representable (Maybe UTCTime) where type RepType (Maybe UTCTime) = RepType UTCTime toRep Nothing = toRep (0 :: Word32) toRep (Just t) = toRep t fromRep v = case fromRep v of Nothing -> Nothing Just t' | t' == (0 :: Word32) -> Just Nothing | otherwise -> Just . Just $ posixSecondsToUTCTime $ fromIntegral t' type KeyID = Text type SessionID = ByteString data ConnectionStatus = Connected | Disconnected deriving (Show, Eq, Ord) data InitResponse = KeyOK | SelectKey data Ent = Ent { entityJid :: Xmpp.Jid , entityDisplayName :: Text , entityDescription :: Text } deriving (Show, Typeable) data AkeEvent = AkeEvent { akeEventStart :: UTCTime , akeEventSuccessfull :: Bool , akeEventPeerJid :: Xmpp.Jid , akeEventOurJid :: Xmpp.Jid , akeEventPeerkeyID :: KeyID , akeEventOurkeyID :: KeyID } deriving (Show, Eq) data ChallengeEvent = ChallengeEvent { challengeEventChallengeOutgoing :: Bool , challengeEventStarted :: UTCTime , challengeEventCompleted :: UTCTime , challengeEventQuestion :: Text , challengeEventResult :: Text } deriving (Show, Eq) data RevocationEvent = RevocationEvent { revocationEventKeyID :: KeyID , revocationEventTime :: UTCTime } data RevocationSignalEvent = RevocationlEvent { revocationSignalEventKeyID :: KeyID , revocationSignalEventTime :: UTCTime } makePrisms ''PontariusState makeRepresentable ''PontariusState makePrisms ''AccountState makeRepresentable ''AccountState makeRepresentable ''RevocationSignalEvent makeRepresentable ''ConnectionStatus makeRepresentable ''InitResponse makeRepresentable ''Ent makeRepresentable ''AkeEvent makeRepresentable ''ChallengeEvent makeRepresentable ''RevocationEvent makeRepresentable ''PeerStatus instance DBus.Representable UUID where type RepType UUID = RepType Text toRep = toRep . Text.pack . UUID.toString fromRep = UUID.fromString . Text.unpack <=< fromRep data AddPeerFailed = AddPeerFailed { addPeerFailedPeer :: !Xmpp.Jid , addPeerFailedReason :: !Text } deriving (Show) makeRepresentable ''AddPeerFailed makeLensesWith camelCaseFields ''AddPeerFailed data RemovePeerFailed = RemovePeerFailed { removePeerFailedPeer :: !Xmpp.Jid , removePeerFailedReason :: !Text } deriving (Show) makeRepresentable ''RemovePeerFailed makeLensesWith camelCaseFields ''RemovePeerFailed
pontarius/pontarius-service
source/PontariusService/Types.hs
Haskell
agpl-3.0
6,475
[ 30522, 1063, 1011, 1001, 2653, 8360, 3207, 11837, 4181, 9243, 1001, 1011, 1065, 1063, 1011, 1001, 2653, 2058, 17468, 3367, 4892, 2015, 1001, 1011, 1065, 1063, 1011, 1001, 7047, 1035, 1043, 16257, 1011, 1042, 3630, 1011, 11582, 1011, 12958, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{% extends "customer/baseaccountpage.html" %} {% load i18n %} {% block extra_breadcrumbs %} <li> <a href="{% url 'customer:notifications-inbox' %}">{% trans 'Notifications inbox' %}</a> <span class="divider">/</span> </li> {% endblock %} {% block tabcontent %} <table class="table table-striped table-bordered"> {% if notification.sender %} <tr> <th>{% trans 'Sender' %}</th> <td>{{ notification.sender }}</td> </tr> {% endif %} <tr> <th>{% trans 'Date sent' %}</th> <td>{{ notification.date_sent }}</td> </tr> {% if notification.body %} <tr> <th>{% trans 'Subject' %}</th> <td>{{ notification.subject|safe }}</td> </tr> <tr> <th>{% trans 'Body' %}</th> <td>{{ notification.body }}</td> </tr> {% else %} <tr> <th>{% trans 'Message' %}</th> <th>{{ notification.subject|safe }}</th> </tr> {% endif %} </table> <div class="form-actions"><a href="{% url 'customer:notifications-inbox' %}" class="btn">{% trans 'Return to notifications inbox' %}</a></div> {% endblock tabcontent %}
marcoantoniooliveira/labweb
oscar/templates/oscar/customer/notifications/detail.html
HTML
bsd-3-clause
1,304
[ 30522, 1063, 1003, 8908, 1000, 8013, 1013, 2918, 6305, 3597, 16671, 13704, 1012, 16129, 1000, 1003, 1065, 1063, 1003, 7170, 1045, 15136, 2078, 1003, 1065, 1063, 1003, 3796, 4469, 1035, 7852, 26775, 25438, 2015, 1003, 1065, 1026, 5622, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div id="skipnav"><a href="#page-top">Skip to main content</a></div> <!-- Navigation --> <nav id="mainNav" class="navbar navbar-default navbar-fixed-top navbar-custom" [ngClass]="{'affix':isShrunk}"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header page-scroll"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i> </button> <ul class="list-inline" style="margin: 0"> <li> <a href="https://www.facebook.com/junior.galdino.74" target="_blank" class="btn-social btn-outline"> <span class="sr-only">Facebook</span><i class="fa fa-fw fa-facebook"></i> </a> </li> <li> <a href="https://www.linkedin.com/in/franclis-galdino-da-silva-b8305a96/" target="_blank" class="btn-social btn-outline"> <span class="sr-only">Linked In</span><i class="fa fa-fw fa-linkedin"></i> </a> </li> <li> <a href="https://github.com/franclisjunior" target="_blank" class="btn-social btn-outline"> <span class="sr-only">Github</span><i class="fa fa-fw fa-github-square"></i> </a> </li> </ul> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li class="page-scroll"> <a pageScroll href="#portfolio">{{ 'PORTFOLIO' | translate }}</a> </li> <li class="page-scroll"> <a pageScroll href="#curriculum">{{ 'CURRICULUM' | translate }}</a> </li> <li class="page-scroll"> <a pageScroll href="#contact">{{ 'CONTACT' | translate }}</a> </li> <li class="dropdown toogle-language"> <i class="dropdown-toggle" id="selectLanguage" style=" color: white" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <span class="toogle-language-icon"> <i class="toogle-language-icon fa fa-language fa-2x"></i> <i class="toogle-language-icon caret"></i> </span> </i> <ul class="dropdown-menu" aria-labelledby="selectLanguage"> <li class="language-item" (click)="setLanguage('english', 'en')" [ngClass]="{'active' : language === 'english'}"> {{ 'ENGLISH' | translate }} </li> <li class="language-item" (click)="setLanguage('portuguese', 'pt')" [ngClass]="{'active' : language === 'portuguese'}"> {{ 'PORTUGUESE' | translate }} </li> </ul> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container-fluid --> </nav> <!-- Header --> <header> <div class="container" id="page-top" tabindex="-1"> <div class="row"> <div class="col-lg-12"> <img class="img-responsive" src="https://scontent.frec3-2.fna.fbcdn.net/v/t1.0-9/1235055_738383992874064_1562100466279412787_n.jpg?oh=78848013f4aadaea7f76371736b71fd7&oe=5981A688" alt=""> <div class="intro-text"> <h1 class="name">Franclis Galdino</h1> <hr class="item-divider item-divider-light item-divider-coffee"> <span class="skills">Full Stack Developer</span> </div> </div> </div> </div> </header> <!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) --> <div class="scroll-top page-scroll" *ngIf="isShrunk"> <a class="btn btn-primary" pageScroll href="#page-top"> <i class="fa fa-chevron-up"></i> </a> </div>
FranclisJunior/portfolio
src/app/header/header.component.html
HTML
mit
3,819
[ 30522, 1026, 4487, 2615, 8909, 1027, 1000, 13558, 2532, 2615, 1000, 1028, 1026, 1037, 17850, 12879, 1027, 1000, 1001, 3931, 1011, 2327, 1000, 1028, 30524, 1026, 6583, 2615, 8909, 1027, 1000, 2364, 2532, 2615, 1000, 2465, 1027, 1000, 6583, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) 1996-2002 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice // and this paragraph appear in all copies. This software program and // documentation are copyrighted by The Regents of the University of // California. The software program and documentation are supplied "AS // IS", without any accompanying services from The Regents. The Regents // does not warrant that the operation of the program will be // uninterrupted or error-free. The end-user understands that the program // was developed for research purposes and is advised not to rely // exclusively on the program for any reason. IN NO EVENT SHALL THE // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. package org.argouml.application.api; /** An plugin interface which identifies an ArgoUML data loader. * <br> * TODO: identify methods * * @author Thierry Lach * @since ARGO0.11.3 */ public interface PluggableProjectWriter extends Pluggable { } /* End interface PluggableProjectWriter */
argocasegeo/argocasegeo
src/org/argouml/application/api/PluggableProjectWriter.java
Java
epl-1.0
1,869
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2727, 1011, 2526, 1996, 22832, 1997, 1996, 2118, 1997, 2662, 1012, 2035, 1013, 1013, 2916, 9235, 1012, 6656, 2000, 2224, 1010, 6100, 1010, 19933, 1010, 1998, 16062, 2023, 1013, 1013, 4007, 1998, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.dank.festivalapp.lib; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DataBaseHelper extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static final String DATABASE_NAME = "FestivalApp.db"; private static final int DATABASE_VERSION = 1; private static DataBaseHelper mInstance = null; private DataBaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public static DataBaseHelper getInstance(Context ctx) { /** * use the application context as suggested by CommonsWare. * this will ensure that you dont accidentally leak an Activitys * context (see this article for more information: * http://developer.android.com/resources/articles/avoiding-memory-leaks.html) */ if (mInstance == null) { mInstance = new DataBaseHelper(ctx); } return mInstance; } public boolean isTableExists(SQLiteDatabase db, String tableName) { Cursor cursor = db.rawQuery("select DISTINCT tbl_name from sqlite_master where tbl_name = '"+ tableName +"'", null); if(cursor != null) { if(cursor.getCount() > 0) { cursor.close(); return true; } cursor.close(); } return false; } @Override public void onCreate(SQLiteDatabase db) { } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(DataBaseHelper.class.getName(), "TODO "); } }
dankl/festivalapp-lib
src/com/dank/festivalapp/lib/DataBaseHelper.java
Java
gpl-3.0
1,650
[ 30522, 7427, 4012, 1012, 4907, 2243, 1012, 2782, 29098, 1012, 5622, 2497, 1025, 12324, 11924, 1012, 4180, 1012, 6123, 1025, 12324, 11924, 1012, 7809, 1012, 12731, 25301, 2099, 1025, 12324, 11924, 1012, 7809, 1012, 29296, 4221, 1012, 29296, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of 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. */ #include "public/platform/WebMediaConstraints.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" #include <math.h> namespace blink { namespace { template <typename T> void maybeEmitNamedValue(StringBuilder& builder, bool emit, const char* name, T value) { if (!emit) return; if (builder.length() > 1) builder.append(", "); builder.append(name); builder.append(": "); builder.appendNumber(value); } void maybeEmitNamedBoolean(StringBuilder& builder, bool emit, const char* name, bool value) { if (!emit) return; if (builder.length() > 1) builder.append(", "); builder.append(name); builder.append(": "); if (value) builder.append("true"); else builder.append("false"); } } // namespace class WebMediaConstraintsPrivate final : public RefCounted<WebMediaConstraintsPrivate> { public: static PassRefPtr<WebMediaConstraintsPrivate> create(); static PassRefPtr<WebMediaConstraintsPrivate> create(const WebMediaTrackConstraintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced); bool isEmpty() const; const WebMediaTrackConstraintSet& basic() const; const WebVector<WebMediaTrackConstraintSet>& advanced() const; const String toString() const; private: WebMediaConstraintsPrivate(const WebMediaTrackConstraintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced); WebMediaTrackConstraintSet m_basic; WebVector<WebMediaTrackConstraintSet> m_advanced; }; PassRefPtr<WebMediaConstraintsPrivate> WebMediaConstraintsPrivate::create() { WebMediaTrackConstraintSet basic; WebVector<WebMediaTrackConstraintSet> advanced; return adoptRef(new WebMediaConstraintsPrivate(basic, advanced)); } PassRefPtr<WebMediaConstraintsPrivate> WebMediaConstraintsPrivate::create(const WebMediaTrackConstraintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced) { return adoptRef(new WebMediaConstraintsPrivate(basic, advanced)); } WebMediaConstraintsPrivate::WebMediaConstraintsPrivate(const WebMediaTrackConstraintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced) : m_basic(basic) , m_advanced(advanced) { } bool WebMediaConstraintsPrivate::isEmpty() const { // TODO(hta): When generating advanced constraints, make sure no empty // elements can be added to the m_advanced vector. return m_basic.isEmpty() && m_advanced.isEmpty(); } const WebMediaTrackConstraintSet& WebMediaConstraintsPrivate::basic() const { return m_basic; } const WebVector<WebMediaTrackConstraintSet>& WebMediaConstraintsPrivate::advanced() const { return m_advanced; } const String WebMediaConstraintsPrivate::toString() const { StringBuilder builder; if (!isEmpty()) { builder.append('{'); builder.append(basic().toString()); if (!advanced().isEmpty()) { if (builder.length() > 1) builder.append(", "); builder.append("advanced: ["); bool first = true; for (const auto& constraintSet : advanced()) { if (!first) builder.append(", "); builder.append('{'); builder.append(constraintSet.toString()); builder.append('}'); first = false; } builder.append(']'); } builder.append('}'); } return builder.toString(); } // *Constraints BaseConstraint::BaseConstraint(const char* name) : m_name(name) { } BaseConstraint::~BaseConstraint() { } LongConstraint::LongConstraint(const char* name) : BaseConstraint(name) , m_min() , m_max() , m_exact() , m_ideal() , m_hasMin(false) , m_hasMax(false) , m_hasExact(false) , m_hasIdeal(false) { } bool LongConstraint::matches(long value) const { if (m_hasMin && value < m_min) { return false; } if (m_hasMax && value > m_max) { return false; } if (m_hasExact && value != m_exact) { return false; } return true; } bool LongConstraint::isEmpty() const { return !m_hasMin && !m_hasMax && !m_hasExact && !m_hasIdeal; } bool LongConstraint::hasMandatory() const { return m_hasMin || m_hasMax || m_hasExact; } WebString LongConstraint::toString() const { StringBuilder builder; builder.append('{'); maybeEmitNamedValue(builder, m_hasMin, "min", m_min); maybeEmitNamedValue(builder, m_hasMax, "max", m_max); maybeEmitNamedValue(builder, m_hasExact, "exact", m_exact); maybeEmitNamedValue(builder, m_hasIdeal, "ideal", m_ideal); builder.append('}'); return builder.toString(); } const double DoubleConstraint::kConstraintEpsilon = 0.00001; DoubleConstraint::DoubleConstraint(const char* name) : BaseConstraint(name) , m_min() , m_max() , m_exact() , m_ideal() , m_hasMin(false) , m_hasMax(false) , m_hasExact(false) , m_hasIdeal(false) { } bool DoubleConstraint::matches(double value) const { if (m_hasMin && value < m_min - kConstraintEpsilon) { return false; } if (m_hasMax && value > m_max + kConstraintEpsilon) { return false; } if (m_hasExact && fabs(static_cast<double>(value) - m_exact) > kConstraintEpsilon) { return false; } return true; } bool DoubleConstraint::isEmpty() const { return !m_hasMin && !m_hasMax && !m_hasExact && !m_hasIdeal; } bool DoubleConstraint::hasMandatory() const { return m_hasMin || m_hasMax || m_hasExact; } WebString DoubleConstraint::toString() const { StringBuilder builder; builder.append('{'); maybeEmitNamedValue(builder, m_hasMin, "min", m_min); maybeEmitNamedValue(builder, m_hasMax, "max", m_max); maybeEmitNamedValue(builder, m_hasExact, "exact", m_exact); maybeEmitNamedValue(builder, m_hasIdeal, "ideal", m_ideal); builder.append('}'); return builder.toString(); } StringConstraint::StringConstraint(const char* name) : BaseConstraint(name) , m_exact() , m_ideal() { } bool StringConstraint::matches(WebString value) const { if (m_exact.isEmpty()) { return true; } for (const auto& choice : m_exact) { if (value == choice) { return true; } } return false; } bool StringConstraint::isEmpty() const { return m_exact.isEmpty() && m_ideal.isEmpty(); } bool StringConstraint::hasMandatory() const { return !m_exact.isEmpty(); } const WebVector<WebString>& StringConstraint::exact() const { return m_exact; } const WebVector<WebString>& StringConstraint::ideal() const { return m_ideal; } WebString StringConstraint::toString() const { StringBuilder builder; builder.append('{'); if (!m_ideal.isEmpty()) { builder.append("ideal: ["); bool first = true; for (const auto& iter : m_ideal) { if (!first) builder.append(", "); builder.append('"'); builder.append(iter); builder.append('"'); first = false; } builder.append(']'); } if (!m_exact.isEmpty()) { if (builder.length() > 1) builder.append(", "); builder.append("exact: ["); bool first = true; for (const auto& iter : m_exact) { if (!first) builder.append(", "); builder.append('"'); builder.append(iter); builder.append('"'); } builder.append(']'); } builder.append('}'); return builder.toString(); } BooleanConstraint::BooleanConstraint(const char* name) : BaseConstraint(name) , m_ideal(false) , m_exact(false) , m_hasIdeal(false) , m_hasExact(false) { } bool BooleanConstraint::matches(bool value) const { if (m_hasExact && static_cast<bool>(m_exact) != value) { return false; } return true; } bool BooleanConstraint::isEmpty() const { return !m_hasIdeal && !m_hasExact; } bool BooleanConstraint::hasMandatory() const { return m_hasExact; } WebString BooleanConstraint::toString() const { StringBuilder builder; builder.append('{'); maybeEmitNamedBoolean(builder, m_hasExact, "exact", exact()); maybeEmitNamedBoolean(builder, m_hasIdeal, "ideal", ideal()); builder.append('}'); return builder.toString(); } WebMediaTrackConstraintSet::WebMediaTrackConstraintSet() : width("width") , height("height") , aspectRatio("aspectRatio") , frameRate("frameRate") , facingMode("facingMode") , volume("volume") , sampleRate("sampleRate") , sampleSize("sampleSize") , echoCancellation("echoCancellation") , latency("latency") , channelCount("channelCount") , deviceId("deviceId") , groupId("groupId") , mediaStreamSource("mediaStreamSource") , renderToAssociatedSink("chromeRenderToAssociatedSink") , hotwordEnabled("hotwordEnabled") , googEchoCancellation("googEchoCancellation") , googExperimentalEchoCancellation("googExperimentalEchoCancellation") , googAutoGainControl("googAutoGainControl") , googExperimentalAutoGainControl("googExperimentalAutoGainControl") , googNoiseSuppression("googNoiseSuppression") , googHighpassFilter("googHighpassFilter") , googTypingNoiseDetection("googTypingNoiseDetection") , googExperimentalNoiseSuppression("googExperimentalNoiseSuppression") , googBeamforming("googBeamforming") , googArrayGeometry("googArrayGeometry") , googAudioMirroring("googAudioMirroring") , googDAEchoCancellation("googDAEchoCancellation") , googNoiseReduction("googNoiseReduction") , offerToReceiveAudio("offerToReceiveAudio") , offerToReceiveVideo("offerToReceiveVideo") , voiceActivityDetection("voiceActivityDetection") , iceRestart("iceRestart") , googUseRtpMux("googUseRtpMux") , enableDtlsSrtp("enableDtlsSrtp") , enableRtpDataChannels("enableRtpDataChannels") , enableDscp("enableDscp") , enableIPv6("enableIPv6") , googEnableVideoSuspendBelowMinBitrate("googEnableVideoSuspendBelowMinBitrate") , googNumUnsignalledRecvStreams("googNumUnsignalledRecvStreams") , googCombinedAudioVideoBwe("googCombinedAudioVideoBwe") , googScreencastMinBitrate("googScreencastMinBitrate") , googCpuOveruseDetection("googCpuOveruseDetection") , googCpuUnderuseThreshold("googCpuUnderuseThreshold") , googCpuOveruseThreshold("googCpuOveruseThreshold") , googCpuUnderuseEncodeRsdThreshold("googCpuUnderuseEncodeRsdThreshold") , googCpuOveruseEncodeRsdThreshold("googCpuOveruseEncodeRsdThreshold") , googCpuOveruseEncodeUsage("googCpuOveruseEncodeUsage") , googHighStartBitrate("googHighStartBitrate") , googPayloadPadding("googPayloadPadding") , googLatencyMs("latencyMs") , googPowerLineFrequency("googPowerLineFrequency") { } std::vector<const BaseConstraint*> WebMediaTrackConstraintSet::allConstraints() const { const BaseConstraint* temp[] = { &width, &height, &aspectRatio, &frameRate, &facingMode, &volume, &sampleRate, &sampleSize, &echoCancellation, &latency, &channelCount, &deviceId, &groupId, &mediaStreamSource, &renderToAssociatedSink, &hotwordEnabled, &googEchoCancellation, &googExperimentalEchoCancellation, &googAutoGainControl, &googExperimentalAutoGainControl, &googNoiseSuppression, &googHighpassFilter, &googTypingNoiseDetection, &googExperimentalNoiseSuppression, &googBeamforming, &googArrayGeometry, &googAudioMirroring, &googDAEchoCancellation, &googNoiseReduction, &offerToReceiveAudio, &offerToReceiveVideo, &voiceActivityDetection, &iceRestart, &googUseRtpMux, &enableDtlsSrtp, &enableRtpDataChannels, &enableDscp, &enableIPv6, &googEnableVideoSuspendBelowMinBitrate, &googNumUnsignalledRecvStreams, &googCombinedAudioVideoBwe, &googScreencastMinBitrate, &googCpuOveruseDetection, &googCpuUnderuseThreshold, &googCpuOveruseThreshold, &googCpuUnderuseEncodeRsdThreshold, &googCpuOveruseEncodeRsdThreshold, &googCpuOveruseEncodeUsage, &googHighStartBitrate, &googPayloadPadding, &googLatencyMs, &googPowerLineFrequency }; const int elementCount = sizeof(temp) / sizeof(temp[0]); return std::vector<const BaseConstraint*>(&temp[0], &temp[elementCount]); } bool WebMediaTrackConstraintSet::isEmpty() const { for (const auto& constraint : allConstraints()) { if (!constraint->isEmpty()) return false; } return true; } bool WebMediaTrackConstraintSet::hasMandatoryOutsideSet(const std::vector<std::string>& goodNames, std::string& foundName) const { for (const auto& constraint : allConstraints()) { if (constraint->hasMandatory()) { if (std::find(goodNames.begin(), goodNames.end(), constraint->name()) == goodNames.end()) { foundName = constraint->name(); return true; } } } return false; } bool WebMediaTrackConstraintSet::hasMandatory() const { std::string dummyString; return hasMandatoryOutsideSet(std::vector<std::string>(), dummyString); } WebString WebMediaTrackConstraintSet::toString() const { StringBuilder builder; bool first = true; for (const auto& constraint : allConstraints()) { if (!constraint->isEmpty()) { if (!first) builder.append(", "); builder.append(constraint->name()); builder.append(": "); builder.append(constraint->toString()); first = false; } } return builder.toString(); } // WebMediaConstraints void WebMediaConstraints::assign(const WebMediaConstraints& other) { m_private = other.m_private; } void WebMediaConstraints::reset() { m_private.reset(); } bool WebMediaConstraints::isEmpty() const { return m_private.isNull() || m_private->isEmpty(); } void WebMediaConstraints::initialize() { ASSERT(isNull()); m_private = WebMediaConstraintsPrivate::create(); } void WebMediaConstraints::initialize(const WebMediaTrackConstraintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced) { ASSERT(isNull()); m_private = WebMediaConstraintsPrivate::create(basic, advanced); } const WebMediaTrackConstraintSet& WebMediaConstraints::basic() const { ASSERT(!isNull()); return m_private->basic(); } const WebVector<WebMediaTrackConstraintSet>& WebMediaConstraints::advanced() const { ASSERT(!isNull()); return m_private->advanced(); } const WebString WebMediaConstraints::toString() const { if (isNull()) return WebString(""); return m_private->toString(); } } // namespace blink
danakj/chromium
third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp
C++
bsd-3-clause
16,445
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2262, 8224, 4297, 1012, 2035, 2916, 9235, 30524, 5060, 1010, 2023, 2862, 1997, 3785, 1998, 1996, 2206, 5860, 19771, 5017, 1012, 1008, 1008, 25707, 2015, 1999, 12441, 2433, 2442, 21376, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2013-2015 Computer Sciences 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. */ package ezbake.warehaus; import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import com.google.common.base.Function; import ezbake.base.thrift.*; import ezbake.common.properties.EzProperties; import ezbake.data.common.TimeUtil; import ezbake.data.iterator.EzBakeVisibilityFilter; import ezbake.security.client.EzSecurityTokenWrapper; import ezbake.security.client.EzbakeSecurityClient; import ezbake.services.centralPurge.thrift.ezCentralPurgeServiceConstants; import ezbake.services.provenance.thrift.PositionsToUris; import ezbake.services.provenance.thrift.ProvenanceService; import ezbake.services.provenance.thrift.ProvenanceServiceConstants; import ezbake.thrift.ThriftClientPool; import ezbake.security.permissions.PermissionUtils; import ezbake.security.serialize.VisibilitySerialization; import ezbake.security.serialize.thrift.VisibilityWrapper; import ezbake.thrift.ThriftUtils; import ezbake.util.AuditEvent; import ezbake.util.AuditEventType; import ezbake.util.AuditLogger; import ezbake.util.AuditLoggerConfigurator; import ezbakehelpers.accumulo.AccumuloHelper; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.BatchDeleter; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ScannerBase; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.user.TimestampFilter; import org.apache.accumulo.core.iterators.user.VersioningIterator; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.core.security.TablePermission; import org.apache.hadoop.io.Text; import org.apache.thrift.TException; import org.apache.thrift.TProcessor; import org.apache.thrift.TSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AccumuloWarehaus extends ezbake.base.thrift.EzBakeBaseThriftService implements WarehausService.Iface, EzBakeBasePurgeService.Iface { private static final Logger logger = LoggerFactory.getLogger(AccumuloWarehaus.class); private EzbakeSecurityClient securityClient = null; private Connector connector; // private FileSystem hdfs; private String accumuloNamespace; private String purgeVisibility; private String purgeAppSecurityId; private static AuditLogger auditLogger; public AccumuloWarehaus() { } @SuppressWarnings({"unchecked", "rawtypes"}) @Override public TProcessor getThriftProcessor() { Properties properties = getConfigurationProperties(); AccumuloHelper accumulo = new AccumuloHelper(properties); try { EzProperties ezproperties = new EzProperties(getConfigurationProperties(), false); purgeVisibility = ezproperties.getProperty(WarehausConstants.PURGE_VISIBILITY_KEY); } catch (Exception e) { throw new RuntimeException(e); } if (purgeVisibility == null || purgeVisibility.trim().isEmpty()) { String msg = "The required Warehaus purge visibility configuration parameter '" + WarehausConstants.PURGE_VISIBILITY_KEY + "' could not be found."; logger.error(msg + ". Set the parameter in the Warehaus application configuration file before starting the Warehaus service."); throw new RuntimeException(msg); } accumuloNamespace = accumulo.getAccumuloNamespace(); if (logger.isDebugEnabled()) { logger.debug("Setting configuration..."); for (Object prop : properties.keySet()) { logger.debug("Property: {} = {}", prop, properties.get(prop)); } } // try { // this.hdfs = HDFSHelper.getFileSystemFromProperties(properties); // } catch (IOException e) { // throw new RuntimeException(e); // } try { this.connector = accumulo.getConnector(true); ensureTable(); } catch (Exception e) { throw new RuntimeException(e); } securityClient = new EzbakeSecurityClient(properties); AuditLoggerConfigurator.setAdditivity(true); auditLogger = AuditLogger.getAuditLogger(AccumuloWarehaus.class); return new WarehausService.Processor(this); } @Override public boolean ping() { try { boolean ping = connector.tableOperations().exists(WarehausConstants.TABLE_NAME); if (!ping) { logger.error("Ping: The warehaus table does not exist."); } boolean purgePing = connector.tableOperations().exists(WarehausConstants.PURGE_TABLE_NAME); if (!purgePing) { logger.error("Ping: The purge warehaus table does not exist."); } return ping && purgePing; } catch (Exception ex) { logger.error("Ping failed with an unexpected exception", ex); return false; } } @Override public IngestStatus insert(Repository data, Visibility visibility, EzSecurityToken security) throws TException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "insert"); auditArgs.put("uri", data.getUri()); auditLog(security, AuditEventType.FileObjectCreate, auditArgs); UpdateEntry entry = new UpdateEntry(); entry.setUri(data.getUri()); entry.setParsedData(data.getParsedData()); entry.setRawData(data.getRawData()); entry.setUpdateVisibility(data.isUpdateVisibility()); IngestStatus status = insertUpdate(entry, visibility, security); logger.debug("insert status : " + status); return status; } @Override public BinaryReplay getLatestRaw(String uri, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getLatestRaw"); auditArgs.put("uri", uri); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getLatest(uri, WarehausUtils.getUriPrefixFromUri(uri), GetDataType.RAW.toString(), security); } @Override public BinaryReplay getLatestParsed(String uri, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getLatestParsed"); auditArgs.put("uri", uri); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getLatest(uri, WarehausUtils.getUriPrefixFromUri(uri), GetDataType.PARSED.toString(), security); } @Override public BinaryReplay getRaw(String uri, long timestamp, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getRaw"); auditArgs.put("uri", uri); auditArgs.put("timestamp", String.valueOf(timestamp)); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getVersion(uri, WarehausUtils.getUriPrefixFromUri(uri), GetDataType.RAW.toString(), timestamp, security); } @Override public BinaryReplay getParsed(String uri, long timestamp, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getParsed"); auditArgs.put("uri", uri); auditArgs.put("timestamp", String.valueOf(timestamp)); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getVersion(uri, WarehausUtils.getUriPrefixFromUri(uri), GetDataType.PARSED.toString(), timestamp, security); } @Override public List<ezbake.warehaus.BinaryReplay> get(ezbake.warehaus.GetRequest getRequest, ezbake.base.thrift.EzSecurityToken security) throws MaxGetRequestSizeExceededException, org.apache.thrift.TException { securityClient.validateReceivedToken(security); List<BinaryReplay> retList; GetDataType getType = getRequest.getGetDataType(); String colQualifier = null; switch (getType) { case RAW: colQualifier = getType.toString(); break; case PARSED: colQualifier = getType.toString(); break; default: break; } List<Key> keys = Lists.newArrayList(); boolean getLatestErr = false; boolean getTimestampErr = false; HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "get"); for (RequestParameter param : getRequest.getRequestParams()) { long timestamp = 0; // if latest, a timestamp value must not be provided if (getRequest.isLatestVersion() && (param.getTimestamp() != null)) { getLatestErr = true; break; } // if not latest, a timestamp value must be provided if (!getRequest.isLatestVersion()) { if (param.getTimestamp() == null) { getTimestampErr = true; break; } else { timestamp = TimeUtil.convertFromThriftDateTime(param.getTimestamp()); } } String uri = param.getUri(); if (getType == GetDataType.VIEW) { colQualifier = param.getSpacename() + "_" + param.getView(); } Key key = new Key(WarehausUtils.getKey(uri), new Text(WarehausUtils.getUriPrefixFromUri(uri)), new Text(colQualifier), timestamp); keys.add(key); auditArgs.put("uri", uri); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); } if (getLatestErr) { throw new TException("A uri timestamp value CAN NOT be provided when requesting the latest version"); } if (getTimestampErr) { throw new TException("A uri timestamp value MUST be provided when not requesting the latest version"); } if (getRequest.isLatestVersion()) { retList = getLatest(keys, security); } else { retList = getVersion(keys, security); } return retList; } @Override public List<DatedURI> replay(String uriPrefix, boolean replayOnlyLatest, DateTime start, DateTime finish, GetDataType type, EzSecurityToken security) throws TException { securityClient.validateReceivedToken(security); if (uriPrefix == null || "".equals(uriPrefix.trim())) { throw new TException("Cannot replay a null or empty URI prefix."); } if (type == GetDataType.VIEW) { throw new TException("Cannot replay data from a view"); } // Default to PARSED if the user did not provide a data type GetDataType typeToReplay = type == null ? GetDataType.PARSED : type; String auths = WarehausUtils.getAuthsListFromToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "replay"); auditArgs.put("uriPrefix", uriPrefix); auditArgs.put("start", start != null ? "" + TimeUtil.convertFromThriftDateTime(start) : ""); auditArgs.put("finish", finish != null ? "" + TimeUtil.convertFromThriftDateTime(finish) : ""); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); BatchScanner scanner = null; List<DatedURI> retVal = null; try { scanner = createScanner(auths); IteratorSetting iteratorSetting = new IteratorSetting(13, "warehausReplayVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ), iteratorSetting); IteratorSetting is = new IteratorSetting(10, "replay", VersioningIterator.class); if (replayOnlyLatest) { VersioningIterator.setMaxVersions(is, 1); } else { VersioningIterator.setMaxVersions(is, Integer.MAX_VALUE); } scanner.addScanIterator(is); long startTime = 0, endTime = System.currentTimeMillis(); if (start != null) { startTime = TimeUtil.convertFromThriftDateTime(start); } if (finish != null) { endTime = TimeUtil.convertFromThriftDateTime(finish); } IteratorSetting tis = new IteratorSetting(20, "timestamp", TimestampFilter.class); TimestampFilter.setRange(tis, startTime, true, endTime, true); scanner.addScanIterator(tis); scanner.setRanges(Lists.newArrayList(new Range())); scanner.fetchColumn(new Text(uriPrefix), new Text(typeToReplay.toString())); retVal = Lists.newArrayList(); Map<String, Integer> uriToRetValPosition = Maps.newHashMap(); for (Entry<Key, Value> entry : scanner) { long ts = entry.getKey().getTimestamp(); String uri = WarehausUtils.getUriFromComputed(entry.getKey().getRow().toString()); DateTime currentDateTime = TimeUtil.convertToThriftDateTime(ts); Visibility visibility = VisibilitySerialization.deserializeVisibilityWrappedValue(entry.getValue()).getVisibilityMarkings(); DatedURI uriToAdd = new DatedURI(currentDateTime, uri, visibility); // If we're only replaying the latest, check if we've already inserted this URI into the list being returned. if (replayOnlyLatest) { // If we've seen this URI already, check the timestamp that we've seen, and if it's older than what we // currently have, replace it. Otherwise ignore it if (uriToRetValPosition.containsKey(uri)) { int position = uriToRetValPosition.get(uri); long oldTimeStamp = TimeUtil.convertFromThriftDateTime(retVal.get(position).getTimestamp()); if (oldTimeStamp < ts) { retVal.remove(position); uriToRetValPosition.put(uri, retVal.size()); retVal.add(uriToAdd); } } else { retVal.add(uriToAdd); } } else { retVal.add(uriToAdd); } } } catch (IOException e) { logger.error("Could not deserialize value from Accumulo", e); throw new TException("Could not retrieve data for request", e); } finally { if (scanner != null) { scanner.close(); } } Collections.sort(retVal, new Comparator<DatedURI>() { @Override public int compare(DatedURI o1, DatedURI o2) { return o1.getTimestamp().compareTo(o2.getTimestamp()); } }); return retVal; } @Override public int replayCount(String urn, DateTime start, DateTime finish, GetDataType type, EzSecurityToken security) throws TException { securityClient.validateReceivedToken(security); logger.info("Next Replay Call is for count"); return replay(urn, false, start, finish, type, security).size(); } @Override public List<Long> getVersions(String uri, EzSecurityToken security) throws TException { String auths = WarehausUtils.getAuthsListFromToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getVersions"); auditArgs.put("uri", uri); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); List<Long> forReturn = Lists.newLinkedList(); BatchScanner scanner = null; try { scanner = createScanner(auths); IteratorSetting iteratorSetting = new IteratorSetting(16, "warehausVersionsVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ), iteratorSetting); IteratorSetting is = new IteratorSetting(10, VersioningIterator.class); VersioningIterator.setMaxVersions(is, Integer.MAX_VALUE); scanner.addScanIterator(is); Key key = new Key(WarehausUtils.getKey(uri), new Text(WarehausUtils.getUriPrefixFromUri(uri))); scanner.setRanges(Lists.newArrayList(new Range(key, true, key.followingKey(PartialKey.ROW_COLFAM), false))); for (Entry<Key, Value> entry : scanner) { long ts = entry.getKey().getTimestamp(); if (!forReturn.contains(ts)) { forReturn.add(ts); } } } finally { if (scanner != null) { scanner.close(); } } return forReturn; } @Override public IngestStatus insertView(ByteBuffer data, ViewId id, Visibility visibility, EzSecurityToken security) throws TException { securityClient.validateReceivedToken(security); IngestStatus status = new IngestStatus(); Long timestamp = Calendar.getInstance().getTimeInMillis(); status.setTimestamp(timestamp); try { checkWritePermission(id.getUri(), visibility, security, false); } catch (EzBakeAccessDenied ad) { status.setStatus(IngestStatusEnum.FAIL); status.setFailedURIs(Lists.newArrayList(id.getUri())); status.setFailureReason(ad.getMessage()); logger.debug("insertView status : " + status); return status; } String accessorId = confirmToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "insertView"); auditArgs.put("uri", id.getUri()); auditArgs.put("accessorId", accessorId); auditLog(security, AuditEventType.FileObjectCreate, auditArgs); Mutation dataMutator = new Mutation(WarehausUtils.getKey(id.getUri())); try { dataMutator.put(new Text(WarehausUtils.getUriPrefixFromUri(id.getUri())), new Text(id.getSpacename() + "_" + id.getView()), new ColumnVisibility(PermissionUtils.getVisibilityString(visibility)), timestamp, VisibilitySerialization.serializeVisibilityWithDataToValue(visibility, new TSerializer().serialize(new VersionControl(data, accessorId)))); } catch (IOException e) { logger.error("Could not serialize value to insert into Accumulo", e); throw new TException("Could not insert data into the Warehaus", e); } BatchWriter writer = null; try { writer = createWriter(); writeMutation(dataMutator, writer); flushWriter(writer); } finally { closeWriter(writer); } status.setStatus(IngestStatusEnum.SUCCESS); logger.debug("insertView status : " + status); return status; } @Override public BinaryReplay getLatestView(ViewId id, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getLatestView"); auditArgs.put("uri", id.getUri()); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getLatest(id.getUri(), WarehausUtils.getUriPrefixFromUri(id.getUri()), id.getSpacename() + "_" + id.getView(), security); } @Override public BinaryReplay getView(ViewId id, long timestamp, EzSecurityToken security) throws TException, EntryNotInWarehausException { securityClient.validateReceivedToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getView"); auditArgs.put("uri", id.getUri()); auditArgs.put("timestamp", String.valueOf(timestamp)); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); return getVersion(id.getUri(), WarehausUtils.getUriPrefixFromUri(id.getUri()), id.getSpacename() + "_" + id.getView(), timestamp, security); } @Override public void importFromHadoop(String filename, Visibility visibility, EzSecurityToken security) throws TException { // logRequest("importFromHadoop", filename, confirmToken(security), WarehausUtils.getAuthsListFromToken(security)); // InputStream is; // try { // is = hdfs.open(new Path(filename)); // } catch (IOException e) { // throw new TException(e); // } // ByteArrayOutputStream baos = new ByteArrayOutputStream(); // try { // int character = is.read(); // while (character > -1) { // baos.write(character); // character = is.read(); // } // } catch (IOException e) { // throw new TException(e); // } finally { // Closeables.closeQuietly(is); // } // Repository data = new Repository(); // new TDeserializer().deserialize(data, baos.toByteArray()); // insert(data, visibility, security); throw new TException("This endpoint is not implemented"); } @Override public IngestStatus updateEntry(UpdateEntry update, Visibility visibility, EzSecurityToken security) throws TException { HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "updateEntry"); auditArgs.put("uri", update.getUri()); auditLog(security, AuditEventType.FileObjectModify, auditArgs); IngestStatus status = insertUpdate(update, visibility, security); logger.debug("updateEntry status : " + status); return status; } private IngestStatus insertUpdate(UpdateEntry update, Visibility visibility, EzSecurityToken security) throws TException { try { checkWritePermission(update.getUri(), visibility, security, update.isUpdateVisibility()); } catch (EzBakeAccessDenied ad) { IngestStatus status = new IngestStatus(); status.setTimestamp(Calendar.getInstance().getTimeInMillis()); status.setStatus(IngestStatusEnum.FAIL); status.setFailedURIs(Lists.newArrayList(update.getUri())); status.setFailureReason(ad.getMessage()); return status; } String id = confirmToken(security); Map<String, VersionControl> parsed = Maps.newHashMap(); Map<String, VersionControl> raw = Maps.newHashMap(); Map<String, Boolean> updateVisibilityFlagMap = Maps.newHashMap(); Map<String, Visibility> visibilityMap = Maps.newHashMap(); if (update.isSetParsedData()) { VersionControl vc = new VersionControl(ByteBuffer.wrap(update.getParsedData()), id); parsed.put(update.getUri(), vc); } if (update.isSetRawData()) { VersionControl vc = new VersionControl(ByteBuffer.wrap(update.getRawData()), id); raw.put(update.getUri(), vc); } updateVisibilityFlagMap.put(update.getUri(), update.isUpdateVisibility()); visibilityMap.put(update.getUri(), visibility); return updateEntries(Lists.newArrayList(update.getUri()), parsed, raw, updateVisibilityFlagMap, visibilityMap, security); } @Override public IngestStatus put(ezbake.warehaus.PutRequest putRequest, EzSecurityToken security) throws TException { String id = confirmToken(security); Map<String, VersionControl> parsedMap = Maps.newHashMap(); Map<String, VersionControl> rawMap = Maps.newHashMap(); Map<String, Boolean> updateVisibilityMap = Maps.newHashMap(); List<String> uriList = Lists.newArrayList(); Map<String, Visibility> visibilityMap = Maps.newHashMap(); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "put"); for (PutUpdateEntry putEntry : putRequest.getEntries()) { UpdateEntry update = putEntry.getEntry(); uriList.add(update.getUri()); updateVisibilityMap.put(update.getUri(), update.isUpdateVisibility()); visibilityMap.put(update.getUri(), putEntry.getVisibility()); if (update.isSetParsedData()) { VersionControl vc = new VersionControl(ByteBuffer.wrap(update.getParsedData()), id); parsedMap.put(update.getUri(), vc); } if (update.isSetRawData()) { VersionControl vc = new VersionControl(ByteBuffer.wrap(update.getRawData()), id); rawMap.put(update.getUri(), vc); } auditArgs.put("uri", update.getUri()); auditLog(security, AuditEventType.FileObjectModify, auditArgs); } IngestStatus status = updateEntries(uriList, parsedMap, rawMap, updateVisibilityMap, visibilityMap, security); logger.debug("put status : " + status); return status; } private IngestStatus updateEntries(List<String> uriList, Map<String, VersionControl> parsedMap, Map<String, VersionControl> rawMap, Map<String, Boolean> updateVisibilityMap, Map<String, Visibility> visibilityMap, EzSecurityToken security) throws TException { String userAuths = WarehausUtils.getAuthsListFromToken(security); String id = confirmToken(security); long timestamp = Calendar.getInstance().getTimeInMillis(); Set<GetDataType> dataTypes = Sets.newHashSet(GetDataType.values()); Map<String, Mutation> mutationMap = Maps.newHashMap(); List<Range> ranges = Lists.newArrayList(); List<String> writableURIs = Lists.newArrayList(); List<String> accessDenied = Lists.newArrayList(); IngestStatus status = new IngestStatus(); BatchScanner scanner = null; BatchWriter writer = null; // Below code is mostly organized to avoid scanning on a uri basis // and instead take advantage of batch scans for improved performance. // A rough order of tasks - // 1. update visibilities, when requested and different from old ones // 2. add new rows for parsed/raw types, version index try { writer = createWriter(); for (String uri : uriList) { for (GetDataType type : dataTypes) { Key key = new Key(WarehausUtils.getKey(uri), new Text(WarehausUtils.getUriPrefixFromUri(uri)), new Text(type.toString())); ranges.add(new Range(key, true, key.followingKey(PartialKey.ROW_COLFAM_COLQUAL), false)); } } if (!ranges.isEmpty()) { try { scanner = createScanner(userAuths); scanner.setRanges(ranges); // need existing group auths IteratorSetting iteratorSetting = new IteratorSetting(21, "warehausEntriesVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ, Permission.MANAGE_VISIBILITY, Permission.WRITE), iteratorSetting); for (Entry<Key, Value> entry : scanner) { String uri = WarehausUtils.getUriFromKey(entry.getKey()); writableURIs.add(uri); // update visibility of old entry if the flag is set. if (updateVisibilityMap.get(uri)) { long oldTimeStamp = entry.getKey().getTimestamp(); Visibility visibilityForUpdate = visibilityMap.get(uri); ColumnVisibility oldVisibility = new ColumnVisibility(entry.getKey().getColumnVisibility()); // Update if new visibility is different than the old one. if (visibilityForUpdate.toString().equals(oldVisibility.toString())) { continue; } VisibilityWrapper wrapper = VisibilitySerialization.deserializeVisibilityWrappedValue(entry.getValue()); VersionControl value = ThriftUtils.deserialize(VersionControl.class, wrapper.getValue()); // Delete to ensure removal of entry with old visibility. // Update only the visibility, leave everything else (incl. timestamp) as is. Mutation mutation = mutationMap.get(uri); if (mutation == null) { mutation = new Mutation(WarehausUtils.getKey(uri)); } mutation.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier(), oldVisibility, oldTimeStamp); mutation.put(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier(), new ColumnVisibility(PermissionUtils.getVisibilityString(visibilityForUpdate)), oldTimeStamp, VisibilitySerialization.serializeVisibilityWithDataToValue(visibilityForUpdate, ThriftUtils.serialize(new VersionControl(ByteBuffer.wrap(value.getPacket()), id)))); mutationMap.put(uri, mutation); } } } finally { if (scanner != null) { scanner.close(); } } } // Scan for existing URIs since writableURIs would only contain // those that user can write to in case of updates. // This will let distinguish between inserts and updates. List<String> existingURIs = Lists.newArrayList(); if (!ranges.isEmpty()) { try { scanner = createScanner(userAuths); scanner.setRanges(ranges); for (Entry<Key, Value> entry : scanner) { String uri = WarehausUtils.getUriFromKey(entry.getKey()); existingURIs.add(uri); } } finally { if (scanner != null) { scanner.close(); } } } // Add new updates to parsed/raw data for (String uri : uriList) { // updates should be writable if (existingURIs.contains(uri) && !writableURIs.contains(uri)) { accessDenied.add(uri); continue; } Visibility visibilityForUpdate = visibilityMap.get(uri); try { checkWritePermission(uri, visibilityForUpdate, security, false); } catch (EzBakeAccessDenied ad) { accessDenied.add(uri); continue; } Mutation mutation = mutationMap.get(uri); if (mutation == null) { mutation = new Mutation(WarehausUtils.getKey(uri)); } if (parsedMap.containsKey(uri)) { mutation.put(new Text(WarehausUtils.getUriPrefixFromUri(uri)), new Text(GetDataType.PARSED.toString()), new ColumnVisibility(PermissionUtils.getVisibilityString(visibilityForUpdate)), timestamp, VisibilitySerialization.serializeVisibilityWithDataToValue(visibilityForUpdate, ThriftUtils.serialize( new VersionControl(ByteBuffer.wrap(parsedMap.get(uri).getPacket()), id)))); } if (rawMap.containsKey(uri)) { mutation.put(new Text(WarehausUtils.getUriPrefixFromUri(uri)), new Text(GetDataType.RAW.toString()), new ColumnVisibility(PermissionUtils.getVisibilityString(visibilityForUpdate)), timestamp, VisibilitySerialization.serializeVisibilityWithDataToValue(visibilityForUpdate, ThriftUtils.serialize( new VersionControl(ByteBuffer.wrap(rawMap.get(uri).getPacket()), id)))); } writeMutation(mutation, writer); } flushWriter(writer); } catch (IOException e) { logger.error("Could not deserialize value from Accumulo", e); throw new TException("Could not retrieve data for request", e); } finally { closeWriter(writer); } status.setTimestamp(timestamp); status.setStatus(IngestStatusEnum.SUCCESS); if (!accessDenied.isEmpty()) { if (accessDenied.size() == uriList.size()) { status.setStatus(IngestStatusEnum.FAIL); } else { status.setStatus(IngestStatusEnum.PARTIAL); } status.setFailedURIs(accessDenied); status.setFailureReason("Given user token does not have the " + "required authorizations to update documents with listed URIs"); return status; } return status; } /** * @throws EntryNotInWarehausException If the document identified by the * given URI was not found. * @throws TException If an error occurs during the fetching of the entry. */ @Override public ezbake.warehaus.EntryDetail getEntryDetails(String uri, ezbake.base.thrift.EzSecurityToken security) throws org.apache.thrift.TException { securityClient.validateReceivedToken(security); String auths = WarehausUtils.getAuthsListFromToken(security); HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "getEntryDetails"); auditArgs.put("uri", uri); auditLog(security, AuditEventType.FileObjectAccess, auditArgs); List<Long> forReturn = Lists.newLinkedList(); List<VersionDetail> versions = Lists.newLinkedList(); BatchScanner scanner = null; int count = 0; try { scanner = createScanner(auths); IteratorSetting iteratorSetting = new IteratorSetting(27, "warehausEntryDetailVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ), iteratorSetting); IteratorSetting is = new IteratorSetting(10, VersioningIterator.class); VersioningIterator.setMaxVersions(is, Integer.MAX_VALUE); scanner.addScanIterator(is); Key key = new Key(WarehausUtils.getKey(uri), new Text(WarehausUtils.getUriPrefixFromUri(uri))); scanner.setRanges(Lists.newArrayList(new Range(key, true, key.followingKey(PartialKey.ROW_COLFAM), false))); for (Entry<Key, Value> entry : scanner) { count++; long ts = entry.getKey().getTimestamp(); if (!forReturn.contains(ts)) { forReturn.add(ts); VersionDetail vd = new VersionDetail(); vd.setUri(uri); vd.setTimestamp(ts); VisibilityWrapper wrapper = VisibilitySerialization.deserializeVisibilityWrappedValue(entry.getValue()); vd.setVisibility(wrapper.getVisibilityMarkings()); VersionControl versionData = ThriftUtils.deserialize(VersionControl.class, wrapper.getValue()); vd.setSecurityId(versionData.getName()); versions.add(vd); } } } catch (IOException e) { logger.error("Could not deserialize the data from Accumulo associated with " + uri + ".", e); throw new TException("Could not deserialize the data from Accumulo associated with " + uri + ".", e); } finally { if (scanner != null) { scanner.close(); } } if (count == 0) { logger.debug("The following document URI was not found in the warehouse: " + uri); throw new EntryNotInWarehausException("The following document URI was not found in the warehouse: " + uri); } EntryDetail entryDetail = new EntryDetail(); entryDetail.setUri(uri); entryDetail.setVersions(versions); return entryDetail; } /********************************************************* /* /* Helper Functions /* *********************************************************/ /** * Validates the security token with the security service and returns either the application security ID or * the user DN associated with the token. * * @param security security token to validate * @return the ID (either application security ID or user DN) associated with the token * @throws TException */ private String confirmToken(EzSecurityToken security) throws TException { securityClient.validateReceivedToken(security); String id; if (security.getType() == TokenType.APP) { id = security.getValidity().getIssuedTo(); } else { id = security.getTokenPrincipal().getPrincipal(); } return id; } /** * <p> * Ensures that the warehaus table is in accumulo and attempts to create * it if it does not exist. * Likewise, checks that the warehaus purge table is in accumulo and will * recreate the table if it does not exist. * </p> * * @throws TException If an error occurs while checking for the accumulo * namespace, warehaus table or warehaus purge table. If an * error occurs while creating the accumulo namespace, warehaus * table or warehaus purge table. */ private void ensureTable() throws TException { try { if (!connector.namespaceOperations().exists(accumuloNamespace)) { logger.warn("The accumulo namespace '" + accumuloNamespace + "' does not exist. An attempt to create namespace will start now."); connector.namespaceOperations().create(accumuloNamespace); logger.warn("The accumulo namespace '" + accumuloNamespace + "' was created."); } } catch (Exception e) { logger.error("An error occurred while checking for the existence of or while creating the accumulo namespace '" + accumuloNamespace + "'."); throw new TException(e); } try { if (!connector.tableOperations().exists(WarehausConstants.TABLE_NAME)) { logger.warn("The warehaus table '" + WarehausConstants.TABLE_NAME + "' does not exist. An attempt to create the table will start now."); connector.tableOperations().create(WarehausConstants.TABLE_NAME, false); logger.warn("The warehaus table '" + WarehausConstants.TABLE_NAME + "' was created."); logger.info("Adding table splits"); String splitsAsString = getConfigurationProperties().getProperty(WarehausConstants.WAREHAUS_SPLITS_KEY, WarehausConstants.DEFAULT_WAREHAUS_SPLITS); String splitsArray[] = splitsAsString.split(","); List<Text> splitsAsText = Lists.transform(Arrays.asList(splitsArray), new Function<String, Text>() { @Override public Text apply(String input) { return new Text(input); } }); SortedSet<Text> splits = new TreeSet<>(splitsAsText); connector.tableOperations().addSplits(WarehausConstants.TABLE_NAME, splits); } } catch (Exception e) { logger.error("An error occurred while checking for the existence of or while creating the warehaus table '" + WarehausConstants.TABLE_NAME + "'.", e); throw new TException(e); } try { if (!connector.tableOperations().exists(WarehausConstants.PURGE_TABLE_NAME)) { logger.warn("The warehaus purge table '" + WarehausConstants.PURGE_TABLE_NAME + "' does not exist. An attempt to create the table will start now."); connector.tableOperations().create(WarehausConstants.PURGE_TABLE_NAME, true); logger.warn("The warehaus purge table '" + WarehausConstants.PURGE_TABLE_NAME + "' was created."); } } catch (Exception e) { logger.error("An error occurred while checking for the existence of or while creating the warehaus purge table '" + WarehausConstants.PURGE_TABLE_NAME + "'.", e); throw new TException(e); } try { String ezBatchUser = getConfigurationProperties().getProperty("ezbatch.user", "ezbake"); connector.securityOperations().grantTablePermission(ezBatchUser, WarehausConstants.TABLE_NAME, TablePermission.READ); logger.info("READ permission granted to ezbatch user"); } catch (Exception e) { logger.error("An error occurred while trying to give the ezbatch user access"); throw new TException(e); } } private BatchScanner createScanner(String auths) throws TException { try { return connector.createBatchScanner(WarehausConstants.TABLE_NAME, WarehausUtils.getAuthsFromString(auths), WarehausConstants.QUERY_THREADS); } catch (TableNotFoundException e) { throw new TException(e); } } private BatchDeleter createDeleter(String auths) throws TException { try { EzProperties properties = new EzProperties(getConfigurationProperties(), false); long maxMemory = properties.getLong(WarehausConstants.BATCH_WRITER_MAX_MEMORY_KEY, WarehausConstants.DEFAULT_WRITER_MAX_MEMORY); long latency = properties.getLong(WarehausConstants.BATCH_WRITER_LATENCY_MS_KEY, WarehausConstants.DEFAULT_LATENCY); int threads = properties.getInteger(WarehausConstants.BATCH_WRITER_WRITE_THREADS_KEY, WarehausConstants.DEFAULT_WRITE_THREADS); BatchWriterConfig config = new BatchWriterConfig().setMaxLatency(latency, TimeUnit.MILLISECONDS).setMaxMemory(maxMemory).setMaxWriteThreads(threads); return connector.createBatchDeleter(WarehausConstants.TABLE_NAME, WarehausUtils.getAuthsFromString(auths), WarehausConstants.QUERY_THREADS, config); } catch (TableNotFoundException e) { throw new TException(e); } } private BatchWriter createWriter() throws TException { try { EzProperties properties = new EzProperties(getConfigurationProperties(), false); long maxMemory = properties.getLong(WarehausConstants.BATCH_WRITER_MAX_MEMORY_KEY, WarehausConstants.DEFAULT_WRITER_MAX_MEMORY); long latency = properties.getLong(WarehausConstants.BATCH_WRITER_LATENCY_MS_KEY, WarehausConstants.DEFAULT_LATENCY); int threads = properties.getInteger(WarehausConstants.BATCH_WRITER_WRITE_THREADS_KEY, WarehausConstants.DEFAULT_WRITE_THREADS); BatchWriterConfig config = new BatchWriterConfig().setMaxLatency(latency, TimeUnit.MILLISECONDS).setMaxMemory(maxMemory).setMaxWriteThreads(threads); BatchWriter writer = connector.createBatchWriter(WarehausConstants.TABLE_NAME, config); logger.debug("Writer initialized with max memory of {}, latency of {}, and {} threads", maxMemory, latency, threads); return writer; } catch (TableNotFoundException e) { logger.error("Could not initialize batch writer because table is missing", e); throw new RuntimeException(e); } } private void writeMutation(Mutation mutator, BatchWriter writer) throws TException { try { writer.addMutation(mutator); } catch (MutationsRejectedException e) { throw new TException(e); } } private void flushWriter(BatchWriter writer) throws TException { try { if (writer != null) { // shouldn't normally be null, but anyway writer.flush(); } } catch (MutationsRejectedException e) { throw new TException(e); } } private void closeWriter(BatchWriter writer) throws TException { try { if (writer != null) { writer.close(); } } catch (MutationsRejectedException e) { throw new TException(e); } } private void addEzBakeVisibilityFilter(ScannerBase scanner, EzSecurityToken token, Set<Permission> permissions, IteratorSetting iteratorSetting) throws TException { iteratorSetting.clearOptions(); EzBakeVisibilityFilter.setOptions(iteratorSetting, token.getAuthorizations(), permissions); scanner.addScanIterator(iteratorSetting); } private void checkWritePermission(String uri, Visibility visibility, EzSecurityToken token, boolean updateVisibility) throws EzBakeAccessDenied { if (!PermissionUtils.getPermissions(token.getAuthorizations(), visibility, true).contains(Permission.WRITE)) { throw new EzBakeAccessDenied().setMessage("Given user token does not have the " + "required authorizations to add/update document with uri " + uri); } if (updateVisibility && !PermissionUtils.getPermissions(token.getAuthorizations(), visibility, true).contains(Permission.MANAGE_VISIBILITY)) { throw new EzBakeAccessDenied().setMessage("Given user token does not have the " + "required authorizations to add/update visibilty of document with uri " + uri); } } private void auditLog(EzSecurityToken userToken, AuditEventType eventType, Map<String, String> args) { AuditEvent event = new AuditEvent(eventType, userToken); for (String argName : args.keySet()) { event.arg(argName, args.get(argName)); } if (auditLogger != null) { auditLogger.logEvent(event); } } /** * ****************************************************** * /* * /* Code Consolidation * /* * ******************************************************* */ private BinaryReplay getLatest(String uri, String columnFamily, String columnQualifier, EzSecurityToken security) throws TException, EntryNotInWarehausException { List<Key> keys = Lists.newArrayList(new Key(WarehausUtils.getKey(uri), new Text(columnFamily), new Text(columnQualifier))); List<BinaryReplay> results = null; try { results = getLatest(keys, security); if (results.size() == 0) { throw new EntryNotInWarehausException(String.format("No entry found in warehaus for uri %s, and data type %s", uri, columnQualifier)); } return results.get(0); } catch (MaxGetRequestSizeExceededException ex) { // should not really happen when fetching one specific key. logger.error("Batch scan max memory exceeded error occured.", ex); throw new TException(ex); } } private List<BinaryReplay> getLatest(List<Key> keys, EzSecurityToken security) throws TException, MaxGetRequestSizeExceededException { List<BinaryReplay> results = Lists.newArrayList(); if (keys == null || keys.size() == 0) { return results; } String auths = WarehausUtils.getAuthsListFromToken(security); BatchScanner scanner = null; try { scanner = createScanner(auths); IteratorSetting iteratorSetting = new IteratorSetting(33, "warehausLatestVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ), iteratorSetting); List<Range> ranges = Lists.newArrayList(); for (Key key : keys) { Range range = new Range(key, true, key.followingKey(PartialKey.ROW_COLFAM_COLQUAL), false); ranges.add(range); } scanner.setRanges(ranges); Map<String, Long> uriTimestamps = Maps.newHashMap(); Map<String, BinaryReplay> uriRetVals = Maps.newHashMap(); long currentScanSize = 0l; long maxBatchScanSize = new EzProperties(this.getConfigurationProperties(), false).getLong( WarehausConstants.BATCH_SCANNER_MAX_MEMORY_KEY, WarehausConstants.DEFAULT_SCANNER_MAX_MEMORY); for (Entry<Key, Value> latest : scanner) { if (latest != null) { String uri = WarehausUtils.getUriFromKey(latest.getKey()); long ts = latest.getKey().getTimestamp(); // Do some kludgy stuff with timestamp checks to ensure // we're only grabbing the latest. // Ideally, we'd like to use a VersioningIterator with // maxVersions set to 1 that gets us the latest, but that // won't always work because updateEntry() doesn't always // update all versions of a uri with the same visibility. if ((!uriTimestamps.containsKey(uri)) || (uriTimestamps.containsKey(uri) && uriTimestamps.get(uri).longValue() < ts)) { BinaryReplay forReturn = new BinaryReplay(); VisibilityWrapper visibilityAndValue = VisibilitySerialization.deserializeVisibilityWrappedValue(latest.getValue()); VersionControl versionData = ThriftUtils.deserialize(VersionControl.class, visibilityAndValue.getValue()); forReturn.setPacket(versionData.getPacket()); forReturn.setTimestamp(TimeUtil.convertToThriftDateTime(ts)); forReturn.setUri(uri); forReturn.setVisibility(visibilityAndValue.getVisibilityMarkings()); // if max batch scan size exceeded, break int len = ThriftUtils.serialize(forReturn).length; currentScanSize = currentScanSize + len; if (currentScanSize > maxBatchScanSize) { throw new MaxGetRequestSizeExceededException("Max get request size of " + maxBatchScanSize + " exceeded. " + "Configure the " + WarehausConstants.BATCH_SCANNER_MAX_MEMORY_KEY + " property appropriately and re-try"); } uriRetVals.put(uri, forReturn); uriTimestamps.put(uri, ts); } } } results.addAll(uriRetVals.values()); } catch (IOException e) { logger.error("Could not deserialize value from Accumulo", e); throw new TException("Could not retrieve data for request", e); } finally { if (scanner != null) { scanner.close(); } } return results; } private BinaryReplay getVersion(String uri, String columnFamily, String columnQualifier, long timestamp, EzSecurityToken security) throws TException, EntryNotInWarehausException { List<Key> keys = Lists.newArrayList(new Key(WarehausUtils.getKey(uri), new Text(columnFamily), new Text(columnQualifier), timestamp)); List<BinaryReplay> results = null; try { results = getVersion(keys, security); if (results.size() == 0) { throw new EntryNotInWarehausException(String.format("No entry found in warehaus for uri %s, and data type %s, at time %s", uri, columnQualifier, timestamp)); } return results.get(0); } catch (MaxGetRequestSizeExceededException ex) { // should not really happen when fetching one specific key. logger.error("Batch scan max memory exceeded error occured.", ex); throw new TException(ex); } } private List<BinaryReplay> getVersion(List<Key> keys, EzSecurityToken security) throws TException, MaxGetRequestSizeExceededException { String auths = WarehausUtils.getAuthsListFromToken(security); List<BinaryReplay> results = Lists.newArrayList(); if (keys == null || keys.size() == 0) { return results; } Map<String, Long> uriTimestamps = Maps.newHashMap(); BatchScanner scanner = null; try { scanner = createScanner(auths); IteratorSetting iteratorSetting = new IteratorSetting(41, "warehausVersionVisibilityIterator", EzBakeVisibilityFilter.class); addEzBakeVisibilityFilter(scanner, security, EnumSet.of(Permission.READ), iteratorSetting); List<Range> ranges = Lists.newArrayList(); for (Key key : keys) { Range range = new Range(key, true, key.followingKey(PartialKey.ROW_COLFAM_COLQUAL), false); ranges.add(range); uriTimestamps.put(WarehausUtils.getUriFromKey(key), key.getTimestamp()); } scanner.setRanges(ranges); // We don't know what maxVersions is going to be configured as on the accumulo cluster, so lets be safe // here and return MAX_VALUE versions for this scanner IteratorSetting is = new IteratorSetting(10, VersioningIterator.class); VersioningIterator.setMaxVersions(is, Integer.MAX_VALUE); scanner.addScanIterator(is); long currentScanSize = 0l; long maxBatchScanSize = new EzProperties(this.getConfigurationProperties(), false).getLong( WarehausConstants.BATCH_SCANNER_MAX_MEMORY_KEY, WarehausConstants.DEFAULT_SCANNER_MAX_MEMORY); for (Entry<Key, Value> entry : scanner) { if (entry != null) { String uri = WarehausUtils.getUriFromKey(entry.getKey()); long ts = entry.getKey().getTimestamp(); // I REALLY wanted to use the TimestampFilter iterator provided with Accumulo here, but it does not work at // millisecond granularity. Which is ridiculous since Accumulo stores timestamps with millisecond granularity. // Doesn't make a lot of sense...does it? /rant // So here's some kludgy stuff to filter by timestamp. if (ts == uriTimestamps.get(uri).longValue()) { BinaryReplay forReturn = new BinaryReplay(); VisibilityWrapper visibilityAndValue = VisibilitySerialization.deserializeVisibilityWrappedValue(entry.getValue()); VersionControl versionData = ThriftUtils.deserialize(VersionControl.class, visibilityAndValue.getValue()); forReturn.setPacket(versionData.getPacket()); forReturn.setTimestamp(TimeUtil.convertToThriftDateTime(ts)); forReturn.setUri(uri); forReturn.setVisibility(visibilityAndValue.getVisibilityMarkings()); // if max batch scan size exceeded, break int len = ThriftUtils.serialize(forReturn).length; currentScanSize = currentScanSize + len; if (currentScanSize > maxBatchScanSize) { throw new MaxGetRequestSizeExceededException("Max get request size of " + maxBatchScanSize + " exceeded. " + "Configure the " + WarehausConstants.BATCH_SCANNER_MAX_MEMORY_KEY + " property appropriately and re-try"); } results.add(forReturn); } } } } catch (IOException e) { logger.error("Could not deserialize value from Accumulo", e); throw new TException("Could not retrieve data for request", e); } finally { if (scanner != null) { scanner.close(); } } return results; } protected void resetTable() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TException { connector.tableOperations().delete(WarehausConstants.TABLE_NAME); connector.tableOperations().delete(WarehausConstants.PURGE_TABLE_NAME); ensureTable(); } /** * Start a purge of the given items. This method will begin purging items * that match the given a list of ids to purge and will call back to the * purgeCallbackService when the purge has completed. The return of this * function without exception indicates that the application has taken * responsibility of purging documents matching purgeIds from its data sets. * It does not indicate completion of the purge. * <p/> * Returns the state of the new purge request. * * @param purgeCallbackService ezDiscovery path of the purge service to call * back. * @param purgeId Unique id to use for this purge request.d should * not take any action based on that fact. Required. * @param idsToPurge A set containing all the items to purge. This should * be sent to the data access layer to perform the purge. * @param initiatorToken Security token for the service or user that * initiated the purge. * @throws PurgeException If the purgeId is null or empty. * @throws TException If an error occurred during the processing of the * purge. */ @Override public PurgeState beginPurge(String purgeCallbackService, long purgeId, Set<Long> idsToPurge, EzSecurityToken initiatorToken) throws PurgeException, EzSecurityTokenException, TException { if (initiatorToken == null) { throw new TException("The security token was not provided when requesting the warehaus purge."); } if (!isPurgeAppSecurityId(initiatorToken)) { throw new TException("A warehaus purge may only be initiated by the Central Purge Service."); } HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "beginPurge"); auditArgs.put("purgeId", Long.toString(purgeId)); auditLog(initiatorToken, AuditEventType.FileObjectDelete, auditArgs); PurgeState purgeState = createDefaultPurgeState(purgeId); purgeState.setPurgeStatus(PurgeStatus.STARTING); insertPurgeStatus(purgeState); ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.execute(new WarehousePurger(purgeId, idsToPurge, initiatorToken)); executorService.shutdown(); return purgeState; } @Override public PurgeState beginVirusPurge(String purgeCallbackService, long purgeId, Set<Long> idsToPurge, EzSecurityToken initiatorToken) throws PurgeException, EzSecurityTokenException, TException { return this.beginPurge(purgeCallbackService, purgeId, idsToPurge, initiatorToken); } /** * <p> * Returns the most recent state of a given purge request. * </p> * * @param purgeId Unique id to use for this purge request * @returns Status of the given purge, UNKNOWN_ID if it was not found */ @Override public PurgeState purgeStatus(EzSecurityToken token, long purgeId) throws EzSecurityTokenException, TException { if (token == null) { throw new TException("The security token was not provided when requesting the warehaus purge status."); } if (!isPurgeAppSecurityId(token)) { throw new TException("A warehaus purge status may only be initiated by the Central Purge Service."); } HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "purgeStatus"); auditArgs.put("purgeId", Long.toString(purgeId)); auditLog(token, AuditEventType.FileObjectAccess, auditArgs); PurgeState state = createDefaultPurgeState(purgeId); state.setPurgeStatus(PurgeStatus.UNKNOWN_ID); Scanner scanner = null; try { scanner = connector.createScanner( WarehausConstants.PURGE_TABLE_NAME, WarehausUtils.getAuthsFromString(WarehausUtils.getAuthsListFromToken(token))); IteratorSetting is = new IteratorSetting(10, VersioningIterator.class); VersioningIterator.setMaxVersions(is, Integer.MAX_VALUE); scanner.addScanIterator(is); scanner.setRange(new Range(new Text(String.valueOf(purgeId)))); int entriesFoundCount = 0; for (Entry<Key, Value> entry : scanner) { entriesFoundCount++; state = ThriftUtils.deserialize(PurgeState.class, entry.getValue().get()); } if (entriesFoundCount > 1) { logger.warn("A total of {} entries were found in the warehaus purge db when searching for the purge id #{}. Expected only the return of the most recent record.", entriesFoundCount, purgeId); } } catch (TableNotFoundException e) { throw new TException(e); } finally { if (scanner != null) { scanner.close(); } } return state; } /** * <p> * Cancelling a purge from the warehouse may not occur. As a result, the * cancel status will be set to {@link CancelStatus#CANNOT_CANCEL}. * </p> */ @Override public PurgeState cancelPurge(EzSecurityToken token, long purgeId) throws EzSecurityTokenException, TException { if (token == null) { throw new TException("The security token was not provided when requesting the warehaus purge cancellation."); } if (!isPurgeAppSecurityId(token)) { throw new TException("A warehaus purge cancellation may only be initiated by the Central Purge Service."); } HashMap<String, String> auditArgs = Maps.newHashMap(); auditArgs.put("action", "cancelPurge"); auditArgs.put("purgeId", Long.toString(purgeId)); auditLog(token, AuditEventType.FileObjectModify, auditArgs); PurgeState state = this.purgeStatus(token, purgeId); if (this.mayCancelPurgeProceed(state)) { state.setCancelStatus(CancelStatus.CANCELED); state.setPurgeStatus(PurgeStatus.FINISHED_COMPLETE); } else { state.setCancelStatus(CancelStatus.CANNOT_CANCEL); } state.setTimeStamp(TimeUtil.getCurrentThriftDateTime()); this.insertPurgeStatus(state); return state; } /** * <p> * Answers true if the give PurgeState is in a state where it may proceed * with a cancellation and false if it is not. * </p> * * @param state The PurgeState which is evaluated to determine if purge * cancellation is permitted. If this is null the false is returned. */ boolean mayCancelPurgeProceed(PurgeState state) { return state != null && CancelStatus.NOT_CANCELED.equals(state.getCancelStatus()) && (PurgeStatus.WAITING_TO_START.equals(state.getPurgeStatus()) || PurgeStatus.STARTING.equals(state.getPurgeStatus())); } /** * <p/> * Creates a PurgeState record with default values. By default, the * purge status is set to {@link PurgeStatus#WAITING_TO_START} and the * cancel status is set to {@link CancelStatus#NOT_CANCELED}. * * @param purgeId The purge id value to which the purgeId attribute * is set. * @return A new instance of a PurgeState containing the given purgeId * and the default values. */ PurgeState createDefaultPurgeState(long purgeId) { PurgeState state = new PurgeState(); state.setCancelStatus(CancelStatus.NOT_CANCELED); state.setNotPurged(new TreeSet<Long>()); state.setPurged(new TreeSet<Long>()); state.setPurgeId(purgeId); state.setSuggestedPollPeriod(2000); state.setTimeStamp(TimeUtil.getCurrentThriftDateTime()); state.setPurgeStatus(PurgeStatus.WAITING_TO_START); return state; } /** * <p> * Inserts a purge status record for the given collection of URIs. The state * of the purge is determined by the status given in the purgeState parameter. * </p> * * @param purgeState The state of the purge. This will be persisted for each * URI given in the uris parameter. Required. The purgeId is required. * @throws TException If an error occurs while writing to the purge table. * If either purgeId or purgeStatus are empty or null. */ void insertPurgeStatus(PurgeState purgeState) throws TException { if (purgeState == null) { throw new TException("The purge state is required for inserting a warehaus purge record."); } Visibility visibility = new Visibility(); visibility.setFormalVisibility(this.purgeVisibility); BatchWriter writer = null; writer = createPurgeWriter(); Mutation m = new Mutation(new Text(String.valueOf(purgeState.getPurgeId()))); try { m.put(new Text(""), new Text(""), new ColumnVisibility(visibility.getFormalVisibility()), Calendar.getInstance().getTimeInMillis(), new Value(ThriftUtils.serialize(purgeState))); writer.addMutation(m); } catch (MutationsRejectedException e) { logger.error("The write to the warehaus purge table failed for Purge Id '" + purgeState.getPurgeId() + "'.", e); throw new TException(e); } finally { try { flushWriter(writer); } finally { closeWriter(writer); } } } /** * <p> * Removes the warehaus entries identified by the given list of URIs. * </p> * * @param uriList A collection of URIs that uniquely identify the warehaus * entries to remove. If this is null or empty then no processing * occurs. * @param initiatorToken The security token. Required. * @throws Exception If an error occurs while deleting the warehaus entries. */ public void remove(Collection<String> uriList, EzSecurityToken initiatorToken) throws Exception { if (uriList == null || uriList.isEmpty()) return; BatchDeleter deleter = null; List<Range> ranges = Lists.newArrayList(); try { for (String uri : uriList) { ranges.add(Range.exact(WarehausUtils.getKey(uri))); } deleter = createDeleter(WarehausUtils.getAuthsListFromToken(initiatorToken)); deleter.setRanges(ranges); deleter.delete(); } finally { if (deleter != null) { deleter.close(); } } } /** * <p> * Given a set of purge bit ids, return the corresponding URI for each * purge bit id as one collection. To see the mapping of purge bit id * to URI then call #getUriMapping. * </p> * * @param idsToPurge All of he id of URIs used by the purge service that * are referenced in a single purge request. Required. * @param securityToken The security token. Required. * @return * @throws TException If an error occurs when translating the bitvector * from the provenance service. */ private Collection<String> getUris(Set<Long> idsToPurge, EzSecurityToken securityToken) throws TException { Map<Long, String> map = this.getUriMapping(idsToPurge, securityToken); Collection<String> uris = map.values(); return uris == null ? new ArrayList<String>() : uris; } /** * <p> * Given a set of ids, return a mapping of ids to URIs. * </p> * * @param idsToPurge All of he id of URIs used by the purge service that * are referenced in a single purge request. Required. * @param securityToken The security token. Required. * @return A map where the value is the URI. * @throws TException If an error occurs when translating the bitvector * from the provenance service. */ private Map<Long, String> getUriMapping(Set<Long> idsToPurge, EzSecurityToken securityToken) throws TException { ThriftClientPool pool = new ThriftClientPool(this.getConfigurationProperties()); ProvenanceService.Client client = null; try { client = pool.getClient(ProvenanceServiceConstants.SERVICE_NAME, ProvenanceService.Client.class); } finally { if (pool != null) pool.close(); } ArrayList<Long> idsToPurgeList = new ArrayList<>(); idsToPurgeList.addAll(idsToPurge); EzSecurityTokenWrapper chainedToken = securityClient.fetchDerivedTokenForApp(securityToken, pool.getSecurityId(ProvenanceServiceConstants.SERVICE_NAME)); PositionsToUris uriPositions = client.getDocumentUriFromId(chainedToken, idsToPurgeList); return uriPositions.getMapping(); } /** * <p> * Answers true if the given security token has an application security id * that is equal to the application security id from the purge service. If * they are not equivalent then false is returned. * </p> * * @param securityToken The security token that is checked to determine if * it is from the purge service. Required. * @return True if the token has an application security id that matches * purge service's application security id and false if not. */ private boolean isPurgeAppSecurityId(EzSecurityToken securityToken) throws EzSecurityTokenException { EzSecurityTokenWrapper securityWrapper = new EzSecurityTokenWrapper(securityToken); securityClient.validateReceivedToken(securityToken); return securityWrapper.getSecurityId().equals(this.getPurgeAppSecurityId()); } /** * <p> * Returns the application securityId for the purge service. * </p> * <p/> * This can be moved to the {@link #getThriftProcessor()} method. * * @return The application security id for the purge service. */ private String getPurgeAppSecurityId() { if (this.purgeAppSecurityId == null) { ThriftClientPool pool = new ThriftClientPool(this.getConfigurationProperties()); purgeAppSecurityId = pool.getSecurityId(ezCentralPurgeServiceConstants.SERVICE_NAME); pool.close(); } return purgeAppSecurityId; } /** * <p> * Create a writer instance for the purge table. * </p> * * @return An accumulo batch writer. * @throws TException If the purge table could not be found. */ private BatchWriter createPurgeWriter() throws TException { try { EzProperties properties = new EzProperties(getConfigurationProperties(), false); BatchWriterConfig writerConfig = new BatchWriterConfig() .setMaxLatency(properties.getLong(WarehausConstants.BATCH_WRITER_LATENCY_MS_KEY, WarehausConstants.DEFAULT_LATENCY), TimeUnit.MILLISECONDS) .setMaxMemory(properties.getLong(WarehausConstants.BATCH_WRITER_MAX_MEMORY_KEY, WarehausConstants.DEFAULT_WRITER_MAX_MEMORY)) .setMaxWriteThreads(properties.getInteger(WarehausConstants.BATCH_WRITER_WRITE_THREADS_KEY, WarehausConstants.DEFAULT_WRITE_THREADS)); return connector.createBatchWriter(WarehausConstants.PURGE_TABLE_NAME, writerConfig); } catch (TableNotFoundException e) { logger.error("A batch writer could not be initialized for the '" + WarehausConstants.PURGE_TABLE_NAME + "' table because it is missing.", e); throw new RuntimeException(e); } } private class WarehousePurger implements Runnable { private long purgeId; private EzSecurityToken initiatorToken; private Set<Long> idsToPurge; private Visibility visibility; WarehousePurger(long purgeId, Set<Long> idsToPurge, EzSecurityToken initiatorToken) { this.purgeId = purgeId; this.idsToPurge = idsToPurge; this.initiatorToken = initiatorToken; this.visibility = new Visibility(); this.visibility.setFormalVisibility(purgeVisibility); } /** * <p> * Answers true if, based on the given purge state, the purge may proceed * and false if it may not. * </p> * * @param state The purge state which is evaluated. */ private boolean mayPurgeProceed(PurgeState state) { return !(CancelStatus.CANCELED.equals(state.getCancelStatus()) || CancelStatus.CANCEL_IN_PROGRESS.equals(state.getCancelStatus()) || PurgeStatus.FINISHED_COMPLETE.equals(state.getPurgeStatus()) || PurgeStatus.FINISHED_INCOMPLETE.equals(state.getPurgeStatus())); } /** * <p> * Executes the warehouse purge. * </p> */ @Override public void run() { try { PurgeState state = purgeStatus(initiatorToken, this.purgeId); if (this.mayPurgeProceed(state)) { if (idsToPurge == null || idsToPurge.size() == 0) { logger.info("No warehouse entries were given for purge request #{}. Marking the purge as finished.", this.purgeId); state.setPurgeStatus(PurgeStatus.FINISHED_COMPLETE); } else { try { Collection<String> uriList = getUris(idsToPurge, initiatorToken); remove(uriList, initiatorToken); state.setPurged(idsToPurge); state.setPurgeStatus(PurgeStatus.FINISHED_COMPLETE); } catch (Exception e) { logger.error("The delete of the URIs from the warehouse table failed for purge request #{}.", this.purgeId, e); state.setNotPurged(idsToPurge); state.setPurgeStatus(PurgeStatus.ERROR); } } state.setTimeStamp(TimeUtil.getCurrentThriftDateTime()); insertPurgeStatus(state); } else { logger.info("The purge request #{} was skipped for warehouse because the state is not valid for a purge. The purge and cancel statuses, respectively, are: {} and {}.", this.purgeId, state.getPurgeStatus(), state.getCancelStatus()); } } catch (TException e) { logger.error("The purge request #{} encountered an error that prevented the warehouse purge from completing properly.", this.purgeId, e); } } } }
ezbake/ezbake-platform-services
warehaus/service/src/main/java/ezbake/warehaus/AccumuloWarehaus.java
Java
apache-2.0
79,271
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2286, 1011, 2325, 3274, 4163, 3840, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* -------------------------------------------------------------------------- */ /* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */ /* */ /* 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. */ /* -------------------------------------------------------------------------- */ define(function(require){ return 'acls-tab'; });
baby-gnu/one
src/sunstone/public/app/tabs/acls-tab/tabId.js
JavaScript
apache-2.0
1,267
[ 30522, 1013, 1008, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * LDAP configuration test class * * PHP version 5 * * Copyright (C) Villanova University 2010. * * 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. * * 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 * * @category VuFind * @package Tests * @author Franck Borel <franck.borel@gbv.de> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki/unit_tests Wiki */ require_once dirname(__FILE__) . '/../../prepend.inc.php'; require_once 'PEAR.php'; require_once 'sys/authn/LDAPConfigurationParameter.php'; /** * LDAP configuration test class * * @category VuFind * @package Tests * @author Franck Borel <franck.borel@gbv.de> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki/unit_tests Wiki */ class LDAPConfigurationParameterTest extends PHPUnit_Framework_TestCase { /** * Standard setup method. * * @return void * @access public */ public function setUp() { $this->pathToTestConfigurationFiles = dirname(__FILE__) . '/../../conf'; } /** * Verify that missing host causes failure. * * @return void * @access public */ public function testWithMissingHost() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter( $this->pathToTestConfigurationFiles . "/authn/ldap/without-ldap-host-config.ini" ); $parameters = $ldapConfigurationParameter->getParameter(); } catch (InvalidArgumentException $expected) { return; } $this->fail('An expected InvalidArgumentException has not been raised'); } /** * Verify that missing port causes failure. * * @return void * @access public */ public function testWithMissingPort() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter( $this->pathToTestConfigurationFiles . "/authn/ldap/without-ldap-port-config.ini" ); $parameters = $ldapConfigurationParameter->getParameter(); } catch (InvalidArgumentException $expected) { return; } $this->fail('An expected InvalidArgumentException has not been raised'); } /** * Verify that missing baseDN causes failure. * * @return void * @access public */ public function testWithMissingBaseDN() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter( $this->pathToTestConfigurationFiles . "/authn/ldap/without-ldap-basedn-config.ini" ); $parameters = $ldapConfigurationParameter->getParameter(); } catch (InvalidArgumentException $expected) { return; } $this->fail('An expected InvalidArgumentException has not been raised'); } /** * Verify that missing UID causes failure. * * @return void * @access public */ public function testWithMissingUid() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter( $this->pathToTestConfigurationFiles . "/authn/ldap/without-ldap-uid-config.ini" ); $parameters = $ldapConfigurationParameter->getParameter(); } catch (InvalidArgumentException $expected) { return; } $this->fail('An expected InvalidArgumentException has not been raised'); } /** * Verify that good parameters parse correctly. * * @return void * @access public */ public function testWithWorkingParameters() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter(); $parameters = $ldapConfigurationParameter->getParameter(); $this->assertTrue(is_array($parameters)); } catch (InvalidArgumentException $unexpected) { $this->fail( "An unexpected InvalidArgumentException has been raised: " . $unexpected ); } } /** * Verify lowercasing of parameter values. * * @return void * @access public */ public function testIfParametersAreConvertedToLowercase() { try { $ldapConfigurationParameter = new LDAPConfigurationParameter( $this->pathToTestConfigurationFiles . "/authn/ldap/unconverted-parameter-values-config.ini" ); $parameters = $ldapConfigurationParameter->getParameter(); foreach ($parameters as $index => $value) { if ($index == "username") { $this->assertTrue($value == "uid"); } if ($index == "college") { $this->assertTrue($value == "employeetype"); } } } catch (InvalidArgumentException $unexpected) { $this->fail( "An unexpected InvalidArgumentException has been raised: " . $unexpected ); } } } ?>
marktriggs/vufind
tests/web/sys/authn/LDAPConfigurationParameterTest.php
PHP
gpl-2.0
5,799
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 25510, 9331, 9563, 3231, 2465, 1008, 1008, 25718, 2544, 1019, 1008, 1008, 9385, 1006, 1039, 1007, 6992, 13455, 2118, 2230, 1012, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * * * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com) * * * * 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. * * * * For more information: http://www.orientechnologies.com * */ package com.tinkerpop.blueprints.impls.orient; import com.orientechnologies.common.collection.OMultiValue; import com.orientechnologies.common.util.OCallable; import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal; import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.db.record.ORecordOperation; import com.orientechnologies.orient.core.exception.ORecordNotFoundException; import com.orientechnologies.orient.core.exception.OSchemaException; import com.orientechnologies.orient.core.exception.OSerializationException; import com.orientechnologies.orient.core.id.ORID; import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.metadata.schema.OClass; import com.orientechnologies.orient.core.metadata.schema.OSchema; import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.record.impl.ORecordBytes; import com.orientechnologies.orient.core.serialization.OSerializableStream; import com.orientechnologies.orient.core.storage.OStorage; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Element; import com.tinkerpop.blueprints.util.ElementHelper; import com.tinkerpop.blueprints.util.ExceptionFactory; import com.tinkerpop.blueprints.util.StringFactory; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Map; /** * Base Graph Element where OrientVertex and OrientEdge classes extends from. Labels are managed as OrientDB classes. * * @author Luca Garulli (http://www.orientechnologies.com) */ @SuppressWarnings("unchecked") public abstract class OrientElement implements Element, OSerializableStream, Externalizable, OIdentifiable { public static final String LABEL_FIELD_NAME = "label"; public static final Object DEF_ORIGINAL_ID_FIELDNAME = "origId"; private static final long serialVersionUID = 1L; // TODO: CAN REMOVE THIS REF IN FAVOR OF CONTEXT INSTANCE? protected transient OrientBaseGraph graph; protected transient OrientBaseGraph.Settings settings; protected OIdentifiable rawElement; protected OrientElement(final OrientBaseGraph rawGraph, final OIdentifiable iRawElement) { graph = rawGraph; rawElement = iRawElement; if (graph != null) settings = graph.settings; } public abstract String getLabel(); public abstract String getBaseClassName(); /** * (Blueprints Extension) Returns the element type in form of String between "Vertex" and "Edge". */ public abstract String getElementType(); /** * Removes the Element from the Graph. In case the element is a Vertex, all the incoming and outgoing edges are automatically * removed too. */ @Override public void remove() { checkIfAttached(); graph.setCurrentGraphInThreadLocal(); graph.autoStartTransaction(); final ORecordOperation oper = graph.getRawGraph().getTransaction().getRecordEntry(getIdentity()); if (oper != null && oper.type == ORecordOperation.DELETED) throw new IllegalStateException("The elements " + getIdentity() + " has already been deleted"); try { getRecord().load(); } catch (ORecordNotFoundException e) { throw new IllegalStateException("The elements " + getIdentity() + " has already been deleted"); } getRecord().delete(); } /** * (Blueprints Extension) Sets multiple properties in one shot against Vertices and Edges. This improves performance avoiding to * save the graph element at every property set. Example: * * <code> * vertex.setProperties( "name", "Jill", "age", 33, "city", "Rome", "born", "Victoria, TX" ); * </code> You can also pass a Map of values as first argument. In this case all the map entries will be set as element * properties: * * <code> * Map<String,Object> props = new HashMap<String,Object>(); * props.put("name", "Jill"); * props.put("age", 33); * props.put("city", "Rome"); * props.put("born", "Victoria, TX"); * vertex.setProperties(props); * </code> * * @param fields * Odd number of fields to set as repeating pairs of key, value, or if one parameter is received and it's a Map, the Map * entries are used as field key/value pairs. * @param <T> * @return */ public <T extends OrientElement> T setProperties(final Object... fields) { if (fields != null && fields.length > 0 && fields[0] != null) { if (!isDetached()) graph.autoStartTransaction(); if (fields.length == 1) { Object f = fields[0]; if (f instanceof Map<?, ?>) { for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) f).entrySet()) setPropertyInternal(this, (ODocument) rawElement.getRecord(), entry.getKey().toString(), entry.getValue()); } else throw new IllegalArgumentException( "Invalid fields: expecting a pairs of fields as String,Object or a single Map<String,Object>, but found: " + f); } else // SET THE FIELDS for (int i = 0; i < fields.length; i += 2) setPropertyInternal(this, (ODocument) rawElement.getRecord(), fields[i].toString(), fields[i + 1]); } return (T) this; } /** * Sets a Property value. * * @param key * Property name * @param value * Property value */ @Override public void setProperty(final String key, final Object value) { validateProperty(this, key, value); if (!isDetached()) graph.autoStartTransaction(); getRecord().field(key, value); if (!isDetached()) save(); } /** * Sets a Property value specifying a type. This is useful when you don't have a schema on this property but you want to force the * type. * * @param key * Property name * @param value * Property value * @param iType * Type to set */ public void setProperty(final String key, final Object value, final OType iType) { validateProperty(this, key, value); if (!isDetached()) graph.autoStartTransaction(); getRecord().field(key, value, iType); if (!isDetached()) save(); } /** * Removes a Property. * * @param key * Property name * @return Old value if any */ @Override public <T> T removeProperty(final String key) { if (!isDetached()) graph.autoStartTransaction(); final Object oldValue = getRecord().removeField(key); if (!isDetached()) save(); return (T) oldValue; } /** * Returns a Property value. * * @param key * Property name * @return Property value if any, otherwise NULL. */ @Override public <T> T getProperty(final String key) { if (key == null) return null; if (key.equals("_class")) return (T) getRecord().getSchemaClass().getName(); else if (key.equals("_version")) return (T) new Integer(getRecord().getVersion()); else if (key.equals("_rid")) return (T) rawElement.getIdentity().toString(); final Object fieldValue = getRecord().field(key); if (fieldValue instanceof OIdentifiable && !(((OIdentifiable) fieldValue).getRecord() instanceof ORecordBytes)) // CONVERT IT TO VERTEX/EDGE return (T) graph.getElement(fieldValue); else if (OMultiValue.isMultiValue(fieldValue) && OMultiValue.getFirstValue(fieldValue) instanceof OIdentifiable) { final OIdentifiable firstValue = (OIdentifiable) OMultiValue.getFirstValue(fieldValue); if (firstValue instanceof ODocument) { final ODocument document = (ODocument) firstValue; if (document.isEmbedded()) return (T) fieldValue; } // CONVERT IT TO ITERABLE<VERTEX/EDGE> return (T) new OrientElementIterable<OrientElement>(graph, OMultiValue.getMultiValueIterable(fieldValue)); } return (T) fieldValue; } /** * Returns the Element Id assuring to save it if it's transient yet. */ @Override public Object getId() { return getIdentity(); } /** * (Blueprints Extension) Saves current element. You don't need to call save() unless you're working against Temporary Vertices. */ public void save() { save(null); } /** * (Blueprints Extension) Saves current element to a particular cluster. You don't need to call save() unless you're working * against Temporary Vertices. * * @param iClusterName * Cluster name or null to use the default "E" */ public void save(final String iClusterName) { checkIfAttached(); graph.setCurrentGraphInThreadLocal(); if (rawElement instanceof ODocument) if (iClusterName != null) rawElement = ((ODocument) rawElement).save(iClusterName); else rawElement = ((ODocument) rawElement).save(); } public int hashCode() { return ((rawElement == null) ? 0 : rawElement.hashCode()); } /** * (Blueprints Extension) Serializes the Element as byte[] * * @throws OSerializationException */ @Override public byte[] toStream() throws OSerializationException { return rawElement.getIdentity().toString().getBytes(); } /** * (Blueprints Extension) Fills the Element from a byte[] * * @param stream * byte array representation of the object * @throws OSerializationException */ @Override public OSerializableStream fromStream(final byte[] stream) throws OSerializationException { final ODocument record = getRecord(); ((ORecordId) record.getIdentity()).fromString(new String(stream)); return this; } @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(rawElement != null ? rawElement.getIdentity() : null); } @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { rawElement = (OIdentifiable) in.readObject(); } /** * (Blueprints Extension) Locks current Element to prevent concurrent access. If lock is exclusive, then no concurrent threads can * read/write it. If the lock is shared, then concurrent threads can only read Element properties, but can't change them. Locks * can be freed by calling @unlock or when the current transaction is closed (committed or rollbacked). * * @see #lock(boolean) * @param iExclusive * True = Exclusive Lock, False = Shared Lock */ @Override public void lock(final boolean iExclusive) { ODatabaseRecordThreadLocal.INSTANCE.get().getTransaction() .lockRecord(this, iExclusive ? OStorage.LOCKING_STRATEGY.KEEP_EXCLUSIVE_LOCK : OStorage.LOCKING_STRATEGY.KEEP_SHARED_LOCK); } /** * (Blueprints Extension) Unlocks previous acquired @lock against the Element. * * @see #lock(boolean) */ @Override public void unlock() { ODatabaseRecordThreadLocal.INSTANCE.get().getTransaction().unlockRecord(this); } /** * (Blueprints Extension) Returns the record's identity. */ @Override public ORID getIdentity() { if (rawElement == null) return ORecordId.EMPTY_RECORD_ID; final ORID rid = rawElement.getIdentity(); if (!rid.isValid() && !isDetached()) { // SAVE THE RECORD TO OBTAIN A VALID RID graph.setCurrentGraphInThreadLocal(); graph.autoStartTransaction(); save(); } return rid; } /** * (Blueprints Extension) Returns the underlying record. */ @Override public ODocument getRecord() { if (rawElement instanceof ODocument) return (ODocument) rawElement; final ODocument doc = rawElement.getRecord(); if (doc == null) return null; // CHANGE THE RID -> DOCUMENT rawElement = doc; return doc; } /** * (Blueprints Extension) Removes the reference to the current graph instance to let working offline. To reattach it use @attach. * * @return Current object to allow chained calls. * @see #attach(OrientBaseGraph), #isDetached */ public OrientElement detach() { // EARLY UNMARSHALL FIELDS getRecord().setLazyLoad(false); getRecord().fieldNames(); // COPY GRAPH SETTINGS TO WORK OFFLINE settings = graph.settings.copy(); graph = null; return this; } /** * (Blueprints Extension) Replaces current graph instance with new one on @detach -ed elements. Use this method to pass elements * between graphs or to switch between Tx and NoTx instances. * * @param iNewGraph * The new Graph instance to use. * @return Current object to allow chained calls. * @see #detach(), #isDetached */ public OrientElement attach(final OrientBaseGraph iNewGraph) { if (iNewGraph == null) throw new IllegalArgumentException("Graph is null"); graph = iNewGraph; // LINK THE GRAPHS SETTINGS settings = graph.settings; return this; } /** * (Blueprints Extension) Tells if the current element has been @detach ed. * * @return True if detached, otherwise false * @see #attach(OrientBaseGraph), #detach */ public boolean isDetached() { return graph == null; } public boolean equals(final Object object) { return ElementHelper.areEqual(this, object); } public int compare(final OIdentifiable iFirst, final OIdentifiable iSecond) { if (iFirst == null || iSecond == null) return -1; return iFirst.compareTo(iSecond); } public int compareTo(final OIdentifiable iOther) { if (iOther == null) return 1; final ORID myRID = getIdentity(); final ORID otherRID = iOther.getIdentity(); if (myRID == null && otherRID == null) return 0; if (myRID == null) return -1; if (otherRID == null) return 1; return myRID.compareTo(otherRID); } /** * (Blueprints Extension) Returns the Graph instance associated to the current element. On @detach ed elements returns NULL. * */ public OrientBaseGraph getGraph() { return graph; } /** * (Blueprints Extension) Validates an Element property. * * @param element * Element instance * @param key * Property name * @param value * property value * @throws IllegalArgumentException */ public final void validateProperty(final Element element, final String key, final Object value) throws IllegalArgumentException { if (settings.standardElementConstraints && null == value) throw ExceptionFactory.propertyValueCanNotBeNull(); if (null == key) throw ExceptionFactory.propertyKeyCanNotBeNull(); if (settings.standardElementConstraints && key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); if (element instanceof Edge && key.equals(StringFactory.LABEL)) throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); if (key.isEmpty()) throw ExceptionFactory.propertyKeyCanNotBeEmpty(); } public void reload() { final ODocument rec = getRecord(); if (rec != null) rec.reload(null, true); } protected void copyTo(final OrientElement iCopy) { iCopy.graph = graph; iCopy.settings = settings; if (rawElement instanceof ODocument) { iCopy.rawElement = new ODocument().fromStream(((ODocument) rawElement).toStream()); } else if (rawElement instanceof ORID) iCopy.rawElement = ((ORID) rawElement).copy(); else throw new IllegalArgumentException("Cannot clone element " + rawElement); } protected void checkClass() { // FORCE EARLY UNMARSHALLING final ODocument doc = getRecord(); doc.deserializeFields(); final OClass cls = doc.getSchemaClass(); if (cls == null || !cls.isSubClassOf(getBaseClassName())) throw new IllegalArgumentException("The document received is not a " + getElementType() + ". Found class '" + cls + "'"); } /** * Check if a class already exists, otherwise create it at the fly. If a transaction is running commit changes, create the class * and begin a new transaction. * * @param className * Class's name */ protected String checkForClassInSchema(final String className) { if (className == null) return null; if (isDetached()) return className; final OSchema schema = graph.getRawGraph().getMetadata().getSchema(); if (!schema.existsClass(className)) { // CREATE A NEW CLASS AT THE FLY try { graph .executeOutsideTx(new OCallable<OClass, OrientBaseGraph>() { @Override public OClass call(final OrientBaseGraph g) { return schema.createClass(className, schema.getClass(getBaseClassName())); } }, "Committing the active transaction to create the new type '", className, "' as subclass of '", getBaseClassName(), "'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction"); } catch (OSchemaException e) { if (!schema.existsClass(className)) throw e; } } else { // CHECK THE CLASS INHERITANCE final OClass cls = schema.getClass(className); if (!cls.isSubClassOf(getBaseClassName())) throw new IllegalArgumentException("Class '" + className + "' is not an instance of " + getBaseClassName()); } return className; } protected void setPropertyInternal(final Element element, final ODocument doc, final String key, final Object value) { validateProperty(element, key, value); doc.field(key, value); } protected void setCurrentGraphInThreadLocal() { if (!isDetached()) graph.setCurrentGraphInThreadLocal(); } protected void checkIfAttached() { if (graph == null) throw new IllegalStateException("Graph element has been detached. Attach it before"); } }
DiceHoldingsInc/orientdb
graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientElement.java
Java
apache-2.0
18,826
[ 30522, 1013, 1008, 1008, 1008, 1008, 9385, 2297, 16865, 6786, 5183, 1006, 18558, 1006, 2012, 1007, 16865, 15937, 3630, 21615, 1012, 4012, 1007, 1008, 1008, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @author jesus * */ public class Principal { public static void main(String[] args) { Persona alumno1 = new Alumno("03181199T","Jesus","Ortega Vilchez",true,true,8); Persona profesor1 = new Profesor("0156478M","Jose Carlos","Villar",true,false,1500.50); Persona profesorFP1 = new ProfesorFP("02314566G","Javier","Olmedo Garcia",true,false,7); Persona profesorESO1 = new ProfesorESO("02415874M","Jose Luis","Fernandez Pérez",true,false,"Informatica"); System.out.println("DATOS: "+alumno1.toString()); System.out.println("Es miembro? "+alumno1.esMiembro()); System.out.println("DATOS: "+profesor1.toString()); System.out.println("Es miembro? "+profesor1.esMiembro()); System.out.println("DATOS: "+profesorFP1.toString()); System.out.println("DATOS: "+profesorESO1.toString()); } }
JesusOrtegaVilchez/JAVA
Ejercicio_Herencia/Principal.java
Java
gpl-2.0
822
[ 30522, 1013, 1008, 1008, 1008, 1030, 3166, 4441, 1008, 1008, 1013, 2270, 2465, 4054, 1063, 2270, 10763, 11675, 2364, 1006, 5164, 1031, 1033, 12098, 5620, 1007, 1063, 16115, 2632, 2819, 3630, 2487, 1027, 2047, 2632, 2819, 3630, 1006, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/****************************************************************************** * * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License 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 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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Modifications for inclusion into the Linux staging tree are * Copyright(c) 2010 Larry Finger. All rights reserved. * * Contact information: * WLAN FAE <wlanfae@realtek.com> * Larry Finger <Larry.Finger@lwfinger.net> * ******************************************************************************/ #ifndef __RTL8712_GP_BITDEF_H__ #define __RTL8712_GP_BITDEF_H__ /*GPIO_CTRL*/ #define _GPIO_MOD_MSK 0xFF000000 #define _GPIO_MOD_SHT 24 #define _GPIO_IO_SEL_MSK 0x00FF0000 #define _GPIO_IO_SEL_SHT 16 #define _GPIO_OUT_MSK 0x0000FF00 #define _GPIO_OUT_SHT 8 #define _GPIO_IN_MSK 0x000000FF #define _GPIO_IN_SHT 0 /*SYS_PINMUX_CFG*/ #define _GPIOSEL_MSK 0x0003 #define _GPIOSEL_SHT 0 /*LED_CFG*/ #define _LED1SV BIT(7) #define _LED1CM_MSK 0x0070 #define _LED1CM_SHT 4 #define _LED0SV BIT(3) #define _LED0CM_MSK 0x0007 #define _LED0CM_SHT 0 /*PHY_REG*/ #define _HST_RDRDY_SHT 0 #define _HST_RDRDY_MSK 0xFF #define _HST_RDRDY BIT(_HST_RDRDY_SHT) #define _CPU_WTBUSY_SHT 1 #define _CPU_WTBUSY_MSK 0xFF #define _CPU_WTBUSY BIT(_CPU_WTBUSY_SHT) /* 11. General Purpose Registers (Offset: 0x02E0 - 0x02FF)*/ /* 8192S GPIO Config Setting (offset 0x2F1, 1 byte)*/ /*----------------------------------------------------------------------------*/ #define GPIOMUX_EN BIT(3) /* When this bit is set to "1", * GPIO PINs will switch to MAC * GPIO Function*/ #define GPIOSEL_GPIO 0 /* UART or JTAG or pure GPIO*/ #define GPIOSEL_PHYDBG 1 /* PHYDBG*/ #define GPIOSEL_BT 2 /* BT_coex*/ #define GPIOSEL_WLANDBG 3 /* WLANDBG*/ #define GPIOSEL_GPIO_MASK (~(BIT(0)|BIT(1))) /* HW Radio OFF switch (GPIO BIT) */ #define HAL_8192S_HW_GPIO_OFF_BIT BIT(3) #define HAL_8192S_HW_GPIO_OFF_MASK 0xF7 #define HAL_8192S_HW_GPIO_WPS_BIT BIT(4) #endif /*__RTL8712_GP_BITDEF_H__*/
mericon/Xp_Kernel_LGH850
virt/drivers/staging/rtl8712/rtl8712_gp_bitdef.h
C
gpl-2.0
2,643
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jsonp({"cep":"37701518","logradouro":"Rua B","bairro":"Jardim do Gin\u00e1sio","cidade":"Po\u00e7os de Caldas","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/37701518.jsonp.js
JavaScript
cc0-1.0
148
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 4261, 19841, 16068, 15136, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 21766, 2050, 1038, 1000, 1010, 1000, 21790, 18933, 1000, 1024, 1000, 15723, 221...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!doctype html> <html> <head> <title>Sam</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <article> <header id="transcript"><i>“Play Tear You Down”</i></header> <h2>Player</h2> <div id="player"></div> </article> <footer> <hr> <a href="http://soundcloud.com/"><img src="img/soundcloud.png"></a> <button id="restart-button">Restart speech recognizer</button> </footer> <script src="//connect.soundcloud.com/sdk.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script> <script src="js/main.js"></script> <script> var player = new MusicPlayer('{{soundcloudClientId}}', '{{soundcloudRedirectUri}}'); var playerActions = { search: { callback: function (query) { player.search(query, function (tracks) { // TODO: render a table of tracks }); }, minLength: 1, interim: false }, play: { callback: function (query) { var recognizer = this; player.search(query, function (tracks) { var track = tracks.filter(function (track) { return track.streamable; })[0]; player.stream(track, function (sound) { var $player = document.getElementById('player'); recognizer.actions.pause = { callback: function () { sound.pause(); }, minLength: 0, interim: true, similar: ['paws', 'pos'] }; recognizer.actions.resume = { callback: function () { sound.resume(); }, minLength: 0, interim: true }; recognizer.actions.stop = { callback: function () { sound.stop(); $player.innerHTML = ''; }, minLength: 0, interim: true }; $player.innerHTML = player.renderTrack(track); sound.play(); }); }); }, minLength: 1, interim: false }, embed: { callback: function (query) { player.search(query, function (tracks) { player.embed(tracks.filter(function (track) { return track.embeddable_by == 'all'; })[0], document.getElementById('player')); }); // TODO: add actions for pause, resume }, minLength: 1, interim: false } }; var recognizer = new SpeechRecognizer(playerActions, function (transcript) { document.getElementById('transcript').innerHTML = transcript; }); recognizer.start(); document.getElementById('restart-button').addEventListener('click', function () { recognizer.restart(); }); </script> </body> </html>
tomshen/sam
views/index.html
HTML
mit
2,932
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 3520, 1026, 1013, 2516, 1028, 1026, 4957, 2128, 2140, 1027, 1000, 6782, 21030, 2102, 1000, 17850, 12879, 1027, 1000, 20116, 2015, 1013, 3671,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_31) on Fri Oct 05 17:19:52 PDT 2012 --> <TITLE> Uses of Class org.apache.hadoop.mapred.join.Parser.NodeToken (Hadoop 0.20.2-cdh3u5 API) </TITLE> <META NAME="date" CONTENT="2012-10-05"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.hadoop.mapred.join.Parser.NodeToken (Hadoop 0.20.2-cdh3u5 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/mapred/join/Parser.NodeToken.html" title="class in org.apache.hadoop.mapred.join"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/hadoop/mapred/join//class-useParser.NodeToken.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Parser.NodeToken.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.hadoop.mapred.join.Parser.NodeToken</B></H2> </CENTER> No usage of org.apache.hadoop.mapred.join.Parser.NodeToken <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/mapred/join/Parser.NodeToken.html" title="class in org.apache.hadoop.mapred.join"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/hadoop/mapred/join//class-useParser.NodeToken.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Parser.NodeToken.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &copy; 2009 The Apache Software Foundation </BODY> </HTML>
YuMatsuzawa/HadoopEclipseProject
hadoop-0.20.2-cdh3u5/docs/api/org/apache/hadoop/mapred/join/class-use/Parser.NodeToken.html
HTML
apache-2.0
6,141
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
const DateTime = Jymfony.Component.DateTime.DateTime; const DateTimeZone = Jymfony.Component.DateTime.DateTimeZone; const TimeSpan = Jymfony.Component.DateTime.TimeSpanInterface; const { expect } = require('chai'); describe('[DateTime] DateTime', function () { it('should accept string on construction', () => { const dt = new DateTime('2017-03-24T00:00:00', 'Etc/UTC'); expect(dt).to.be.instanceOf(DateTime); }); it('should accept unix timestamp on construction', () => { const dt = new DateTime(1490313600, 'Etc/UTC'); expect(dt).to.be.instanceOf(DateTime); }); it('should accept a js Date object on construction', () => { const date = new Date(1490313600000); const dt = new DateTime(date, 'Etc/UTC'); expect(dt).to.be.instanceOf(DateTime); expect(dt.year).to.be.equal(2017); expect(dt.month).to.be.equal(3); expect(dt.day).to.be.equal(24); expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); expect(dt.millisecond).to.be.equal(0); }); it('today should set time to midnight', () => { const dt = DateTime.today; expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); expect(dt.millisecond).to.be.equal(0); }); it('yesterday should set time to midnight', () => { const dt = DateTime.yesterday; expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); expect(dt.millisecond).to.be.equal(0); }); let tests = [ [ '2017-01-01T00:00:00', 'P-1D', '2016-12-31T00:00:00+0000' ], [ '2016-12-31T00:00:00', 'P+1D', '2017-01-01T00:00:00+0000' ], [ '2016-11-30T00:00:00', 'P+1D', '2016-12-01T00:00:00+0000' ], [ '2017-01-01T00:00:00', 'P-1Y', '2016-01-01T00:00:00+0000' ], [ '2016-02-29T00:00:00', 'P-1Y', '2015-02-28T00:00:00+0000' ], ]; for (const t of tests) { it('add timespan should work correctly', () => { const [ date, span, expected ] = t; let dt = new DateTime(date); dt = dt.modify(new TimeSpan(span)); expect(dt.toString()).to.be.equal(expected); }); } it('createFromFormat should correctly parse a date', () => { const dt = DateTime.createFromFormat(DateTime.RFC2822, 'Wed, 20 Jun 2018 10:19:32 GMT'); expect(dt.toString()).to.be.equal('2018-06-20T10:19:32+0000'); }); tests = [ [ '2020 mar 29 01:00 Europe/Rome', 3600, 1, 0 ], [ '2020 mar 29 02:00 Europe/Rome', 7200, 3, 0 ], [ '2020 mar 29 03:00 Europe/Rome', 7200, 3, 0 ], [ '2020 mar 29 04:00 Europe/Rome', 7200, 4, 0 ], [ '2020 may 04 02:00 Europe/Rome', 7200, 2, 0 ], ]; for (const index of tests.keys()) { const t = tests[index]; it('should correctly handle timezone transitions #'+index, () => { const dt = new DateTime(t[0]); expect(dt.timezone).to.be.instanceOf(DateTimeZone); expect(dt.timezone.getOffset(dt)).to.be.equal(t[1]); expect(dt.hour).to.be.equal(t[2]); expect(dt.minute).to.be.equal(t[3]); }); } it('should correctly handle timezone transitions on modify', () => { let dt = new DateTime('2020 mar 29 01:59:59 Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); dt = dt.modify(new TimeSpan('PT1S')); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.hour).to.be.equal(3); expect(dt.minute).to.be.equal(0); }); it('should correctly handle between rules', () => { let dt = new DateTime('1866 dec 11 00:00 Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(2996); dt = new DateTime('1866 dec 11 23:59:59 Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(2996); expect(dt.toString()).to.be.equal('1866-12-11T23:59:59+0049'); dt = dt.modify(new TimeSpan('PT1S')); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(2996); expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); dt = new DateTime('1893 Oct 31 23:49:55', 'Europe/Rome'); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(2996); expect(dt.day).to.be.equal(31); expect(dt.hour).to.be.equal(23); expect(dt.minute).to.be.equal(49); expect(dt.second).to.be.equal(55); dt = dt.modify(new TimeSpan('PT1S')); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); dt = new DateTime('1916 Jun 3 23:59:59', 'Europe/Rome'); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.hour).to.be.equal(23); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); dt = dt.modify(new TimeSpan('PT1S')); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.month).to.be.equal(6); expect(dt.day).to.be.equal(4); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); dt = new DateTime('2020 Oct 25 01:59:59', 'Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); dt = dt.modify(new TimeSpan('PT1H')); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.hour).to.be.equal(2); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); dt = dt.modify(new TimeSpan('PT1S')); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.hour).to.be.equal(2); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(0); dt = new DateTime('2020 Oct 25 01:59:59', 'Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); dt = dt.modify(new TimeSpan('P1D')); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.timestamp).to.be.equal(1603673999); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); dt = dt.modify(new TimeSpan('P-1D')); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.timestamp).to.be.equal(1603583999); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); dt = dt.modify(new TimeSpan('P1M')); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.timestamp).to.be.equal(1606265999); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); expect(dt.day).to.be.equal(25); expect(dt.month).to.be.equal(11); expect(dt.year).to.be.equal(2020); dt = dt.modify(new TimeSpan('P-1M')); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.timestamp).to.be.equal(1603583999); dt = dt.modify(new TimeSpan('P1Y')); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.timestamp).to.be.equal(1635119999); expect(dt.hour).to.be.equal(1); expect(dt.minute).to.be.equal(59); expect(dt.second).to.be.equal(59); expect(dt.day).to.be.equal(25); expect(dt.month).to.be.equal(10); expect(dt.year).to.be.equal(2021); dt = dt.modify(new TimeSpan('P7D')); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.timestamp).to.be.equal(1635728399); dt = dt.modify(new TimeSpan('P-1Y7D')); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.timestamp).to.be.equal(1603583999); }); it ('invalid times for timezone', () => { let dt = new DateTime('1893 Oct 31 23:49:58', 'Europe/Rome'); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(3600); expect(dt.year).to.be.equal(1893); expect(dt.month).to.be.equal(11); expect(dt.day).to.be.equal(1); expect(dt.hour).to.be.equal(0); expect(dt.minute).to.be.equal(0); expect(dt.second).to.be.equal(2); dt = new DateTime('2020 mar 29 02:01:00 Europe/Rome'); expect(dt.timezone.name).to.be.equal('Europe/Rome'); expect(dt.timezone.getOffset(dt)).to.be.equal(7200); expect(dt.hour).to.be.equal(3); expect(dt.minute).to.be.equal(1); }); });
alekitto/jymfony
src/Component/DateTime/test/DateTimeTest.js
JavaScript
mit
9,292
[ 30522, 9530, 3367, 3058, 7292, 1027, 1046, 24335, 14876, 4890, 1012, 6922, 1012, 3058, 7292, 1012, 3058, 7292, 1025, 9530, 3367, 3058, 7292, 15975, 1027, 1046, 24335, 14876, 4890, 1012, 6922, 1012, 3058, 7292, 1012, 3058, 7292, 15975, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// NOTE: this file should only be included when embedding the inspector - no other files should be included (this will do everything) // If gliEmbedDebug == true, split files will be used, otherwise the cat'ed scripts will be inserted (function() { var pathRoot = ""; var useDebug = window["gliEmbedDebug"]; // Find self in the <script> tags var scripts = document.head.getElementsByTagName("script"); for (var n = 0; n < scripts.length; n++) { var scriptTag = scripts[n]; var src = scriptTag.src.toLowerCase(); if (/core\/embed.js$/.test(src)) { // Found ourself - strip our name and set the root var index = src.lastIndexOf("embed.js"); pathRoot = scriptTag.src.substring(0, index); break; } } function insertHeaderNode(node) { var targets = [ document.body, document.head, document.documentElement ]; for (var n = 0; n < targets.length; n++) { var target = targets[n]; if (target) { if (target.firstElementChild) { target.insertBefore(node, target.firstElementChild); } else { target.appendChild(node); } break; } } } ; function insertStylesheet(url) { var link = document.createElement("link"); link.rel = "stylesheet"; link.href = url; insertHeaderNode(link); return link; } ; function insertScript(url) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = url; insertHeaderNode(script); return script; } ; if (useDebug) { // Fall through below and use the loader to get things } else { var jsurl = pathRoot + "lib/gli.all.js"; var cssurl = pathRoot + "lib/gli.all.css"; window.gliCssUrl = cssurl; insertStylesheet(cssurl); insertScript(jsurl); } // Always load the loader if (useDebug) { var script = insertScript(pathRoot + "loader.js"); function scriptLoaded() { gliloader.pathRoot = pathRoot; if (useDebug) { // In debug mode load all the scripts gliloader.load([ "host", "replay", "ui" ]); } } ; script.onreadystatechange = function() { if (("loaded" === script.readyState || "complete" === script.readyState) && !script.loadCalled) { this.loadCalled = true; scriptLoaded(); } }; script.onload = function() { if (!script.loadCalled) { this.loadCalled = true; scriptLoaded(); } }; } // Hook canvas.getContext var originalGetContext = HTMLCanvasElement.prototype.getContext; if (!HTMLCanvasElement.prototype.getContextRaw) { HTMLCanvasElement.prototype.getContextRaw = originalGetContext; } HTMLCanvasElement.prototype.getContext = function() { var ignoreCanvas = this.internalInspectorSurface; if (ignoreCanvas) { return originalGetContext.apply(this, arguments); } var contextNames = [ "moz-webgl", "webkit-3d", "experimental-webgl", "webgl" ]; var requestingWebGL = contextNames.indexOf(arguments[0]) != -1; if (requestingWebGL) { // Page is requesting a WebGL context! // TODO: something } var result = originalGetContext.apply(this, arguments); if (result == null) { return null; } if (requestingWebGL) { // TODO: pull options from somewhere? result = gli.host.inspectContext(this, result); var hostUI = new gli.host.HostUI(result); result.hostUI = hostUI; // just so we can access it later for // debugging } return result; }; })();
freekv/jpip.js
examples/js/embed.js
JavaScript
apache-2.0
4,075
[ 30522, 1013, 1013, 3602, 1024, 2023, 5371, 2323, 2069, 2022, 2443, 2043, 7861, 8270, 4667, 1996, 7742, 1011, 2053, 2060, 6764, 2323, 2022, 2443, 1006, 2023, 2097, 2079, 2673, 1007, 1013, 1013, 2065, 1043, 8751, 18552, 14141, 15878, 15916, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.processor; import org.apache.camel.CamelContext; import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.junit.jupiter.api.Test; public class EventNotifierExchangeSentExampleTest extends ContextTestSupport { @Override protected CamelContext createCamelContext() throws Exception { DefaultCamelContext context = (DefaultCamelContext) super.createCamelContext(); // START SNIPPET: e1 // add event notifier where we can log the times it took to process // exchanges sent to an endpoint context.getManagementStrategy().addEventNotifier(new MyLoggingSentEventNotifer()); // END SNIPPET: e1 return context; } @Test public void testExchangeSent() throws Exception { getMockEndpoint("mock:result").expectedMessageCount(1); template.sendBody("direct:start", "Hello World"); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").to("direct:bar").to("mock:result"); from("direct:bar").delay(1000); } }; } }
nikhilvibhav/camel
core/camel-core/src/test/java/org/apache/camel/processor/EventNotifierExchangeSentExampleTest.java
Java
apache-2.0
2,185
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 2030, 2062, 1008, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 5500, 2007, 1008, 2023, 2147, 2005, 3176, 2592, 4953, 9385, 6095, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
""" Builds out and synchronizes yum repo mirrors. Initial support for rsync, perhaps reposync coming later. Copyright 2006-2007, Red Hat, Inc Michael DeHaan <mdehaan@redhat.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ import os import os.path import time import yaml # Howell-Clark version import sys HAS_YUM = True try: import yum except: HAS_YUM = False import utils from cexceptions import * import traceback import errno from utils import _ import clogger class RepoSync: """ Handles conversion of internal state to the tftpboot tree layout """ # ================================================================================== def __init__(self,config,tries=1,nofail=False,logger=None): """ Constructor """ self.verbose = True self.api = config.api self.config = config self.distros = config.distros() self.profiles = config.profiles() self.systems = config.systems() self.settings = config.settings() self.repos = config.repos() self.rflags = self.settings.reposync_flags self.tries = tries self.nofail = nofail self.logger = logger if logger is None: self.logger = clogger.Logger() self.logger.info("hello, reposync") # =================================================================== def run(self, name=None, verbose=True): """ Syncs the current repo configuration file with the filesystem. """ self.logger.info("run, reposync, run!") try: self.tries = int(self.tries) except: utils.die(self.logger,"retry value must be an integer") self.verbose = verbose report_failure = False for repo in self.repos: env = repo.environment for k in env.keys(): self.logger.info("environment: %s=%s" % (k,env[k])) if env[k] is not None: os.putenv(k,env[k]) if name is not None and repo.name != name: # invoked to sync only a specific repo, this is not the one continue elif name is None and not repo.keep_updated: # invoked to run against all repos, but this one is off self.logger.info("%s is set to not be updated" % repo.name) continue repo_mirror = os.path.join(self.settings.webdir, "repo_mirror") repo_path = os.path.join(repo_mirror, repo.name) mirror = repo.mirror if not os.path.isdir(repo_path) and not repo.mirror.lower().startswith("rhn://"): os.makedirs(repo_path) # which may actually NOT reposync if the repo is set to not mirror locally # but that's a technicality for x in range(self.tries+1,1,-1): success = False try: self.sync(repo) success = True except: utils.log_exc(self.logger) self.logger.warning("reposync failed, tries left: %s" % (x-2)) if not success: report_failure = True if not self.nofail: utils.die(self.logger,"reposync failed, retry limit reached, aborting") else: self.logger.error("reposync failed, retry limit reached, skipping") self.update_permissions(repo_path) if report_failure: utils.die(self.logger,"overall reposync failed, at least one repo failed to synchronize") return True # ================================================================================== def sync(self, repo): """ Conditionally sync a repo, based on type. """ if repo.breed == "rhn": return self.rhn_sync(repo) elif repo.breed == "yum": return self.yum_sync(repo) #elif repo.breed == "apt": # return self.apt_sync(repo) elif repo.breed == "rsync": return self.rsync_sync(repo) else: utils.die(self.logger,"unable to sync repo (%s), unknown or unsupported repo type (%s)" % (repo.name, repo.breed)) # ==================================================================================== def createrepo_walker(self, repo, dirname, fnames): """ Used to run createrepo on a copied Yum mirror. """ if os.path.exists(dirname) or repo['breed'] == 'rsync': utils.remove_yum_olddata(dirname) # add any repo metadata we can use mdoptions = [] if os.path.isfile("%s/.origin/repomd.xml" % (dirname)): if not HAS_YUM: utils.die(self.logger,"yum is required to use this feature") rmd = yum.repoMDObject.RepoMD('', "%s/.origin/repomd.xml" % (dirname)) if rmd.repoData.has_key("group"): groupmdfile = rmd.getData("group").location[1] mdoptions.append("-g %s" % groupmdfile) if rmd.repoData.has_key("prestodelta"): # need createrepo >= 0.9.7 to add deltas if utils.check_dist() == "redhat" or utils.check_dist() == "suse": cmd = "/usr/bin/rpmquery --queryformat=%{VERSION} createrepo" createrepo_ver = utils.subprocess_get(self.logger, cmd) if createrepo_ver >= "0.9.7": mdoptions.append("--deltas") else: utils.die(self.logger,"this repo has presto metadata; you must upgrade createrepo to >= 0.9.7 first and then need to resync the repo through cobbler.") blended = utils.blender(self.api, False, repo) flags = blended.get("createrepo_flags","(ERROR: FLAGS)") try: # BOOKMARK cmd = "createrepo %s %s %s" % (" ".join(mdoptions), flags, dirname) utils.subprocess_call(self.logger, cmd) except: utils.log_exc(self.logger) self.logger.error("createrepo failed.") del fnames[:] # we're in the right place # ==================================================================================== def rsync_sync(self, repo): """ Handle copying of rsync:// and rsync-over-ssh repos. """ repo_mirror = repo.mirror if not repo.mirror_locally: utils.die(self.logger,"rsync:// urls must be mirrored locally, yum cannot access them directly") if repo.rpm_list != "" and repo.rpm_list != []: self.logger.warning("--rpm-list is not supported for rsync'd repositories") # FIXME: don't hardcode dest_path = os.path.join("/var/www/cobbler/repo_mirror", repo.name) spacer = "" if not repo.mirror.startswith("rsync://") and not repo.mirror.startswith("/"): spacer = "-e ssh" if not repo.mirror.endswith("/"): repo.mirror = "%s/" % repo.mirror # FIXME: wrapper for subprocess that logs to logger cmd = "rsync -rltDv %s --delete --exclude-from=/etc/cobbler/rsync.exclude %s %s" % (spacer, repo.mirror, dest_path) rc = utils.subprocess_call(self.logger, cmd) if rc !=0: utils.die(self.logger,"cobbler reposync failed") os.path.walk(dest_path, self.createrepo_walker, repo) self.create_local_file(dest_path, repo) # ==================================================================================== def rhn_sync(self, repo): """ Handle mirroring of RHN repos. """ repo_mirror = repo.mirror # FIXME? warn about not having yum-utils. We don't want to require it in the package because # RHEL4 and RHEL5U0 don't have it. if not os.path.exists("/usr/bin/reposync"): utils.die(self.logger,"no /usr/bin/reposync found, please install yum-utils") cmd = "" # command to run has_rpm_list = False # flag indicating not to pull the whole repo # detect cases that require special handling if repo.rpm_list != "" and repo.rpm_list != []: has_rpm_list = True # create yum config file for use by reposync # FIXME: don't hardcode dest_path = os.path.join("/var/www/cobbler/repo_mirror", repo.name) temp_path = os.path.join(dest_path, ".origin") if not os.path.isdir(temp_path): # FIXME: there's a chance this might break the RHN D/L case os.makedirs(temp_path) # how we invoke yum-utils depends on whether this is RHN content or not. # this is the somewhat more-complex RHN case. # NOTE: this requires that you have entitlements for the server and you give the mirror as rhn://$channelname if not repo.mirror_locally: utils.die("rhn:// repos do not work with --mirror-locally=1") if has_rpm_list: self.logger.warning("warning: --rpm-list is not supported for RHN content") rest = repo.mirror[6:] # everything after rhn:// cmd = "/usr/bin/reposync %s -r %s --download_path=%s" % (self.rflags, rest, "/var/www/cobbler/repo_mirror") if repo.name != rest: args = { "name" : repo.name, "rest" : rest } utils.die(self.logger,"ERROR: repository %(name)s needs to be renamed %(rest)s as the name of the cobbler repository must match the name of the RHN channel" % args) if repo.arch == "i386": # counter-intuitive, but we want the newish kernels too repo.arch = "i686" if repo.arch != "": cmd = "%s -a %s" % (cmd, repo.arch) # now regardless of whether we're doing yumdownloader or reposync # or whether the repo was http://, ftp://, or rhn://, execute all queued # commands here. Any failure at any point stops the operation. if repo.mirror_locally: rc = utils.subprocess_call(self.logger, cmd) # Don't die if reposync fails, it is logged # if rc !=0: # utils.die(self.logger,"cobbler reposync failed") # some more special case handling for RHN. # create the config file now, because the directory didn't exist earlier temp_file = self.create_local_file(temp_path, repo, output=False) # now run createrepo to rebuild the index if repo.mirror_locally: os.path.walk(dest_path, self.createrepo_walker, repo) # create the config file the hosts will use to access the repository. self.create_local_file(dest_path, repo) # ==================================================================================== def yum_sync(self, repo): """ Handle copying of http:// and ftp:// yum repos. """ repo_mirror = repo.mirror # warn about not having yum-utils. We don't want to require it in the package because # RHEL4 and RHEL5U0 don't have it. if not os.path.exists("/usr/bin/reposync"): utils.die(self.logger,"no /usr/bin/reposync found, please install yum-utils") cmd = "" # command to run has_rpm_list = False # flag indicating not to pull the whole repo # detect cases that require special handling if repo.rpm_list != "" and repo.rpm_list != []: has_rpm_list = True # create yum config file for use by reposync dest_path = os.path.join("/var/www/cobbler/repo_mirror", repo.name) temp_path = os.path.join(dest_path, ".origin") if not os.path.isdir(temp_path) and repo.mirror_locally: # FIXME: there's a chance this might break the RHN D/L case os.makedirs(temp_path) # create the config file that yum will use for the copying if repo.mirror_locally: temp_file = self.create_local_file(temp_path, repo, output=False) if not has_rpm_list and repo.mirror_locally: # if we have not requested only certain RPMs, use reposync cmd = "/usr/bin/reposync %s --config=%s --repoid=%s --download_path=%s" % (self.rflags, temp_file, repo.name, "/var/www/cobbler/repo_mirror") if repo.arch != "": if repo.arch == "x86": repo.arch = "i386" # FIX potential arch errors if repo.arch == "i386": # counter-intuitive, but we want the newish kernels too cmd = "%s -a i686" % (cmd) else: cmd = "%s -a %s" % (cmd, repo.arch) elif repo.mirror_locally: # create the output directory if it doesn't exist if not os.path.exists(dest_path): os.makedirs(dest_path) use_source = "" if repo.arch == "src": use_source = "--source" # older yumdownloader sometimes explodes on --resolvedeps # if this happens to you, upgrade yum & yum-utils extra_flags = self.settings.yumdownloader_flags cmd = "/usr/bin/yumdownloader %s %s --disablerepo=* --enablerepo=%s -c %s --destdir=%s %s" % (extra_flags, use_source, repo.name, temp_file, dest_path, " ".join(repo.rpm_list)) # now regardless of whether we're doing yumdownloader or reposync # or whether the repo was http://, ftp://, or rhn://, execute all queued # commands here. Any failure at any point stops the operation. if repo.mirror_locally: rc = utils.subprocess_call(self.logger, cmd) if rc !=0: utils.die(self.logger,"cobbler reposync failed") repodata_path = os.path.join(dest_path, "repodata") if not os.path.exists("/usr/bin/wget"): utils.die(self.logger,"no /usr/bin/wget found, please install wget") # grab repomd.xml and use it to download any metadata we can use cmd2 = "/usr/bin/wget -q %s/repodata/repomd.xml -O %s/repomd.xml" % (repo_mirror, temp_path) rc = utils.subprocess_call(self.logger,cmd2) if rc == 0: # create our repodata directory now, as any extra metadata we're # about to download probably lives there if not os.path.isdir(repodata_path): os.makedirs(repodata_path) rmd = yum.repoMDObject.RepoMD('', "%s/repomd.xml" % (temp_path)) for mdtype in rmd.repoData.keys(): # don't download metadata files that are created by default if mdtype not in ["primary", "primary_db", "filelists", "filelists_db", "other", "other_db"]: mdfile = rmd.getData(mdtype).location[1] cmd3 = "/usr/bin/wget -q %s/%s -O %s/%s" % (repo_mirror, mdfile, dest_path, mdfile) utils.subprocess_call(self.logger,cmd3) if rc !=0: utils.die(self.logger,"wget failed") # now run createrepo to rebuild the index if repo.mirror_locally: os.path.walk(dest_path, self.createrepo_walker, repo) # create the config file the hosts will use to access the repository. self.create_local_file(dest_path, repo) # ==================================================================================== # def apt_sync(self, repo): # # """ # Handle copying of http:// and ftp:// debian repos. # """ # # repo_mirror = repo.mirror # # # warn about not having mirror program. # # mirror_program = "/usr/bin/debmirror" # if not os.path.exists(mirror_program): # utils.die(self.logger,"no %s found, please install it"%(mirror_program)) # # cmd = "" # command to run # has_rpm_list = False # flag indicating not to pull the whole repo # # # detect cases that require special handling # # if repo.rpm_list != "" and repo.rpm_list != []: # utils.die(self.logger,"has_rpm_list not yet supported on apt repos") # # if not repo.arch: # utils.die(self.logger,"Architecture is required for apt repositories") # # # built destination path for the repo # dest_path = os.path.join("/var/www/cobbler/repo_mirror", repo.name) # # if repo.mirror_locally: # mirror = repo.mirror.replace("@@suite@@",repo.os_version) # # idx = mirror.find("://") # method = mirror[:idx] # mirror = mirror[idx+3:] # # idx = mirror.find("/") # host = mirror[:idx] # mirror = mirror[idx+1:] # # idx = mirror.rfind("/dists/") # suite = mirror[idx+7:] # mirror = mirror[:idx] # # mirror_data = "--method=%s --host=%s --root=%s --dist=%s " % ( method , host , mirror , suite ) # # # FIXME : flags should come from repo instead of being hardcoded # # rflags = "--passive --nocleanup" # for x in repo.yumopts: # if repo.yumopts[x]: # rflags += " %s %s" % ( x , repo.yumopts[x] ) # else: # rflags += " %s" % x # cmd = "%s %s %s %s" % (mirror_program, rflags, mirror_data, dest_path) # if repo.arch == "src": # cmd = "%s --source" % cmd # else: # arch = repo.arch # if arch == "x86": # arch = "i386" # FIX potential arch errors # if arch == "x86_64": # arch = "amd64" # FIX potential arch errors # cmd = "%s --nosource -a %s" % (cmd, arch) # # rc = utils.subprocess_call(self.logger, cmd) # if rc !=0: # utils.die(self.logger,"cobbler reposync failed") # ================================================================================== def create_local_file(self, dest_path, repo, output=True): """ Creates Yum config files for use by reposync Two uses: (A) output=True, Create local files that can be used with yum on provisioned clients to make use of this mirror. (B) output=False, Create a temporary file for yum to feed into yum for mirroring """ # the output case will generate repo configuration files which are usable # for the installed systems. They need to be made compatible with --server-override # which means they are actually templates, which need to be rendered by a cobbler-sync # on per profile/system basis. if output: fname = os.path.join(dest_path,"config.repo") else: fname = os.path.join(dest_path, "%s.repo" % repo.name) self.logger.debug("creating: %s" % fname) if not os.path.exists(dest_path): utils.mkdir(dest_path) config_file = open(fname, "w+") config_file.write("[%s]\n" % repo.name) config_file.write("name=%s\n" % repo.name) optenabled = False optgpgcheck = False if output: if repo.mirror_locally: line = "baseurl=http://${server}/cobbler/repo_mirror/%s\n" % (repo.name) else: mstr = repo.mirror if mstr.startswith("/"): mstr = "file://%s" % mstr line = "baseurl=%s\n" % mstr config_file.write(line) # user may have options specific to certain yum plugins # add them to the file for x in repo.yumopts: config_file.write("%s=%s\n" % (x, repo.yumopts[x])) if x == "enabled": optenabled = True if x == "gpgcheck": optgpgcheck = True else: mstr = repo.mirror if mstr.startswith("/"): mstr = "file://%s" % mstr line = "baseurl=%s\n" % mstr if self.settings.http_port not in (80, '80'): http_server = "%s:%s" % (self.settings.server, self.settings.http_port) else: http_server = self.settings.server line = line.replace("@@server@@",http_server) config_file.write(line) if not optenabled: config_file.write("enabled=1\n") config_file.write("priority=%s\n" % repo.priority) # FIXME: potentially might want a way to turn this on/off on a per-repo basis if not optgpgcheck: config_file.write("gpgcheck=0\n") config_file.close() return fname # ================================================================================== def update_permissions(self, repo_path): """ Verifies that permissions and contexts after an rsync are as expected. Sending proper rsync flags should prevent the need for this, though this is largely a safeguard. """ # all_path = os.path.join(repo_path, "*") cmd1 = "chown -R root:apache %s" % repo_path utils.subprocess_call(self.logger, cmd1) cmd2 = "chmod -R 755 %s" % repo_path utils.subprocess_call(self.logger, cmd2)
colloquium/cobbler
cobbler/action_reposync.py
Python
gpl-2.0
22,241
[ 30522, 1000, 1000, 1000, 16473, 2041, 1998, 26351, 8093, 10698, 11254, 9805, 2213, 16360, 2080, 13536, 1012, 3988, 2490, 2005, 12667, 6038, 2278, 1010, 3383, 16360, 2891, 6038, 2278, 2746, 2101, 1012, 9385, 2294, 1011, 2289, 1010, 2417, 604...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# AUTOGENERATED FILE FROM balenalib/generic-armv7ahf-debian:stretch-run # A few reasons for installing distribution-provided OpenJDK: # # 1. Oracle. Licensing prevents us from redistributing the official JDK. # # 2. Compiling OpenJDK also requires the JDK to be installed, and it gets # really hairy. # # For some sample build times, see Debian's buildd logs: # https://buildd.debian.org/status/logs.php?pkg=openjdk-8 RUN apt-get update && apt-get install -y --no-install-recommends \ bzip2 \ unzip \ xz-utils \ && rm -rf /var/lib/apt/lists/* # Default to UTF-8 file.encoding ENV LANG C.UTF-8 # add a simple script that can auto-detect the appropriate JAVA_HOME value # based on whether the JDK or only the JRE is installed RUN { \ echo '#!/bin/sh'; \ echo 'set -e'; \ echo; \ echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ } > /usr/local/bin/docker-java-home \ && chmod +x /usr/local/bin/docker-java-home # do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe RUN ln -svT "/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)" /docker-java-home ENV JAVA_HOME /docker-java-home RUN set -ex; \ \ # deal with slim variants not having man page directories (which causes "update-alternatives" to fail) if [ ! -d /usr/share/man/man1 ]; then \ mkdir -p /usr/share/man/man1; \ fi; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ openjdk-8-jdk-headless \ ; \ rm -rf /var/lib/apt/lists/*; \ \ # verify that "docker-java-home" returns what we expect [ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \ \ # update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ # ... and verify that it actually worked for one of the alternatives we care about update-alternatives --query java | grep -q 'Status: manual' CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Stretch \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nOpenJDK v8-jdk \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
nghiant2710/base-images
balena-base-images/openjdk/generic-armv7ahf/debian/stretch/8-jdk/run/Dockerfile
Dockerfile
apache-2.0
3,105
[ 30522, 1001, 8285, 6914, 16848, 5371, 2013, 28352, 8189, 29521, 1013, 12391, 1011, 2849, 2615, 2581, 4430, 2546, 1011, 2139, 15599, 1024, 7683, 1011, 2448, 1001, 1037, 2261, 4436, 2005, 23658, 4353, 1011, 3024, 2330, 3501, 2094, 2243, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//================================================================================================= /*! // \file blaze/math/views/subvector/SubvectorData.h // \brief Header file for the implementation of the SubvectorData class template // // Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. 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. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_ #define _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <blaze/util/MaybeUnused.h> #include <blaze/util/Types.h> namespace blaze { //================================================================================================= // // CLASS DEFINITION // //================================================================================================= //************************************************************************************************* /*!\brief Auxiliary class template for the data members of the Subvector class. // \ingroup subvector // // The auxiliary SubvectorData class template represents an abstraction of the data members of // the Subvector class template. The necessary set of data members is selected depending on the // number of compile time subvector arguments. */ template< size_t... CSAs > // Compile time subvector arguments class SubvectorData {}; //************************************************************************************************* //================================================================================================= // // CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME ARGUMENTS // //================================================================================================= //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Specialization of the SubvectorData class template for zero compile time subvector // arguments. // \ingroup subvector // // This specialization of SubvectorData adapts the class template to the requirements of zero // compile time subvector arguments. */ template<> class SubvectorData<> { public: //**Compile time flags************************************************************************** //! Compilation flag for compile time optimization. /*! The \a compileTimeArgs compilation flag indicates whether the view has been created by means of compile time arguments and whether these arguments can be queried at compile time. In that case, the \a compileTimeArgs compilation flag is set to \a true, otherwise it is set to \a false. */ static constexpr bool compileTimeArgs = false; //********************************************************************************************** //**Constructors******************************************************************************** /*!\name Constructors */ //@{ template< typename... RSAs > inline SubvectorData( size_t index, size_t n, RSAs... args ); SubvectorData( const SubvectorData& ) = default; //@} //********************************************************************************************** //**Destructor********************************************************************************** /*!\name Destructor */ //@{ ~SubvectorData() = default; //@} //********************************************************************************************** //**Assignment operators************************************************************************ /*!\name Assignment operators */ //@{ SubvectorData& operator=( const SubvectorData& ) = delete; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ inline size_t offset() const noexcept; inline size_t size () const noexcept; //@} //********************************************************************************************** private: //**Member variables**************************************************************************** /*!\name Member variables */ //@{ const size_t offset_; //!< The offset of the subvector within the vector. const size_t size_; //!< The size of the subvector. //@} //********************************************************************************************** }; /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief The constructor for SubvectorData. // // \param index The offset of the subvector within the given vector. // \param n The size of the subvector. // \param args The optional subvector arguments. */ template< typename... RSAs > // Optional subvector arguments inline SubvectorData<>::SubvectorData( size_t index, size_t n, RSAs... args ) : offset_( index ) // The offset of the subvector within the vector , size_ ( n ) // The size of the subvector { MAYBE_UNUSED( args... ); } /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Returns the offset of the subvector within the underlying vector. // // \return The offset of the subvector. */ inline size_t SubvectorData<>::offset() const noexcept { return offset_; } /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Returns the current size/dimension of the subvector. // // \return The size of the subvector. */ inline size_t SubvectorData<>::size() const noexcept { return size_; } /*! \endcond */ //************************************************************************************************* //================================================================================================= // // CLASS TEMPLATE SPECIALIZATION FOR TWO COMPILE TIME ARGUMENTS // //================================================================================================= //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Specialization of the SubvectorData class template for two compile time subvector // arguments. // \ingroup subvector // // This specialization of SubvectorData adapts the class template to the requirements of two // compile time arguments. */ template< size_t I // Index of the first element , size_t N > // Number of elements class SubvectorData<I,N> { public: //**Compile time flags************************************************************************** //! Compilation flag for compile time optimization. /*! The \a compileTimeArgs compilation flag indicates whether the view has been created by means of compile time arguments and whether these arguments can be queried at compile time. In that case, the \a compileTimeArgs compilation flag is set to \a true, otherwise it is set to \a false. */ static constexpr bool compileTimeArgs = true; //********************************************************************************************** //**Constructors******************************************************************************** /*!\name Constructors */ //@{ template< typename... RSAs > explicit inline SubvectorData( RSAs... args ); SubvectorData( const SubvectorData& ) = default; //@} //********************************************************************************************** //**Destructor********************************************************************************** /*!\name Destructor */ //@{ ~SubvectorData() = default; //@} //********************************************************************************************** //**Assignment operators************************************************************************ /*!\name Assignment operators */ //@{ SubvectorData& operator=( const SubvectorData& ) = delete; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ static constexpr size_t offset() noexcept; static constexpr size_t size () noexcept; //@} //********************************************************************************************** }; /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief The constructor for SubvectorData. // // \param args The optional subvector arguments. */ template< size_t I // Index of the first element , size_t N > // Number of elements template< typename... RSAs > // Optional subvector arguments inline SubvectorData<I,N>::SubvectorData( RSAs... args ) { MAYBE_UNUSED( args... ); } /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Returns the offset of the subvector within the underlying vector. // // \return The offset of the subvector. */ template< size_t I // Index of the first element , size_t N > // Number of elements constexpr size_t SubvectorData<I,N>::offset() noexcept { return I; } /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Returns the current size/dimension of the subvector. // // \return The size of the subvector. */ template< size_t I // Index of the first element , size_t N > // Number of elements constexpr size_t SubvectorData<I,N>::size() noexcept { return N; } /*! \endcond */ //************************************************************************************************* } // namespace blaze #endif
camillescott/boink
include/goetia/sketches/sketch/vec/blaze/blaze/math/views/subvector/SubvectorData.h
C
mit
12,696
[ 30522, 1013, 1013, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @file * Provides JavaScript additions to the managed file field type. * * This file provides progress bar support (if available), popup windows for * file previews, and disabling of other file fields during Ajax uploads (which * prevents separate file fields from accidentally uploading files). */ (function ($, Drupal) { "use strict"; /** * Attach behaviors to managed file element upload fields. */ Drupal.behaviors.fileValidateAutoAttach = { attach: function (context, settings) { var $context = $(context); var elements; function initFileValidation(selector) { $context.find(selector) .once('fileValidate') .on('change.fileValidate', { extensions: elements[selector] }, Drupal.file.validateExtension); } if (settings.file && settings.file.elements) { elements = settings.file.elements; Object.keys(elements).forEach(initFileValidation); } }, detach: function (context, settings, trigger) { var $context = $(context); var elements; function removeFileValidation(selector) { $context.find(selector) .removeOnce('fileValidate') .off('change.fileValidate', Drupal.file.validateExtension); } if (trigger === 'unload' && settings.file && settings.file.elements) { elements = settings.file.elements; Object.keys(elements).forEach(removeFileValidation); } } }; /** * Attach behaviors to managed file element upload fields. */ Drupal.behaviors.fileAutoUpload = { attach: function (context) { $(context).find('input[type="file"]').once('auto-file-upload').on('change.autoFileUpload', Drupal.file.triggerUploadButton); }, detach: function (context, setting, trigger) { if (trigger === 'unload') { $(context).find('input[type="file"]').removeOnce('auto-file-upload').off('.autoFileUpload'); } } }; /** * Attach behaviors to the file upload and remove buttons. */ Drupal.behaviors.fileButtons = { attach: function (context) { var $context = $(context); $context.find('.form-submit').on('mousedown', Drupal.file.disableFields); $context.find('.form-managed-file .form-submit').on('mousedown', Drupal.file.progressBar); }, detach: function (context) { var $context = $(context); $context.find('.form-submit').off('mousedown', Drupal.file.disableFields); $context.find('.form-managed-file .form-submit').off('mousedown', Drupal.file.progressBar); } }; /** * Attach behaviors to links within managed file elements. */ Drupal.behaviors.filePreviewLinks = { attach: function (context) { $(context).find('div.form-managed-file .file a, .file-widget .file a').on('click', Drupal.file.openInNewWindow); }, detach: function (context) { $(context).find('div.form-managed-file .file a, .file-widget .file a').off('click', Drupal.file.openInNewWindow); } }; /** * File upload utility functions. */ Drupal.file = Drupal.file || { /** * Client-side file input validation of file extensions. */ validateExtension: function (event) { event.preventDefault(); // Remove any previous errors. $('.file-upload-js-error').remove(); // Add client side validation for the input[type=file]. var extensionPattern = event.data.extensions.replace(/,\s*/g, '|'); if (extensionPattern.length > 1 && this.value.length > 0) { var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi'); if (!acceptableMatch.test(this.value)) { var error = Drupal.t("The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.", { // According to the specifications of HTML5, a file upload control // should not reveal the real local path to the file that a user // has selected. Some web browsers implement this restriction by // replacing the local path with "C:\fakepath\", which can cause // confusion by leaving the user thinking perhaps Drupal could not // find the file because it messed up the file path. To avoid this // confusion, therefore, we strip out the bogus fakepath string. '%filename': this.value.replace('C:\\fakepath\\', ''), '%extensions': extensionPattern.replace(/\|/g, ', ') }); $(this).closest('div.form-managed-file').prepend('<div class="messages messages--error file-upload-js-error" aria-live="polite">' + error + '</div>'); this.value = ''; // Cancel all other change event handlers. event.stopImmediatePropagation(); } } }, /** * Trigger the upload_button mouse event to auto-upload as a managed file. */ triggerUploadButton: function (event) { $(event.target).closest('.form-managed-file').find('.form-submit').trigger('mousedown'); }, /** * Prevent file uploads when using buttons not intended to upload. */ disableFields: function (event) { var $clickedButton = $(this); // Only disable upload fields for Ajax buttons. if (!$clickedButton.hasClass('ajax-processed')) { return; } // Check if we're working with an "Upload" button. var $enabledFields = []; if ($clickedButton.closest('div.form-managed-file').length > 0) { $enabledFields = $clickedButton.closest('div.form-managed-file').find('input.form-file'); } // Temporarily disable upload fields other than the one we're currently // working with. Filter out fields that are already disabled so that they // do not get enabled when we re-enable these fields at the end of behavior // processing. Re-enable in a setTimeout set to a relatively short amount // of time (1 second). All the other mousedown handlers (like Drupal's Ajax // behaviors) are excuted before any timeout functions are called, so we // don't have to worry about the fields being re-enabled too soon. // @todo If the previous sentence is true, why not set the timeout to 0? var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled'); $fieldsToTemporarilyDisable.prop('disabled', true); setTimeout(function () { $fieldsToTemporarilyDisable.prop('disabled', false); }, 1000); }, /** * Add progress bar support if possible. */ progressBar: function (event) { var $clickedButton = $(this); var $progressId = $clickedButton.closest('div.form-managed-file').find('input.file-progress'); if ($progressId.length) { var originalName = $progressId.attr('name'); // Replace the name with the required identifier. $progressId.attr('name', originalName.match(/APC_UPLOAD_PROGRESS|UPLOAD_IDENTIFIER/)[0]); // Restore the original name after the upload begins. setTimeout(function () { $progressId.attr('name', originalName); }, 1000); } // Show the progress bar if the upload takes longer than half a second. setTimeout(function () { $clickedButton.closest('div.form-managed-file').find('div.ajax-progress-bar').slideDown(); }, 500); }, /** * Open links to files within forms in a new window. */ openInNewWindow: function (event) { event.preventDefault(); $(this).attr('target', '_blank'); window.open(this.href, 'filePreview', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=500,height=550'); } }; })(jQuery, Drupal);
drupal-ukraine/csua_d8
drupal/core/modules/file/file.js
JavaScript
gpl-2.0
7,766
[ 30522, 1013, 1008, 1008, 1008, 1030, 5371, 1008, 3640, 9262, 22483, 13134, 2000, 1996, 3266, 5371, 2492, 2828, 1012, 1008, 30524, 3769, 6279, 3645, 2005, 1008, 5371, 19236, 2015, 1010, 1998, 4487, 3736, 9709, 1997, 2060, 5371, 4249, 2076, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using UnityEngine; using System; public struct SpriteInfo { public string SpriteSheetName; public Vector2 SpritePosition; public Vector3 SpriteSize; }
NickABoen/Dungeon-Explorer
Dungeon Explorer/Assets/Scripts/Structures/SpriteInfo.cs
C#
mit
156
[ 30522, 2478, 8499, 13159, 3170, 1025, 2478, 2291, 1025, 2270, 2358, 6820, 6593, 11867, 17625, 2378, 14876, 1063, 2270, 5164, 11867, 28884, 21030, 2102, 18442, 1025, 2270, 9207, 2475, 11867, 17625, 26994, 1025, 2270, 9207, 2509, 11867, 28884, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //<script> $(document).ready(function() { var curSource = "/alliance/dutylist/calendarsearch"; $('#dutylsitCalendar').fullCalendar({ contentHeight: 600, aspectRatio: 8, handleWindowResize: true, // Изменять размер календаря пропорционально изменению окна браузера editable: false, // Редактирование запрещено, т.к. источник событий json-feed из БД isRTL: false, // Отображать календарь в обратном порядке (true/false) // hiddenDays: [], // Скрыть дни недели [перечислить номера дней недели ч-з запятую] weekMode: 'liquid', weekNumbers: true, weekends: true, defaultView: 'month', selectable: false, editable: false, lang: 'ru', more: 3, firstday: 1, theme:true, buttonIcons: { prev: 'left-single-arrow', next: 'right-single-arrow', prevYear: 'left-double-arrow', nextYear: 'right-double-arrow' }, themeButtonsIcons: { prev: 'circle-triangle-w', next: 'circle-triangle-e', prevYear: 'seek-prev', nextYear: 'seek-next' }, // eventLimitClick // "popover" — показывает всплывающую панель со списком всех событий (по умолчанию) // "week" — переходит на вид недели, оглашенный в параметре header // "day" — переходит на вид дня, оглашенный в параметре header // название вида — текстовое название вида из списка доступных видов // функция — callback-функция для выполнения произвольного кода eventLimit: true, eventLimitClick: 'popover', views: { agenda: { eventLimit: 15, } }, // hiddenDays: [ 1, 2, 3, 4, 5 ], businessHours: { start: '9:00', // время начала end: '21:00', // время окончания dow: [ 6, 7 ] // days of week. an array of zero-based day of week integers (0=Sunday) дни недели, начиная с 0 (0-ВСК) }, // eventSources: [curSource[0],curSource[1]], eventSources: [ { url: curSource, cache: true, error: function() { alert("Ошибка получения источника событий"); }, }, ], header: { left: 'prev,today,next', center: 'title,filter', right: 'month,agendaWeek,agendaDay', }, eventRender: function eventRender(event, eventElement, element, view) { if (event.imageurl) { eventElement.find("div.fc-content").prepend("<div class='text-center' style='padding: 1px;'><img class='img-rounded' src='" + event.imageurl +"' width='50' height='50'></div>"); } return ['all', event.title].indexOf($('#employee_filter').val()) >= 0; }, eventClick: function(event, jsEvent, view) { $('#modalTitle').html(moment(event.start).format('DD/MM/YYYY') + ' - Оперативный дежурный на указанную дату:'); $('#modalBody').html("<div class='text-center'> <img class='img-rounded text-center' src='" + event.imageurl + "' width='50' height='50'>" + ' <b>' + event.title + '</b></div>'); $('#eventUrl').attr('href',event.url); $('#fullCalModal').modal(); }, dayClick: function(date, jsEvent, view) { var d = new Date(date); if (confirm("Перейти к выбранной дате - " + d.toLocaleDateString('en-GB') + " ?")) { $('#dutylsitCalendar').fullCalendar('changeView', 'agendaDay'); $('#dutylsitCalendar').fullCalendar('gotoDate', d); } // alert('Clicked on: ' + date.format()); // alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); // alert('Current view: ' + view.name); }, // Цвет дня в календаре: // dayRender : function(date, cell) { // var idx = null; // var today = new Date().toDateString(); // var ddate = date.toDate().toDateString(); // if (ddate == today) { // idx = cell.index() + 1; // cell.css("background-color", "azure"); // $( // ".fc-time-grid .fc-bg table tbody tr td:nth-child(" // + idx + ")").css( // "background-color", "azure"); // } // }, dayRender: function (date, cell) { var today = new Date().toDateString(); var end = new Date(); end.setDate(today+7); if (date.toDate().toDateString() === today) { cell.css("background-color", "#5cb85c"); } if(date.toDate().toDateString() > today && date.toDate().toDateString() <= end) { cell.css("background-color", "yellow"); } }, }); }); // DatePicker $('#dutylistDatepicker').datepicker({ dateFormat: 'yy-mm-dd', inline: true, showButtonPanel: true, changeYear: true, changeMonth: true, yearRange: '-2:+2', altField: '#dutylistDatepicker', altFormat: 'dd/mm/yy', beforeShow: function() { setTimeout(function(){ $('.ui-datepicker').css('z-index', 99999999999999); }, 0); }, onSelect: function(dateText, inst) { var d = new Date(dateText); if (confirm("Перейти к выбранной дате - " + d.toLocaleDateString('en-GB') + " ?")) { $('#dutylsitCalendar').fullCalendar('changeView', 'agendaDay'); $('#dutylsitCalendar').fullCalendar('gotoDate', d); } else { // alert(d.toLocaleDateString()); // $('#datepicker').datepicker('setDate', null); // $('#datepicker').val('').datepicker("refresh"); } } }); // Опции селектора $('#employee_filter').on('change',function(){ $('#dutylsitCalendar').fullCalendar('rerenderEvents'); }); function showOrHide() { cb = document.getElementById('checkbox'); if (cb.checked) hideDays(); else showDays(); } var hideDays = function() { $('#dutylsitCalendar').fullCalendar('option', { hiddenDays: [1, 2, 3, 4, 5], }); } var showDays = function() { $('#dutylsitCalendar').fullCalendar('option', { hiddenDays: [], }); } function hideSideBar() { document.getElementById("sidebar").style.display = "none"; } // $('#filterStatus').multiselect({ // numberDisplayed: 2, // enableFiltering: false, // includeSelectAllOption: true, // nonSelectedText: 'Статус', // });
m-ishchenko/AllianceCG
web/js/modules/alliance/dutylist/calendar.js
JavaScript
bsd-3-clause
8,663
[ 30522, 1013, 1008, 1008, 2000, 2689, 2023, 6105, 20346, 1010, 5454, 6105, 20346, 2015, 1999, 2622, 5144, 1012, 1008, 2000, 2689, 2023, 23561, 5371, 1010, 5454, 5906, 1064, 23561, 2015, 1008, 1998, 2330, 1996, 23561, 1999, 1996, 3559, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Copyright 2015 Mirantis, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from threading import Timer from oslo_log import log as logging from networking_vsphere._i18n import _LI from networking_vsphere.utils.rpc_translator import update_rules from neutron.agent import securitygroups_rpc LOG = logging.getLogger(__name__) class DVSSecurityGroupRpc(securitygroups_rpc.SecurityGroupAgentRpc): def __init__(self, context, plugin_rpc, defer_refresh_firewall=False): self.context = context self.plugin_rpc = plugin_rpc self._devices_to_update = set() self.init_firewall(defer_refresh_firewall) def prepare_devices_filter(self, device_ids): if not device_ids: return LOG.info(_LI("Preparing filters for devices %s"), device_ids) if self.use_enhanced_rpc: devices_info = self.plugin_rpc.security_group_info_for_devices( self.context, list(device_ids)) devices = update_rules(devices_info) else: devices = self.plugin_rpc.security_group_rules_for_devices( self.context, list(device_ids)) self.firewall.prepare_port_filter(devices.values()) def remove_devices_filter(self, device_ids): if not device_ids: return LOG.info(_LI("Remove device filter for %r"), device_ids) self.firewall.remove_port_filter(device_ids) def _refresh_ports(self): device_ids = self._devices_to_update self._devices_to_update = self._devices_to_update - device_ids if not device_ids: return if self.use_enhanced_rpc: devices_info = self.plugin_rpc.security_group_info_for_devices( self.context, device_ids) devices = update_rules(devices_info) else: devices = self.plugin_rpc.security_group_rules_for_devices( self.context, device_ids) self.firewall.update_port_filter(devices.values()) def refresh_firewall(self, device_ids=None): LOG.info(_LI("Refresh firewall rules")) self._devices_to_update |= device_ids if device_ids: Timer(2, self._refresh_ports).start()
VTabolin/networking-vsphere
networking_vsphere/agent/firewalls/dvs_securitygroup_rpc.py
Python
apache-2.0
2,782
[ 30522, 1001, 9385, 2325, 18062, 16778, 2015, 1010, 4297, 1012, 1001, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 1001, 2025, 2224, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "tool_move.hpp" #include "document/idocument_board.hpp" #include "board/board.hpp" #include "document/idocument_package.hpp" #include "pool/package.hpp" #include "document/idocument_padstack.hpp" #include "pool/padstack.hpp" #include "document/idocument_schematic.hpp" #include "schematic/schematic.hpp" #include "document/idocument_symbol.hpp" #include "pool/symbol.hpp" #include "imp/imp_interface.hpp" #include "util/accumulator.hpp" #include "util/util.hpp" #include <iostream> #include "core/tool_id.hpp" namespace horizon { ToolMove::ToolMove(IDocument *c, ToolID tid) : ToolBase(c, tid), ToolHelperMove(c, tid), ToolHelperMerge(c, tid) { } void ToolMove::expand_selection() { std::set<SelectableRef> pkgs_fixed; std::set<SelectableRef> new_sel; for (const auto &it : selection) { switch (it.type) { case ObjectType::LINE: { Line *line = doc.r->get_line(it.uuid); new_sel.emplace(line->from.uuid, ObjectType::JUNCTION); new_sel.emplace(line->to.uuid, ObjectType::JUNCTION); } break; case ObjectType::POLYGON_EDGE: { Polygon *poly = doc.r->get_polygon(it.uuid); auto vs = poly->get_vertices_for_edge(it.vertex); new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, vs.first); new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, vs.second); } break; case ObjectType::NET_LABEL: { auto &la = doc.c->get_sheet()->net_labels.at(it.uuid); new_sel.emplace(la.junction->uuid, ObjectType::JUNCTION); } break; case ObjectType::BUS_LABEL: { auto &la = doc.c->get_sheet()->bus_labels.at(it.uuid); new_sel.emplace(la.junction->uuid, ObjectType::JUNCTION); } break; case ObjectType::POWER_SYMBOL: { auto &ps = doc.c->get_sheet()->power_symbols.at(it.uuid); new_sel.emplace(ps.junction->uuid, ObjectType::JUNCTION); } break; case ObjectType::BUS_RIPPER: { auto &rip = doc.c->get_sheet()->bus_rippers.at(it.uuid); new_sel.emplace(rip.junction->uuid, ObjectType::JUNCTION); } break; case ObjectType::LINE_NET: { auto line = &doc.c->get_sheet()->net_lines.at(it.uuid); for (auto &it_ft : {line->from, line->to}) { if (it_ft.is_junc()) { new_sel.emplace(it_ft.junc.uuid, ObjectType::JUNCTION); } } } break; case ObjectType::TRACK: { auto track = &doc.b->get_board()->tracks.at(it.uuid); for (auto &it_ft : {track->from, track->to}) { if (it_ft.is_junc()) { new_sel.emplace(it_ft.junc.uuid, ObjectType::JUNCTION); } } } break; case ObjectType::VIA: { auto via = &doc.b->get_board()->vias.at(it.uuid); new_sel.emplace(via->junction->uuid, ObjectType::JUNCTION); } break; case ObjectType::POLYGON: { auto poly = doc.r->get_polygon(it.uuid); int i = 0; for (const auto &itv : poly->vertices) { (void)sizeof itv; new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, i); i++; } } break; case ObjectType::ARC: { Arc *arc = doc.r->get_arc(it.uuid); new_sel.emplace(arc->from.uuid, ObjectType::JUNCTION); new_sel.emplace(arc->to.uuid, ObjectType::JUNCTION); new_sel.emplace(arc->center.uuid, ObjectType::JUNCTION); } break; case ObjectType::SCHEMATIC_SYMBOL: { auto sym = doc.c->get_schematic_symbol(it.uuid); for (const auto &itt : sym->texts) { new_sel.emplace(itt->uuid, ObjectType::TEXT); } } break; case ObjectType::BOARD_PACKAGE: { BoardPackage *pkg = &doc.b->get_board()->packages.at(it.uuid); if (pkg->fixed) { pkgs_fixed.insert(it); } else { for (const auto &itt : pkg->texts) { new_sel.emplace(itt->uuid, ObjectType::TEXT); } } } break; default:; } } selection.insert(new_sel.begin(), new_sel.end()); if (pkgs_fixed.size() && imp) imp->tool_bar_flash("can't move fixed package"); for (auto it = selection.begin(); it != selection.end();) { if (pkgs_fixed.count(*it)) it = selection.erase(it); else ++it; } } Coordi ToolMove::get_selection_center() { Accumulator<Coordi> accu; std::set<SelectableRef> items_ignore; for (const auto &it : selection) { if (it.type == ObjectType::BOARD_PACKAGE) { const auto &pkg = doc.b->get_board()->packages.at(it.uuid); for (auto &it_txt : pkg.texts) { items_ignore.emplace(it_txt->uuid, ObjectType::TEXT); } } else if (it.type == ObjectType::SCHEMATIC_SYMBOL) { const auto &sym = doc.c->get_sheet()->symbols.at(it.uuid); for (auto &it_txt : sym.texts) { items_ignore.emplace(it_txt->uuid, ObjectType::TEXT); } } } for (const auto &it : selection) { if (items_ignore.count(it)) continue; switch (it.type) { case ObjectType::JUNCTION: accu.accumulate(doc.r->get_junction(it.uuid)->position); break; case ObjectType::HOLE: accu.accumulate(doc.r->get_hole(it.uuid)->placement.shift); break; case ObjectType::BOARD_HOLE: accu.accumulate(doc.b->get_board()->holes.at(it.uuid).placement.shift); break; case ObjectType::SYMBOL_PIN: accu.accumulate(doc.y->get_symbol_pin(it.uuid).position); break; case ObjectType::SCHEMATIC_SYMBOL: accu.accumulate(doc.c->get_schematic_symbol(it.uuid)->placement.shift); break; case ObjectType::BOARD_PACKAGE: accu.accumulate(doc.b->get_board()->packages.at(it.uuid).placement.shift); break; case ObjectType::PAD: accu.accumulate(doc.k->get_package().pads.at(it.uuid).placement.shift); break; case ObjectType::TEXT: accu.accumulate(doc.r->get_text(it.uuid)->placement.shift); break; case ObjectType::POLYGON_VERTEX: accu.accumulate(doc.r->get_polygon(it.uuid)->vertices.at(it.vertex).position); break; case ObjectType::DIMENSION: if (it.vertex < 2) { auto dim = doc.r->get_dimension(it.uuid); accu.accumulate(it.vertex == 0 ? dim->p0 : dim->p1); } break; case ObjectType::POLYGON_ARC_CENTER: accu.accumulate(doc.r->get_polygon(it.uuid)->vertices.at(it.vertex).arc_center); break; case ObjectType::SHAPE: accu.accumulate(doc.a->get_padstack().shapes.at(it.uuid).placement.shift); break; case ObjectType::BOARD_PANEL: accu.accumulate(doc.b->get_board()->board_panels.at(it.uuid).placement.shift); break; case ObjectType::PICTURE: accu.accumulate(doc.r->get_picture(it.uuid)->placement.shift); break; case ObjectType::BOARD_DECAL: accu.accumulate(doc.b->get_board()->decals.at(it.uuid).placement.shift); break; default:; } } if (doc.c || doc.y) return (accu.get() / 1.25_mm) * 1.25_mm; else return accu.get(); } ToolResponse ToolMove::begin(const ToolArgs &args) { std::cout << "tool move\n"; move_init(args.coords); Coordi selection_center; if (tool_id == ToolID::ROTATE_CURSOR || tool_id == ToolID::MIRROR_CURSOR) selection_center = args.coords; else selection_center = get_selection_center(); collect_nets(); if (tool_id == ToolID::ROTATE || tool_id == ToolID::MIRROR_X || tool_id == ToolID::MIRROR_Y || tool_id == ToolID::ROTATE_CURSOR || tool_id == ToolID::MIRROR_CURSOR) { move_mirror_or_rotate(selection_center, tool_id == ToolID::ROTATE || tool_id == ToolID::ROTATE_CURSOR); if (tool_id == ToolID::MIRROR_Y) { move_mirror_or_rotate(selection_center, true); move_mirror_or_rotate(selection_center, true); } finish(); return ToolResponse::commit(); } if (tool_id == ToolID::MOVE_EXACTLY) { if (auto r = imp->dialogs.ask_datum_coord("Move exactly")) { move_do(*r); finish(); return ToolResponse::commit(); } else { return ToolResponse::end(); } } imp->tool_bar_set_actions({ {InToolActionID::LMB}, {InToolActionID::RMB}, {InToolActionID::ROTATE, InToolActionID::MIRROR, "rotate/mirror"}, {InToolActionID::ROTATE_CURSOR, InToolActionID::MIRROR_CURSOR, "rotate/mirror around cursor"}, {InToolActionID::RESTRICT}, }); update_tip(); for (const auto &it : selection) { if (it.type == ObjectType::POLYGON_VERTEX || it.type == ObjectType::POLYGON_EDGE) { auto poly = doc.r->get_polygon(it.uuid); if (auto plane = dynamic_cast<Plane *>(poly->usage.ptr)) { planes.insert(plane); } } } for (auto plane : planes) { plane->fragments.clear(); plane->revision++; } InToolActionID action = InToolActionID::NONE; switch (tool_id) { case ToolID::MOVE_KEY_FINE_UP: action = InToolActionID::MOVE_UP_FINE; break; case ToolID::MOVE_KEY_UP: action = InToolActionID::MOVE_UP; break; case ToolID::MOVE_KEY_FINE_DOWN: action = InToolActionID::MOVE_DOWN_FINE; break; case ToolID::MOVE_KEY_DOWN: action = InToolActionID::MOVE_DOWN; break; case ToolID::MOVE_KEY_FINE_LEFT: action = InToolActionID::MOVE_LEFT_FINE; break; case ToolID::MOVE_KEY_LEFT: action = InToolActionID::MOVE_LEFT; break; case ToolID::MOVE_KEY_FINE_RIGHT: action = InToolActionID::MOVE_RIGHT_FINE; break; case ToolID::MOVE_KEY_RIGHT: action = InToolActionID::MOVE_RIGHT; break; default:; } if (action != InToolActionID::NONE) { is_key = true; ToolArgs args2; args2.type = ToolEventType::ACTION; args2.action = action; update(args2); } if (tool_id == ToolID::MOVE_KEY) is_key = true; imp->tool_bar_set_tool_name("Move"); return ToolResponse(); } void ToolMove::collect_nets() { for (const auto &it : selection) { switch (it.type) { case ObjectType::BOARD_PACKAGE: { BoardPackage *pkg = &doc.b->get_board()->packages.at(it.uuid); for (const auto &itt : pkg->package.pads) { if (itt.second.net) nets.insert(itt.second.net->uuid); } } break; case ObjectType::JUNCTION: { auto ju = doc.r->get_junction(it.uuid); if (ju->net) nets.insert(ju->net->uuid); } break; default:; } } } bool ToolMove::can_begin() { expand_selection(); return selection.size() > 0; } void ToolMove::update_tip() { auto delta = get_delta(); std::string s = coord_to_string(delta + key_delta, true) + " "; if (!is_key) { s += restrict_mode_to_string(); } imp->tool_bar_set_tip(s); } void ToolMove::do_move(const Coordi &d) { move_do_cursor(d); if (doc.b && update_airwires && nets.size()) { doc.b->get_board()->update_airwires(true, nets); } update_tip(); } void ToolMove::finish() { for (const auto &it : selection) { if (it.type == ObjectType::SCHEMATIC_SYMBOL) { auto sym = doc.c->get_schematic_symbol(it.uuid); doc.c->get_schematic()->autoconnect_symbol(doc.c->get_sheet(), sym); if (sym->component->connections.size() == 0) { doc.c->get_schematic()->place_bipole_on_line(doc.c->get_sheet(), sym); } } } if (doc.c) { merge_selected_junctions(); } if (doc.b) { auto brd = doc.b->get_board(); brd->expand_flags = static_cast<Board::ExpandFlags>(Board::EXPAND_AIRWIRES); brd->airwires_expand = nets; for (auto plane : planes) { brd->update_plane(plane); } } } ToolResponse ToolMove::update(const ToolArgs &args) { if (args.type == ToolEventType::MOVE) { if (!is_key) do_move(args.coords); return ToolResponse(); } else if (args.type == ToolEventType::ACTION) { if (any_of(args.action, {InToolActionID::LMB, InToolActionID::COMMIT}) || (is_transient && args.action == InToolActionID::LMB_RELEASE)) { finish(); return ToolResponse::commit(); } else if (any_of(args.action, {InToolActionID::RMB, InToolActionID::CANCEL})) { return ToolResponse::revert(); } else if (args.action == InToolActionID::RESTRICT) { cycle_restrict_mode(); do_move(args.coords); } else if (any_of(args.action, {InToolActionID::ROTATE, InToolActionID::MIRROR})) { bool rotate = args.action == InToolActionID::ROTATE; const auto selection_center = get_selection_center(); move_mirror_or_rotate(selection_center, rotate); } else if (any_of(args.action, {InToolActionID::ROTATE_CURSOR, InToolActionID::MIRROR_CURSOR})) { bool rotate = args.action == InToolActionID::ROTATE_CURSOR; move_mirror_or_rotate(args.coords, rotate); } else { const auto [dir, fine] = dir_from_action(args.action); if (dir.x || dir.y) { auto sp = imp->get_grid_spacing(); if (fine) sp = sp / 10; key_delta += dir * sp; move_do(dir * sp); update_tip(); } } } return ToolResponse(); } } // namespace horizon
carrotIndustries/horizon
src/core/tools/tool_move.cpp
C++
gpl-3.0
14,465
[ 30522, 1001, 2421, 1000, 6994, 1035, 2693, 1012, 6522, 2361, 1000, 1001, 2421, 1000, 6254, 1013, 8909, 10085, 27417, 2102, 1035, 2604, 1012, 6522, 2361, 1000, 1001, 2421, 1000, 2604, 1013, 2604, 1012, 6522, 2361, 1000, 1001, 2421, 1000, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** Author: Sharmin Akter **/ /** Created at: 4/30/2012 12:07:26 AM **/ #include<stdio.h> int main() { int i,j,k,p,m,n,t; while(scanf("%d",&t)==1) { for(i=1;i<=t;i++) { scanf("%d",&p); if(p==2||p==3||p==5||p==7||p==13||p==17) printf("Yes\n"); else printf("No\n"); getchar(); } } return 0; }
sajinia/UVa-Online-Judge
Volume-11/1180-(2 numbery).cpp
C++
gpl-3.0
437
[ 30522, 1013, 1008, 1008, 3166, 1024, 21146, 27512, 17712, 3334, 1008, 1008, 1013, 1013, 1008, 1008, 2580, 2012, 1024, 1018, 1013, 2382, 1013, 2262, 2260, 1024, 5718, 1024, 2656, 2572, 1008, 1008, 1013, 1001, 2421, 1026, 2358, 20617, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.sling.caconfig.impl.override; import static org.junit.Assert.assertTrue; import java.util.Collection; import org.apache.sling.testing.mock.sling.junit.SlingContext; import org.junit.Rule; import org.junit.Test; public class OsgiConfigurationOverrideProviderTest { @Rule public SlingContext context = new SlingContext(); @Test public void testEnabled() { OsgiConfigurationOverrideProvider provider = context.registerInjectActivateService( new OsgiConfigurationOverrideProvider(), "enabled", true, "overrides", new String[] { "test/param1=value1", "[/content]test/param2=value2" }); Collection<String> overrides = provider.getOverrideStrings(); assertTrue(overrides.contains("test/param1=value1")); assertTrue(overrides.contains("[/content]test/param2=value2")); } @Test public void testDisabled() { OsgiConfigurationOverrideProvider provider = context.registerInjectActivateService( new OsgiConfigurationOverrideProvider(), "enabled", false, "overrides", new String[] { "test/param1=value1", "[/content]test/param2=value2" }); Collection<String> overrides = provider.getOverrideStrings(); assertTrue(overrides.isEmpty()); } }
roele/sling
bundles/extensions/caconfig/impl/src/test/java/org/apache/sling/caconfig/impl/override/OsgiConfigurationOverrideProviderTest.java
Java
apache-2.0
2,278
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1008, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1008, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1008, 4953, 9385, 6095, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<html> <head> <title> TEAMMATES - Instructor </title> <link href="/favicon.png" rel="shortcut icon"> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <link href="https://unpkg.com/bootstrap@3.1.1/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="https://unpkg.com/bootstrap@3.1.1/dist/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"> <link href="/stylesheets/teammatesCommon.css" rel="stylesheet" type="text/css"> <link href="/stylesheets/datepicker.css" media="screen" rel="stylesheet" type="text/css"> <link href="https://unpkg.com/tinymce@4.5.1/skins/lightgray/skin.min.css" id="u0" rel="stylesheet" type="text/css"> <link href="https://unpkg.com/tinymce@4.5.1/skins/lightgray/content.inline.min.css" rel="stylesheet"> </head> <body spellcheck="false"> <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button class="navbar-toggle" data-target="#contentLinks" data-toggle="collapse" type="button"> <span class="sr-only"> Toggle navigation </span> <span class="icon-bar"> </span> <span class="icon-bar"> </span> <span class="icon-bar"> </span> </button> <a class="navbar-brand" href="/index.jsp"> TEAMMATES </a> </div> <div class="collapse navbar-collapse" id="contentLinks"> <ul class="nav navbar-nav"> <li> <a class="nav home" data-link="instructorHome" href="/page/instructorHomePage?user=CFeedbackUiT.nocourses"> Home </a> </li> <li> <a class="nav courses" data-link="instructorCourse" href="/page/instructorCoursesPage?user=CFeedbackUiT.nocourses"> Courses </a> </li> <li class="active"> <a class="nav evaluations" data-link="instructorEval" href="/page/instructorFeedbacksPage?user=CFeedbackUiT.nocourses"> Sessions </a> </li> <li> <a class="nav students" data-link="instructorStudent" href="/page/instructorStudentListPage?user=CFeedbackUiT.nocourses"> Students </a> </li> <li> <a class="nav comments" data-link="instructorComments" href="/page/instructorCommentsPage?user=CFeedbackUiT.nocourses"> Comments </a> </li> <li> <a class="nav search" data-link="instructorSearch" href="/page/instructorSearchPage?user=CFeedbackUiT.nocourses"> Search </a> </li> <li> <a class="nav help" href="/instructorHelp.jsp" rel="noopener noreferrer" target="_blank"> Help </a> </li> </ul> <ul class="nav navbar-nav pull-right"> <li> <a class="nav logout" href="/logout" id="btnLogout"> Logout ( <span class="text-info tool-tip-decorate" data-original-title="CFeedbackUiT.nocourses" data-placement="bottom" data-toggle="tooltip" title=""> CFeedbackUiT.nocourses </span> ) </a> </li> </ul> </div> </div> </div> <div class="container" id="mainContent"> <div id="topOfPage"> </div> <h1> Add New Feedback Session </h1> <br> <div class="well well-plain"> <form action="/page/instructorFeedbackAdd" class="form-group" id="form_feedbacksession" method="post"> <div class="row"> <h4 class="label-control col-md-2 text-md"> Create new </h4> <div class="col-md-5"> <div class="col-xs-10 tablet-no-padding" data-original-title="Select a session type here." data-placement="top" data-toggle="tooltip" title=""> <select class="form-control" id="fstype" name="fstype"> <option value="STANDARD"> Session with your own questions </option> <option selected="" value="TEAMEVALUATION"> Team peer evaluation session </option> </select> </div> <div class="col-xs-1"> <h5> <a href="/instructorHelp.jsp#fbSetupSession" rel="noopener noreferrer" target="_blank"> <span class="glyphicon glyphicon-info-sign"> </span> </a> </h5> </div> </div> <h4 class="label-control col-xs-12 col-md-1 text-md"> Or: </h4> <div class="col-xs-12 col-md-3"> <a class="btn btn-info" id="button_copy" style="vertical-align:middle;"> Copy from previous feedback sessions </a> </div> </div> <br> <div class="panel panel-primary"> <div class="panel-body"> <div class="row"> <div class="col-sm-12 col-md-6" data-original-title="Please select the course for which the feedback session is to be created." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group has-error"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="courseid"> Course ID </label> </h5> <div class="col-sm-10 col-md-8"> <select class="form-control text-color-red" id="courseid" name="courseid"> <option selected="" value=""> No un-archived courses </option> </select> </div> </div> </div> <div class="col-sm-12 col-md-6 tablet-no-mobile-margin-top-20px" data-original-title="You should not need to change this as your timezone is auto-detected. <br><br>However, note that daylight saving is not taken into account i.e. if you are in UTC -8:00 and there is daylight saving, you should choose UTC -7:00 and its corresponding timings." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="timezone"> Timezone </label> </h5> <div class="col-sm-10 col-md-8"> <select class="form-control" id="timezone" name="timezone"> <option value="-12"> (UTC -12:00) Baker Island, Howland Island </option> <option value="-11"> (UTC -11:00) American Samoa, Niue </option> <option value="-10"> (UTC -10:00) Hawaii, Cook Islands </option> <option value="-9.5"> (UTC -09:30) Marquesas Islands </option> <option value="-9"> (UTC -09:00) Gambier Islands, Alaska </option> <option value="-8"> (UTC -08:00) Los Angeles, Vancouver, Tijuana </option> <option value="-7"> (UTC -07:00) Phoenix, Calgary, Ciudad Juárez </option> <option value="-6"> (UTC -06:00) Chicago, Guatemala City, Mexico City, San José, San Salvador, Tegucigalpa, Winnipeg </option> <option value="-5"> (UTC -05:00) New York, Lima, Toronto, Bogotá, Havana, Kingston </option> <option value="-4.5"> (UTC -04:30) Caracas </option> <option value="-4"> (UTC -04:00) Santiago, La Paz, San Juan de Puerto Rico, Manaus, Halifax </option> <option value="-3.5"> (UTC -03:30) St. John's </option> <option value="-3"> (UTC -03:00) Buenos Aires, Montevideo, São Paulo </option> <option value="-2"> (UTC -02:00) Fernando de Noronha, South Georgia and the South Sandwich Islands </option> <option value="-1"> (UTC -01:00) Cape Verde, Greenland, Azores islands </option> <option value="0"> (UTC) Accra, Abidjan, Casablanca, Dakar, Dublin, Lisbon, London </option> <option value="1"> (UTC +01:00) Belgrade, Berlin, Brussels, Lagos, Madrid, Paris, Rome, Tunis, Vienna, Warsaw </option> <option value="2"> (UTC +02:00) Athens, Sofia, Cairo, Kiev, Istanbul, Beirut, Helsinki, Jerusalem, Johannesburg, Bucharest </option> <option value="3"> (UTC +03:00) Nairobi, Baghdad, Doha, Khartoum, Minsk, Riyadh </option> <option value="3.5"> (UTC +03:30) Tehran </option> <option value="4"> (UTC +04:00) Baku, Dubai, Moscow </option> <option value="4.5"> (UTC +04:30) Kabul </option> <option value="5"> (UTC +05:00) Karachi, Tashkent </option> <option value="5.5"> (UTC +05:30) Colombo, Delhi </option> <option value="5.75"> (UTC +05:45) Kathmandu </option> <option value="6"> (UTC +06:00) Almaty, Dhaka, Yekaterinburg </option> <option value="6.5"> (UTC +06:30) Yangon </option> <option value="7"> (UTC +07:00) Jakarta, Bangkok, Novosibirsk, Hanoi </option> <option value="8"> (UTC +08:00) Perth, Beijing, Manila, Singapore, Kuala Lumpur, Denpasar, Krasnoyarsk </option> <option value="8.75"> (UTC +08:45) Eucla </option> <option value="9"> (UTC +09:00) Seoul, Tokyo, Pyongyang, Ambon, Irkutsk </option> <option value="9.5"> (UTC +09:30) Adelaide </option> <option value="10"> (UTC +10:00) Canberra, Yakutsk, Port Moresby </option> <option value="10.5"> (UTC +10:30) Lord Howe Islands </option> <option value="11"> (UTC +11:00) Vladivostok, Noumea </option> <option value="12"> (UTC +12:00) Auckland, Suva </option> <option value="12.75"> (UTC +12:45) Chatham Islands </option> <option value="13"> (UTC +13:00) Phoenix Islands, Tokelau, Tonga </option> <option value="14"> (UTC +14:00) Line Islands </option> </select> </div> </div> </div> </div> <br class="hidden-xs"> <div class="row"> <div class="col-sm-12" data-original-title="Enter the name of the feedback session e.g. Feedback Session 1." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2"> <label class="control-label" for="fsname"> Session name </label> </h5> <div class="col-sm-10"> <input class="form-control" id="fsname" maxlength="38" name="fsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value=""> </div> </div> </div> </div> <br class="hidden-xs"> <div class="row" id="instructionsRow"> <div class="col-sm-12" data-original-title="Enter instructions for this feedback session. e.g. Avoid comments which are too critical.<br> It will be displayed at the top of the page when users respond to the session." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 margin-top-0"> <label class="control-label" for="instructions"> Instructions </label> </h5> <div class="col-sm-10"> <div id="richtext-toolbar-container"> </div> <div class="panel panel-default panel-body mce-content-body content-editor" contenteditable="true" id="instructions" spellcheck="false" style="position: relative;"> <p> Please answer all the given questions. </p> </div> <input name="instructions" type="hidden"> </div> </div> </div> </div> </div> </div> <div class="panel panel-primary" id="timeFramePanel"> <div class="panel-body"> <div class="row"> <div class="col-md-5" data-original-title="Please select the date and time for which users can start submitting responses for the feedback session." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="label-control" for="startdate"> Submission opening time </label> </div> </div> <div class="row"> <div class="col-xs-6"> <input class="form-control col-sm-2 hasDatepicker" id="startdate" name="startdate" placeholder="Date" type="text" value="${date.nexthour}"> </div> <div class="col-xs-6"> <select class="form-control" id="starttime" name="starttime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> </div> <div class="col-md-5 border-left-gray" data-original-title="Please select the date and time after which the feedback session will no longer accept submissions from users." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="label-control" for="enddate"> Submission closing time </label> </div> </div> <div class="row"> <div class="col-xs-6"> <input class="form-control col-sm-2 hasDatepicker" id="enddate" name="enddate" placeholder="Date" type="text" value=""> </div> <div class="col-xs-6"> <select class="form-control" id="endtime" name="endtime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> </div> <div class="col-md-2 border-left-gray" data-original-title="Please select the amount of time that the system will continue accepting <br>submissions after the specified deadline." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="control-label" for="graceperiod"> Grace period </label> </div> </div> <div class="row"> <div class="col-xs-12"> <select class="form-control" id="graceperiod" name="graceperiod"> <option value="0"> 0 mins </option> <option value="5"> 5 mins </option> <option value="10"> 10 mins </option> <option selected="" value="15"> 15 mins </option> <option value="20"> 20 mins </option> <option value="25"> 25 mins </option> <option value="30"> 30 mins </option> </select> </div> </div> </div> </div> </div> </div> <div id="uncommonSettingsSection"> <div class="panel panel-primary" id="sessionResponsesVisiblePanel" style="display:none;"> <div class="panel-body"> <div class="row"> <div class="col-xs-12 col-md-6"> <div class="row"> <div class="col-xs-12" data-original-title="Please select when you want the questions for the feedback session to be visible to users who need to participate. Note that users cannot submit their responses until the submissions opening time set below." data-placement="top" data-toggle="tooltip" title=""> <label class="label-control"> Session visible from </label> </div> </div> <div class="row radio"> <h5 class="col-xs-2" data-original-title="Select this option to enter in a custom date and time for which the feedback session will become visible.<br>Note that you can make a session visible before it is open for submissions so that users can preview the questions." data-placement="top" data-toggle="tooltip" title=""> <label for="sessionVisibleFromButton_custom"> At </label> <input id="sessionVisibleFromButton_custom" name="sessionVisibleFromButton" type="radio" value="custom"> </h5> <div class="col-xs-5"> <input class="form-control col-sm-2 hasDatepicker" disabled="" id="visibledate" name="visibledate" type="text" value=""> </div> <div class="col-xs-5"> <select class="form-control" disabled="" id="visibletime" name="visibletime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option to have the feedback session become visible when it is open for submissions (as selected above)." data-placement="top" data-toggle="tooltip" title=""> <label for="sessionVisibleFromButton_atopen"> Submission opening time </label> <input checked="" id="sessionVisibleFromButton_atopen" name="sessionVisibleFromButton" type="radio" value="atopen"> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option if you want the feedback session to be private. A private session is never visible to anyone. Private sessions can be used to record your own comments about others, for your own reference." data-placement="top" data-toggle="tooltip" title=""> <label for="sessionVisibleFromButton_never"> Never </label> <input id="sessionVisibleFromButton_never" name="sessionVisibleFromButton" type="radio" value="never"> </div> </div> </div> <div class="col-xs-12 col-md-6 border-left-gray" id="responsesVisibleFromColumn"> <div class="row"> <div class="col-xs-12" data-original-title="Please select when the responses for the feedback session will be visible to the designated recipients.<br>You can select the response visibility for each type of user and question later." data-placement="top" data-toggle="tooltip" title=""> <label class="label-control"> Responses visible from </label> </div> </div> <div class="row radio"> <h5 class="col-xs-2" data-original-title="Select this option to use a custom time for when the responses of the feedback session<br>will be visible to the designated recipients." data-placement="top" data-toggle="tooltip" title=""> <label for="resultsVisibleFromButton_custom"> At </label> <input id="resultsVisibleFromButton_custom" name="resultsVisibleFromButton" type="radio" value="custom"> </h5> <div class="col-xs-5"> <input class="form-control hasDatepicker" disabled="" id="publishdate" name="publishdate" type="text" value=""> </div> <div class="col-xs-5"> <select class="form-control" data-original-title="Select this option to enter in a custom date and time for which</br>the responses for this feedback session will become visible." data-placement="top" data-toggle="tooltip" disabled="" id="publishtime" name="publishtime" title=""> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option to have the feedback responses be immediately visible<br>when the session becomes visible to users." data-placement="top" data-toggle="tooltip" title=""> <label for="resultsVisibleFromButton_atvisible"> Immediately </label> <input id="resultsVisibleFromButton_atvisible" name="resultsVisibleFromButton" type="radio" value="atvisible"> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option if you intend to manually publish the responses for this session later on." data-placement="top" data-toggle="tooltip" title=""> <label for="resultsVisibleFromButton_later"> Publish manually </label> <input checked="" id="resultsVisibleFromButton_later" name="resultsVisibleFromButton" type="radio" value="later"> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option if you intend never to publish the responses." data-placement="top" data-toggle="tooltip" title=""> <label for="resultsVisibleFromButton_never"> Never </label> <input id="resultsVisibleFromButton_never" name="resultsVisibleFromButton" type="radio" value="never"> </div> </div> </div> </div> </div> </div> <div class="panel panel-primary" id="sendEmailsForPanel" style="display:none;"> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <label class="control-label"> Send emails for </label> </div> </div> <div class="row"> <div class="col-md-3" data-original-title="Select this option to automatically send an email to students to notify them when the session is open for submission." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label> Session opening reminder </label> <input checked="" disabled="" id="sendreminderemail_open" name="sendreminderemail" type="checkbox" value="FEEDBACK_OPENING"> </div> </div> <div class="col-md-3" data-original-title="Select this option to automatically send an email to students to remind them to submit 24 hours before the end of the session." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label for="sendreminderemail_closing"> Session closing reminder </label> <input checked="" id="sendreminderemail_closing" name="sendreminderemail" type="checkbox" value="FEEDBACK_CLOSING"> </div> </div> <div class="col-md-4" data-original-title="Select this option to automatically send an email to students to notify them when the session results is published." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label for="sendreminderemail_published"> Results published announcement </label> <input checked="" id="sendreminderemail_published" name="sendreminderemail" type="checkbox" value="FEEDBACK_PUBLISHED"> </div> </div> </div> </div> </div> <div class="margin-bottom-15px text-muted" id="uncommonSettingsSessionResponsesVisible"> <span id="uncommonSettingsSessionResponsesVisibleInfoText"> Session is visible at submission opening time, responses are only visible when you publish the results. </span> <a class="editUncommonSettingsButton" data-done="[Done]" data-edit="[Edit]" id="editUncommonSettingsSessionResponsesVisibleButton"> [Change] </a> </div> <div class="margin-bottom-15px text-muted" id="uncommonSettingsSendEmails"> <span id="uncommonSettingsSendEmailsInfoText"> Emails are sent when session opens (within 15 mins), 24 hrs before session closes and when results are published. </span> <a class="editUncommonSettingsButton" data-done="[Done]" data-edit="[Edit]" id="editUncommonSettingsSendEmailsButton"> [Change] </a> </div> </div> <div class="form-group"> <div class="row"> <div class="col-md-offset-5 col-md-3"> <button class="btn btn-primary" disabled="" id="button_submit" type="submit"> Create Feedback Session </button> </div> </div> </div> <div class="row"> <div class="col-md-12 text-center"> <b> You need to have an active(unarchived) course to create a session! </b> </div> </div> <input name="user" type="hidden" value="CFeedbackUiT.nocourses"> </form> </div> <form action="/page/instructorFeedbacksPage" class="ajaxForSessionsForm" id="ajaxForSessions" style="display:none;"> <input name="user" type="hidden" value="CFeedbackUiT.nocourses"> <input name="isusingAjax" type="hidden" value="on"> </form> <br> <div id="statusMessagesToUser" style="display: block;"> <div class="overflow-auto alert alert-warning statusMessage"> You have not created any courses yet, or you have no active courses. Go <a href="/page/instructorCoursesPage?user=CFeedbackUiT.nocourses"> here </a> to create or unarchive a course. </div> </div> <script defer="" src="/js/statusMessage.js" type="text/javascript"> </script> <br> <div class="" id="sessionList"> <table class="table-responsive table table-striped table-bordered" id="table-sessions"> <thead> <tr class="fill-primary"> <th class="button-sort-ascending course-id-table-width" id="button_sortid" onclick="toggleSort(this);"> Course ID <span class="icon-sort unsorted"> </span> </th> <th class="button-sort-none session-name-table-width" id="button_sortname" onclick="toggleSort(this)"> Session Name <span class="icon-sort unsorted"> </span> </th> <th> Status </th> <th> <span class="tool-tip-decorate" data-original-title="Number of students submitted / Class size" data-placement="top" data-toggle="tooltip" title=""> Response Rate </span> </th> <th class="no-print"> Action(s) </th> </tr> </thead> <tbody> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </tbody> </table> <p class="col-md-12 text-muted"> Note: The table above doesn't contain sessions from archived courses. To view sessions from an archived course, unarchive the course first. </p> <br> <br> <br> <div class="align-center"> No records found. </div> <br> <br> <br> </div> <div aria-hidden="true" aria-labelledby="remindModal" class="modal fade" id="remindModal" role="dialog" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <form action="/page/instructorFeedbackRemindParticularStudents?next=%2Fpage%2FinstructorFeedbacksPage" method="post" name="form_remind_list" role="form"> <div class="modal-header"> <button aria-hidden="true" class="close" data-dismiss="modal" type="button"> × </button> <h4 class="modal-title"> Remind Particular Students <small> (Select the student(s) you want to remind) </small> </h4> </div> <div class="modal-body"> <div class="form-group" id="studentList"> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> <input class="btn btn-primary" type="submit" value="Remind"> <input name="user" type="hidden" value="CFeedbackUiT.nocourses"> </div> </form> </div> </div> </div> <div aria-hidden="true" aria-labelledby="copyModalTitle" class="modal fade" id="copyModal" role="dialog" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button class="close" data-dismiss="modal" type="button"> <span aria-hidden="true"> × </span> <span class="sr-only"> Close </span> </button> <h4 class="modal-title" id="copyModalTitle"> Creating a new session by copying a previous session </h4> </div> <div class="modal-body" id="copySessionsBody"> <form action="/page/instructorFeedbackCopy" class="form" id="copyModalForm" method="post" role="form"> <div class="form-group"> <label class="control-label" for="modalCopiedCourseId"> Create in course </label> <select class="form-control" id="modalCopiedCourseId" name="copiedcourseid"> <option selected="" value=""> No un-archived courses </option> </select> </div> <div class="form-group"> <label class="control-label" for="modalCopiedSessionName"> Name for new session </label> <input class="form-control" id="modalCopiedSessionName" maxlength="38" name="copiedfsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value=""> </div> <label> Copy sessions/questions from </label> <table class="table-responsive table table-bordered table-hover margin-0" id="copyTableModal"> <thead class="fill-primary"> <tr> <th style="width:20px;">   </th> <th> Course ID </th> <th> Feedback Session Name </th> </tr> </thead> </table> <input id="modalSessionName" name="fsname" type="hidden" value=""> <input id="modalCourseId" name="courseid" type="hidden" value=""> <input name="user" type="hidden" value="CFeedbackUiT.nocourses"> </form> </div> <div class="modal-footer margin-0"> <button class="btn btn-primary" disabled="" id="button_copy_submit" type="button"> Copy </button> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> </div> </div> </div> </div> <div aria-hidden="true" aria-labelledby="fsCopyModal" class="modal fade" id="fsCopyModal" role="dialog" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <form action="/page/instructorFeedbackEditCopy?next=%2Fpage%2FinstructorFeedbacksPage" id="instructorCopyModalForm" method="post" role="form"> <div class="modal-header"> <button aria-hidden="true" class="close" data-dismiss="modal" type="button"> × </button> <h4 class="modal-title"> Copy this feedback session to other courses <br> <small> (Select the course(s) you want to copy this feedback session to) </small> </h4> </div> <div class="modal-body"> <div class="form-group" id="courseList"> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> <input class="btn btn-primary" id="fscopy_submit" type="submit" value="Copy"> <input name="user" type="hidden" value="CFeedbackUiT.nocourses"> </div> </form> </div> </div> </div> </div> <div class="container-fluid" id="footerComponent"> <div class="container"> <div class="row"> <div class="col-md-2"> <span> [ <a href="/index.jsp"> TEAMMATES </a> V${version}] </span> </div> <div class="col-md-8"> [for <span class="highlight-white"> TEAMMATES Test Institute 1 </span> ] </div> <div class="col-md-2"> <span> [Send <a class="link" href="/contact.jsp" rel="noopener noreferrer" target="_blank"> Feedback </a> ] </span> </div> </div> </div> </div> <script async="" src="https://ssl.google-analytics.com/ga.js" type="text/javascript"> </script> <script src="/js/googleAnalytics.js" type="text/javascript"> </script> <script src="https://unpkg.com/jquery@1.12.4/dist/jquery.min.js" type="text/javascript"> </script> <script src="https://unpkg.com/jquery-ui-dist@1.12.1/jquery-ui.min.js" type="text/javascript"> </script> <script src="https://unpkg.com/bootstrap@3.1.1/dist/js/bootstrap.min.js" type="text/javascript"> </script> <script src="https://unpkg.com/bootbox@4.4.0/bootbox.min.js" type="text/javascript"> </script> <script src="/js/common.js" type="text/javascript"> </script> <script src="https://unpkg.com/tinymce@4.5.1/tinymce.min.js" type="text/javascript"> </script> <script src="/js/richTextEditor.js" type="text/javascript"> </script> <script src="/js/datepicker.js" type="text/javascript"> </script> <script src="/js/instructor.js" type="text/javascript"> </script> <script src="/js/ajaxResponseRate.js" type="text/javascript"> </script> <script src="/js/instructorFeedbackAjaxRemindModal.js" type="text/javascript"> </script> <script src="/js/instructorFeedbacksAjax.js" type="text/javascript"> </script> <script src="/js/instructorFeedbacks.js" type="text/javascript"> </script> <script src="/js/instructorFeedbacksSpecific.js" type="text/javascript"> </script> <div class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" id="ui-datepicker-div"> </div> </body> </html>
karthikaacharya/teammates
src/test/resources/pages/instructorFeedbackEmptyAll.html
HTML
gpl-2.0
47,060
[ 30522, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 13220, 1011, 9450, 1026, 1013, 2516, 1028, 1026, 4957, 17850, 12879, 1027, 1000, 1013, 6904, 7903, 2239, 1012, 1052, 3070, 1000, 2128, 2140, 1027, 1000, 2460, 12690, 12696, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: 窗口滚动判断元素是否显示不重复监听 date: 2016-04-23 tags: [jQuery,动画,函数] categories: Dynamic --- 当窗口滚动时,判断一个元素是不是出现在窗口可视范围。在元素第一次出现时在控制台打印 true,以后再次出现不做任何处理。用代码实现 ```javascript var clock; $(window).on("scroll", function() { if (clock) { clearTimeout(clock); } clock = setTimeout(function() { isVisible($("div")); }, 500) }) function isVisible($node) { $node.each(function() { var current = $(this); var top = current.offset().top, height = $(window).height(), scrollTop = $(window).scrollTop(); if (top < height + scrollTop && top > scrollTop) { // console.log(current.text()); showNode(current); } }); } function showNode(cur) { if (cur.attr("data-show")) { return; } cur.attr("data-show", true); console.log(cur.attr("data-show")) } ``` ```html div{ margin: 20px; padding: 10px; } </style> <div>hello 1</div> <div>hello 2</div> <div>hello 3</div> <div>hello 4</div> <div>hello 5</div> <div>hello 6</div> <div>hello 7</div> <div>hello 8</div> <div>hello 9</div> <div>hello 10</div> <div>hello 11</div> <div>hello 12</div> <div>hello 13</div> <div>hello 14</div> <div>hello 15</div> <div>hello 16</div> <div>hello 17</div> <div>hello 18</div> <div>hello 19</div> <div>hello 20</div> ```
wmsj100/myStudy
Language/WebUI/Dynamic/jQuery/Package/窗口滚动监听/窗口滚动判断元素是否显示不重复监听.md
Markdown
gpl-3.0
1,431
[ 30522, 1011, 1011, 1011, 2516, 1024, 100, 1788, 100, 100, 100, 100, 1769, 100, 100, 100, 100, 1923, 1744, 100, 100, 100, 100, 3058, 1024, 2355, 1011, 5840, 1011, 2603, 22073, 1024, 1031, 1046, 4226, 2854, 1010, 100, 100, 1010, 100, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2009 Torus Knot Software Ltd 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. ----------------------------------------------------------------------------- */ #ifndef __XSIMATERIALEXPORTER_H__ #define __XSIMATERIALEXPORTER_H__ #include "OgreXSIHelper.h" #include "OgreBlendMode.h" #include "OgreMaterialSerializer.h" namespace Ogre { class XsiMaterialExporter { public: XsiMaterialExporter(); virtual ~XsiMaterialExporter(); /** Export a set of XSI materials to a material script. @param materials List of materials to export @param filename Name of the script file to create @param copyTextures Whether to copy any textures used into the same folder as the material script. */ void exportMaterials(MaterialMap& materials, TextureProjectionMap& texProjMap, const String& filename, bool copyTextures); protected: MaterialSerializer mMatSerializer; typedef std::multimap<long,TextureUnitState*> TextureUnitTargetMap; /// Map of target id -> texture unit to match up tex transforms TextureUnitTargetMap mTextureUnitTargetMap; /// Pass queue, used to invert ordering PassQueue mPassQueue; /// Texture projection map TextureProjectionMap mTextureProjectionMap; // Export a single material void exportMaterial(MaterialEntry* matEntry, bool copyTextures, const String& texturePath); /// Fill in all the details of a pass void populatePass(Pass* pass, XSI::Shader& xsishader); /// Fill in the texture units - note this won't pick up transforms yet void populatePassTextures(Pass* pass, PassEntry* passEntry, bool copyTextures, const String& texturePath); /// Find any texture transforms and hook them up via 'target' void populatePassTextureTransforms(Pass* pass, XSI::Shader& xsishader); /// Populate basic rejection parameters for the pass void populatePassDepthCull(Pass* pass, XSI::Shader& xsishader); /// Populate lighting parameters for the pass void populatePassLighting(Pass* pass, XSI::Shader& xsishader); /// Populate scene blending parameters for the pass void populatePassSceneBlend(Pass* pass, XSI::Shader& xsishader); void populatePassCgPrograms(Pass* pass, XSI::Shader& xsishader); void populatePassHLSLPrograms(Pass* pass, XSI::Shader& xsishader); void populatePassD3DAssemblerPrograms(Pass* pass, XSI::Shader& xsishader); void populateOGLFiltering(TextureUnitState* tex, XSI::Shader& xsishader); void populateDXFiltering(TextureUnitState* tex, XSI::Shader& xsishader); // Utility method to get texture coord set from tspace_id name unsigned short getTextureCoordIndex(const String& tspace); /// Add a 2D texture from a shader TextureUnitState* add2DTexture(Pass* pass, XSI::Shader& shader, bool copyTextures, const String& targetFolder); /// Add a cubic texture from a shader TextureUnitState* addCubicTexture(Pass* pass, XSI::Shader& shader, bool copyTextures, const String& targetFolder); void clearPassQueue(void); SceneBlendFactor convertSceneBlend(short xsiVal); TextureUnitState::TextureAddressingMode convertAddressingMode(short xsiVal); void convertTexGenOGL(TextureUnitState* tex, long xsiVal, XSI::Shader& shader); void convertTexGenDX(TextureUnitState* tex, long xsiVal, XSI::Shader& shader); }; } #endif
gorkinovich/DefendersOfMankind
dependencies/Ogre/Tools/XSIExport/include/OgreXSIMaterialExporter.h
C
gpl-3.0
4,467
[ 30522, 1013, 1008, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!-- ~ Copyright (c) 2017. MIT-license for Jari Van Melckebeke ~ Note that there was a lot of educational work in this project, ~ this project was (or is) used for an assignment from Realdolmen in Belgium. ~ Please just don't abuse my work --> <html> <head> <meta charset="utf-8"> <script src="esl.js"></script> <script src="config.js"></script> </head> <body> <style> html, body, #main { width: 100%; height: 100%; } </style> <div id="main"></div> <script> require([ 'echarts', 'echarts/chart/scatter', 'echarts/component/legend', 'echarts/component/polar' ], function (echarts) { var chart = echarts.init(document.getElementById('main'), null, { renderer: 'canvas' }); var data1 = []; var data2 = []; var data3 = []; for (var i = 0; i < 100; i++) { data1.push([Math.random() * 5, Math.random() * 360]); data2.push([Math.random() * 5, Math.random() * 360]); data3.push([Math.random() * 10, Math.random() * 360]); } chart.setOption({ legend: { data: ['scatter', 'scatter2', 'scatter3'] }, polar: { }, angleAxis: { type: 'value' }, radiusAxis: { axisAngle: 0 }, series: [{ coordinateSystem: 'polar', name: 'scatter', type: 'scatter', symbolSize: 10, data: data1 }, { coordinateSystem: 'polar', name: 'scatter2', type: 'scatter', symbolSize: 10, data: data2 }, { coordinateSystem: 'polar', name: 'scatter3', type: 'scatter', symbolSize: 10, data: data3 }] }); }) </script> </body> </html>
N00bface/Real-Dolmen-Stage-Opdrachten
stageopdracht/src/main/resources/static/vendors/gentelella/vendors/echarts/test/polarScatter.html
HTML
mit
2,536
[ 30522, 1026, 999, 1011, 1011, 1066, 9385, 1006, 1039, 1007, 2418, 1012, 10210, 1011, 6105, 2005, 15723, 2072, 3158, 11463, 19869, 24597, 2063, 1066, 3602, 2008, 2045, 2001, 1037, 2843, 1997, 4547, 2147, 1999, 2023, 2622, 1010, 1066, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
! { dg-do run } ! ! PR fortran/45489 ! ! Check that non-referenced variables are default ! initialized if they are INTENT(OUT) or function results. ! Only the latter (i.e. "x=f()") was not working before ! PR 45489 was fixed. ! program test_init implicit none integer, target :: tgt type A integer, pointer:: p => null () integer:: i=3 end type A type(A):: x, y(3) x=f() if (associated(x%p) .or. x%i /= 3) STOP 1 y(1)%p => tgt y%i = 99 call sub1(3,y) if (associated(y(1)%p) .or. any(y(:)%i /= 3)) STOP 2 y(1)%p => tgt y%i = 99 call sub2(y) if (associated(y(1)%p) .or. any(y(:)%i /= 3)) STOP 3 contains function f() result (fr) type(A):: fr end function f subroutine sub1(n,x) integer :: n type(A), intent(out) :: x(n:n+2) end subroutine sub1 subroutine sub2(x) type(A), intent(out) :: x(:) end subroutine sub2 end program test_init
Gurgel100/gcc
gcc/testsuite/gfortran.dg/initialization_27.f90
FORTRAN
gpl-2.0
889
[ 30522, 999, 1063, 1040, 2290, 1011, 2079, 2448, 1065, 999, 999, 10975, 3481, 5521, 1013, 3429, 18139, 2683, 999, 999, 4638, 2008, 2512, 1011, 14964, 10857, 2024, 12398, 999, 3988, 3550, 2065, 2027, 2024, 7848, 1006, 2041, 1007, 2030, 3853...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package bhgomes.jaql.logging; import java.util.logging.StreamHandler; /** * Singleton object for System.out as a StreamHandler * * @author Brandon Gomes (bhgomes) */ public final class STDOUT extends StreamHandler { /** * Singleton instance */ private static final STDOUT instance = new STDOUT(); /** * Default constructor of the singleton instance */ private STDOUT() { this.setOutputStream(System.out); } /** * @return instance of the singleton */ public static final STDOUT getInstance() { return STDOUT.instance; } }
bhgomes/jaql
src/main/java/bhgomes/jaql/logging/STDOUT.java
Java
mit
608
[ 30522, 7427, 1038, 25619, 8462, 2015, 1012, 14855, 4160, 2140, 1012, 15899, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 15899, 1012, 5460, 11774, 3917, 1025, 1013, 1008, 1008, 1008, 28159, 4874, 2005, 2291, 1012, 2041, 2004, 1037, 5460, 117...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: page title: Angel Bolt Entertainment Trade Fair date: 2016-05-24 author: Vincent Proctor tags: weekly links, java status: published summary: Pellentesque habitant morbi tristique senectus. banner: images/banner/leisure-02.jpg booking: startDate: 07/17/2017 endDate: 07/22/2017 ctyhocn: MOBJCHX groupCode: ABETF published: true --- Praesent a mattis ante, eget porta velit. Proin blandit enim quis sem placerat congue. Aliquam ac mauris at nulla tristique suscipit. Ut nibh velit, consectetur sit amet ante id, ullamcorper aliquet enim. In accumsan urna nec elit fermentum dictum. Etiam suscipit metus sed convallis vehicula. Proin dignissim rutrum egestas. In commodo sapien at ligula rutrum imperdiet. Vestibulum vitae tincidunt tortor. In interdum sodales bibendum. Nunc ut dolor quis ligula viverra tincidunt. Nunc aliquet tincidunt faucibus. Suspendisse congue non nisl a ullamcorper. Nulla congue imperdiet tempus. Phasellus sed dictum est, dapibus dapibus libero. Sed ornare nulla vehicula dui gravida pellentesque. In commodo eros sed justo viverra, vel sodales mi accumsan. Ut at eros consequat, gravida est eget, aliquet purus. Curabitur eu tortor non velit dignissim scelerisque. Aliquam tellus libero, placerat eget varius sit amet, rhoncus ut velit. Aenean auctor elit eget felis luctus, in viverra mi commodo. Proin scelerisque ex id arcu consectetur, ac iaculis sapien suscipit. In aliquet massa quis elit congue, sit amet feugiat augue pretium. Quisque eu lorem aliquet, interdum arcu eu, lobortis enim. Praesent porttitor varius lorem, cursus egestas nibh cursus vitae. * Mauris vitae est pulvinar, euismod elit et, tempor ex * Sed sit amet ipsum a diam laoreet rutrum sed quis eros * Proin tempus est ac efficitur laoreet. Suspendisse tincidunt non eros sit amet dictum. Donec varius mi id orci consectetur ultricies. Donec rutrum, ligula id vulputate iaculis, justo tellus egestas eros, vitae faucibus eros neque commodo felis. Phasellus non imperdiet orci. Pellentesque ut risus eget lacus vulputate tincidunt. Quisque et dui et ante aliquam fringilla quis a turpis. Fusce tincidunt, arcu ac vehicula facilisis, ante libero fermentum justo, eget tincidunt est est et risus. Vivamus mi turpis, blandit ut odio sit amet, maximus mollis erat. Mauris et augue erat. Fusce ornare, leo et ullamcorper sollicitudin, ante sapien suscipit felis, eget condimentum turpis enim non tellus. Nulla erat neque, rutrum in lectus vitae, ultrices pellentesque enim. Aliquam dictum semper placerat. Phasellus facilisis condimentum interdum. In pulvinar euismod quam, eu sagittis ligula elementum non.
KlishGroup/prose-pogs
pogs/M/MOBJCHX/ABETF/index.md
Markdown
mit
2,623
[ 30522, 1011, 1011, 1011, 9621, 1024, 3931, 2516, 1024, 4850, 10053, 4024, 3119, 4189, 3058, 1024, 2355, 1011, 5709, 1011, 2484, 3166, 1024, 6320, 28770, 22073, 1024, 4882, 6971, 1010, 9262, 3570, 1024, 2405, 12654, 1024, 21877, 12179, 4570,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...