// Copyright (C) 2016 by rr-
//
// This file is part of arc_unpacker.
//
// arc_unpacker is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// arc_unpacker 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 arc_unpacker. If not, see <http://www.gnu.org/licenses/>.

#include "dec/abogado/v_audio_decoder.h"
#include "io/memory_byte_stream.h"

using namespace au;
using namespace au::dec::abogado;

static const s16 table0[] = {
    0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E,
    0x0010, 0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F,
    0x0022, 0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042,
    0x0049, 0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F,
    0x009D, 0x00AD, 0x00BE, 0x00D1, 0x00E6, 0x00FD, 0x0117, 0x0133,
    0x0151, 0x0173, 0x0198, 0x01C1, 0x01EE, 0x0220, 0x0256, 0x0292,
    0x02D4, 0x031C, 0x036C, 0x03C3, 0x0424, 0x048E, 0x0502, 0x0583,
    0x0610, 0x06AB, 0x0756, 0x0812, 0x08E0, 0x09C3, 0x0ABD, 0x0BD0,
    0x0CFF, 0x0E4C, 0x0FBA, 0x114C, 0x1307, 0x14EE, 0x1706, 0x1954,
    0x1BDC, 0x1EA5, 0x21B6, 0x2515, 0x28CA, 0x2CDF, 0x315B, 0x364B,
    0x3BB9, 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462,
    0x7FFF,
};

static const int table1[] = {-1, -1, -1, -1, 2, 4, 6, 8};

template<typename T> static T clip(const T input, const T low, const T high)
{
    if (input < low)
        return low;
    if (input > high)
        return high;
    return input;
}

bool VAudioDecoder::is_recognized_impl(io::File &input_file) const
{
    const auto possible_sample_rate = input_file.stream.seek(0).read_le<u32>();
    return possible_sample_rate == 22050
        || possible_sample_rate == 44100;
}

static s16 transform_sample(u8 input, s16 &prev, int &acc)
{
    const auto input_high = input >> 3;
    const auto input_low = input & 7;
    const auto mul = table0[acc];
    acc = clip(acc + table1[input_low], 0, 0x58);
    s16 ret = clip(
        input_high
            ? prev - ((((input_low << 1) + 1) * mul) >> 3)
            : prev + ((((input_low << 1) + 1) * mul) >> 3),
        -32768,
        32767);
    prev = ret;
    return ret;
}

res::Audio VAudioDecoder::decode_impl(
    const Logger &logger, io::File &input_file) const
{
    const auto sample_rate = input_file.stream.seek(0).read_le<u32>();
    const auto channel_count = input_file.stream.seek(4).read_le<u16>();
    const auto sample_count = input_file.stream.seek(188).read_le<u32>();
    const auto data = input_file.stream.seek(196).read_to_eof();

    io::MemoryByteStream sample_stream;
    if (channel_count == 2)
    {
        s16 lprev = 0, rprev = 0;
        int lacc = 0, racc = 0;
        for (const auto c : data)
        {
            sample_stream.write_le<s16>(transform_sample(c >> 4, lprev, lacc));
            sample_stream.write_le<s16>(transform_sample(c & 0xF, rprev, racc));
        }
    }
    else if (channel_count == 1)
    {
        s16 prev = 0;
        int acc = 0;
        for (const auto c : data)
        {
            sample_stream.write_le<s16>(transform_sample(c >> 4, prev, acc));
            sample_stream.write_le<s16>(transform_sample(c & 0xF, prev, acc));
        }
    }
    else
    {
        throw err::UnsupportedChannelCountError(channel_count);
    }

    res::Audio audio;
    audio.channel_count = channel_count;
    audio.bits_per_sample = 16;
    audio.sample_rate = sample_rate;
    audio.samples = sample_stream.seek(0).read_to_eof();
    return audio;
}

static auto _ = dec::register_decoder<VAudioDecoder>("abogado/v");

{'repo_name': 'vn-tools/arc_unpacker', 'stars': '327', 'repo_language': 'C++', 'file_name': 'tsujidou-junai.lst', 'mime_type': 'text/plain', 'hash': 452555337142916316, 'source_dataset': 'data'}


//-*****************************************************************************
//
// Copyright (c) 2009-2012,
//  Sony Pictures Imageworks Inc. and
//  Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
// 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 Sony Pictures Imageworks, nor
// Industrial Light & Magic, nor the names of their contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//-*****************************************************************************

#ifndef _Alembic_AbcMaterial_MaterialAssignment_h_
#define _Alembic_AbcMaterial_MaterialAssignment_h_

#include <Alembic/AbcMaterial/IMaterial.h>
#include <Alembic/AbcMaterial/OMaterial.h>

namespace Alembic {
namespace AbcMaterial {
namespace ALEMBIC_VERSION_NS {

#define MATERIALASSIGN_PROPNAME ".material.assign"
#define MATERIAL_PROPNAME ".material"

//! Adds a material assignment to an object. The value should be
//! the absolute path to an Material object.
//! (The default interpretation is that this path is to an object within
//! the same archive.)
//!
//! The default value for "propName" is officially supported convention
//! of the library. You may provide an alternative value for custom
//! solutions that want to make use of this convenience.
void addMaterialAssignment(
        Abc::OObject iObject,
        const std::string & iValue,
        const std::string & iPropName = MATERIALASSIGN_PROPNAME );

//! Adds a material assignment within a compound property. The conventions
//! and concerns are identical as with applying to an object. This exists
//! primarily for custom solutions which want to make use of the convenience
//! within nested compounds.
void addMaterialAssignment(
        Abc::OCompoundProperty iProp,
        const std::string & iValue,
        const std::string & iPropName = MATERIALASSIGN_PROPNAME );

//! Adds a local material schema to any object. This is intended for
//! "has-a" cases such as "this polymesh has a material locally defined."
//!
//! The default value for "propName" is officially supported convention
//! of the library. You may provide an alternative value for custom
//! solutions that want to make use of this convenience.
OMaterialSchema addMaterial(
    Abc::OObject iObject,
    const std::string & iPropName = MATERIAL_PROPNAME );

//! Adds a local material schema within any compound. This is intended
//! for the "has-a" cases for nested compound properties.
OMaterialSchema addMaterial(
    Abc::OCompoundProperty iProp,
    const std::string & iPropName = MATERIAL_PROPNAME );

//! Returns true and fills result with the value of previously defined
//! material assignment path. The default interpretation of the value
//! is as a full path to an IMaterial object within the same archive.
//!
//! The default value for "propName" is officially supported convention
//! of the library. You may provide an alternative value for custom
//! solutions that want to make use of this convenience.
bool getMaterialAssignmentPath(
    Abc::IObject iObject,
    std::string & oResult,
    const std::string & iPropName = MATERIALASSIGN_PROPNAME );

//! Returns true and fills result with the value of previously defined
//! material assignment path within a given compound property.
//!
//! The common case is at the object level but this is here as a convenince
//! for custom solutions
bool getMaterialAssignmentPath(
    Abc::ICompoundProperty iProp,
    std::string & oResult,
    const std::string & iPropName = MATERIALASSIGN_PROPNAME );

//! Returns true and fills result a previously defined local material
//! on this object following the "has a" pattern.
//!
//! The default value for "propName" is officially supported convention
//! of the library. You may provide an alternative value for custom
//! solutions that want to make use of this convenience.
bool hasMaterial(
        Abc::IObject iObject,
        IMaterialSchema & oResult,
        const std::string & iPropName = MATERIAL_PROPNAME );

//! Returns true and fills result a previously defined local material
//! within the given compound property. This is useful for solutions
//! in which another schema wants to contain a material definition
//! but not advertise it as such at the object level
bool hasMaterial(
        Abc::ICompoundProperty iCompound,
        IMaterialSchema & oResult,
        const std::string & iPropName = MATERIAL_PROPNAME );

} // End namespace ALEMBIC_VERSION_NS

using namespace ALEMBIC_VERSION_NS;

} // End namespace AbcMaterial
} // End namespace Alembic

#endif

{'repo_name': 'Exocortex/ExocortexCrate', 'stars': '127', 'repo_language': 'C', 'file_name': 'CMakeLists.txt', 'mime_type': 'text/plain', 'hash': 8390593883002869547, 'source_dataset': 'data'}


/*
    This file is part of Magnum.

    Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
                2020 Vladimír Vondruš <mosra@centrum.cz>

    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 NEW_GLSL
#define in varying
#define fragmentColor gl_FragColor
#define texture texture2D
#endif

#ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 2)
#endif
uniform lowp vec4 backgroundColor; /* defaults to zero */

#ifdef EXPLICIT_UNIFORM_LOCATION
layout(location = 3)
#endif
uniform lowp vec4 color
    #ifndef GL_ES
    = vec4(1.0)
    #endif
    ;

#ifdef EXPLICIT_TEXTURE_LAYER
/* See AbstractVector.h for details about the ID */
layout(binding = 6)
#endif
uniform lowp sampler2D vectorTexture;

in mediump vec2 interpolatedTextureCoordinates;

#ifdef NEW_GLSL
#ifdef EXPLICIT_ATTRIB_LOCATION
layout(location = COLOR_OUTPUT_ATTRIBUTE_LOCATION)
#endif
out lowp vec4 fragmentColor;
#endif

void main() {
    lowp float intensity = texture(vectorTexture, interpolatedTextureCoordinates).r;
    fragmentColor = mix(backgroundColor, color, intensity);
}

{'repo_name': 'mosra/magnum', 'stars': '3079', 'repo_language': 'C++', 'file_name': 'MagnumAnimation-custom.cpp', 'mime_type': 'text/x-c', 'hash': 3795019613075907069, 'source_dataset': 'data'}


#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED
#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED

// Copyright Eric Niebler 2008
//
// 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/mpl for documentation.

// $Source$
// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $
// $Revision: 24874 $

