text:
import unittest
import functools
import numpy

from traits.testing.api import UnittestTools
from traits.api import TraitError

from simphony.cuds.particles import Particles, Particle, Bond
from simphony.core.data_container import DataContainer
from simphony.core.cuba import CUBA

from simphony_mayavi.core.api import CUBADataExtractor

class TestCUBADataExtractor(UnittestTools, unittest.TestCase):

    def setUp(self):
        self.points = [
            [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
        self.temperature = numpy.arange(4)
        self.velocity = [
            (0.5, 0.5, 0.5), (1.0, 0.0, 1.0), (1.0, 1.0, 0.0), (1.0, 1.0, 1.0)]
        self.bonds = [[0, 1], [0, 3], [1, 3, 2]]
        self.container = Particles('test')

        # add particles
        particle_list = []
        for index, point in enumerate(self.points):
            data = DataContainer(
                TEMPERATURE=self.temperature[index],
                VELOCITY=self.velocity[index])
            particle_list.append(Particle(coordinates=point, data=data))
        self.point_uids = self.container.add(particle_list)

        # add bonds
        bond_iter = (Bond(particles=[self.point_uids[index]
                                     for index in indices],
                          data=DataContainer(NAME=str(len(indices))))
                     for indices in self.bonds)
        self.bond_uids = self.container.add(bond_iter)

    def test_initialization(self):
        container = self.container
        extractor = CUBADataExtractor(function=functools.partial(
            container.iter, item_type=CUBA.PARTICLE))
        self.assertEqual(
            extractor.available, set((CUBA.TEMPERATURE, CUBA.VELOCITY)))
        self.assertEqual(extractor.data, {})

    def test_selectinng_available(self):
        container = self.container
        extractor = CUBADataExtractor(function=functools.partial(
            container.iter, item_type=CUBA.PARTICLE))

        with self.assertTraitChanges(extractor, 'data', count=1):
            extractor.selected = CUBA.TEMPERATURE

        self.assertEqual(len(extractor.data), 4)
        for uid, data in extractor.data.iteritems():
            particle = container.get(uid)
            self.assertEqual(particle.data[CUBA.TEMPERATURE], data)

    def test_selecting_none(self):
        extractor = CUBADataExtractor(
            function=functools.partial(
                self.container.iter, item_type=CUBA.PARTICLE))

        with self.assertTraitChanges(extractor, 'data', count=2):
            extractor.selected = CUBA.TEMPERATURE
            extractor.selected = None

        self.assertEqual(extractor.data, {})

    def test_selecting_unavailable(self):
        container = self.container
        extractor = CUBADataExtractor(
            function=functools.partial(container.iter,
                                       item_type=CUBA.PARTICLE))

        with self.assertTraitChanges(extractor, 'data', count=1):
            extractor.selected = CUBA.NAME

        self.assertEqual(len(extractor.data), 4)
        for uid, data in extractor.data.iteritems():
            self.assertTrue(container.has(uid))
            self.assertEqual(data, None)

    def test_function_change(self):
        container = self.container
        extractor = CUBADataExtractor(
            function=functools.partial(container.iter,
                                       item_type=CUBA.PARTICLE))
        extractor.selected = CUBA.TEMPERATURE

        with self.assertRaises(TraitError):
            extractor.function = functools.partial(container.iter,
                                                   item_type=CUBA.BOND)

    def test_keys_filtering(self):
        container = self.container
        extractor = CUBADataExtractor(
            function=functools.partial(
                container.iter,
                item_type=CUBA.PARTICLE),
            keys=set(self.point_uids[:1]))
        extractor.selected = CUBA.TEMPERATURE

        particle = container.get(self.point_uids[0])
        self.assertEqual(
            extractor.data,
            {self.point_uids[0]: particle.data[CUBA.TEMPERATURE]})

    def test_keys_filtering_change(self):
        container = self.container
        extractor = CUBADataExtractor(
            function=functools.partial(
                container.iter,
                item_type=CUBA.PARTICLE), keys=set(self.point_uids[:1]))
        extractor.selected = CUBA.TEMPERATURE

        with self.assertTraitChanges(extractor, 'data', count=1):
            extractor.keys = set(self.point_uids)

        self.assertEqual(len(extractor.data), 4)
        for uid, data in extractor.data.iteritems():
            particle = container.get(uid)
            self.assertEqual(particle.data[CUBA.TEMPERATURE], data)


text:
<?php

namespace AlphaRPC\Manager\Protocol;

use AlphaRPC\Common\Protocol\Message\MessageAbstract;
use AlphaRPC\Common\Socket\Message;

/**
 * ClientHandlerJobRequest is the Message that the ClientHandler uses
 * to request the WorkerHandler to process a Job
 *
 * @author Jacob Kiers <jacob@alphacomm.nl>
 * @package AlphaRPC
 * @subpackage MessageTypes
 */
class WorkerStatusResponse extends MessageAbstract
{
    /**
     * Contains the worker status.
     *
     * @var array
     */
    protected $workerStatus;

    /**
     *
     * @param array $workerStatus
     */
    public function __construct(array $workerStatus)
    {
        $this->workerStatus = $workerStatus;
    }

    /**
     * Returns status of the workers.
     *
     * @return array
     */
    public function getWorkerStatus()
    {
        return $this->workerStatus;
    }

    /**
     * Creates an instance from the Message.
     *
     * @param Message $msg
     *
     * @return WorkerStatusResponse
     */
    public static function fromMessage(Message $msg)
    {
        $workerStatus = array();
        while ($msg->peek() !== null) {
            $id = $msg->shift();
            $actionCount = (int) $msg->shift();
            $actionList = array();
            for ($i = 0; $i < $actionCount; $i++) {
                $actionList[] = $msg->shift();
            }

            $workerStatus[$id] = array(
                'id'          => $id,
                'actionList'  => $actionList,
                'current'     => $msg->shift(),
                'ready'       => (bool) $msg->shift(),
                'valid'       => (bool) $msg->shift(),
            );
        }

        return new self($workerStatus);
    }

    /**
     * Create a new Message from this instance.
     *
     * @return Message
     */
    public function toMessage()
    {
        $m = new Message();

        /* @var $w Worker */
        foreach ($this->workerStatus as $w) {
            $m->push($w['id']);
            $m->push(count($w['actionList']));
            $m->append($w['actionList']);
            $m->push($w['current']);
            $m->push($w['ready']);
            $m->push($w['valid']);
        }

        return $m;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.spark.network.shuffle.mesos;

import java.io.IOException;
import java.nio.ByteBuffer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.spark.network.client.RpcResponseCallback;
import org.apache.spark.network.client.TransportClient;
import org.apache.spark.network.sasl.SecretKeyHolder;
import org.apache.spark.network.shuffle.ExternalShuffleClient;
import org.apache.spark.network.shuffle.protocol.mesos.RegisterDriver;
import org.apache.spark.network.util.TransportConf;

/**
 * A client for talking to the external shuffle service in Mesos coarse-grained mode.
 *
 * This is used by the Spark driver to register with each external shuffle service on the cluster.
 * The reason why the driver has to talk to the service is for cleaning up shuffle files reliably
 * after the application exits. Mesos does not provide a great alternative to do this, so Spark
 * has to detect this itself.
 */
public class MesosExternalShuffleClient extends ExternalShuffleClient {
  private final Logger logger = LoggerFactory.getLogger(MesosExternalShuffleClient.class);

  /**
   * Creates an Mesos external shuffle client that wraps the {@link ExternalShuffleClient}.
   * Please refer to docs on {@link ExternalShuffleClient} for more information.
   */
  public MesosExternalShuffleClient(
      TransportConf conf,
      SecretKeyHolder secretKeyHolder,
      boolean saslEnabled,
      boolean saslEncryptionEnabled) {
    super(conf, secretKeyHolder, saslEnabled, saslEncryptionEnabled);
  }

  public void registerDriverWithShuffleService(String host, int port) throws IOException {
    checkInit();
    ByteBuffer registerDriver = new RegisterDriver(appId).toByteBuffer();
    TransportClient client = clientFactory.createClient(host, port);
    client.sendRpc(registerDriver, new RpcResponseCallback() {
      @Override
      public void onSuccess(ByteBuffer response) {
        logger.info("Successfully registered app " + appId + " with external shuffle service.");
      }

      @Override
      public void onFailure(Throwable e) {
        logger.warn("Unable to register app " + appId + " with external shuffle service. " +
          "Please manually remove shuffle data after driver exit. Error: " + e);
      }
    });
  }
}


text:
'use strict'

import React, { Component } from 'react'
import {
  View,
  Image,
  Text,
  TouchableHighlight,
  ListView,
} from 'react-native'

import { Actions } from 'react-native-router-flux'
import Icon from 'react-native-vector-icons/Ionicons';
import { connect } from 'react-redux'
import Dropdown from 'react-native-modal-dropdown';

import {
  importImage,
  handlePhotoTap,
  handleSetFolder,
} from '../actions/homeActions';

import { styles } from '../styles'

class Home extends Component  {
  render() {
    let options = this.props.folderList.slice();
    let label = this.props.folder;
    if (!label) label = "Select Folder...";

    return (
      <View style={styles.lightContainer}>
        <Dropdown onSelect={i => {
            this.props.handleSetFolder(options[i])
          }}
          animated={false}
          defaultValue={label}
          options={options}
          style={styles.dropdownButton}
          textStyle={styles.dropdownText}
          dropdownStyle={styles.dropdownOptions}
          dropdownTextStyle={styles.dropdownOptionsText}
          />

        <View style={styles.topContainer}>
          <ListView contentContainerStyle={styles.list}
            enableEmptySections={true}
            dataSource={this.props.ds}
            pageSize={9} // Needs to be a multiple of the number of
            // cells per row or else they will be gaps
            // when the rows are loaded
            renderRow={(rowData, sectionID, rowID, highlightRow) =>
                <TouchableHighlight
                  underlayColor='transparent'
                  onPress={ () => {
                    console.log("here", this.props.unfilteredImages);
                    this.props.handlePhotoTap(rowData.image_index)
                  }}>
                  <Image
                    style={styles.item}
                    resizeMode='cover'
                    source={{uri: rowData.image}} />
                </TouchableHighlight>
            } />

        </View>

        <View style={styles.bottomContainer}>

            <TouchableHighlight
                onPress={ Actions.info }
                style={styles.smallIconButton}>
                <Icon name="ios-information-circle-outline" style={styles.icon}> </Icon>
            </TouchableHighlight>

            <TouchableHighlight
                onPress={() => this.props.importImage(this.props.folder) }
                  style={styles.button}
                  accessibilityLabel="Import Photos">
                <Text style={styles.wordText}>Import Photos</Text>
            </TouchableHighlight>

            <TouchableHighlight
                onPress={ Actions.help }
                style={styles.smallIconButton}>
                <Icon name="ios-help-circle-outline" style={styles.icon}> </Icon>
            </TouchableHighlight>
        </View>

        </View>
    );
  }
}

const mapDispatchToProps = {
  importImage,
  handlePhotoTap,
  handleSetFolder,
}

const mapStateToProps = (state) => {
  const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
  ds.removeClippedSubviews = false;
  var filtered_images = state.images.image_list.filter(image => image.folder === state.images.folder);
  var images = ds.cloneWithRows(filtered_images);
  return {
    "ds": images,
    "unfilteredImages": state.images.image_list,
    "folder": state.images.folder,
    "folderList": state.images.folder_list,
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(Home);


text:
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE DataKinds, EmptyDataDecls,  TypeInType, TypeOperators, ExistentialQuantification, RankNTypes, DefaultSignatures,
GADTs, DuplicateRecordFields, PatternSynonyms, DeriveTraversable, DeriveGeneric, DeriveDataTypeable, DeriveLift, StandaloneDeriving, DeriveAnyClass #-}

module GRIN.LowLevelGrin where

import qualified Data.Map.Strict as Map
import Data.Text
--import GHC.TypeLits
import GHC.Generics
import Data.Data
import Data.Kind
import GRIN.GrinValue
import Control.Lens.Plated
import GRIN.GrinIdentifiers
import GRIN.GrinValue
import GRIN.GrinTag

type Val = GrinValue
type Name = GrinIdentifier
type VariableName = GrinIdentifier
type FunctionName = GrinIdentifier

type FieldOffset = Int

data StackOrHeap = Stack | Heap deriving (Data, Show, Eq)

-- ^ Low-level GRIN instructions. These allow for more fine-grained optimisations and easier translation to the next language in the pipeline, especially LLVM.
data LowLevelSimpleExpression ext f a where
  Alloc :: {size :: Val f a, allocateWhere :: Maybe StackOrHeap} -> LowLevelSimpleExpression ext f a -- ^ Ask for a pointer to a store in the heap with maximum size 'size'.
  Dealloc :: {target :: Pointer a} -> LowLevelSimpleExpression ext f a -- ^ We can insert Deallocs when the variable is dead and nothing points to its value (from the sharing analysis)
  FetchUpdate :: {source :: Name, destination :: Name} -> LowLevelSimpleExpression ext f a -- ^ Copies the node pointed to by 'source' and puts it in 'destination'.
  FetchField :: {name :: Name, offset :: FieldOffset, tag ::  Maybe Tag } -> LowLevelSimpleExpression ext f a -- ^ Fetch individual fields, rather than the entire node. Offset 0 is the tag.

  deriving  (Typeable)

data LowLevelGrin

deriving instance (ValueConstraint f a) => Data (LowLevelSimpleExpression LowLevelGrin f a)
deriving instance Functor (LowLevelSimpleExpression ext f)
deriving instance Foldable (LowLevelSimpleExpression ext f)
deriving instance Traversable (LowLevelSimpleExpression ext f)
deriving instance (Show a, Show (f (Val f a))) => Show (LowLevelSimpleExpression ext f a)


text:
#ifndef BUBBLEFS_PALTFORM_APOLLO_TIMER_H_
#define BUBBLEFS_PALTFORM_APOLLO_TIMER_H_

#include <stdint.h>
#include <chrono>
#include <string>

#include "platform/macros.h"

namespace bubblefs {
namespace myapollo {
namespace common {
namespace time {

using TimePoint = std::chrono::system_clock::time_point;

class Timer {
 public:
  Timer() = default;

  // no-thread safe.
  void Start();

  // return the elapsed time,
  // also output msg and time in glog.
  // automatically start a new timer.
  // no-thread safe.
  uint64_t End(const std::string &msg);

 private:
  // in ms.
  TimePoint start_time_;
  TimePoint end_time_;

  DISALLOW_COPY_AND_ASSIGN(Timer);
};

class TimerWrapper {
 public:
  explicit TimerWrapper(const std::string &msg) : msg_(msg) {
    timer_.Start();
  }

  ~TimerWrapper() {
    timer_.End(msg_);
  }

 private:
  Timer timer_;
  std::string msg_;

  DISALLOW_COPY_AND_ASSIGN(TimerWrapper);
};

}  // namespace time
}  // namespace common
}  // namespace myapollo
}  // namespace bubblefs

#endif  // BUBBLEFS_PALTFORM_APOLLO_TIMER_H_


text:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;

using Duality;
using Duality.Resources;
using Duality.Components;
using Duality.Serialization;
using Duality.Tests.Components;

using OpenTK;
using NUnit.Framework;

namespace Duality.Tests.Resources
{
	[TestFixture]
	public class ICmpInitializableTest
	{
		private Scene scene;
		private GameObject obj;

		[SetUp] public void Setup()
		{
			this.scene = new Scene();
			this.obj = new GameObject("TestObject");
			this.scene.AddObject(this.obj);
		}
		[TearDown] public void Teardown()
		{
			this.scene.Dispose();
			this.scene		= null;
			this.obj		= null;
		}

		[Test] public void AddRemove()
		{
			InitializableEventReceiver initTester = new InitializableEventReceiver();

			// Adding and Removing
			this.obj.AddComponent(initTester);
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.AddToGameObject));
			this.obj.RemoveComponent(initTester);
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.RemovingFromGameObject));
		}
		[Test] public void ActivateDeactivate()
		{
			InitializableEventReceiver initTester = this.obj.AddComponent<InitializableEventReceiver>();

			// Activate by Scene.Current
			Scene.SwitchTo(this.scene, true);
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Activate));
			initTester.Reset();

			// Deactivate by GameObject.Active
			this.obj.Active = false;
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
			initTester.Reset();

			// Activate by GameObject.Active
			this.obj.Active = true;
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Activate));
			initTester.Reset();

			// Deactivate by Component.Active
			initTester.Active = false;
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
			initTester.Reset();

			// Activate by Component.Active
			initTester.Active = true;
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Activate));
			initTester.Reset();

			// Deactivate by Scene.Current
			Scene.SwitchTo(null, true);
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
			initTester.Reset();
		}
		[Test] public void DeactivateGameObjectDispose()
		{
			InitializableEventReceiver initTester = this.obj.AddComponent<InitializableEventReceiver>();
			Scene.SwitchTo(this.scene, true);
			this.obj.Dispose();
			DualityApp.RunCleanup(); // Need to run cleanup, so disposed GameObjects will be processed.
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
		}
		[Test] public void DeactivateComponentDispose()
		{
			InitializableEventReceiver initTester = this.obj.AddComponent<InitializableEventReceiver>();
			Scene.SwitchTo(this.scene, true);
			initTester.Dispose();
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
		}
		[Test] public void DeactivateSceneDispose()
		{
			InitializableEventReceiver initTester = this.obj.AddComponent<InitializableEventReceiver>();
			Scene.SwitchTo(this.scene, true);
			this.scene.Dispose();
			Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Deactivate));
		}
		[Test] public void Serialize()
		{
			InitializableEventReceiver initTester = this.obj.AddComponent<InitializableEventReceiver>();
			using (MemoryStream stream = new MemoryStream())
			{
				this.scene.Save(stream);
				Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Saving));
				Assert.IsTrue(initTester.HasReceived(InitializableEventReceiver.EventFlag.Saved));

				stream.Seek(0, SeekOrigin.Begin);
				this.scene = Resource.Load<Scene>(stream);
				Assert.IsTrue(this.scene.FindComponent<InitializableEventReceiver>().HasReceived(InitializableEventReceiver.EventFlag.Loaded));
			}
		}
	}
}