#include <boost/mpl/aux_/adl_barrier.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>

BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN

template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_;

BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
BOOST_MPL_AUX_ADL_BARRIER_DECL(char_)

#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED

{'repo_name': 'myiosemail/ShowTimeVideoLive', 'stars': '254', 'repo_language': 'C++', 'file_name': 'contents.xcworkspacedata', 'mime_type': 'text/xml', 'hash': -8510961750361295418, 'source_dataset': 'data'}


/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2014 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */
#ifdef USE_TI_UIPICKER

#import "TiUIPickerRowProxy.h"

@implementation TiUIPickerRowProxy

- (void)dealloc
{
  RELEASE_TO_NIL(snapshot);
  [super dealloc];
}

- (NSString *)apiName
{
  return @"Ti.UI.PickerRow";
}

- (UIView *)viewWithFrame:(CGRect)theFrame reusingView:(UIView *)theView
{
  //The picker on IOS seems to consist of 3 tableViews (or some derivative of it) each of which calls the
  //delegate method. So we have a singleView from our proxy residing in 3 superViews.
  //While older version of IOS somehow made this work, IOS7 seems to be completely broken.
  //So what we are doing is creating a snapshot (toImage() -> UIImageView) and returning that.
  //Downside -> No touch events from pickerrow or its children
  //Upside -> It works and is performant. Accessibility is configured on the delegate

  NSString *title = [TiUtils stringValue:[self valueForKey:@"title"]];
  WebFont *pickerFont = [TiUtils fontValue:[self valueForKey:@"font"] def:[WebFont defaultFont]];
  if (title != nil) {
    UILabel *pickerLabel = nil;

    if ([theView isMemberOfClass:[UILabel class]]) {
      pickerLabel = (UILabel *)theView;
    }

    if (pickerLabel == nil) {
      pickerLabel = [[[UILabel alloc] initWithFrame:theFrame] autorelease];
      [pickerLabel setTextAlignment:NSTextAlignmentLeft];
      [pickerLabel setBackgroundColor:[UIColor clearColor]];
      [pickerLabel setFont:[pickerFont font]];
    }
    [pickerLabel setText:title];
    id ourColor = [self valueForKey:@"color"];
    if (ourColor) {
      UIColor *color = [[TiUtils colorValue:ourColor] color];
      pickerLabel.textColor = color;
    }
    return pickerLabel;
  } else {
    if (snapshot == nil) {
      UIView *myview = [self barButtonViewForSize:theFrame.size];
      CGSize size = myview.bounds.size;
      if (CGSizeEqualToSize(size, CGSizeZero) || size.width == 0 || size.height == 0) {
#ifndef TI_USE_AUTOLAYOUT
        CGFloat width = [self autoWidthForSize:CGSizeMake(1000, 1000)];
        CGFloat height = [self autoHeightForSize:CGSizeMake(width, 0)];
#else
        CGSize s = [[self view] sizeThatFits:CGSizeMake(1000, 1000)];
        CGFloat width = s.width;
        CGFloat height = s.height;
#endif
        if (width > 0 && height > 0) {
          size = CGSizeMake(width, height);
        }
        if (CGSizeEqualToSize(size, CGSizeZero) || width == 0 || height == 0) {
          size = [UIScreen mainScreen].bounds.size;
        }
        CGRect rect = CGRectMake(0, 0, size.width, size.height);
        [TiUtils setView:myview positionRect:rect];
      }
      UIGraphicsBeginImageContextWithOptions(size, [myview.layer isOpaque], 0);
      [myview.layer renderInContext:UIGraphicsGetCurrentContext()];
      UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
      snapshot = [image retain];
      UIGraphicsEndImageContext();
    }

    UIImageView *pickerImage = nil;
    if ([theView isMemberOfClass:[UIImageView class]]) {
      pickerImage = (UIImageView *)theView;
    }

    if (pickerImage == nil) {
      pickerImage = [[[UIImageView alloc] initWithFrame:theFrame] autorelease];
      [pickerImage setBackgroundColor:[UIColor clearColor]];
      [pickerImage setContentMode:UIViewContentModeScaleAspectFit];
    }

    [pickerImage setImage:snapshot];
    return pickerImage;
  }
}

@end

#endif

{'repo_name': 'appcelerator/titanium_mobile', 'stars': '2484', 'repo_language': 'Objective-C', 'file_name': 'Console.yml', 'mime_type': 'text/plain', 'hash': 575064336150021946, 'source_dataset': 'data'}


$theme-name: "partkeepr";

$base-color: #c7c7c7;

$blue-gradient-top: #2aaad3;
$blue-gradient-bottom: #2067a3;

$blue-light-gradient-top: #eff1f3;
$blue-light-gradient-bottom: #b0bcc5;

$blue-border-top: #2373af;
$blue-border-bottom: #173a72;

$tabbar-strip-background-color: $base-color;
$tab-color-active: white;

$tabbar-strip-height: 3px;

$panel-header-background-gradient: color-stops(#535353, #363636);
$panel-border-color: #AAA;
$panel-header-color: #EEE;
$panel-header-font-family: tahoma,arial,verdana,sans-serif;
$panel-header-font-weight: bold;

$boundlist-background-color: lighten($base-color, 10%);

$button-default-border-radius: 5px;
$button-small-border-radius: 5px;

$button-default-background-color: #cbcbcb;
$button-default-border-color: #b9b9b9;
$button-default-border-width: 1px;

$button-default-background-gradient: color-stops(lighten($base-color,15), $base-color);
$button-default-background-gradient-over: color-stops(lighten($base-color,20), $base-color);
$button-default-background-gradient-pressed: color-stops($base-color, lighten($base-color,2));

$button-toolbar-base-color: $base-color;
$button-toolbar-background-color: $base-color;
$button-toolbar-border-color: $button-default-border-color;
$button-toolbar-background-gradient: $button-default-background-gradient;
$button-toolbar-background-gradient-over: $button-default-background-gradient-over;
$button-toolbar-background-gradient-pressed: $button-default-background-gradient-pressed;

$toolbar-background-color: #dddddd;
$toolbar-background-gradient: color-stops(lighten($toolbar-background-color,5),$toolbar-background-color);

$fieldset-border-radius: 4px;
$fieldset-border: 1px solid #a0a0a0;
$fieldset-box-shadow: 0px 0px 2px white, inset 0px 0px 2px white;

$form-toolbar-field-height: 22px;

$form-checkbox-image: 'form/checkbox.png' !default;
$form-radio-image: 'form/radio.png' !default;

$font-family: tahoma,arial,verdana,sans-serif !default;

$grid-header-trigger-width: 17px;

$boundlist-item-over-background-color: #2070a6;
$boundlist-item-over-border-color: #247eb3;

$tab-base-color: #eaeaea;
$tab-color-active: #333333;

$tab-height: 23;

$tip-base-color: $base-color;
$tip-background-gradient: color-stops(lighten($base-color,15), $base-color);;

$tab-background-gradient-active: color-stops($blue-gradient-top, $blue-gradient-bottom);

$grid-header-over-border-color: darken(#d3d3d3, 10);
$grid-header-over-background-color: $blue-border-top;
$grid-header-over-background-gradient: color-stops($blue-light-gradient-top, $blue-light-gradient-bottom);

$grid-over-lighten: 40;

$grid-over-light-color: lighten(#d3d3d3, 10);
$grid-over-dark-color: lighten(#a2a2a2, 20);

$grid-row-cell-alt-background: lighten($grid-over-dark-color, 20);

$grid-row-cell-over-background-color: $grid-over-light-color;
$grid-row-cell-over-background-gradient: color-stops($grid-over-light-color, $grid-over-dark-color);

$grid-row-cell-selected-background-gradient: color-stops($blue-gradient-top, $blue-gradient-bottom);
$grid-row-cell-selected-background-color: $blue-gradient-top;

$panel-base-color: #DBDBDB;

$datepicker-selected-item-border-color: #2067a3;
$datepicker-selected-item-background-color: #2aaad3;
$datepicker-item-hover-background-color: #2aaad3;
$include-missing-images: true;

$datepicker-th-background-gradient: color-stops($blue-gradient-top, $blue-gradient-bottom);
$datepicker-th-color: white;

// TEST STUFF

$menu-item-active-background-color: $blue-light-gradient-top;
$menu-item-active-background-gradient: color-stops($blue-light-gradient-top, $blue-light-gradient-bottom);
//$menu-item-active-border-color: white;

//$menu-item-active-background-color: #CBCBCB;
//$menu-background-color: #CBCBCB;

@import 'ext4/default/all';

.x-toolbar-mainmenu {
	@include background-gradient($grid-over-light-color, color-stops($blue-gradient-top, $blue-gradient-bottom));
}

.x-toolbar-mainmenu .x-btn-default-toolbar-small {
	border: 0 !important;
	background: none;
	box-shadow: none;
}

.x-toolbar-mainmenu .x-btn-default-toolbar-small .x-btn-inner {
	color: white;
	font-weight: bold;
	text-shadow: 0 0 1px #000;
}

.x-toolbar-mainmenu .x-btn-over {
	//background-color: $blue-gradient-top;
	@include background-gradient($blue-gradient-top, color-stops(lighten($blue-gradient-top,15), lighten($blue-gradient-bottom,15)));
}

.x-toolbar-mainmenu .x-btn-menu-active {
	@include background-gradient($blue-gradient-top, color-stops(lighten($blue-gradient-top,15), lighten($blue-gradient-bottom,15)));
}

.x-toolbar-mainmenu .x-btn-default-toolbar-small .x-btn-arrow {
	background-image: url(../themes/images/partkeepr/button/arrow-white.gif);
}
// This line changes the location of your images when creating UIs to be relative instead of within the ExtJS directory.
// You MUST set this to true/string value if you are creating new UIs + supporting legacy browsers.
// This only applies to new UIs. It does not apply to default component images (i.e. when changing $base-color)
// The value can either be true, in which case the image path will be "../images/"
// or a string, of where the path is
$relative-image-path-for-uis: true; // defaults to "../images/" when true

.x-btn-default-toolbar-small {
	padding: 3px;
}

.x-panel-header-default .x-panel-header-text {
	text-shadow: 1px 1px 0px black;
}

.x-accordion-hd {
	text-shadow: clear;
}

.x-border-layout-ct {
	/*background-color: #efefef;*/
}

.x-panel-header-default {
	box-shadow: none;
}

.x-panel-header-default-top {
	box-shadow: none;
	-webkit-box-shadow: none;
}

.x-panel-header-default-framed-top {
	box-shadow: none;
	-webkit-box-shadow: none;
}

.partkeepr-logo-align {
	margin-right: 1px;
	text-align: right;
}

.x-tab-default-icon-text-left em {
	margin-left: -4px;
}

{'repo_name': 'partkeepr/PartKeepr', 'stars': '706', 'repo_language': 'JavaScript', 'file_name': 'base.html.twig', 'mime_type': 'text/html', 'hash': -4847641012738349250, 'source_dataset': 'data'}


<?PHP
/**
 * Includes
 */
require_once($GLOBALS['g_campsiteDir'].'/db_connect.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/DatabaseObject.php');

class Subscription extends DatabaseObject
{
	var $m_dbTableName = 'Subscriptions';
	var $m_keyColumnNames = array('Id');
	var $m_keyIsAutoIncrement = true;
	var $m_columnNames = array(
		'Id',
		'IdUser',
		'IdPublication',
		'Active',
		'ToPay',
		'Currency',
		'Type');

	/**
	 * A user's subscription to a publication.
	 *
	 * @param int $p_id
	 * @return Subscription
	 */
	public function Subscription($p_id = null)
	{
		parent::DatabaseObject($this->m_columnNames);
		$this->m_data['Id'] = $p_id;
		if (!is_null($p_id)) {
			$this->fetch();
		}
	} // constructor

	/**
	 * Delete this subscription and all cooresponding section subscriptions.
	 *
	 * @return boolean
	 */
	public function delete()
	{
		global $g_ado_db;
	    $queryStr = "DELETE FROM SubsSections WHERE IdSubscription=".$this->m_data['Id'];
	    $g_ado_db->Execute($queryStr);
        $deleted = parent::delete();
	    return $deleted;
	} // fn delete

	/**
	 * Unique ID for this subscription.
	 *
	 * @return int
	 */
	public function getSubscriptionId()
	{
		return $this->m_data['Id'];
	} // fn getSubscriptionId

	/**
	 * The user who is subscribed.
	 *
	 * @return int
	 */
	public function getUserId()
	{
		return $this->m_data['IdUser'];
	} // fn getUserId

	/**
	 * The publication to which the user is subscribed.
	 *
	 * @return int
	 */
	public function getPublicationId()
	{
		return $this->m_data['IdPublication'];
	} // fn getPublicationId

	/**
	 * @return float
	 */
	public function getToPay()
	{
		return $this->m_data['ToPay'];
	} // fn getToPay

	/**
	 * @param float $p_value
	 * @return boolean
	 */
	public function setToPay($p_value)
	{
		global $g_ado_db;
		$success = $this->setProperty('ToPay', $p_value);
		if ($success && ( ($p_value == '0') || ($p_value == 0) ) ) {
			$queryStr ="UPDATE SubsSections SET PaidDays=Days WHERE IdSubscription=".$this->m_data['Id'];
			$g_ado_db->Execute($queryStr);
		}
		return $success;
	} // fn setToPay

	/**
	 * @return string
	 */
	public function getCurrency()
	{
		return $this->m_data['Currency'];
	} // fn getCurrency

	/**
	 * Returns 'T' for Trial subscription or 'P' for paid subscription.
	 *
	 * @return string
	 */
	public function getType()
	{
		return $this->m_data['Type'];
	} // fn getType

	/**
	 * Return TRUE if the subscription is active.
	 *
	 * @return boolean
	 */
	public function isActive()
	{
		$active = $this->m_data['Active'];
		if ($active == 'Y') {
			return true;
		} else {
			return false;
		}
	} // fn isActive

	/**
	 * Set whether the subscription is active.
	 *
	 * @param boolean $p_value
	 * @return boolean
	 */
	public function setIsActive($p_value)
	{
		if ($p_value) {
			return $this->setProperty('Active', 'Y');
		} else {
			return $this->setProperty('Active', 'N');
		}
	} // fn setIsActive

	/**
	 * Return the number of subscriptions in the given publication.
	 *
	 * @param int $p_publicationId
	 * @param int $p_userId
	 * @return int
	 */
	public static function GetNumSubscriptions($p_publicationId = null, $p_userId = null)
	{
		global $g_ado_db;
		$queryStr = "SELECT COUNT(*) FROM Subscriptions";
		$constraints = array();
		if (!is_null($p_publicationId)) {
			$constraints[] = array('IdPublication', $p_publicationId);
		}
		if (!is_null($p_userId)) {
			$constraints[] = array('IdUser', $p_userId);
		}
		if (count($constraints) > 0) {
			$tmpArray = array();
			foreach ($constraints as $constraint) {
				$tmpArray[] = $constraint[0]."='".$constraint[1]."'";
			}
			$queryStr .= " WHERE ".implode(" AND ", $tmpArray);
		}
		$total = $g_ado_db->GetOne($queryStr);
		return $total;
	} // fn GetNumSubscriptions

	/**
	 * Fetch the subscription objects that match the search criteria.
	 *
	 * @param int $p_publicationId
	 * @param int $p_userId
	 * @param array $p_sqlOptions
	 * @return array
	 */
	public static function GetSubscriptions($p_publicationId = null,
	                                        $p_userId = null, $p_sqlOptions = null)
	{
		$constraints = array();
		if (!is_null($p_publicationId)) {
			$constraints[] = array('IdPublication', $p_publicationId);
		}
		if (!is_null($p_userId)) {
			$constraints[] = array('IdUser', $p_userId);
		}
		return DatabaseObject::Search('Subscription', $constraints, $p_sqlOptions);
	} // fn GetSubscriptions

	/**
	 * Delete all the subscriptions to this section.
	 *
	 * @param int $p_publicationId
	 * @param int $p_sectionId
	 * @return int
	 *     The number of subscriptions deleted.
	 */
    public static function DeleteSubscriptionsInSection($p_publicationId, $p_sectionId)
    {
        global $g_ado_db;
    	$query = "SELECT Id FROM Subscriptions WHERE IdPublication = " . $p_publicationId;
    	$subscriberIds = $g_ado_db->GetCol($query);
    	$numSubscriberIds = count($subscriberIds);
    	if ($numSubscriberIds <= 0) {
    		return 0;
    	}
		$delQuery = "DELETE FROM SubsSections "
					." WHERE IdSubscription IN (".implode(",", $subscriberIds).")"
		     		." AND SectionNumber = " . $p_sectionId;
		$g_ado_db->Execute($delQuery);
    	return $numSubscriberIds;
    } // fn DeleteSubscriptionsInSection

    /**
     * Add the given section to all subscriptions.  Return the number of
     * subscriptions affected.
     *
     * @param int $p_publicationId
     * @param int $p_sectionId
     * @return int
     */
    public static function AddSectionToAllSubscriptions($p_publicationId, $p_sectionId)
    {
        global $g_ado_db;
    	// Retrieve the default trial and paid time of the subscriptions
    	$query = 'SELECT TimeUnit, TrialTime, PaidTime FROM Publications WHERE Id = '
    	         . $p_publicationId;
    	$rows = $g_ado_db->GetAll($query);
    	if (count($rows) < 0) {
    		return -1;
    	}
    	if (count($rows) == 0) {
    		return 0;
    	}
    	$row = $rows[0];

    	// Convert the time into a number of days
    	switch ($row['TimeUnit']){
    	case 'D':
    		$trialDays = $row['TrialTime'];
    		$paidDays = $row['PaidTime'];
    		break;
    	case 'W':
    		$trialDays = $row['TrialTime'] * 7;
    		$paidDays = $row['PaidTime'] * 7;
    		break;
    	case 'M':
    		$trialDays = $row['TrialTime'] * 30;
    		$paidDays = $row['PaidTime'] * 30;
    		break;
    	case 'Y':
    		$trialDays = $row['TrialTime'] * 365;
    		$paidDays = $row['PaidTime'] * 365;
    		break;
    	}

    	$defaultDays['T'] = $defaultPaidDays['T'] = $trialDays;
    	$defaultDays['P'] = $defaultPaidDays['P'] = $paidDays;

    	// Read active subscriptions for the given publication
    	$subs_query = 'SELECT Subscriptions.Id, Subscriptions.Type, SubsSections.StartDate,'
    	     .' SubsSections.Days, SubsSections.PaidDays '
    	     .' FROM Subscriptions '
    	     .' LEFT JOIN SubsSections ON Subscriptions.Id = SubsSections.IdSubscription '
    	     .' WHERE Subscriptions.IdPublication = ' . $p_publicationId
    	     .' AND Subscriptions.Active = \'Y\' '
    	     .' GROUP BY SubsSections.IdSubscription'
    	     .' ORDER BY Subscriptions.Id ASC';
    	$rows = $g_ado_db->GetAll($subs_query);
    	$subscriptionCount = 0;
    	foreach ($rows as $row) {
		    // If the subscriber is not currently subscribed to any sections
			if ($row['StartDate'] == '') {
				$startDate = 'NOW()';
				$days = $defaultDays[$row['Type']];
				$paidDays = $defaultPaidDays[$row['Type']];
			} else {
				$startDate = "'" . $row['StartDate'] . "'";
			}

			$query = 'INSERT INTO SubsSections '
			         .' SET IdSubscription = ' . $row['Id']
			         .', SectionNumber = ' . $p_sectionId
			         .', StartDate = ' . $startDate
			         .', Days = ' . $row['Days']
			         .', PaidDays = ' . $row['PaidDays'];
			$g_ado_db->Execute($query);
			$subscriptionCount++;
    	} // foreach

    	return $subscriptionCount;
    } // fn AddSectionToAllSubscriptions

} // class Subscription
?>

{'repo_name': 'sourcefabric/Newscoop', 'stars': '245', 'repo_language': 'PHP', 'file_name': 'PublicationListener.php', 'mime_type': 'text/x-php', 'hash': -3511129444923635204, 'source_dataset': 'data'}


// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/*============================================================
**
**
**
**
**
** Purpose: Default IComparer implementation.
**
**
===========================================================*/
namespace System.Collections {

    using System;
    using System.Globalization;
    using System.Runtime.Serialization;
    using System.Security.Permissions;
    using System.Diagnostics.Contracts;

    [Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
    public sealed class Comparer : IComparer , ISerializable
    {
        private CompareInfo m_compareInfo;
        public static readonly Comparer Default = new Comparer(CultureInfo.CurrentCulture);
        public static readonly Comparer DefaultInvariant = new Comparer(CultureInfo.InvariantCulture);

        private const String CompareInfoName = "CompareInfo";

        private Comparer() {
            m_compareInfo = null;
        }

        public Comparer(CultureInfo culture) {
            if (culture==null) {
                throw new ArgumentNullException("culture");
            }
            Contract.EndContractBlock();
            m_compareInfo = culture.CompareInfo;
        }

        private Comparer(SerializationInfo info, StreamingContext context) {
            m_compareInfo = null;
            SerializationInfoEnumerator enumerator = info.GetEnumerator();
            while( enumerator.MoveNext()) {
                switch( enumerator.Name) {
                    case CompareInfoName:
                        m_compareInfo = (CompareInfo) info.GetValue(CompareInfoName, typeof(CompareInfo));
                        break;
                }
            }
        }

        // Compares two Objects by calling CompareTo.  If a ==
        // b,0 is returned.  If a implements
        // IComparable, a.CompareTo(b) is returned.  If a
        // doesn't implement IComparable and b does,
        // -(b.CompareTo(a)) is returned, otherwise an
        // exception is thrown.
        //
        public int Compare(Object a, Object b) {
            if (a == b) return 0;
            if (a == null) return -1;
            if (b == null) return 1;
            if (m_compareInfo != null) {
                String sa = a as String;
                String sb = b as String;
                if (sa != null && sb != null)
                    return m_compareInfo.Compare(sa, sb);
            }

            IComparable ia = a as IComparable;
            if (ia != null)
                return ia.CompareTo(b);

            IComparable ib = b as IComparable;
            if (ib != null)
                return -ib.CompareTo(a);

            throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable"));
        }

        [System.Security.SecurityCritical]  // auto-generated_required
        public void GetObjectData(SerializationInfo info, StreamingContext context) {
            if (info==null) {
                throw new ArgumentNullException("info");
            }
            Contract.EndContractBlock();

            if( m_compareInfo != null) {
                info.AddValue(CompareInfoName, m_compareInfo);
            }
        }
    }
}

{'repo_name': 'xen2/SharpLang', 'stars': '256', 'repo_language': 'C#', 'file_name': 'SharpLang.RuntimeInline.vcxproj.filters', 'mime_type': 'text/xml', 'hash': -2337043615795947780, 'source_dataset': 'data'}


/// @ref gtc_bitfield
/// @file glm/gtc/bitfield.hpp
///
/// @see core (dependence)
/// @see gtc_bitfield (dependence)
///
/// @defgroup gtc_bitfield GLM_GTC_bitfield
/// @ingroup gtc
///
/// Include <glm/gtc/bitfield.hpp> to use the features of this extension.
///
/// Allow to perform bit operations on integer values

#include "../detail/setup.hpp"

#pragma once

// Dependencies
#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
#include "../detail/_vectorize.hpp"
#include <limits>

#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
#	pragma message("GLM: GLM_GTC_bitfield extension included")
#endif

namespace glm
{
	/// @addtogroup gtc_bitfield
	/// @{

	/// Build a mask of 'count' bits
	///
	/// @see gtc_bitfield
	template<typename genIUType>
	GLM_FUNC_DECL genIUType mask(genIUType Bits);

	/// Build a mask of 'count' bits
	///
	/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
	/// @tparam T Signed and unsigned integer scalar types
	/// @tparam Q Value from qualifier enum
	///
	/// @see gtc_bitfield
	template<length_t L, typename T, qualifier Q>
	GLM_FUNC_DECL vec<L, T, Q> mask(vec<L, T, Q> const& v);

	/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
	///
	/// @see gtc_bitfield
	template<typename genIUType>
	GLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);

	/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
	///
	/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
	/// @tparam T Signed and unsigned integer scalar types
	/// @tparam Q Value from qualifier enum
	///
	/// @see gtc_bitfield
	template<length_t L, typename T, qualifier Q>
	GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift);

	/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
	///
	/// @see gtc_bitfield
	template<typename genIUType>
	GLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);

	/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
	///
	/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
	/// @tparam T Signed and unsigned integer scalar types
	/// @tparam Q Value from qualifier enum
	///
	/// @see gtc_bitfield
	template<length_t L, typename T, qualifier Q>
	GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift);

	/// Set to 1 a range of bits.
	///
	/// @see gtc_bitfield
	template<typename genIUType>
	GLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);

	/// Set to 1 a range of bits.
	///
	/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
	/// @tparam T Signed and unsigned integer scalar types
	/// @tparam Q Value from qualifier enum
	///
	/// @see gtc_bitfield
	template<length_t L, typename T, qualifier Q>
	GLM_FUNC_DECL vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount);

	/// Set to 0 a range of bits.
	///
	/// @see gtc_bitfield
	template<typename genIUType>
	GLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);

	/// Set to 0 a range of bits.
	///
	/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
	/// @tparam T Signed and unsigned integer scalar types
	/// @tparam Q Value from qualifier enum
	///
	/// @see gtc_bitfield
	template<length_t L, typename T, qualifier Q>
	GLM_FUNC_DECL vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);

	/// Interleaves the bits of x and y.
	/// The first bit is the first bit of x followed by the first bit of y.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);

	/// Interleaves the bits of x, y and z.
	/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);

	/// Interleaves the bits of x, y, z and w.
	/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);

	/// Interleaves the bits of x, y, z and w.
	/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);

	/// Interleaves the bits of x, y, z and w.
	/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);

	/// Interleaves the bits of x, y, z and w.
	/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
	/// The other bits are interleaved following the previous sequence.
	///
	/// @see gtc_bitfield
	GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);

	/// @}
} //namespace glm