text:
import { Box, Text } from '@tlon/indigo-react';
import React, { ReactElement } from 'react';

const SubmitDragger = (): ReactElement => (
  <Box
    top={0}
    bottom={0}
    left={0}
    right={0}
    position='absolute'
    backgroundColor='white'
    height='100%'
    width='100%'
    display='flex'
    alignItems='center'
    justifyContent='center'
    style={{ pointerEvents: 'none', zIndex: 999 }}
  >
      <Text fontSize={1} color='black'>
        Drop a file to upload
      </Text>
    </Box>
);

export default SubmitDragger;


text:
package net.cazzar.mods.jukeboxreloaded.client.particles;

import net.minecraft.world.World;

public class EntityDoubleQuaverFX extends EntityNoteFX {
    public EntityDoubleQuaverFX(World world, double x, double y, double z) {
        super(world, x, y, z);
        setParticleIcon(ParticleIcons.DOUBLE_QUAVER);
    }
}


text:
Dreamweaver-Colors
==================

Color setting files for Dreamweaver

	/Applications/Adobe Dreamweaver [version]/Configuration/CodeColoring

* I haven't tested these...


text:
namespace blink {

namespace {

bool ValidateNamedArrayBufferViews(
    const MLNamedArrayBufferViews& named_array_buffer_views,
    const HashMap<String, MLGraph::ResourceInfo>& resources_info,
    String& error_message) {
  if (named_array_buffer_views.size() !=
      base::checked_cast<wtf_size_t>(resources_info.size())) {
    error_message = String::Format(
        "The number (%u) of the array buffer views doesn't match the "
        "expectation (%u).",
        named_array_buffer_views.size(),
        base::checked_cast<wtf_size_t>(resources_info.size()));
    return false;
  }
  for (const auto& named_array_buffer_view : named_array_buffer_views) {
    const auto& [name, array_buffer_or_view] = named_array_buffer_view;
    if (!resources_info.Contains(name)) {
      error_message = String::Format("The name \"%s\" isn't part of the graph.",
                                     name.Utf8().c_str());
      return false;
    }
    const auto& info = resources_info.at(name);
    if (!array_buffer_or_view->IsArrayBufferView()) {
      error_message = String::Format(
          "The object with name \"%s\" is not an ArrayBufferView.",
          name.Utf8().c_str());
      return false;
    }
    auto* array_buffer_view =
        array_buffer_or_view->GetAsArrayBufferView().Get();
    if (array_buffer_view->GetType() != GetArrayBufferViewType(info.type)) {
      error_message = String::Format(
          "The type (%s) of the array buffer view with name \"%s\" doesn't "
          "match the expected operand type (%s).",
          array_buffer_view->TypeName(), name.Utf8().c_str(),
          V8MLOperandType(info.type).AsCStr());
      return false;
    }
    if (array_buffer_view->byteLength() != info.byte_length) {
      error_message = String::Format(
          "The byte length (%zu) of the array buffer view with name \"%s\" "
          "doesn't match the expected byte length (%zu).",
          array_buffer_view->byteLength(), name.Utf8().c_str(),
          info.byte_length);
      return false;
    }
  }
  return true;
}

}  // namespace

MLGraph::MLGraph(MLContext* context) : ml_context_(context) {}

MLGraph::~MLGraph() = default;

void MLGraph::Trace(Visitor* visitor) const {
  visitor->Trace(ml_context_);
  ScriptWrappable::Trace(visitor);
}

const HashMap<String, MLGraph::ResourceInfo>& MLGraph::GetInputResourcesInfo()
    const {
  DCHECK(resources_info_initialized_);
  return input_resources_info_;
}

const HashMap<String, MLGraph::ResourceInfo>& MLGraph::GetOutputResourcesInfo()
    const {
  DCHECK(resources_info_initialized_);
  return output_resources_info_;
}

void MLGraph::ComputeAsync(const MLNamedArrayBufferViews& inputs,
                           const MLNamedArrayBufferViews& outputs,
                           ScriptPromiseResolver* resolver) {
  // The MLGraph object should be initialized before computing.
  DCHECK(resources_info_initialized_);

  // Validate the input and output MLNamedArrayBufferViews.
  String error_message;
  if (!ValidateNamedArrayBufferViews(inputs, input_resources_info_,
                                     error_message)) {
    resolver->Reject(MakeGarbageCollected<DOMException>(
        DOMExceptionCode::kDataError, "Invalid inputs: " + error_message));
    return;
  }
  if (!ValidateNamedArrayBufferViews(outputs, output_resources_info_,
                                     error_message)) {
    resolver->Reject(MakeGarbageCollected<DOMException>(
        DOMExceptionCode::kDataError, "Invalid outputs: " + error_message));
    return;
  }

  // Call ComputeAsyncImpl() implemented by an MLGraph backend.
  ComputeAsyncImpl(inputs, outputs, resolver);
}

void MLGraph::BuildAsync(const MLNamedOperands& named_outputs,
                         ScriptPromiseResolver* resolver) {
  String error_message;
  if (!ValidateAndInitializeResourcesInfo(named_outputs, error_message)) {
    resolver->Reject(MakeGarbageCollected<DOMException>(
        DOMExceptionCode::kDataError, error_message));
    return;
  }
  BuildAsyncImpl(named_outputs, resolver);
}

MLGraph* MLGraph::BuildSync(const MLNamedOperands& named_outputs,
                            ExceptionState& exception_state) {
  String error_message;
  if (!ValidateAndInitializeResourcesInfo(named_outputs, error_message)) {
    exception_state.ThrowDOMException(DOMExceptionCode::kDataError,
                                      error_message);
    return nullptr;
  }
  return BuildSyncImpl(named_outputs, exception_state);
}

bool MLGraph::ValidateAndInitializeResourcesInfo(
    const MLNamedOperands& named_outputs,
    String& error_message) {
  DCHECK(!resources_info_initialized_);

  // The outputs should not be empty.
  if (named_outputs.empty()) {
    error_message = "At least one output needs to be provided.";
    return false;
  }

  // The queue and visited set of operators that help implement the
  // breadth-first graph traversal:
  // https://en.wikipedia.org/wiki/Breadth-first_search
  HeapDeque<Member<const MLOperator>> operators_queue;
  HeapHashSet<Member<const MLOperator>> visited_operators;

  // Validate the named outputs, setup corresponding output resource info and
  // initialize the queue and visited set with their dependent operators.
  for (const auto& output : named_outputs) {
    const auto& name = output.first;
    const auto& operand = output.second;
    // Validate whether it is an output operand.
    if (operand->Kind() != MLOperand::OperandKind::kOutput) {
      error_message = String::Format(
          "The operand with name \"%s\" is not an output operand.",
          name.Utf8().c_str());
      return false;
    }
    // Setup resource info for this output operand.
    output_resources_info_.insert(
        name, ResourceInfo({.type = operand->Type(),
                            .byte_length = operand->ByteLength()}));
    // Mark its dependent operator is visited.
    visited_operators.insert(operand->Operator());
    // Enqueue its dependent operator.
    operators_queue.push_back(operand->Operator());
  }

  while (operators_queue.size() > 0) {
    // If the queue is not empty, dequeue an operator from the queue.
    const auto current_operator = operators_queue.TakeFirst();
    // Enumerate the current operator's input operands.
    for (const auto& operand : current_operator->Inputs()) {
      switch (operand->Kind()) {
        case MLOperand::OperandKind::kOutput:
          DCHECK(operand->Operator());
          // If the operand is an output operand and its dependent operator is
          // not visited, mark the dependent operator is visited and enqueue
          // it.
          if (!visited_operators.Contains(operand->Operator())) {
            visited_operators.insert(operand->Operator());
            operators_queue.push_back(operand->Operator());
          }
          break;
        case MLOperand::OperandKind::kInput:
          // If the operand is an input operand, validate whether its name is
          // unique.
          if (input_resources_info_.Contains(operand->Name())) {
            error_message =
                String::Format("The input name \"%s\" is duplicated.",
                               operand->Name().Utf8().c_str());
            return false;
          }
          // Setup resource info for this input operand.
          input_resources_info_.insert(
              operand->Name(),
              ResourceInfo({.type = operand->Type(),
                            .byte_length = operand->ByteLength()}));
          break;
        case MLOperand::OperandKind::kConstant:
          // If the operand is a constant operand, there is no check needed.
          break;
      }
    }
  }
  resources_info_initialized_ = true;
  return true;
}

}  // namespace blink