#include "bitfield.inl"

{'repo_name': 'ddiakopoulos/sandbox', 'stars': '161', 'repo_language': 'C++', 'file_name': 'sampler1d_array.inl', 'mime_type': 'text/x-c++', 'hash': 1000592782354080332, 'source_dataset': 'data'}


<?php
require_once( "woo/view/ViewHelper.php" );
$request = \woo\view\VH::getRequest();
?>

<title> Add a Venue </title>

<?php print $request->getFeedbackString("

"); ?>

<form method="post">
    <input type="text" value="<?php echo $request->getProperty( 'space_name' ) ?>" name="venue_name" />
    <input type="submit" value="submit" />
</form>

{'repo_name': 'wususu/effective-resourses', 'stars': '1061', 'repo_language': 'PHP', 'file_name': 'listing10.01.php', 'mime_type': 'text/x-php', 'hash': 2623948630732192177, 'source_dataset': 'data'}


<!doctype html>
<!--
@license
Copyright 2016 The TensorFlow Authors. 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.
-->

<html>
<head>
  <meta charset="utf-8">
  <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
  <script src="../../web-component-tester/browser.js"></script>
  <link rel="import" href="../tf-graph-common.html">
</head>
<body>
  <script src="parser-test.js"></script>
  <script src="graph-test.js"></script>
  <script src="hierarchy-test.js"></script>
  <script src="layout-test.js"></script>
  <script src="util-test.js"></script>
</body>
</html>

{'repo_name': 'natanielruiz/android-yolo', 'stars': '574', 'repo_language': 'C++', 'file_name': 'workspace.xml', 'mime_type': 'text/xml', 'hash': -303091686404427606, 'source_dataset': 'data'}


<!DOCTYPE html>

    <title>Array Extension Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

Katana Docs (99% documented)

View on GitHub

        Katana Reference

        Array Extension Reference

            Classes

                EmptySideEffectDependencyContainer

                Node

                PlasticNode

                PlasticView

                Renderer

                StateMockProvider

                Store

                ViewsContainer

            Enums

                AnimationType

                AsyncActionState

                EmptyKeys

            Extensions

                Array

                CGSize

                UIView

            Protocols

                Action

                ActionWithSideEffect

                AnyAsyncAction

                AnyConnectedNodeDescription

                AnyNode

                AnyNodeDescription

                AnyNodeDescriptionProps

                AnyNodeDescriptionWithChildren

                AnyNodeDescriptionWithRefProps

                AnyPlasticNodeDescription

                AnyPlatformNativeViewWithRef

                AnyStore

                AsyncAction

                Childrenable

                ConnectedNodeDescription

                LinkeableAction

                NativeViewRef

                NativeViewWithRef

                NodeDescription

                NodeDescriptionProps

                NodeDescriptionState

                NodeDescriptionWithChildren

                NodeDescriptionWithRef

                NodeDescriptionWithRefProps

                PlasticNodeDescription

                PlasticReferenceSizeable

                PlatformNativeView

                SideEffectDependencyContainer

                State

            Structs

                ActionLinker

                ActionLinks

                Anchor

                – Kind

                Animation

                AnimationContainer

                AnimationOptions

                AnimationProps

                ChildrenAnimations

                EdgeInsets

                EmptyProps

                EmptyState

                Size

                Value

            Typealiases

                AnimationPropsTransformer

                AnyRefCallbackClosure

                NodeUpdateCompletion

                RefCallbackClosure

                StoreDispatch

                StoreListener

                StoreMiddleware

                StoreUnsubscribe

            Associated Types

                PropsType

Array

struct Array<Element> : RandomAccessCollection, MutableCollection

                    centerBetween(left:right:spacings:)

Centers the view instances in the array together with a collection of inter-view spacings horizontally so that
their sizes, top edges and bottom edges are preserved.

Declaration

Swift

public func centerBetween(left: Anchor, right: Anchor, spacings: [Value]? = nil)

Parameters

                                left

the left view anchor used for the horizontal centering

                                right

the right view anchor used for the horizontal centering

                                spacings

individual spacings to use between the views. Must be an array of N-1 Value instances where N is the number of views in the view array. If nil, an array of Value.zero is used instead

                        Show on GitHub

                    centerBetween(top:bottom:spacings:)

Centers the view instances in the array together with a collection of inter-view spacings vertically so that
their sizes, left edges and right edges are preserved.

Declaration

Swift

public func centerBetween(top: Anchor, bottom: Anchor, spacings: [Value]? = nil)

Parameters

                                left

the top view anchor used for the vertical centering

                                right

the bottom view anchor used for the vertical centering

                                spacings

individual spacings to use between the views. Must be an array of N-1 Value instances where N is the number of views in the view array. If nil, an array of Value.zero is used instead

                        Show on GitHub

                    fill(left:right:insets:spacings:widths:)

Fills the horizontal space between two view anchors with the view instances in the array given a collection of
inter-view spacings and insets. The final widths of the views will be determined by a collection of relational view
widths.

Declaration

Swift

public func fill(left: Anchor,
                   right: Anchor,
                   insets: EdgeInsets = .zero,
                   spacings: [Value]? = nil,
                   widths: [CGFloat]? = nil)

Parameters

                                left

the left view anchor for the horizontal distribution of the views

                                right

the right view anchor for the horizontal distribution of the views

                                insets

the insets for the left and right view anchors. The default value is .zero

                                spacings

a collection of Value intances used to calculate the spacings between the views. Must be an array of N-1 Value instances where N is the number of views in the view array. If nil, an array of Value.zero is used instead

                                widths

a collection of CGFloats that are the view widths in relation to eachother. For example, by passing [1, 2] the method will give to the second view a width that is two times the width of the first view. Must contain N values where N is the number of views in the array. If nil all the views will have the same width

                        Show on GitHub

                    fill(top:bottom:insets:spacings:heights:)

Fills the vertical space between two view anchors with the view instances in the array given a collection of
inter-view spacings and insets. The final heights of the array views will be determined by a collection of relational view
heights.

Declaration

Swift

public func fill(top: Anchor,
                bottom: Anchor,
                insets: EdgeInsets = .zero,
                spacings: [Value]? = nil,
                heights: [CGFloat]? = nil)

Parameters

                                top

the top view anchor for the vertical distribution of the views

                                bottom

the bottom view anchor for the vertical distribution of the views

                                insets

the insets for the top and bottom view anchors. The default value is .zero

                                spacings

a collection of Value intances used to calculate the spacings between the views. Must be an array of N-1 Value instances where N is the number of views in the view array. If nil, an array of Value.zero is used instead

                                heights

a collection of CGFloats that are the view heights in relation to eachother. For example, by passing [1, 2] the method will give to the second view an height that is two times the height of the first view. Must contain N values where N is the number of views in the array. If nil all the views will have the same height

                        Show on GitHub

© 2017 Bending Spoons Team. All rights reserved. (Last updated: 2017-07-18)

Generated by jazzy ♪♫ v0.7.4, a Realm project.

{'repo_name': 'BendingSpoons/katana-swift', 'stars': '2005', 'repo_language': 'Swift', 'file_name': 'CGSize.html', 'mime_type': 'text/html', 'hash': -8829938077499305288, 'source_dataset': 'data'}


# SPDX-License-Identifier: GPL-2.0
HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
                                  -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
                                  -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
                                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
                                  -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
                                  -e s/tile.*/tile/ )

ifndef ARCH
ARCH := $(HOSTARCH)
endif

SRCARCH := $(ARCH)

# Additional ARCH settings for x86
ifeq ($(ARCH),i386)
        SRCARCH := x86
endif
ifeq ($(ARCH),x86_64)
        SRCARCH := x86
endif

# Additional ARCH settings for sparc
ifeq ($(ARCH),sparc32)
       SRCARCH := sparc
endif
ifeq ($(ARCH),sparc64)
       SRCARCH := sparc
endif

# Additional ARCH settings for sh
ifeq ($(ARCH),sh64)
       SRCARCH := sh
endif

# Additional ARCH settings for tile
ifeq ($(ARCH),tilepro)
       SRCARCH := tile
endif
ifeq ($(ARCH),tilegx)
       SRCARCH := tile
endif

LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
ifeq ($(LP64), 1)
  IS_64_BIT := 1
else
  IS_64_BIT := 0
endif

{'repo_name': 'OnePlusOSS/android_kernel_oneplus_sm8150', 'stars': '115', 'repo_language': 'C', 'file_name': 'm5mols_controls.c', 'mime_type': 'text/x-c', 'hash': 6339746344939228360, 'source_dataset': 'data'}


/*
 *
 *  * Copyright 2019-2020 the original author or authors.
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  *      https://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 test.org.springdoc.api.app82;

public class PersonDTO {
	private String email;

	private String firstName;

	private String lastName;

	public PersonDTO() {
	}

	public PersonDTO(final String email, final String firstName, final String lastName) {
		this.email = email;
		this.firstName = firstName;
		this.lastName = lastName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(final String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(final String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(final String lastName) {
		this.lastName = lastName;
	}
}

{'repo_name': 'springdoc/springdoc-openapi', 'stars': '741', 'repo_language': 'Java', 'file_name': 'CompanyController.java', 'mime_type': 'text/x-java', 'hash': -1963781730358677920, 'source_dataset': 'data'}


create table src_rc_merge_test_stat(key int, value string) stored as rcfile;

load data local inpath '../../data/files/smbbucket_1.rc' into table src_rc_merge_test_stat;
load data local inpath '../../data/files/smbbucket_2.rc' into table src_rc_merge_test_stat;
load data local inpath '../../data/files/smbbucket_3.rc' into table src_rc_merge_test_stat;

show table extended like `src_rc_merge_test_stat`;
desc extended src_rc_merge_test_stat;

analyze table src_rc_merge_test_stat compute statistics;

desc extended src_rc_merge_test_stat;

alter table src_rc_merge_test_stat concatenate;

show table extended like `src_rc_merge_test_stat`;
desc extended src_rc_merge_test_stat;

create table src_rc_merge_test_part_stat(key int, value string) partitioned by (ds string) stored as rcfile;

alter table src_rc_merge_test_part_stat add partition (ds='2011');

load data local inpath '../../data/files/smbbucket_1.rc' into table src_rc_merge_test_part_stat partition (ds='2011');
load data local inpath '../../data/files/smbbucket_2.rc' into table src_rc_merge_test_part_stat partition (ds='2011');
load data local inpath '../../data/files/smbbucket_3.rc' into table src_rc_merge_test_part_stat partition (ds='2011');

show table extended like `src_rc_merge_test_part_stat` partition (ds='2011');
desc extended src_rc_merge_test_part_stat;

analyze table src_rc_merge_test_part_stat partition(ds='2011') compute statistics;

desc extended src_rc_merge_test_part_stat;

alter table src_rc_merge_test_part_stat partition (ds='2011') concatenate;

show table extended like `src_rc_merge_test_part_stat` partition (ds='2011');
desc extended src_rc_merge_test_part_stat;

drop table src_rc_merge_test_stat;
drop table src_rc_merge_test_part_stat;

{'repo_name': 'qubole/spark-on-lambda', 'stars': '131', 'repo_language': 'Scala', 'file_name': 'ReplSuite.scala', 'mime_type': 'text/plain', 'hash': 922694980212002127, 'source_dataset': 'data'}


var convert = require('./convert'),
    func = convert('xorWith', require('../xorWith'));

func.placeholder = require('./placeholder');
module.exports = func;

{'repo_name': 'openshift/origin-aggregated-logging', 'stars': '130', 'repo_language': 'Ruby', 'file_name': 'matchesProperty.js', 'mime_type': 'text/plain', 'hash': -7647540278780073272, 'source_dataset': 'data'}


// Upload Managers
//
// The s3manager package's Uploader provides concurrent upload of content to S3
// by taking advantage of S3's Multipart APIs. The Uploader also supports both
// io.Reader for streaming uploads, and will also take advantage of io.ReadSeeker
// for optimizations if the Body satisfies that type. Once the Uploader instance
// is created you can call Upload concurrently from multiple goroutines safely.
//
//   // The session the S3 Uploader will use
//   sess := session.Must(session.NewSession())
//
//   // Create an uploader with the session and default options
//   uploader := s3manager.NewUploader(sess)
//
//   f, err  := os.Open(filename)
//   if err != nil {
//       return fmt.Errorf("failed to open file %q, %v", filename, err)
//   }
//
//   // Upload the file to S3.
//   result, err := uploader.Upload(&s3manager.UploadInput{
//       Bucket: aws.String(myBucket),
//       Key:    aws.String(myString),
//       Body:   f,
//   })
//   if err != nil {
//       return fmt.Errorf("failed to upload file, %v", err)
//   }
//   fmt.Printf("file uploaded to, %s\n", aws.StringValue(result.Location))
//
// See the s3manager package's Uploader type documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Uploader
//
// Download Manager
//
// The s3manager package's Downloader provides concurrently downloading of Objects
// from S3. The Downloader will write S3 Object content with an io.WriterAt.
// Once the Downloader instance is created you can call Download concurrently from
// multiple goroutines safely.
//
//   // The session the S3 Downloader will use
//   sess := session.Must(session.NewSession())
//
//   // Create a downloader with the session and default options
//   downloader := s3manager.NewDownloader(sess)
//
//   // Create a file to write the S3 Object contents to.
//   f, err := os.Create(filename)
//   if err != nil {
//       return fmt.Errorf("failed to create file %q, %v", filename, err)
//   }
//
//   // Write the contents of S3 Object to the file
//   n, err := downloader.Download(f, &s3.GetObjectInput{
//       Bucket: aws.String(myBucket),
//       Key:    aws.String(myString),
//   })
//   if err != nil {
//       return fmt.Errorf("failed to download file, %v", err)
//   }
//   fmt.Printf("file downloaded, %d bytes\n", n)
//
// See the s3manager package's Downloader type documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader
//
// Automatic URI cleaning
//
// Interacting with objects whose keys contain adjacent slashes (e.g. bucketname/foo//bar/objectname)
// requires setting DisableRestProtocolURICleaning to true in the aws.Config struct
// used by the service client.
//
//   svc := s3.New(sess, &aws.Config{
//      	DisableRestProtocolURICleaning: aws.Bool(true),
//   })
//   out, err := svc.GetObject(&s3.GetObjectInput {
//      	Bucket: aws.String("bucketname"),
//       	Key: aws.String("//foo//bar//moo"),
//   })
//
// Get Bucket Region
//
// GetBucketRegion will attempt to get the region for a bucket using a region
// hint to determine which AWS partition to perform the query on. Use this utility
// to determine the region a bucket is in.
//
//   sess := session.Must(session.NewSession())
//
//   bucket := "my-bucket"
//   region, err := s3manager.GetBucketRegion(ctx, sess, bucket, "us-west-2")
//   if err != nil {
//       if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" {
//            fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket)
//       }
//       return err
//   }
//   fmt.Printf("Bucket %s is in %s region\n", bucket, region)
//
// See the s3manager package's GetBucketRegion function documentation for more information
// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion
//
// S3 Crypto Client
//
// The s3crypto package provides the tools to upload and download encrypted
// content from S3. The Encryption and Decryption clients can be used concurrently
// once the client is created.
//
//    sess := session.Must(session.NewSession())
//
//    // Create the decryption client.
//    svc := s3crypto.NewDecryptionClient(sess)
//
//    // The object will be downloaded from S3 and decrypted locally. By metadata
//    // about the object's encryption will instruct the decryption client how
//    // decrypt the content of the object. By default KMS is used for keys.
//    result, err := svc.GetObject(&s3.GetObjectInput {
//        Bucket: aws.String(myBucket),
//        Key: aws.String(myKey),
//    })
//
// See the s3crypto package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3crypto/
//
package s3

{'repo_name': 'gravitational/teleport', 'stars': '8375', 'repo_language': 'Go', 'file_name': 'teleport.yaml', 'mime_type': 'text/plain', 'hash': 8917438968714871539, 'source_dataset': 'data'}


<!DOCTYPE html>

	<meta charset="utf-8">
	<title>jQuery UI Progressbar - Default functionality</title>
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">

	<link rel="stylesheet" href="../demos.css">

Default determinate progress bar.

{'repo_name': 'unconed/TermKit', 'stars': '4473', 'repo_language': 'JavaScript', 'file_name': 'Readme.txt', 'mime_type': 'text/plain', 'hash': 2151852211734036742, 'source_dataset': 'data'}


using Keg.DAL;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.DataContracts;

namespace Keg.DAL.Models
{

    /// <summary>
    /// Class Designed to hold the values from CosmosDB related to KegConfig Only
    /// </summary>
    public class KegConfig
    {
        /// <summary>
        /// Hardcoded class for KegConfig Type
        /// </summary>
        [JsonProperty("type")]
        public string Type { get { return "KegConfig"; } }

        /// <summary>
        /// Identifier
        /// </summary>
        [JsonProperty("id")]
        public string Id { get; set; }

        /// <summary>
        /// Maximum Event Duration In Minutes
        /// </summary>
        [JsonProperty("maxeventdurationminutes")]
        public int MaxEventDurationMinutes { get; set; }

        /// <summary>
        /// Maximum Ounces to be consumed in UserConsumptionReset Minutes
        /// </summary>
        [JsonProperty("maxuserouncesperhour")]
        public int MaxUserOuncesPerHour { get; set; }

        /// <summary>
        /// Core Business Hours ( Not allowed)
        /// </summary>
        [JsonProperty("corehours")]
        public string CoreHours { get; set; }

        /// <summary>
        /// Core Days allowed
        /// </summary>
        [JsonProperty("coredays")]
        public string CoreDays { get; set; }

        /// <summary>
        /// Maintenance Mode Flag
        /// </summary>
        [JsonProperty("maintenance")]
        public bool MaintenanceMode { get; set; }

        /// <summary>
        /// Weight Callibration Factor
        /// </summary>
        [JsonProperty("weightcalibrationfactor")]
        public float WeightCalibrationFactor { get; set; }

        /// <summary>
        /// Weight Callibration Offset
        /// </summary>
        [JsonProperty("weightcalibrationoffset")]
        public float WeightCalibrationOffset { get; set; }

        /// <summary>
        /// Maxiumum volume in the Keg
        /// </summary>
        [JsonProperty("maxkegvolumeinpints")]
        public float MaxKegVolumeInPints { get; set; }

        /// <summary>
        /// Maximum Weight Of Keg allowed
        /// </summary>
        [JsonProperty("maxkegweight")]
        public float MaxKegWeight { get; set; }

        /// <summary>
        /// Weight of Empty Keg
        /// </summary>
        [JsonProperty("emptykegweight")]
        public float EmptyKegWeight { get; set; }

        /// <summary>
        /// Maximum visitors allowed per Event
        /// </summary>
        [JsonProperty("maxvisitorsperevent")]
        public Int32 MaxPersonsPerEvent { get; set; }

        /// <summary>
        /// User Consumption Limit Reset
        /// </summary>
        [JsonProperty("userconsumptionresetminutes")]
        public Int32 UserConsumptionReset { get; set; }

        /// <summary>
        /// Flow Callibration Number
        /// </summary>
        [JsonProperty("flowcalibrationfactor")]
        public float FlowCalibrationFactor { get; set; }

        /// <summary>
        /// Flow Callibration Offset
        /// </summary>
        [JsonProperty("flowcalibrationoffset")]
        public float FlowCalibrationOffset { get; set; }

        /// <summary>
        /// Counter Seconds
        /// </summary>
        [JsonProperty("counterSeconds")]
        public Int32 CounterSeconds { get; set; }

        /// <summary>
        /// CounterShort Seconds
        /// </summary>
        [JsonProperty("counterSecondsShort")]
        public Int32 CounterSecondsShort { get; set; }

    }

    public static class GlobalSettings
    {
        public static string UrlCombine(params string[] urls)
        {
            string result = "";

            foreach (var url in urls)
            {
                if (result.Length > 0 && url.Length > 0)
                    result += '/';

                result += url.Trim('/');
            }

            return result.TrimEnd('/');
        }

        private static bool CheckValidUrl()
        {
            try
            {
                //TODO: Add Validation
                //Constants.COSMOSAzureFunctionsURL
                return true;
            }
            catch(Exception ex)
            {
                KegLogger.KegLogException(ex, "GlobalSettings:GetKegSetting", SeverityLevel.Critical);
                throw ex;
            }

        }

        public static async Task<IEnumerable<KegConfig>> GetKegSettings()
        {
            if(!CheckValidUrl())
            {
                return null;
            }
            var client = new System.Net.Http.HttpClient();
            string url =  $"{UrlCombine(Constants.COSMOSAzureFunctionsURL,"kegconfig")}?code={Constants.AF_KEGKEY}";
            var response = await client.GetAsync(url);
            var body = await response.Content.ReadAsStringAsync();
            List<KegConfig> list = JsonConvert.DeserializeObject<List<KegConfig>>(body);
            return list;
        }

        public static async Task<KegConfig> GetKegSetting(string id)
        {
            if (!CheckValidUrl())
            {
                return null;
            }

            var myClientHandler = new HttpClientHandler
            {
                Credentials = System.Net.CredentialCache.DefaultCredentials
            };

            var client = new HttpClient(myClientHandler)
            {
                Timeout = TimeSpan.FromSeconds(60)
            };

            //var client = new Windows.Web.Http.HttpClient();
            string url = $"{UrlCombine(Constants.COSMOSAzureFunctionsURL, "kegconfig", id)}?code={Constants.AF_KEGKEY}";

            try
            {
                var response = await client.GetAsync(new Uri(url));
                var body = await response.Content.ReadAsStringAsync();
                List<KegConfig> list = JsonConvert.DeserializeObject<List<KegConfig>>(body);
                return list.FirstOrDefault();
            }
            catch(TaskCanceledException tEx)
            {
                KegLogger.KegLogException(tEx, "GlobalSettings:GetKegSetting", SeverityLevel.Critical);
                throw tEx;
            }
            catch(HttpRequestException hEx)
            {
                KegLogger.KegLogException(hEx, "GlobalSettings:GetKegSetting", SeverityLevel.Critical);
                throw hEx;
            }
        }

        /// <summary>
        /// Test Method and not to be used.
        /// </summary>
        /// <param name="item"></param>
        public static async void SetKegSettings(this KegConfig item)
        {
            var client = new System.Net.Http.HttpClient();
            string url = $"{UrlCombine(Constants.COSMOSAzureFunctionsURL, "kegconfig")}?code={Constants.AF_KEGKEY}";
            StringContent content = new StringContent(JsonConvert.SerializeObject(item));
            var response = await client.PostAsync(url, content);
            var body = await response.Content.ReadAsStringAsync();
        }
    }
}

{'repo_name': 'microsoft/Windows-iotcore-samples', 'stars': '525', 'repo_language': 'C++', 'file_name': 'Default.rd.xml', 'mime_type': 'text/plain', 'hash': -7152011535963188995, 'source_dataset': 'data'}


From 5f5c9858af167f842ee8df053920b98387a71af1 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 5 Mar 2018 11:41:25 +0100
Subject: [PATCH 02/27] watchdog: ath79: fix maximum timeout

If the userland tries to set a timeout higher than the max_timeout,
then we should fallback to max_timeout.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/watchdog/ath79_wdt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/watchdog/ath79_wdt.c
+++ b/drivers/watchdog/ath79_wdt.c
@@ -115,10 +115,14 @@ static inline void ath79_wdt_disable(voi

 static int ath79_wdt_set_timeout(int val)
 {
-	if (val < 1 || val > max_timeout)
+	if (val < 1)
 		return -EINVAL;

-	timeout = val;
+	if (val > max_timeout)
+		timeout = max_timeout;
+	else
+		timeout = val;
+
 	ath79_wdt_keepalive();

 	return 0;

{'repo_name': 'lede-project/source', 'stars': '1469', 'repo_language': 'C', 'file_name': 'cdefs.h', 'mime_type': 'text/x-c', 'hash': -1189094646793006488, 'source_dataset': 'data'}


//
//  WithLatestFrom.swift
//  RxSwift
//
//  Created by Yury Korolev on 10/19/15.
//  Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

extension ObservableType {

    /**
     Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.

     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)

     - parameter second: Second observable source.
     - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.
     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.
     */
    public func withLatestFrom<SecondO: ObservableConvertibleType, ResultType>(_ second: SecondO, resultSelector: @escaping (E, SecondO.E) throws -> ResultType) -> Observable<ResultType> {
        return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: resultSelector)
    }

    /**
     Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emitts an element.

     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)

     - parameter second: Second observable source.
     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.
     */
    public func withLatestFrom<SecondO: ObservableConvertibleType>(_ second: SecondO) -> Observable<SecondO.E> {
        return WithLatestFrom(first: asObservable(), second: second.asObservable(), resultSelector: { $1 })
    }
}