text:
from oslo_policy import policy

from nova.policies import base

POLICY_ROOT = 'os_compute_api:os-suspend-server:%s'

suspend_server_policies = [
    base.create_rule_default(
        POLICY_ROOT % 'resume',
        base.RULE_ADMIN_OR_OWNER,
        "Resume suspended server",
        [
            {
                'method': 'POST',
                'path': '/servers/{server_id}/action (resume)'
            }
        ]),
    base.create_rule_default(
        POLICY_ROOT % 'suspend',
        base.RULE_ADMIN_OR_OWNER,
        "Suspend server",
        [
            {
                'method': 'POST',
                'path': '/servers/{server_id}/action (suspend)'
            }
        ]),
    policy.RuleDefault(
        name=POLICY_ROOT % 'discoverable',
        check_str=base.RULE_ANY),
]

def list_rules():
    return suspend_server_policies


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Sample Deployment for codedeploy with github 3</title>

Congratulations

This application was deployed using AWS CodeDeploy. with GitHub 2 KMT staging eaie

For next steps, read the AWS CodeDeploy Documentation.


text:
using HyperMock.Exceptions;
using HyperMock.IntTests.Support;
using Shouldly;
using Xunit;

namespace HyperMock.IntTests
{
    public class StrictSetupFunctionTests
    {
        [Fact]
        public void CallThrowsStrictMockViolationExceptionForUnSetupMockFunction()
        {
            var accountServiceMock = Mock.Create<IAccountService>(MockBehavior.Strict);
            var info = new AccountInfo { Number = "12345678", DebitAmount = 100 };
            var subject = new AccountController(accountServiceMock.Object);

            Should.Throw<StrictMockViolationException>(() => subject.Debit(info));
        }
    }
}