final fileprivate class WithLatestFromSink<FirstType, SecondType, O: ObserverType>
    : Sink<O>
    , ObserverType
    , LockOwnerType
    , SynchronizedOnType {
    typealias ResultType = O.E
    typealias Parent = WithLatestFrom<FirstType, SecondType, ResultType>
    typealias E = FirstType

    fileprivate let _parent: Parent

    var _lock = RecursiveLock()
    fileprivate var _latest: SecondType?

    init(parent: Parent, observer: O, cancel: Cancelable) {
        _parent = parent

        super.init(observer: observer, cancel: cancel)
    }

    func run() -> Disposable {
        let sndSubscription = SingleAssignmentDisposable()
        let sndO = WithLatestFromSecond(parent: self, disposable: sndSubscription)

        sndSubscription.setDisposable(_parent._second.subscribe(sndO))
        let fstSubscription = _parent._first.subscribe(self)

        return Disposables.create(fstSubscription, sndSubscription)
    }

    func on(_ event: Event<E>) {
        synchronizedOn(event)
    }

    func _synchronized_on(_ event: Event<E>) {
        switch event {
        case let .next(value):
            guard let latest = _latest else { return }
            do {
                let res = try _parent._resultSelector(value, latest)

                forwardOn(.next(res))
            } catch let e {
                forwardOn(.error(e))
                dispose()
            }
        case .completed:
            forwardOn(.completed)
            dispose()
        case let .error(error):
            forwardOn(.error(error))
            dispose()
        }
    }
}

final fileprivate class WithLatestFromSecond<FirstType, SecondType, O: ObserverType>
    : ObserverType
    , LockOwnerType
    , SynchronizedOnType {

    typealias ResultType = O.E
    typealias Parent = WithLatestFromSink<FirstType, SecondType, O>
    typealias E = SecondType

    private let _parent: Parent
    private let _disposable: Disposable

    var _lock: RecursiveLock {
        return _parent._lock
    }

    init(parent: Parent, disposable: Disposable) {
        _parent = parent
        _disposable = disposable
    }

    func on(_ event: Event<E>) {
        synchronizedOn(event)
    }

    func _synchronized_on(_ event: Event<E>) {
        switch event {
        case let .next(value):
            _parent._latest = value
        case .completed:
            _disposable.dispose()
        case let .error(error):
            _parent.forwardOn(.error(error))
            _parent.dispose()
        }
    }
}

final fileprivate class WithLatestFrom<FirstType, SecondType, ResultType>: Producer<ResultType> {
    typealias ResultSelector = (FirstType, SecondType) throws -> ResultType

    fileprivate let _first: Observable<FirstType>
    fileprivate let _second: Observable<SecondType>
    fileprivate let _resultSelector: ResultSelector

    init(first: Observable<FirstType>, second: Observable<SecondType>, resultSelector: @escaping ResultSelector) {
        _first = first
        _second = second
        _resultSelector = resultSelector
    }

    override func run<O : ObserverType>(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == ResultType {
        let sink = WithLatestFromSink(parent: self, observer: observer, cancel: cancel)
        let subscription = sink.run()
        return (sink: sink, subscription: subscription)
    }
}

{'repo_name': 'Edison-Hsu/100-days-of-RxSwift', 'stars': '168', 'repo_language': 'Swift', 'file_name': 'contents.xcworkspacedata', 'mime_type': 'text/xml', 'hash': -8437612460080902816, 'source_dataset': 'data'}


/**
******************************************************************************
*
* @file       mercatorprojection.h
* @author     The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author     Tau Labs, http://taulabs.org, Copyright (C) 2013
* @brief
* @see        The GNU Public License (GPL) Version 3
* @defgroup   TLMapWidget
* @{
*
*****************************************************************************/
/*
* 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 3 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, see <http://www.gnu.org/licenses/>
*/
#ifndef MERCATORPROJECTION_H
#define MERCATORPROJECTION_H
#include "../pureprojection.h"

namespace projections {
    class MercatorProjection:public internals::PureProjection
{
public:
    MercatorProjection();
    virtual QString Type(){return "MercatorProjection";}
    virtual Size TileSize() const;
    virtual double Axis() const;
    virtual double Flattening()const;
    virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom);
    virtual internals::PointLatLng FromPixelToLatLng(const qint64 &x,const qint64 &y,const int &zoom);
    virtual  Size GetTileMatrixMinXY(const int &zoom);
    virtual  Size GetTileMatrixMaxXY(const int &zoom);
private:
    const double MinLatitude;
    const double MaxLatitude;
    const double MinLongitude;
    const double MaxLongitude;
    Size tileSize;
};

}
#endif // MERCATORPROJECTION_H

{'repo_name': 'd-ronin/dRonin', 'stars': '234', 'repo_language': 'C', 'file_name': 'dialog_settings.xml', 'mime_type': 'text/xml', 'hash': -4437876604960298557, 'source_dataset': 'data'}


/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://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.springframework.integration.samples.tcpclientserver;

import java.io.UnsupportedEncodingException;

import org.springframework.core.convert.converter.Converter;

/**
 * Simple byte array to String converter; allowing the character set
 * to be specified.
 *
 * @author Gary Russell
 * @since 2.1
 *
 */
public class ByteArrayToStringConverter implements Converter<byte[], String> {

	private String charSet = "UTF-8";

	public String convert(byte[] bytes) {
		try {
			return new String(bytes, this.charSet);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return new String(bytes);
		}
	}

	/**
	 * @return the charSet
	 */
	public String getCharSet() {
		return charSet;
	}

	/**
	 * @param charSet the charSet to set
	 */
	public void setCharSet(String charSet) {
		this.charSet = charSet;
	}

}

{'repo_name': 'spring-projects/spring-integration-samples', 'stars': '1820', 'repo_language': 'Java', 'file_name': 'KafkaAppProperties.java', 'mime_type': 'text/x-java', 'hash': -4602269087700323123, 'source_dataset': 'data'}


/*
 * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code 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
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package java.net;

import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

import sun.net.ConnectionResetException;

/**
 * This stream extends FileInputStream to implement a
 * SocketInputStream. Note that this class should NOT be
 * public.
 *
 * @author      Jonathan Payne
 * @author      Arthur van Hoff
 */
class SocketInputStream extends FileInputStream
{
    static {
        init();
    }

    private boolean eof;
    private AbstractPlainSocketImpl impl = null;
    private byte temp[];
    private Socket socket = null;

    /**
     * Creates a new SocketInputStream. Can only be called
     * by a Socket. This method needs to hang on to the owner Socket so
     * that the fd will not be closed.
     * @param impl the implemented socket input stream
     */
    SocketInputStream(AbstractPlainSocketImpl impl) throws IOException {
        super(impl.getFileDescriptor());
        this.impl = impl;
        socket = impl.getSocket();
    }

    /**
     * Returns the unique {@link java.nio.channels.FileChannel FileChannel}
     * object associated with this file input stream.

     *
     * The {@code getChannel} method of {@code SocketInputStream}
     * returns {@code null} since it is a socket based stream.

     *
     * @return  the file channel associated with this file input stream
     *
     * @since 1.4
     * @spec JSR-51
     */
    public final FileChannel getChannel() {
        return null;
    }

    /**
     * Reads into an array of bytes at the specified offset using
     * the received socket primitive.
     * @param fd the FileDescriptor
     * @param b the buffer into which the data is read
     * @param off the start offset of the data
     * @param len the maximum number of bytes read
     * @param timeout the read timeout in ms
     * @return the actual number of bytes read, -1 is
     *          returned when the end of the stream is reached.
     * @exception IOException If an I/O error has occurred.
     */
    private native int socketRead0(FileDescriptor fd,
                                   byte b[], int off, int len,
                                   int timeout)
        throws IOException;