text:
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Newtonsoft.Json;

namespace EzDSC
{
    internal class EzSettings
    {
        public string LastRepositoryPath;
        public FormWindowState WindowState = FormWindowState.Normal;
        public Size WindowSize = new Size(1200, 600);

        public static string GetPath()
        {
            return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\EzDSC\\settings.json";
        }

        public static EzSettings Load()
        {
            string path = GetPath();
            FileSystem.DirectoryCreateIfNotExists(Path.GetDirectoryName(path));
            return !File.Exists(path) ? new EzSettings() : JsonConvert.DeserializeObject<EzSettings>(File.ReadAllText(path));
        }

        public void Save()
        {
            File.WriteAllText(GetPath(), JsonConvert.SerializeObject(this, Formatting.Indented));
        }
    }
}


text:
<?php

namespace Icoding\Widgets;

use Arrilot\Widgets\AbstractWidget;

use Icoding\Models\PermissionModel;

class DashboardSiderWidget extends AbstractWidget
{
    /**
     * The configuration array.
     *
     * @var array
     */
    protected $config = [];

    /**
     * Treat this method as a controller action.
     * Return view() or other content to display.
     */
    public function run()
    {
        $user = \Auth::user();

        // 当前菜单
        $current = $user->cachedPermissionsByName(\Route::currentRouteName());

        $currentFamily = [];
        $kinship = explode('-', trim($current['kinship'], '-'));

        foreach ($kinship as $ii){
            $level = $user->cachedPermissionsById($ii);
            $level['title'] = $level['display_name'];
            array_push($currentFamily, $level);
        }

        // 获取用户菜单
        $menus = $user->cachedMenus();

        return view("widgets.dashboard_sider", [
            'menus' => $menus,
            'kinship' => $kinship,
            'current' => $currentFamily,
        ]);
    }
}


text:
from django.forms import ModelForm
from spotify.models import User
from django import forms

class UserForm(ModelForm):
    class Meta:
            model = User
            fields = ['username', 'password']
            widgets = {
                'username': forms.TextInput(attrs={'required':'true'}),
                'password': forms.PasswordInput(attrs={'required':'true'})

            }

class RegistrationForm(ModelForm):
    class Meta:
            model = User
            fields = ['username', 'password', 'first_name', 'last_name', 'email']
            widgets = {
                'username': forms.TextInput(attrs={'required':'true'}),
                'password': forms.PasswordInput(attrs={'required':'true'}),
                'first_name': forms.TextInput(attrs={'required':'true'}),
                'last_name': forms.TextInput(attrs={'required':'true'}),
                'email': forms.EmailInput(attrs={'required':'true'})

            }


text:
'Copyright 2019 Esri