    // wrap native call to allow instrumentation
    /**
     * Reads into an array of bytes at the specified offset using
     * the received socket primitive.
     * @param fd the FileDescriptor
     * @param b the buffer into which the data is read
     * @param off the start offset of the data
     * @param len the maximum number of bytes read
     * @param timeout the read timeout in ms
     * @return the actual number of bytes read, -1 is
     *          returned when the end of the stream is reached.
     * @exception IOException If an I/O error has occurred.
     */
    private int socketRead(FileDescriptor fd,
                           byte b[], int off, int len,
                           int timeout)
        throws IOException {
        return socketRead0(fd, b, off, len, timeout);
    }

    /**
     * Reads into a byte array data from the socket.
     * @param b the buffer into which the data is read
     * @return the actual number of bytes read, -1 is
     *          returned when the end of the stream is reached.
     * @exception IOException If an I/O error has occurred.
     */
    public int read(byte b[]) throws IOException {
        return read(b, 0, b.length);
    }

    /**
     * Reads into a byte array b at offset off,
     * length bytes of data.
     * @param b the buffer into which the data is read
     * @param off the start offset of the data
     * @param length the maximum number of bytes read
     * @return the actual number of bytes read, -1 is
     *          returned when the end of the stream is reached.
     * @exception IOException If an I/O error has occurred.
     */
    public int read(byte b[], int off, int length) throws IOException {
        return read(b, off, length, impl.getTimeout());
    }

    int read(byte b[], int off, int length, int timeout) throws IOException {
        int n;

        // EOF already encountered
        if (eof) {
            return -1;
        }

        // connection reset
        if (impl.isConnectionReset()) {
            throw new SocketException("Connection reset");
        }

        // bounds check
        if (length <= 0 || off < 0 || length > b.length - off) {
            if (length == 0) {
                return 0;
            }
            throw new ArrayIndexOutOfBoundsException("length == " + length
                    + " off == " + off + " buffer length == " + b.length);
        }

        boolean gotReset = false;

        // acquire file descriptor and do the read
        FileDescriptor fd = impl.acquireFD();
        try {
            n = socketRead(fd, b, off, length, timeout);
            if (n > 0) {
                return n;
            }
        } catch (ConnectionResetException rstExc) {
            gotReset = true;
        } finally {
            impl.releaseFD();
        }

        /*
         * We receive a "connection reset" but there may be bytes still
         * buffered on the socket
         */
        if (gotReset) {
            impl.setConnectionResetPending();
            impl.acquireFD();
            try {
                n = socketRead(fd, b, off, length, timeout);
                if (n > 0) {
                    return n;
                }
            } catch (ConnectionResetException rstExc) {
            } finally {
                impl.releaseFD();
            }
        }

        /*
         * If we get here we are at EOF, the socket has been closed,
         * or the connection has been reset.
         */
        if (impl.isClosedOrPending()) {
            throw new SocketException("Socket closed");
        }
        if (impl.isConnectionResetPending()) {
            impl.setConnectionReset();
        }
        if (impl.isConnectionReset()) {
            throw new SocketException("Connection reset");
        }
        eof = true;
        return -1;
    }

    /**
     * Reads a single byte from the socket.
     */
    public int read() throws IOException {
        if (eof) {
            return -1;
        }
        temp = new byte[1];
        int n = read(temp, 0, 1);
        if (n <= 0) {
            return -1;
        }
        return temp[0] & 0xff;
    }

    /**
     * Skips n bytes of input.
     * @param numbytes the number of bytes to skip
     * @return  the actual number of bytes skipped.
     * @exception IOException If an I/O error has occurred.
     */
    public long skip(long numbytes) throws IOException {
        if (numbytes <= 0) {
            return 0;
        }
        long n = numbytes;
        int buflen = (int) Math.min(1024, n);
        byte data[] = new byte[buflen];
        while (n > 0) {
            int r = read(data, 0, (int) Math.min((long) buflen, n));
            if (r < 0) {
                break;
            }
            n -= r;
        }
        return numbytes - n;
    }

    /**
     * Returns the number of bytes that can be read without blocking.
     * @return the number of immediately available bytes
     */
    public int available() throws IOException {
        return impl.available();
    }

    /**
     * Closes the stream.
     */
    private boolean closing = false;
    public void close() throws IOException {
        // Prevent recursion. See BugId 4484411
        if (closing)
            return;
        closing = true;
        if (socket != null) {
            if (!socket.isClosed())
                socket.close();
        } else
            impl.close();
        closing = false;
    }

    void setEOF(boolean eof) {
        this.eof = eof;
    }

    /**
     * Overrides finalize, the fd is closed by the Socket.
     */
    protected void finalize() {}

    /**
     * Perform class load-time initializations.
     */
    private native static void init();
}

{'repo_name': 'Tencent/TencentKona-8', 'stars': '209', 'repo_language': 'Java', 'file_name': 'ProfileDataVerifier.java', 'mime_type': 'text/plain', 'hash': -3134028931299777223, 'source_dataset': 'data'}


/*  Snippet code for Operations with images tutorial (not intended to be run but should built successfully) */

#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int,char**)
{
    std::string filename = "";
    // Input/Output
    {
        //! [Load an image from a file]
        Mat img = imread(filename);
        //! [Load an image from a file]
        CV_UNUSED(img);
    }
    {
        //! [Load an image from a file in grayscale]
        Mat img = imread(filename, IMREAD_GRAYSCALE);
        //! [Load an image from a file in grayscale]
        CV_UNUSED(img);
    }
    {
        Mat img(4,4,CV_8U);
        //! [Save image]
        imwrite(filename, img);
        //! [Save image]
    }
    // Accessing pixel intensity values
    {
        Mat img(4,4,CV_8U);
        int y = 0, x = 0;
        {
            //! [Pixel access 1]
            Scalar intensity = img.at<uchar>(y, x);
            //! [Pixel access 1]
            CV_UNUSED(intensity);
        }
        {
            //! [Pixel access 2]
            Scalar intensity = img.at<uchar>(Point(x, y));
            //! [Pixel access 2]
            CV_UNUSED(intensity);
        }
        {
            //! [Pixel access 3]
            Vec3b intensity = img.at<Vec3b>(y, x);
            uchar blue = intensity.val[0];
            uchar green = intensity.val[1];
            uchar red = intensity.val[2];
            //! [Pixel access 3]
            CV_UNUSED(blue);
            CV_UNUSED(green);
            CV_UNUSED(red);
        }
        {
            //! [Pixel access 4]
            Vec3f intensity = img.at<Vec3f>(y, x);
            float blue = intensity.val[0];
            float green = intensity.val[1];
            float red = intensity.val[2];
            //! [Pixel access 4]
            CV_UNUSED(blue);
            CV_UNUSED(green);
            CV_UNUSED(red);
        }
        {
            //! [Pixel access 5]
            img.at<uchar>(y, x) = 128;
            //! [Pixel access 5]
        }
        {
            int i = 0;
            //! [Mat from points vector]
            vector<Point2f> points;
            //... fill the array
            Mat pointsMat = Mat(points);
            //! [Mat from points vector]

            //! [Point access]
            Point2f point = pointsMat.at<Point2f>(i, 0);
            //! [Point access]
            CV_UNUSED(point);
        }
    }
    // Memory management and reference counting
    {
        //! [Reference counting 1]
        std::vector<Point3f> points;
        // .. fill the array
        Mat pointsMat = Mat(points).reshape(1);
        //! [Reference counting 1]
        CV_UNUSED(pointsMat);
    }
    {
        //! [Reference counting 2]
        Mat img = imread("image.jpg");
        Mat img1 = img.clone();
        //! [Reference counting 2]
        CV_UNUSED(img1);
    }
    {
        //! [Reference counting 3]
        Mat img = imread("image.jpg");
        Mat sobelx;
        Sobel(img, sobelx, CV_32F, 1, 0);
        //! [Reference counting 3]
    }
    // Primitive operations
    {
        Mat img;
        {
            //! [Set image to black]
            img = Scalar(0);
            //! [Set image to black]
        }
        {
            //! [Select ROI]
            Rect r(10, 10, 100, 100);
            Mat smallImg = img(r);
            //! [Select ROI]
            CV_UNUSED(smallImg);
        }
    }
    {
        //! [BGR to Gray]
        Mat img = imread("image.jpg"); // loading a 8UC3 image
        Mat grey;
        cvtColor(img, grey, COLOR_BGR2GRAY);
        //! [BGR to Gray]
    }
    {
        Mat dst, src;
        //! [Convert to CV_32F]
        src.convertTo(dst, CV_32F);
        //! [Convert to CV_32F]
    }
    // Visualizing images
    {
        //! [imshow 1]
        Mat img = imread("image.jpg");
        namedWindow("image", WINDOW_AUTOSIZE);
        imshow("image", img);
        waitKey();
        //! [imshow 1]
    }
    {
        //! [imshow 2]
        Mat img = imread("image.jpg");
        Mat grey;
        cvtColor(img, grey, COLOR_BGR2GRAY);
        Mat sobelx;
        Sobel(grey, sobelx, CV_32F, 1, 0);
        double minVal, maxVal;
        minMaxLoc(sobelx, &minVal, &maxVal); //find minimum and maximum intensities
        Mat draw;
        sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
        namedWindow("image", WINDOW_AUTOSIZE);
        imshow("image", draw);
        waitKey();
        //! [imshow 2]
    }

    return 0;
}

{'repo_name': 'opencv/opencv', 'stars': '46380', 'repo_language': 'C++', 'file_name': 'porting_anisotropic_segmentation.markdown', 'mime_type': 'text/plain', 'hash': 2587542185850262306, 'source_dataset': 'data'}