'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.
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Drawing
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ADF.CATIDs
Imports ESRI.ArcGIS.Controls
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Geometry

  ''' <summary>
  ''' Summary description for AddMyDynamicLayerCmd.
  ''' </summary>
  <Guid("0ddfd2b0-45ba-416a-93c8-c7db41de30e4"), ClassInterface(ClassInterfaceType.None), ComVisible(True), ProgId("AddMyDynamicLayerCmd")> _
  Public NotInheritable Class AddMyDynamicLayerCmd : Inherits BaseCommand
	#Region "COM Registration Function(s)"
	<ComRegisterFunction(), ComVisible(False)> _
	Private Shared Sub RegisterFunction(ByVal registerType As Type)
	  ' Required for ArcGIS Component Category Registrar support
	  ArcGISCategoryRegistration(registerType)

	  '
	  ' TODO: Add any COM registration code here
	  '
	End Sub

	<ComUnregisterFunction(), ComVisible(False)> _
	Private Shared Sub UnregisterFunction(ByVal registerType As Type)
	  ' Required for ArcGIS Component Category Registrar support
	  ArcGISCategoryUnregistration(registerType)

	  '
	  ' TODO: Add any COM unregistration code here
	  '
	End Sub

	#Region "ArcGIS Component Category Registrar generated code"
	''' <summary>
	''' Required method for ArcGIS Component Category registration -
	''' Do not modify the contents of this method with the code editor.
	''' </summary>
	Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
	  Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
	  ControlsCommands.Register(regKey)

	End Sub
	''' <summary>
	''' Required method for ArcGIS Component Category unregistration -
	''' Do not modify the contents of this method with the code editor.
	''' </summary>
	Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
	  Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
	  ControlsCommands.Unregister(regKey)

	End Sub

	#End Region
	#End Region

	Private m_hookHelper As IHookHelper = Nothing
	Private m_dynamicLayer As MyDynamicLayerClass = Nothing
	Private m_bIsConnected As Boolean = False
	Private m_bOnce As Boolean = True

	Public Sub New()
	  MyBase.m_category = ".NET Samples"
	  MyBase.m_caption = "Add Dynamic Layer"
	  MyBase.m_message = "Add Dynamic Layer"
	  MyBase.m_toolTip = "Add Dynamic Layer"
	  MyBase.m_name = "AddMyDynamicLayerCmd"

	  Try
			Dim bitmapResourceName As String = Me.GetType().Name & ".bmp"
			MyBase.m_bitmap = New Bitmap(Me.GetType(), bitmapResourceName)
	  Catch ex As Exception
			System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap")
	  End Try
	End Sub

#Region "Overridden Class Methods"

    ''' <summary>
    ''' Occurs when this command is created
    ''' </summary>
    ''' <param name="hook">Instance of the application</param>
    Public Overrides Sub OnCreate(ByVal hook As Object)
        If hook Is Nothing Then
            Return
        End If

        If m_hookHelper Is Nothing Then
            m_hookHelper = New HookHelperClass()
        End If

        m_hookHelper.Hook = hook
    End Sub

    ''' <summary>
    ''' Occurs when this command is clicked
    ''' </summary>
    Public Overrides Sub OnClick()
        'make sure to switch into dynamic mode
        Dim dynamicMap As IDynamicMap = TryCast(m_hookHelper.FocusMap, IDynamicMap)
        'make sure that the current Map supports the DynamicDisplay
        If Nothing Is dynamicMap Then
            Return
        End If

        If (Not m_bIsConnected) Then
            'make sure to switch into dynamic mode
            If (Not dynamicMap.DynamicMapEnabled) Then
                dynamicMap.DynamicMapEnabled = True
            End If

            'do some initializations...
            If m_bOnce Then
                'initialize the dynamic layer
                m_dynamicLayer = New MyDynamicLayerClass()
                m_dynamicLayer.Name = "Dynamic Layer"

                m_bOnce = False
            End If

            'make sure that the layer did not get added to the map
            Dim bLayerHasBeenAdded As Boolean = False
            If m_hookHelper.FocusMap.LayerCount > 0 Then
                Dim layers As IEnumLayer = m_hookHelper.FocusMap.Layers(Nothing, False)
                layers.Reset()
                Dim layer As ILayer = layers.Next()
                Do While Not layer Is Nothing
                    If TypeOf layer Is MyDynamicLayerClass Then
                        bLayerHasBeenAdded = True
                        Exit Do
                    End If
                    layer = layers.Next()
                Loop
            End If

            If (Not bLayerHasBeenAdded) Then
                'add the dynamic layer to the map
                m_hookHelper.FocusMap.AddLayer(m_dynamicLayer)
            End If
            'connect to the synthetic data source
            m_dynamicLayer.Connect()
        Else
            'disconnect to the synthetic data source
            m_dynamicLayer.Disconnect()

            'delete the layer from the map
            m_hookHelper.FocusMap.DeleteLayer(m_dynamicLayer)

            'disable the dynamic display
            If dynamicMap.DynamicMapEnabled Then
                dynamicMap.DynamicMapEnabled = False
            End If
        End If

        'set the connected flag
        m_bIsConnected = Not m_bIsConnected
    End Sub

    ''' <summary>
    ''' set the state of the button of the command
    ''' </summary>
    Public Overrides ReadOnly Property Checked() As Boolean
        Get
            Return m_bIsConnected
        End Get
    End Property

#End Region

  End Class


text:
<?php
include_once("google/config.php");
include_once("google/includes/functions.php");

//print_r($_GET);die;

if(isset($_REQUEST['code'])){
  $gClient->authenticate();
  $_SESSION['token'] = $gClient->getAccessToken();
  header('Location: ' . filter_var($redirectUrl, FILTER_SANITIZE_URL));
}

if (isset($_SESSION['token'])) {
  $gClient->setAccessToken($_SESSION['token']);
}

if ($gClient->getAccessToken()) {
  $userProfile = $google_oauthV2->userinfo->get();
  //DB Insert
  $gUser = new Users();
  $gUser->checkUser('google',$userProfile['id'],$userProfile['given_name'],$userProfile['family_name'],$userProfile['email'],$userProfile['gender'],$userProfile['locale'],$userProfile['link'],$userProfile['picture']);
  $_SESSION['google_data'] = $userProfile; // Storing Google User Data in Session
  header("location: ");
  $_SESSION['token'] = $gClient->getAccessToken();
} else {
  $authUrl = $gClient->createAuthUrl();
}
?>
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
    <title>JUIT||E-CELL</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="css/material.min.css">
    <link rel="stylesheet" href="https://code.getmdl.io/1.1.1/material.indigo-pink.min.css">
    <link rel="stylesheet" href="css/styles.css">
    <link href="themes/1/js-image-slider.css" rel="stylesheet" type="text/css" />

    <link href="generic.css" rel="stylesheet" type="text/css" />

              search

              <input class="mdl-textfield__input" type="text" id="search-field">

          <?php  if(isset($_SESSION["loggedin_user_id"]) || !empty($_SESSION["user"])){
              $user = $_SESSION["user"];
              echo 'pictureUrl.' style="height:50px;width:50px;border-radius:50px;" id="pro">';
              $logout = 'linkedin/logout.php?logout';
              $_SESSION['linkedin'] = $user->id;
            }
              else{
             echo'
             <button class="android-more-button mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect" id="more-button">
            more_vert
          </button>

<button id="show-dialog" class="mdl-button" style="width:100%;">Login

<button id="show-dialog1" class="mdl-button" style="width:100%;">Signup

';
               } ?>

<a href=<?php echo $logout;?> style="text-decoration:none;" class="ho">power_settings_new  Logout

account_circle  Profile

          Home

          Blogs & Forums
          Blogs
          Forums

          Galleries
          Photos
          Videos

          About
          Our Team
          About us

          Contact us

    Event Calender

    News Feed

<marquee bgcolor=white style="height: 600px;width: 100%;" direction=up scrollamount="3" onmouseover="this.stop();" onmouseout="this.start();">
<?php
$dbServer = 'localhost';
    $dbUsername = 'root';
    $dbPassword = '';
    $dbName = 'ecell';
$conn = mysql_connect($dbServer, $dbUsername, $dbPassword);
mysql_select_db($dbName);
    if (!$conn) {
    die("Connection failed: " . $conn->connect_error);
    }
    else{
      $userTable='news';
$sqli = "SELECT * FROM $userTable";
$resultin = mysql_query($sqli);
    while($h = mysql_fetch_array($resultin)) {

?>

<?php echo $h[1];?>

<?php echo $h[2];?>

<?php }}?>
 </marquee>

The best of your Entrepreneurship can be Cherished.

                Android works perfectly with your favourite apps like Google Maps,
                Calendar and YouTube.

More from Ecell

Vision

                We believe that entrepreneurship is the key that can unlock India's latent inventive potential. It will not only push India to the forefront of the world but also help raise the quality of life in the country.

Achievements

                Ecell, through its activities and competitions, has served as the guiding torch to many individuals to start their own ventures.

Success Stories

                These successes have not been entirely ours.It has been a slow and rewarding journey for us as well as the participants who participated in Eureka! . A quick look at some of the most successful ventures that have sprung out of Eureka! over the years.

Goals

Sow the seeds of entrepreneurial leadership across all disciplines

Facilitate entrepreneurial activity on campus

Bridge the gap between industry and the academic curriculum

Build a high-quality ecosystem on campus to support resource-strapped startup ventures

              <button class="mdl-mega-footer--social-btn" style="background:#fff;"></button>

              <button class="mdl-mega-footer--social-btn" style="background:#fff;"></button>

              <button class="mdl-mega-footer--social-btn" style="background:#fff;"></button>

                Back to Top
                expand_less

 © 2016 Ecell, JUIT

Some features may not be available in all devices.

    <dialog class="mdl-dialog">
    <button type="button" class="mdl-button close" style="left:80%;">✖</button>

Login

<?php echo '

';?>

</dialog>


text:
package net.minecraft.stats;

import net.minecraft.item.Item;
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.util.IChatComponent;

public class StatCrafting extends StatBase
{
    private final Item field_150960_a;

    public StatCrafting(String p_i45910_1_, String p_i45910_2_, IChatComponent statNameIn, Item p_i45910_4_)
    {
        super(p_i45910_1_ + p_i45910_2_, statNameIn);
        this.field_150960_a = p_i45910_4_;
        int i = Item.getIdFromItem(p_i45910_4_);

        if (i != 0)
        {
            IScoreObjectiveCriteria.INSTANCES.put(p_i45910_1_ + i, this.func_150952_k());
        }
    }
}


text:
import aarForm from 'mk-aar-form'

function actionCreator(option){
    return {
        formAction: new aarForm.action(option)
    }
}

export default {
    actionCreator
}


text:
using Orleans.Transactions.TestKit.xUnit;
using Xunit;
using Xunit.Abstractions;

namespace Orleans.Transactions.AzureStorage.Tests
{
    [TestCategory("AzureStorage"), TestCategory("Transactions-dev")]
    public class ConsistencyFaultInjectionTests: ConsistencyTransactionTestRunnerxUnit, IClassFixture<RandomFaultInjectedTestFixture>
    {
        public ConsistencyFaultInjectionTests(RandomFaultInjectedTestFixture fixture, ITestOutputHelper output)
            : base(fixture.GrainFactory, output)
        { }

        protected override bool StorageAdaptorHasLimitedCommitSpace => true;
        protected override bool StorageErrorInjectionActive => true;
    }
}


text:
class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  #before_action :authenticate_beta if Rails.env.development? && Rails.application.config.TEST_ADMIN_PWD!=''
  #before_action :authenticate_beta if Rails.env.development?

  def authenticate_beta
    authenticate_or_request_with_http_basic('Administration') do |username, password|
      #username == 'admin' && password == Rails.application.config.TEST_ADMIN_PWD
      username == 'admin' && password == 'admin'
    end
  end

end


text:
package com.google.code.validationframework.base.transform.map;

import com.google.code.validationframework.api.transform.Transformer;

import java.util.Collection;
import java.util.Map;

/**
 * Transformer getting a map as input and returning its values as output.
 *
 * @param <I> Type of map to get the values from.
 */
public class GetMapValuesTransformer<I extends Map<?, V>, V> implements Transformer<I, Collection<V>> {

    /**
     * @see Transformer#transform(Object)
     */
    @Override
    public Collection<V> transform(I input) {
        return input.values();
    }
}


text:
#ifndef _ROM_GPIO_H_
#define _ROM_GPIO_H_

#include <stdint.h>
#include <stdbool.h>

#include "esp_attr.h"
#include "soc/gpio_reg.h"

#ifdef __cplusplus
extern "C" {
#endif

/** \defgroup gpio_apis, uart configuration and communication related apis
  * @brief gpio apis
  */

/** @addtogroup gpio_apis
  * @{
  */

#define GPIO_REG_READ(reg)              READ_PERI_REG(reg)
#define GPIO_REG_WRITE(reg, val)        WRITE_PERI_REG(reg, val)
#define GPIO_ID_PIN0                    0
#define GPIO_ID_PIN(n)                  (GPIO_ID_PIN0+(n))
#define GPIO_PIN_ADDR(i)                (GPIO_PIN0_REG + i*4)

#define GPIO_FUNC_IN_HIGH               0x38
#define GPIO_FUNC_IN_LOW                0x3C

#define GPIO_ID_IS_PIN_REGISTER(reg_id) \
    ((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1)))

#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)

typedef enum {
    GPIO_PIN_INTR_DISABLE = 0,
    GPIO_PIN_INTR_POSEDGE = 1,
    GPIO_PIN_INTR_NEGEDGE = 2,
    GPIO_PIN_INTR_ANYEDGE = 3,
    GPIO_PIN_INTR_LOLEVEL = 4,
    GPIO_PIN_INTR_HILEVEL = 5
} GPIO_INT_TYPE;

#define GPIO_OUTPUT_SET(gpio_no, bit_value) \
        ((gpio_no < 32) ? gpio_output_set(bit_value<<gpio_no, (bit_value ? 0 : 1)<<gpio_no, 1<<gpio_no,0) : \
                         gpio_output_set_high(bit_value<<(gpio_no - 32), (bit_value ? 0 : 1)<<(gpio_no - 32), 1<<(gpio_no -32),0))
#define GPIO_DIS_OUTPUT(gpio_no)    ((gpio_no < 32) ? gpio_output_set(0,0,0, 1<<gpio_no) : gpio_output_set_high(0,0,0, 1<<(gpio_no - 32)))
#define GPIO_INPUT_GET(gpio_no)     ((gpio_no < 32) ? ((gpio_input_get()>>gpio_no)&BIT0) : ((gpio_input_get_high()>>(gpio_no - 32))&BIT0))

/* GPIO interrupt handler, registered through gpio_intr_handler_register */
typedef void (* gpio_intr_handler_fn_t)(uint32_t intr_mask, bool high, void *arg);

/**
  * @brief Initialize GPIO. This includes reading the GPIO Configuration DataSet
  *        to initialize "output enables" and pin configurations for each gpio pin.
  *        Please do not call this function in SDK.
  *
  * @param  None
  *
  * @return None
  */
void gpio_init(void);

/**
  * @brief Change GPIO(0-31) pin output by setting, clearing, or disabling pins, GPIO0<->BIT(0).
  *         There is no particular ordering guaranteed; so if the order of writes is significant,
  *         calling code should divide a single call into multiple calls.
  *
  * @param  uint32_t set_mask : the gpios that need high level.
  *
  * @param  uint32_t clear_mask : the gpios that need low level.
  *
  * @param  uint32_t enable_mask : the gpios that need be changed.
  *
  * @param  uint32_t disable_mask : the gpios that need diable output.
  *
  * @return None
  */
void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask);

/**
  * @brief Change GPIO(32-39) pin output by setting, clearing, or disabling pins, GPIO32<->BIT(0).
  *         There is no particular ordering guaranteed; so if the order of writes is significant,
  *         calling code should divide a single call into multiple calls.
  *
  * @param  uint32_t set_mask : the gpios that need high level.
  *
  * @param  uint32_t clear_mask : the gpios that need low level.
  *
  * @param  uint32_t enable_mask : the gpios that need be changed.
  *
  * @param  uint32_t disable_mask : the gpios that need diable output.
  *
  * @return None
  */
void gpio_output_set_high(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask);

/**
  * @brief Sample the value of GPIO input pins(0-31) and returns a bitmask.
  *
  * @param None
  *
  * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO0.
  */
uint32_t gpio_input_get(void);

/**
  * @brief Sample the value of GPIO input pins(32-39) and returns a bitmask.
  *
  * @param None
  *
  * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO32.
  */
uint32_t gpio_input_get_high(void);

/**
  * @brief Register an application-specific interrupt handler for GPIO pin interrupts.
  *        Once the interrupt handler is called, it will not be called again until after a call to gpio_intr_ack.
  *        Please do not call this function in SDK.
  *
  * @param gpio_intr_handler_fn_t fn : gpio application-specific interrupt handler
  *
  * @param void *arg : gpio application-specific interrupt handler argument.
  *
  * @return None
  */
void gpio_intr_handler_register(gpio_intr_handler_fn_t fn, void *arg);

/**
  * @brief Get gpio interrupts which happens but not processed.
  *        Please do not call this function in SDK.
  *
  * @param None
  *
  * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO0.
  */
uint32_t gpio_intr_pending(void);

/**
  * @brief Get gpio interrupts which happens but not processed.
  *        Please do not call this function in SDK.
  *
  * @param None
  *
  * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO32.
  */
uint32_t gpio_intr_pending_high(void);

/**
  * @brief Ack gpio interrupts to process pending interrupts.
  *        Please do not call this function in SDK.
  *
  * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO0.
  *
  * @return None
  */
void gpio_intr_ack(uint32_t ack_mask);

/**
  * @brief Ack gpio interrupts to process pending interrupts.
  *        Please do not call this function in SDK.
  *
  * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO32.
  *
  * @return None
  */
void gpio_intr_ack_high(uint32_t ack_mask);

/**
  * @brief Set GPIO to wakeup the ESP32.
  *        Please do not call this function in SDK.
  *
  * @param uint32_t i: gpio number.
  *
  * @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used
  *
  * @return None
  */
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);

/**
  * @brief disable GPIOs to wakeup the ESP32.
  *        Please do not call this function in SDK.
  *
  * @param None
  *
  * @return None
  */
void gpio_pin_wakeup_disable(void);

/**
  * @brief set gpio input to a signal, one gpio can input to several signals.
  *
  * @param uint32_t gpio : gpio number, 0~0x2f
  *                        gpio == 0x3C, input 0 to signal
  *                        gpio == 0x3A, input nothing to signal
  *                        gpio == 0x38, input 1 to signal
  *
  * @param uint32_t signal_idx : signal index.
  *
  * @param bool inv : the signal is inv or not
  *
  * @return None
  */
void gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv);

/**
  * @brief set signal output to gpio, one signal can output to several gpios.
  *
  * @param uint32_t gpio : gpio number, 0~0x2f
  *
  * @param uint32_t signal_idx : signal index.
  *                        signal_idx == 0x100, cancel output put to the gpio
  *
  * @param bool out_inv : the signal output is invert or not
  *
  * @param bool oen_inv : the signal output enable is invert or not
  *
  * @return None
  */
void gpio_matrix_out(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv);

/**
  * @brief Select pad as a gpio function from IOMUX.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_select_gpio(uint32_t gpio_num);

/**
  * @brief Set pad driver capability.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @param uint32_t drv : 0-3
  *
  * @return None
  */
void gpio_pad_set_drv(uint32_t gpio_num, uint32_t drv);

/**
  * @brief Pull up the pad from gpio number.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_pullup(uint32_t gpio_num);

/**
  * @brief Pull down the pad from gpio number.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_pulldown(uint32_t gpio_num);

/**
  * @brief Unhold the pad from gpio number.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_unhold(uint32_t gpio_num);

/**
  * @brief Hold the pad from gpio number.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_hold(uint32_t gpio_num);

/**
  * @brief enable gpio pad input.
  *
  * @param uint32_t gpio_num : gpio number, 0~0x2f
  *
  * @return None
  */
void gpio_pad_input_enable(uint32_t gpio_num);

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* _ROM_GPIO_H_ */


text:
static int		eventToDo;
static int		isAnEvent=0;
static Point	coord;

PaintView::PaintView(int			x,
					 int			y,
					 int			w,
					 int			h,
					 const char*	l)
						: Fl_Gl_Window(x,y,w,h,l),
						  m_pDoc(NULL),
						  m_pPaintBitstart(NULL),
						  m_nDrawWidth(0),
						  m_nDrawHeight(0),
						  m_nStartRow(0),
						  m_nEndRow(0),
						  m_nStartCol(0),
						  m_nEndCol(0)
{
	m_nWindowWidth	= w;
	m_nWindowHeight	= h;

	mode(FL_RGB | FL_DOUBLE | FL_STENCIL | FL_ALPHA);
}

void PaintView::draw()
{
	#ifndef MESA
	// To avoid flicker on some machines.
	glDrawBuffer(GL_FRONT_AND_BACK);
	#endif // !MESA

	const bool is_valid = valid();
	if(!is_valid)
	{

		glClearColor(0.7f, 0.7f, 0.7f, 1.0);

		// We're only using 2-D, so turn off depth
		glDisable(GL_DEPTH_TEST);

		ortho();

		glClear(GL_COLOR_BUFFER_BIT);
	}

	Point scrollpos;// = GetScrollPosition();
	scrollpos.x = 0;
	scrollpos.y	= 0;

	m_nWindowWidth	= w();
	m_nWindowHeight	= h();

	int drawWidth, drawHeight;
	drawWidth = std::min( m_nWindowWidth, m_pDoc->GetPaintWidth() );
	drawHeight = std::min(m_nWindowHeight, m_pDoc->GetPaintHeight());

	int startrow = m_pDoc->GetPaintHeight() - (scrollpos.y + drawHeight);
	if ( startrow < 0 ) startrow = 0;

	m_pPaintBitstart = m_pDoc->Painting() +
		3 * ((m_pDoc->GetPaintWidth() * startrow) + scrollpos.x);

	m_nDrawWidth	= drawWidth;
	m_nDrawHeight	= drawHeight;

	m_nStartRow		= startrow;
	m_nEndRow		= startrow + drawHeight;
	m_nStartCol		= scrollpos.x;
	m_nEndCol		= m_nStartCol + drawWidth;

	if (!is_valid)
	{
		// Update stencil buffer here
		glEnable(GL_STENCIL_TEST);

		glStencilMask(0xFF);
		glClear(GL_STENCIL_BUFFER_BIT);

		// Force drawing to stencil
		glStencilFunc(GL_NEVER, 1, 0xFF);
		glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);

		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
		glBegin(GL_TRIANGLE_STRIP);
		glVertex2f(0, m_nWindowHeight - m_nDrawHeight);
		glVertex2f(m_nDrawWidth, m_nWindowHeight - m_nDrawHeight);
		glVertex2f(0, m_nWindowHeight);
		glVertex2f(m_nDrawWidth, m_nWindowHeight);
		glEnd();
		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

		glStencilMask(0);
		glStencilFunc(GL_LESS, 0, 0xFF);
	}

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);

	if ( m_pDoc->Painting() && !isAnEvent)
	{
		RestoreContent();

	}

	if ( m_pDoc->Painting() && isAnEvent)
	{

		// Clear it after processing.
		isAnEvent	= 0;

		//Point source( coord.x + m_nStartCol, m_nEndRow - coord.y );
		Point target( coord.x, m_nWindowHeight - coord.y );

		// This is the event handler
		switch (eventToDo)
		{
		case LEFT_MOUSE_DOWN:
			m_pDoc->OnPaintLeftMouseDown(target);
			break;

		case LEFT_MOUSE_DRAG:
			m_pDoc->OnPaintLeftMouseDrag(target);
			break;

		case LEFT_MOUSE_UP:
			m_pDoc->OnPaintLeftMouseUp(target);
			break;

		case RIGHT_MOUSE_DOWN:
			m_pDoc->OnRightMouseDown(target);
			break;

		case RIGHT_MOUSE_DRAG:
			m_pDoc->OnRightMouseDrag(target);
			break;

		case RIGHT_MOUSE_UP:
			m_pDoc->OnRightMouseUp(target);
			break;

		default:
			printf("Unknown event!!\n");
			break;
		}
	}

	glFlush();

	#ifndef MESA
	// To avoid flicker on some machines.
	glDrawBuffer(GL_BACK);
	#endif // !MESA

}

int PaintView::handle(int event)
{
	switch(event)
	{
	case FL_ENTER:
	    redraw();
		break;

	case FL_PUSH:
		coord.x = Fl::event_x();
		coord.y = Fl::event_y();
		if (Fl::event_button()>1)
			eventToDo=RIGHT_MOUSE_DOWN;
		else
			eventToDo=LEFT_MOUSE_DOWN;
		isAnEvent=1;
		redraw();
		break;

	case FL_DRAG:
		coord.x = Fl::event_x();
		coord.y = Fl::event_y();
		if (Fl::event_button()>1)
			eventToDo=RIGHT_MOUSE_DRAG;
		else
			eventToDo=LEFT_MOUSE_DRAG;
		isAnEvent=1;
		redraw();
		m_pDoc->OnPaintingCursorMove(coord);
		break;

	case FL_RELEASE:
		coord.x = Fl::event_x();
		coord.y = Fl::event_y();
		if (Fl::event_button()>1)
			eventToDo=RIGHT_MOUSE_UP;
		else
			eventToDo=LEFT_MOUSE_UP;
		isAnEvent=1;
		redraw();
		break;

	case FL_MOVE:
		coord.x = Fl::event_x();
		coord.y = Fl::event_y();
		m_pDoc->OnPaintingCursorMove(coord);
		break;

	default:
		return 0;
		break;
	}

	return 1;
}

void PaintView::refresh()
{
	redraw();
}

void PaintView::resizeWindow(int width, int height)
{
	resize(x(), y(), width, height);
}

void PaintView::OverlayLine(const Point &from, const Point &to)
{
	GLubyte col[] = {0x33, 0xB5, 0xE5};
	glColor3ubv(col);
	glBegin(GL_LINES);
	glVertex2f(from.x, from.y);
	glVertex2f(to.x, to.y);
	glEnd();
}

void PaintView::SaveCurrentContent()
{
	// Tell openGL to read from the front buffer when capturing
	// out paint strokes
	glReadBuffer(GL_FRONT);

	glPixelStorei( GL_PACK_ALIGNMENT, 1 );
	glPixelStorei( GL_PACK_ROW_LENGTH, m_pDoc->GetPaintWidth() );

	glReadPixels( 0,
				  m_nWindowHeight - m_nDrawHeight,
				  m_nDrawWidth,
				  m_nDrawHeight,
				  GL_RGB,
				  GL_UNSIGNED_BYTE,
				  m_pPaintBitstart );
}

void PaintView::RestoreContent()
{
	glDrawBuffer(GL_BACK);

	glClear( GL_COLOR_BUFFER_BIT );

	glRasterPos2i( 0, m_nWindowHeight - m_nDrawHeight );
	glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
	glPixelStorei( GL_UNPACK_ROW_LENGTH, m_pDoc->GetPaintWidth() );
	glDrawPixels( m_nDrawWidth,
				  m_nDrawHeight,
				  GL_RGB,
				  GL_UNSIGNED_BYTE,
				  m_pPaintBitstart);

//	glDrawBuffer(GL_FRONT);
}


text:
template<typename T> class Vector;

template<typename T> class List {
public:
  void push_back(T);

  struct node {};
  node *head;
  unsigned size;
};

extern List<double> *instantiateListDoubleDeclaration;
extern List<long> *instantiateListLongDeclaration;

namespace A {
  class Y {
    template <typename T> friend class WhereAmI;
  };
}

template <typename T> class A::WhereAmI {
public:
  static void func() {}
};

template<typename T> struct Outer {
  struct Inner {};
};

template<bool, bool> struct ExplicitInstantiation {
  void f() {}
};

template<typename> struct DelayUpdates {};

template<typename T> struct OutOfLineInline {
  void f();
  void g();
  void h();
};
template<typename T> inline void OutOfLineInline<T>::f() {}
template<typename T> inline void OutOfLineInline<T>::g() {}
template<typename T> inline void OutOfLineInline<T>::h() {}

namespace EmitDefaultedSpecialMembers {
  template<typename T> struct SmallVectorImpl {
    SmallVectorImpl() {}
    ~SmallVectorImpl() {} // non-trivial dtor
  };
  template<typename T, unsigned N> struct SmallVector : SmallVectorImpl<T> {
    // trivial dtor
  };
  template<unsigned N> struct SmallString : SmallVector<char, N> {
    // trivial dtor
  };
}

template<typename T> struct WithUndefinedStaticDataMember {
  static T undefined;
};

template<typename T> struct __attribute__((packed, aligned(2))) WithAttributes {
  T value;
};
WithAttributes<int> *get_with_attributes();


text:
// Copyright 2017 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using Newtonsoft.Json;
using System.Collections.Generic;

namespace BenchmarkUploader
{
    /// <summary>
    /// Class containing all the important parts of a briefjson export
    /// </summary>
    public class BriefJsonModel
    {
        public HostEnvironment HostEnvironmentInfo { get; set; }
        public List<JsonBenchmark> Benchmarks { get; set; }

        public class OptionalString
        {
            public bool IsValueCreated { get; set; }
            public string Value { get; set; }

            public string GetValue() => IsValueCreated ? Value : null;
        }

        public class HostEnvironment
        {
            public string RuntimeVersion { get; set; }
            public string Architecture { get; set; }
            public bool HasRyuJit { get; set; }
            public string BenchmarkDotNetVersion { get; set; }
            public string JitModules { get; set; }
            public string OsVersion { get; set; }
            public string ProcessorName { get; set; }
            public int LogicalCoreCount { get; set; }
        }

        public class JsonBenchmark
        {
            public string Namespace { get; set; }
            public string Type { get; set; }
            public string Method { get; set; }
            public string MethodTitle { get; set; }
            public string Parameters { get; set; }
            public JsonStatistics Statistics { get; set; }
        }

        public class JsonStatistics
        {
            public int N { get; set; }
            public double Mean { get; set; }
            public double Min { get; set; }
            public double Max { get; set; }
            public double Median { get; set; }
            public double LowerFence { get; set; }
            public double UpperFence { get; set; }
            public double Q1 { get; set; }
            public double Q3 { get; set; }
            public double InterquartileRange { get; set; }
            public List<double> Outliers { get; set; }
            public double StandardError { get; set; }
            public double Variance { get; set; }
            public double StandardDeviation { get; set; }

            [JsonIgnore]
            public double Skewness => RawSkewness is double d ? d : 0.0;
            [JsonIgnore]
            public double Kurtosis => RawKurtosis is double d ? d : 0.0;

            // These are sometimes represented as empty strings...
            [JsonProperty("Skewness")]
            public object RawSkewness { get; set; }
            [JsonProperty("Kurtosis")]
            public object RawKurtosis { get; set; }

            // TODO: Confidence interval?
            public Percentiles Percentiles { get; set; }
        }

        public class Percentiles
        {
            public double P0 { get; set; }
            public double P25 { get; set; }
            public double P50 { get; set; }
            public double P67 { get; set; }
            public double P80 { get; set; }
            public double P85 { get; set; }
            public double P90 { get; set; }
            public double P95 { get; set; }
            public double P100 { get; set; }
        }
    }
}


text:
function codeCoverageReport()

  % run this after running the profiler.  displays a list of
  % files, methods, and lines in the current directory (+ subdirectories,
  % skipping /dev/ and /test/ subdirectories) that we not touched by any
  % method during the most recent invocationo of the profiler.
  %
  % the most common way to run this is running unitTest with the 'coverage'
  % option set to true

  stats = profile('info');

  [~,filestr] = system('find . -iname "*.m" | grep -v /dev/ | grep -v /test/');
  files = strread(filestr,'%s\n');
%  files = cellfun(@(a) [pwd,a(2:end)],files,'UniformOutput',false);
  current_path = pwd;

  disp('======= Code Coverage Report =======');
  for file_index=1:length(files)
    current_filename = [current_path,files{file_index}(2:end)];
    function_table_indices = find(strcmp(current_filename,{stats.FunctionTable.FileName}));
    if isempty(function_table_indices)
      fprintf(' Untouched file: %s\n',files{file_index},files{file_index});
    else
      executed_lines = vertcat(stats.FunctionTable(function_table_indices).ExecutedLines);
      executed_lines = executed_lines(:,1);

      if isempty(executed_lines)
        fprintf(' The file %s was called but did not execute (presumably do to parse errors)',files{file_index},files{file_index});
      else
        executable_lines = callstats('file_lines',current_filename)';
        missed_lines = setdiff(executable_lines,executed_lines);
        if ~isempty(missed_lines)
          call_info = getcallinfo(current_filename,'-v7.8');
          executed_function_names = cellfun(@(a) regexp(a,'(\w+)$','tokens','once'), {stats.FunctionTable(function_table_indices).FunctionName},'UniformOutput',false);

          for function_info = call_info
            function_table_index = function_table_indices(strcmp(function_info.name,executed_function_names));

            if isempty(function_table_index)
              [path,file,ext] = fileparts(files{file_index});
              fprintf('  Untouched method %s>%s\n',current_filename,function_info.name,file,function_info.name);
            else
              executable_lines_in_function = executable_lines(executable_lines>=function_info.firstline & executable_lines<=function_info.lastline);
              executed_lines_in_function = stats.FunctionTable(function_table_index).ExecutedLines;
              executed_lines_in_function = executed_lines_in_function(:,1);
              missed_lines_in_function = setdiff(executable_lines_in_function,executed_lines_in_function);
              if ~isempty(missed_lines_in_function)
                fprintf('  Untouched lines in %s\n',stats.FunctionTable(function_table_index).FunctionName,stats.FunctionTable(function_table_index).FunctionName);
%                disp(missed_lines_in_function')
              end
            end
          end
        end
      end
    end
  end
  disp('======= End of Code Coverage Report =======');
end