text:
- This section explains how to configure the instance of TheHiveProject in Cortex XSOAR.

- Start by logging in to your Hive Project server
- Navigate to the user configuration
- The the user you would like to use as authantication in XSOAR, select `Create API Key`
- Copy the key then fill in the following in the instance:

**Host:** The host (such as https://127.0.0.1:9000)

**API Key:** The key you have just copied

- Optionally select whether you would like to create incidents from the incidents in Hive
- Optionally select whether you would like to use the default `incident type` and `classifiers`
- Ensure to tick `Trust any certificate (not secure)` if you are using self-signed certs
- Select whether you would like case mirroring enabled


text:
package noear.snacks;

import noear.snacks.exts.Act1;
import noear.snacks.exts.Act2;
import noear.snacks.exts.Act3;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

/**
 * Created by noear on 14-6-11.
 */
public class ONode extends ONodeBase {

    public static String  NULL_DEFAULT="null";
    public static boolean BOOL_USE01=false;
    public static FormatHanlder TIME_FORMAT_ACTION=(date)->{
        if (date == null)
            return "null";
        else
            return "\"" + date.toString() + "\"";
    };

    public static final ONode NULL =  new ONode().asNull();

    //=============
    public ONode(){

    }

    /**输出自己,以供消费*/
    public ONode exp(Act1<ONode> expr){
        expr.run(this);
        return this;
    }

    public <T> T map(T t, Act3<T,String,ONode> hander){
        if(isObject()){
            _object.members.forEach((k,v)->{
                hander.run(t,k,v);
            });
        }

        if(isArray()){
            _array.elements.forEach(v->{
                hander.run(t,null,v);
            });
        }

        return t;
    }

    public <T> void val(T val){
        valSet(val);
    }
    //返回自己(重新设置基础类型的值)//不适合做为公有的
    protected   <T> ONode valSet(T val){
        tryInitValue();
        _value.set(val);
        return this;
    }

    public ONode(int value){
        tryInitValue();
        _value.set(value);
    }

    public ONode(long value){
        tryInitValue();
        _value.set(value);
    }

    public ONode(double value){
        tryInitValue();
        _value.set(value);
    }

    public ONode(String value){
        tryInitValue();
        _value.set(value);
    }

    public ONode(boolean value){
        tryInitValue();
        _value.set(value);
    }

    public ONode(Date value){
        tryInitValue();
        _value.set(value);
    }

    public boolean contains(String key) {
        if (_object == null || _type != ONodeType.Object)
            return false;
        else
            return _object.contains(key);
    }

    public int count()
    {
        if(isObject())
            return _object.count();

        if(isArray())
            return _array.count();

        return 0;
    }

    //========================
    public double getDouble() {
        if (_value == null)
            return 0;
        else
            return _value.getDouble();
    }

    public double getDouble(int scale)
    {
        double temp = getDouble();

        if(temp==0)
            return 0;
        else
            return new BigDecimal(temp)
                    .setScale(scale,BigDecimal.ROUND_HALF_UP)
                    .doubleValue();
    }

    public int getInt() {
        if (_value == null)
            return 0;
        else
            return _value.getInt();
    }

    public boolean getBoolean() {
        if (_value == null)
            return false;
        else
            return _value.getBoolean();
    }

    public Date getDate() {
        if (_value == null)
            return null;
        else
            return _value.getDate();
    }

    public long getLong() {
        if (_value == null)
            return 0;
        else
            return _value.getLong();
    }

    public String getString() {
        if (_value == null) {
            if(isObject()){
                return toJson();
            }

            if(isArray()){
                return toJson();
            }

            return "";
        }
        else {
            return _value.getString();
        }
    }

    public <T> T getModel(Class<T> cls){
        return (T)OMapper.map(this,cls);
    }

    //=============
    //返回结果节点
    public ONode get(int index) {
        tryInitArray();

        if (_array.elements.size() > index)
            return _array.elements.get(index);
        else
            return null;
    }
    //返回结果节点,如果不存在则自动创建
    public ONode get(String key) {
        tryInitObject();

        if (_object.contains(key))
            return _object.get(key);
        else {
            ONode temp = new ONode();
            _object.set(key, temp);
            return temp;
        }
    }

    //返回自己
    public ONode add(ONode value) {
        tryInitArray();

        _array.add(value);

        return this;
    }

    //返回自己
    public ONode addAll(ONode ary) {
        tryInitArray();

        if (ary != null && ary.isArray()) {
            _array.elements.addAll(ary._array.elements);
        }

        return this;
    }

    //返回自己
    public <T> ONode addAll(Iterable<T> ary){
        tryInitArray();

        if(ary!=null) {
            ary.forEach(m -> add(m));
        }
        return this;
    }

    //返回自己
    public <T> ONode addAll(Iterable<T> ary, Act2<ONode,T> handler) {
        tryInitArray();

        if(ary!=null) {
            ary.forEach(m -> handler.run(this.add(), m));
        }
        return this;
    }

    public ONode add(Object value){
        tryInitArray();

        if(value instanceof ONode){
            add((ONode)value);
        }else{
            add(new ONode().valSet(value));
        }

        return this;
    }

    public ONode add(String value) {
        return add(new ONode(value));
    }

    public ONode add(String value, boolean isOps) {
        if (isOps) {
            return add(ONode.tryLoad(value));
        } else {
            return add(new ONode(value));
        }
    }

    public ONode add(int value) {
        return add(new ONode(value));
    }

    public ONode add(long value) {
        return add(new ONode(value));
    }

    public ONode add(double value) {
        return add(new ONode(value));
    }

    public ONode add(boolean value) {
        return add(new ONode(value));
    }

    public ONode add(Date value) {
        return add(new ONode(value));
    }

    //返回新节点
    public ONode add(){
        ONode n = new ONode();

        add(n);

        return n;
    }

    public ONode rename(String key, String newKey){

        if(isObject()) {
            _object.rename(key, newKey);
        }

        if(isArray()){
            for(ONode n : _array.elements) {
                n.rename(key, newKey);
            }
        }

        return this;
    }

    public boolean remove(String key){
        if(isObject()) {
            _object.remove(key);
            return true;
        }

        if(isArray()){
            for(ONode n : _array.elements) {
                if(n.isObject()) {
                    n.remove(key);
                }
            }

            return true;
        }

        return false;
    }

    //返回自己
    public ONode setAll(ONode obj) {
        tryInitObject();

        if (obj != null && obj.isObject()) {
            _object.members.putAll(obj._object.members);
        }

        return this;
    }

    //返回自己
    public <T> ONode setAll(Map<String,T> map) {
        tryInitObject();

        if (map != null) {
            map.forEach((k, v) -> {
                set(k, v);
            });
        }
        return this;
    }

    public <T> ONode setAll(Map<String,T> map, Act2<ONode,T> handler) {
        tryInitObject();

        if (map != null) {
            map.forEach((k, v) -> {
                handler.run(this.get(k), v);
            });
        }
        return this;
    }

    //返回自己
    public  ONode set(String key,String value) {
        return set(key, new ONode(value));
    }
    public  ONode set(String key,String value, boolean isOps) {
        if (isOps) {
            return set(key, ONode.tryLoad(value));
        } else {
            return set(key, new ONode(value));
        }
    }

    //返回自己
    public  ONode set(String key,int value) {
        return set(key, new ONode(value));
    }

    //返回自己
    public  ONode set(String key,long value) {
        return set(key, new ONode(value));
    }

    //返回自己
    public  ONode set(String key,double value) {
        return set(key, new ONode(value));
    }

    //返回自己
    public  ONode set(String key,boolean value) {
        return set(key, new ONode(value));
    }

    //返回自己
    public  ONode set(String key,Date value) {
        return set(key, new ONode(value));
    }

    //返回自己
    public ONode set(String key,ONode value) {
        tryInitObject();
        _object.set(key, value);

        return this;
    }

    //返回自己
    public ONode set(String key, Object value){
        tryInitObject();
        if(value instanceof ONode){
            _object.set(key,(ONode) value);
        }else{
            _object.set(key, new ONode().valSet(value));
        }
        return this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
class AddPromotionableToSpreeProducts < ActiveRecord::Migration
  def change
    add_column :spree_products, :promotionable, :boolean, default: true
  end
end


text:
References
==========
+ He, T., Kong, R., Holmes, A., Nguyen, M., Sabuncu, M., Eickhoff, S.B., Bzdok, D., Feng, J. and Yeo, B.T., 2019. [**Deep Neural Networks and Kernel Regression Achieve Comparable Accuracies for Functional Connectivity Prediction of Behavior and Demographics**](https://doi.org/10.1016/j.neuroimage.2019.116276), NeuroImage, 116276.

----

Usage
==========

- The example about how to use the code is detailed in `$CBIG_CODE_DIR/stable_projects/predict_phenotypes/He2019_KRDNN/examples/README.md`
- If you have access to HCP and UK Biobank dataset, you can replicate our result using the instructions detailed in `$CBIG_CODE_DIR/stable_projects/predict_phenotypes/He2019_KRDNN/replication/README.md`.

----

Bugs and Questions
====
Please contact He Tong at hetong1115@gmail.com.


text:
using namespace swift;
using namespace ast_scope;

#pragma mark ASTScope

void ASTScope::unqualifiedLookup(
    SourceFile *SF, SourceLoc loc,
    namelookup::AbstractASTScopeDeclConsumer &consumer) {
  if (auto *s = SF->getASTContext().Stats)
    ++s->getFrontendCounters().NumASTScopeLookups;
  ASTScopeImpl::unqualifiedLookup(SF, loc, consumer);
}

llvm::SmallVector<LabeledStmt *, 4> ASTScope::lookupLabeledStmts(
    SourceFile *sourceFile, SourceLoc loc) {
  return ASTScopeImpl::lookupLabeledStmts(sourceFile, loc);
}

std::pair<CaseStmt *, CaseStmt *> ASTScope::lookupFallthroughSourceAndDest(
    SourceFile *sourceFile, SourceLoc loc) {
  return ASTScopeImpl::lookupFallthroughSourceAndDest(sourceFile, loc);
}

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(push)
#pragma warning(disable : 4996)
#endif

void ASTScope::dump() const { impl->dump(); }

#if SWIFT_COMPILER_IS_MSVC
#pragma warning(pop)
#endif

void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
  impl->dumpOneScopeMapLocation(lineCol);
}

#pragma mark ASTScopeImpl

const PatternBindingEntry &AbstractPatternEntryScope::getPatternEntry() const {
  return decl->getPatternList()[patternEntryIndex];
}

Pattern *AbstractPatternEntryScope::getPattern() const {
  return getPatternEntry().getPattern();
}

NullablePtr<ClosureExpr> BraceStmtScope::parentClosureIfAny() const {
  return !getParent() ? nullptr : getParent().get()->getClosureIfClosureScope();
}

NullablePtr<ClosureExpr> ASTScopeImpl::getClosureIfClosureScope() const {
  return nullptr;
}

SourceManager &ASTScopeImpl::getSourceManager() const {
  return getASTContext().SourceMgr;
}

Stmt *LabeledConditionalStmtScope::getStmt() const {
  return getLabeledConditionalStmt();
}

#pragma mark getLabeledConditionalStmt
LabeledConditionalStmt *IfStmtScope::getLabeledConditionalStmt() const {
  return stmt;
}
LabeledConditionalStmt *WhileStmtScope::getLabeledConditionalStmt() const {
  return stmt;
}
LabeledConditionalStmt *GuardStmtScope::getLabeledConditionalStmt() const {
  return stmt;
}

#pragma mark getASTContext

ASTContext &ASTScopeImpl::getASTContext() const {
  if (auto d = getDeclIfAny())
    return d.get()->getASTContext();
  return getParent().get()->getASTContext();
}

#pragma mark getClassName

std::string GenericTypeOrExtensionScope::getClassName() const {
  return declKindName() + portionName() + "Scope";
}

#define DEFINE_GET_CLASS_NAME(Name)                                            \
  std::string Name::getClassName() const { return #Name; }

DEFINE_GET_CLASS_NAME(ASTSourceFileScope)
DEFINE_GET_CLASS_NAME(GenericParamScope)
DEFINE_GET_CLASS_NAME(AbstractFunctionDeclScope)
DEFINE_GET_CLASS_NAME(ParameterListScope)
DEFINE_GET_CLASS_NAME(FunctionBodyScope)
DEFINE_GET_CLASS_NAME(DefaultArgumentInitializerScope)
DEFINE_GET_CLASS_NAME(AttachedPropertyWrapperScope)
DEFINE_GET_CLASS_NAME(PatternEntryDeclScope)
DEFINE_GET_CLASS_NAME(PatternEntryInitializerScope)
DEFINE_GET_CLASS_NAME(ConditionalClausePatternUseScope)
DEFINE_GET_CLASS_NAME(ConditionalClauseInitializerScope)
DEFINE_GET_CLASS_NAME(CaptureListScope)
DEFINE_GET_CLASS_NAME(ClosureParametersScope)
DEFINE_GET_CLASS_NAME(TopLevelCodeScope)
DEFINE_GET_CLASS_NAME(SpecializeAttributeScope)
DEFINE_GET_CLASS_NAME(DifferentiableAttributeScope)
DEFINE_GET_CLASS_NAME(SubscriptDeclScope)
DEFINE_GET_CLASS_NAME(EnumElementScope)
DEFINE_GET_CLASS_NAME(IfStmtScope)
DEFINE_GET_CLASS_NAME(WhileStmtScope)
DEFINE_GET_CLASS_NAME(GuardStmtScope)
DEFINE_GET_CLASS_NAME(GuardStmtBodyScope)
DEFINE_GET_CLASS_NAME(RepeatWhileScope)
DEFINE_GET_CLASS_NAME(DoStmtScope)
DEFINE_GET_CLASS_NAME(DoCatchStmtScope)
DEFINE_GET_CLASS_NAME(SwitchStmtScope)
DEFINE_GET_CLASS_NAME(ForEachStmtScope)
DEFINE_GET_CLASS_NAME(ForEachPatternScope)
DEFINE_GET_CLASS_NAME(CaseStmtScope)
DEFINE_GET_CLASS_NAME(CaseLabelItemScope)
DEFINE_GET_CLASS_NAME(CaseStmtBodyScope)
DEFINE_GET_CLASS_NAME(BraceStmtScope)

#undef DEFINE_GET_CLASS_NAME

#pragma mark getSourceFile

const SourceFile *ASTScopeImpl::getSourceFile() const {
  return getParent().get()->getSourceFile();
}

const SourceFile *ASTSourceFileScope::getSourceFile() const { return SF; }

ASTContext &ASTSourceFileScope::getASTContext() const {
  return SF->getASTContext();
}

SourceRange ExtensionScope::getBraces() const { return decl->getBraces(); }

SourceRange NominalTypeScope::getBraces() const { return decl->getBraces(); }

NullablePtr<NominalTypeDecl>
ExtensionScope::getCorrespondingNominalTypeDecl() const {
  return decl->getExtendedNominal();
}

void ASTScopeImpl::preOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
  fn(this);
  preOrderChildrenDo(fn);
}
void ASTScopeImpl::preOrderChildrenDo(function_ref<void(ASTScopeImpl *)> fn) {
  for (auto *child : getChildren())
    child->preOrderDo(fn);
}

void ASTScopeImpl::postOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
  for (auto *child : getChildren())
    child->postOrderDo(fn);
  fn(this);
}


text:
<?php

namespace Sinergia\Brasil\DateTime;

/**
 * Class DateMesBr
 * @package Sinergia\Brasil\DateTime
 */
class DateMesBr extends DateTimeBr
{

    protected function init()
    {
        $this->setDay(1)->setHour(0)->setMinute(0)->setSecond(0);
    }

    /**
     * Retona data em string para ser impressa.
     * @return bool|string
     */
    public function __toString()
    {
        return $this->format('m/Y');
    }

}


text:
import yaml

import cekit

from cekit.descriptor import Descriptor

execute_schemas = [yaml.safe_load("""
        map:
          name: {type: str}
          script: {type: str}
          user: {type: text}""")]

container_schemas = [yaml.safe_load("""
        seq:
          - {type: any}""")]

class Execute(Descriptor):
    def __init__(self, descriptor, module_name):
        self.schemas = execute_schemas
        super(Execute, self).__init__(descriptor)

        descriptor['directory'] = module_name

        descriptor['module_name'] = module_name

        if 'name' not in descriptor:
            descriptor['name'] = "%s/%s" % (module_name,
                                            descriptor['script'])

    @property
    def name(self):
        return self.get('name')

    @name.setter
    def name(self, value):
        self._descriptor['name'] = value

    @property
    def script(self):
        return self.get('script')

    @script.setter
    def script(self, value):
        self._descriptor['script'] = value

    @property
    def user(self):
        return self.get('user', cekit.DEFAULT_USER)

    @user.setter
    def user(self, value):
        self._descriptor['user'] = value


text:
namespace Microsoft.Graph
{
    using System;
    using System.Collections.Generic;
    using System.IO;

    /// <summary>
    /// The interface IPostRequestBuilder.
    /// </summary>
    public partial interface IPostRequestBuilder : IOutlookItemRequestBuilder
    {
        /// <summary>
        /// Builds the request.
        /// </summary>
        /// <returns>The built request.</returns>
        new IPostRequest Request();

        /// <summary>
        /// Builds the request.
        /// </summary>
        /// <param name="options">The query and header options for the request.</param>
        /// <returns>The built request.</returns>
        new IPostRequest Request(IEnumerable<Option> options);

        /// <summary>
        /// Gets the request builder for Extensions.
        /// </summary>
        /// <returns>The <see cref="IPostExtensionsCollectionRequestBuilder"/>.</returns>
        IPostExtensionsCollectionRequestBuilder Extensions { get; }

        /// <summary>
        /// Gets the request builder for InReplyTo.
        /// </summary>
        /// <returns>The <see cref="IPostRequestBuilder"/>.</returns>
        IPostRequestBuilder InReplyTo { get; }

        /// <summary>
        /// Gets the request builder for Attachments.
        /// </summary>
        /// <returns>The <see cref="IPostAttachmentsCollectionRequestBuilder"/>.</returns>
        IPostAttachmentsCollectionRequestBuilder Attachments { get; }

        /// <summary>
        /// Gets the request builder for PostForward.
        /// </summary>
        /// <returns>The <see cref="IPostForwardRequestBuilder"/>.</returns>
        IPostForwardRequestBuilder Forward(
            IEnumerable<Recipient> ToRecipients,
            string Comment = null);

        /// <summary>
        /// Gets the request builder for PostReply.
        /// </summary>
        /// <returns>The <see cref="IPostReplyRequestBuilder"/>.</returns>
        IPostReplyRequestBuilder Reply(
            Post Post);

    }
}


text:
@implementation NSArray (BlockUtils)

- (NSArray *)filteredArrayUsingBlock:(BOOL (^)(id, NSUInteger, BOOL *))test
{
    NSIndexSet *pass = [self indexesOfObjectsPassingTest:test];
    return [self objectsAtIndexes:pass];
}

@end


text:
rule:
  aip: 128
  name: [core, '0128', resource-reconciling-behavior]
  summary: Declarative-friendly resources should annotate the `reconciling` field as `OUTPUT_ONLY`.
permalink: /128/resource-reconciling-behavior
redirect_from:
  - /0128/resource-reconciling-behavior
---

# Declarative-friendly resources: Reconciling field behavior

This rule enforces that all declarative-friendly resources have
`google.api.field_behavior` set to `OUTPUT_ONLY` on their `bool
reconciling` field, as mandated in [AIP-128][].

## Details

This rule looks at any message with a `google.api.resource` annotation that
includes `style: DECLARATIVE_FRIENDLY`, and complains if the `reconciling` field
does not have a `google.api.field_behavior` annotation with a value of
`OUTPUT_ONLY`.

## Examples

**Incorrect** code for this rule:

```proto
// Incorrect.
message Book {
  option (google.api.resource) = {
    type: "library.googleapis.com/Book"
    pattern: "publishers/{publisher}/books/{book}"
    style: DECLARATIVE_FRIENDLY
  };

  string name = 1;

  // The `google.api.field_behavior` annotation should be `OUTPUT_ONLY`.
  bool reconciling = 2;
}
```

**Correct** code for this rule:

```proto
// Correct.
message Book {
  option (google.api.resource) = {
    type: "library.googleapis.com/Book"
    pattern: "publishers/{publisher}/books/{book}"
    style: DECLARATIVE_FRIENDLY
  };

  string name = 1;

  bool reconciling = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}
```

## Disabling

If you need to violate this rule, use a leading comment above the field.
Remember to also include an [aip.dev/not-precedent][] comment explaining why.

```proto
message Book {
  option (google.api.resource) = {
    type: "library.googleapis.com/Book"
    pattern: "publishers/{publisher}/books/{book}"
    style: DECLARATIVE_FRIENDLY
  };

  string name = 1;

  // (-- api-linter: core::0128::resource-reconciling-behavior=disabled
  //     aip.dev/not-precedent: We need to do this because reasons. --)
  bool reconciling = 2;
}
```

If you need to violate this rule for an entire file, place the comment at the
top of the file.

[aip-128]: https://aip.dev/128
[aip.dev/not-precedent]: https://aip.dev/not-precedent


text:
<?xml version="1.0" encoding="UTF-8"?>
<includes>

	<include name="IncludesCustomPVRWindow">

		<include>PVRFanart</include>

		<control id="100" type="fixedlist">
			<left>-238</left>
			<top>242</top>
			<width>2200</width>
			<height>576</height>
			<oninfo condition="!String.IsEmpty(Container(100).ListItem.Plot) | !String.IsEmpty(Container(100).ListItem.PlotOutline)">RunScript(script.toolbox,info=textviewer,header='$ESCINFO[Container(100).ListItem.Title]',text='$ESCVAR[Plot]')</oninfo>
			<onup>SetProperty(LabelsDelayFadeAnimation,1,home)</onup>
			<onback>SetProperty(LabelsDelayFadeAnimation,1,home)</onback>
			<onback condition="!String.IsEqual(Container(100).CurrentItem,1)">Control.Move(100,$INFO[Container(100).CurrentItem,-])</onback>
			<onback condition="!String.IsEqual(Container(100).CurrentItem,1)">Control.Move(100,1)</onback>
			<onup condition="!String.IsEqual(Container(100).CurrentItem,1)">Control.Move(100,$INFO[Container(100).CurrentItem,-])</onup>
			<onup condition="!String.IsEqual(Container(100).CurrentItem,1)">Control.Move(100,1)</onup>
			<onup>back</onup>
			<onleft>Back</onleft>
			<onright>noop</onright>
			<onright condition="!Window.IsVisible(1103)">SetProperty(BounceRight,1,Home)</onright>
			<include>ViewTypeBounceAnimation</include>
			<ondown>1001</ondown>
			<defaultcontrol always="true">0</defaultcontrol>
			<preloaditems>2</preloaditems>
			<focusposition>1</focusposition>
			<orientation>horizontal</orientation>
			<scrolltime easing="inout" tween="sine">300</scrolltime>
			<include content="ViewOpenAnimation">
				<param name="pos1">193,10</param>
				<param name="pos2">497,-174</param>
				<param name="pos3">497,195</param>
				<param name="pos4">497,-246</param>
				<param name="pos5">497,10</param>
				<param name="pos6">497,168</param>
			</include>
			<include content="ViewPVRLayout">
				<param name="ID">100</param>
			</include>
			<content sortorder="$PARAM[SortOrder]" sortby="$PARAM[SortBy]">$PARAM[Path]</content>
		</control>

		<control type="group">
			<include>LabelsDelayFadeAnimation</include>
			<visible>String.IsEmpty(Window(Home).Property(LabelsDelayFadeAnimation))</visible>

			<control type="grouplist">
				<left>198</left>
				<top>134</top>
				<height>80</height>
				<itemgap>10</itemgap>
				<orientation>horizontal</orientation>
				<usecontrolcoords>true</usecontrolcoords>
				<include>VisibleDelayFadeAnimation</include>
				<control type="label">
					<width>auto</width>
					<height>60</height>
					Med48
					<aligny>bottom</aligny>
					<textcolor>ffdadada</textcolor>
					[CAPITALIZE]$PARAM[HeadingLabel][/CAPITALIZE]
				</control>
				<control type="label">
					<top>15</top>
					<width>auto</width>
					<height>60</height>
					Med32
					<aligny>bottom</aligny>
					<textcolor>ffdadada</textcolor>
					$INFO[Container(100).CurrentItem]
					<visible>Integer.IsGreater(Container(100).NumItems,0)</visible>
				</control>
				<control type="label">
					<top>14</top>
					<width>auto</width>
					<height>60</height>
					Light36
					<aligny>bottom</aligny>
					<textcolor>ff505050</textcolor>
					|
					<visible>Integer.IsGreater(Container(100).NumItems,0)</visible>
				</control>
				<control type="label">
					<top>15</top>
					<width>auto</width>
					<height>60</height>
					Light32
					<aligny>bottom</aligny>
					<textcolor>ff505050</textcolor>
					$INFO[Container(100).NumItems]
					<visible>Integer.IsGreater(Container(100).NumItems,0)</visible>
				</control>
			</control>

			<control type="grouplist">
				<left>1360</left>
				<top>153</top>
				<width>440</width>
				<height>60</height>
				<align>right</align>
				<itemgap>6</itemgap>
				<orientation>horizontal</orientation>
				<usecontrolcoords>true</usecontrolcoords>
				<include>VisibleDelayFadeAnimation</include>
				<control type="label">
					<width>auto</width>
					<height>30</height>
					Light28
					<align>right</align>
					<textcolor>ffa4a4a4</textcolor>
					$LOCALIZE[31086]
				</control>
				<control type="label">
					<top>1</top>
					<width>auto</width>
					<height>30</height>
					<align>right</align>
					Med28
					<textcolor>ffa4a4a4</textcolor>
					$PARAM[SortbyLabel]
				</control>
			</control>

			<control type="group">
				<left>196</left>
				<top>807</top>
				<include>VisibleDelayFadeAnimation</include>

				<control id="1000" type="grouplist">
					<left>-10</left>
					<height>100</height>
					<itemgap>0</itemgap>
					<onleft>100</onleft>
					<onright>100</onright>
					<onup>100</onup>
					<orientation>horizontal</orientation>
					<usecontrolcoords>true</usecontrolcoords>
					<defaultcontrol always="true">1001</defaultcontrol>

					<control id="1001" type="button">
						<width>0</width>
						<height>0</height>
						-
						<onfocus>Right</onfocus>
						<include>NoTextures</include>
						<visible>!Control.HasFocus(30)</visible>
					</control>
					<control id="30" type="button">
						<width min="104" max="224">auto</width>
						<wrapmultiline>true</wrapmultiline>
						<height>100</height>
						<onup>100</onup>
						<ondown>3000</ondown>
						<onclick>SetProperty(LabelsDelayFadeAnimation,1,home)</onclick>
						<onclick>ActivateWindow(tvguide)</onclick>
						Med24
						$LOCALIZE[31545]
						<textoffsetx>28</textoffsetx>
						<textcolor>ffdadada</textcolor>
						<focusedcolor>ff222222</focusedcolor>
						<texturefocus border="13,5,6,8">views/button_fo.png</texturefocus>
						<texturenofocus border="13,3,6,6">views/button_nf.png</texturenofocus>
					</control>
					<control id="32" type="button">
						<width min="104" max="224">auto</width>
						<wrapmultiline>true</wrapmultiline>
						<height>100</height>
						<onup>100</onup>
						<ondown>3000</ondown>
						<onclick>SetProperty(LabelsDelayFadeAnimation,1,home)</onclick>
						<onclick>ActivateWindow(tvchannels)</onclick>
						Med24
						$LOCALIZE[31547]
						<textoffsetx>28</textoffsetx>
						<textcolor>ffdadada</textcolor>
						<focusedcolor>ff222222</focusedcolor>
						<texturefocus border="13,5,6,8">views/button_fo.png</texturefocus>
						<texturenofocus border="13,3,6,6">views/button_nf.png</texturenofocus>
					</control>
					<control id="31" type="button">
						<width min="104" max="224">auto</width>
						<wrapmultiline>true</wrapmultiline>
						<height>100</height>
						<onup>100</onup>
						<ondown>3000</ondown>
						<onclick>SetProperty(LabelsDelayFadeAnimation,1,home)</onclick>
						<onclick>ActivateWindow(tvrecordings)</onclick>
						Med24
						$LOCALIZE[31546]
						<textoffsetx>28</textoffsetx>
						<textcolor>ffdadada</textcolor>
						<focusedcolor>ff222222</focusedcolor>
						<texturefocus border="13,5,6,8">views/button_fo.png</texturefocus>
						<texturenofocus border="13,3,6,6">views/button_nf.png</texturenofocus>
					</control>
					<control id="34" type="button">
						<width min="104" max="224">auto</width>
						<wrapmultiline>true</wrapmultiline>
						<height>100</height>
						<onup>100</onup>
						<ondown>3000</ondown>
						<onclick>ActivateWindow(TVTimers)</onclick>
						Med24
						$LOCALIZE[31548]
						<textoffsetx>28</textoffsetx>
						<textcolor>ffdadada</textcolor>
						<focusedcolor>ff222222</focusedcolor>
						<texturefocus border="13,5,6,8">views/button_fo.png</texturefocus>
						<texturenofocus border="13,3,6,6">views/button_nf.png</texturenofocus>
						<visible>!String.IsEqual(Container(100).ListItem.Label,..)</visible>
					</control>
				</control>

				<control type="grouplist">
					<top>110</top>
					<height>28</height>
					<itemgap>10</itemgap>
					<orientation>horizontal</orientation>
					<usecontrolcoords>true</usecontrolcoords>
					<control type="label">
						<width>auto</width>
						<height>24</height>
						Med24Num
						<aligny>bottom</aligny>
						<textcolor>ffFFC24B</textcolor>
						$INFO[Container(100).ListItem.ChannelNumber,,. ]$INFO[Container(100).ListItem.ChannelName]
					</control>
					<control type="label">
						<width>auto</width>
						<height>24</height>
						Med24Num
						<aligny>bottom</aligny>
						<textcolor>ffbebebe</textcolor>
						$INFO[Container(100).ListItem.StartTime]$INFO[Container(100).ListItem.EndTime, - ,]
					</control>
					<control type="label">
						<width>auto</width>
						<height>24</height>
						Med24Num
						<aligny>bottom</aligny>
						<textcolor>ffbebebe</textcolor>
						  [COLOR ff707070]$LOCALIZE[19031][/COLOR] $INFO[Container(100).ListItem.NextTitle]
						<visible>!String.IsEmpty(Container(100).ListItem.NextTitle)</visible>
					</control>
				</control>

				<control type="textbox">
					<top>143</top>
					<width>1192</width>
					<height>84</height>
					<align>left</align>
					Reg30Spaced
					<pagecontrol>99</pagecontrol>
					<autoscroll>false</autoscroll>
					<textcolor>ffbcbcbc</textcolor>
					[B]$INFO[Container(100).ListItem.Title][/B] $VAR[Plot]
				</control>
				<control id="99" type="scrollbar">
					<top>103</top>
					<width>1192</width>
					<height>126</height>
					<showonepage>false</showonepage>
					<orientation>vertical</orientation>
				</control>

				<control id="3000" type="button">
					<left>1194</left>
					<top>192</top>
					<width>37</width>
					<height>23</height>
					<onup>100</onup>
					<ondown>noop</ondown>
					<onleft>100</onleft>
					<onright>100</onright>
					<onclick>SetProperty(OpenTextViewer,2,home)</onclick>
					<onclick>RunScript(script.toolbox,info=textviewer,header='$ESCINFO[Container(100).ListItem.Title]',text='$ESCVAR[Plot]')</onclick>
					<texturefocus>views/more_fo.png</texturefocus>
					<texturenofocus>views/more_nf.png</texturenofocus>
					<visible>!Window.IsVisible(textviewer) + Control.IsVisible(99)</visible>
				</control>

				<control type="image">
					<left>1194</left>
					<top>192</top>
					<width>37</width>
					<height>23</height>
					<texture>views/more_nf.png</texture>
					<visible>Window.IsVisible(textviewer)</visible>
				</control>
			</control>
		</control>
	</include>
</includes>


text:
package org.apache.ignite.internal.processors.cache;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;

import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.CLOSED;
import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.EXECUTION;
import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.IDLE;
import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.RESULT_READY;

/**
 * Query cursor implementation.
 */
public class QueryCursorImpl<T> implements QueryCursorEx<T> {
    /** */
    private final static AtomicReferenceFieldUpdater<QueryCursorImpl, State> STATE_UPDATER =
        AtomicReferenceFieldUpdater.newUpdater(QueryCursorImpl.class, State.class, "state");

    /** Query executor. */
    private Iterable<T> iterExec;

    /** */
    private Iterator<T> iter;

    /** */
    private volatile State state = IDLE;

    /** */
    private List<GridQueryFieldMetadata> fieldsMeta;

    /** */
    private final GridQueryCancel cancel;

    /**
     * @param iterExec Query executor.
     * @param cancel Cancellation closure.
     */
    public QueryCursorImpl(Iterable<T> iterExec, GridQueryCancel cancel) {
        this.iterExec = iterExec;
        this.cancel = cancel;
    }

    /**
     * @param iterExec Query executor.
     */
    public QueryCursorImpl(Iterable<T> iterExec) {
        this(iterExec, null);
    }

    /** {@inheritDoc} */
    @Override public Iterator<T> iterator() {
        if (!STATE_UPDATER.compareAndSet(this, IDLE, EXECUTION))
            throw new IgniteException("Iterator is already fetched or query was cancelled.");

        iter = iterExec.iterator();

        if (!STATE_UPDATER.compareAndSet(this, EXECUTION, RESULT_READY)) {
            // Handle race with cancel and make sure the iterator resources are freed correctly.
            closeIter();

            throw new CacheException(new QueryCancelledException());
        }

        assert iter != null;

        return iter;
    }

    /** {@inheritDoc} */
    @Override public List<T> getAll() {
        List<T> all = new ArrayList<>();

        try {
            for (T t : this) // Implicitly calls iterator() to do all checks.
                all.add(t);
        }
        finally {
            close();
        }

        return all;
    }

    /** {@inheritDoc} */
    @Override public void getAll(QueryCursorEx.Consumer<T> clo) throws IgniteCheckedException {
        try {
            for (T t : this)
                clo.consume(t);
        }
        finally {
            close();
        }
    }

    /** {@inheritDoc} */
    @Override public void close() {
        while(state != CLOSED) {
            if (STATE_UPDATER.compareAndSet(this, RESULT_READY, CLOSED)) {
                closeIter();

                return;
            }

            if (STATE_UPDATER.compareAndSet(this, EXECUTION, CLOSED)) {
                if (cancel != null)
                    cancel.cancel();

                return;
            }

            if (STATE_UPDATER.compareAndSet(this, IDLE, CLOSED))
                return;
        }
    }

    /**
     * Closes iterator.
     */
    private void closeIter() {
        if (iter instanceof AutoCloseable) {
            try {
                ((AutoCloseable)iter).close();
            }
            catch (Exception e) {
                throw new IgniteException(e);
            }
        }
    }

    /**
     * @param fieldsMeta SQL Fields query result metadata.
     */
    public void fieldsMeta(List<GridQueryFieldMetadata> fieldsMeta) {
        this.fieldsMeta = fieldsMeta;
    }

    /**
     * @return SQL Fields query result metadata.
     */
    @Override public List<GridQueryFieldMetadata> fieldsMeta() {
        return fieldsMeta;
    }

    /** Query cursor state */
    protected enum State {
        /** Idle. */IDLE,
        /** Executing. */EXECUTION,
        /** Result ready. */RESULT_READY,
        /** Closed. */CLOSED,
    }
}


text:
import * as React from 'react';

class Venue extends React.Component<{}, void> {
  public render() {
    return (

Venue

              Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
              incididunt ut labore et dolore magna aliqua.

    );
  }
}

export { Venue };


text:
namespace arc {

bool CanLaunchGhostWindowByRestoreData(
    const app_restore::AppRestoreData& restore_data) {
  const bool not_need_bounds =
      restore_data.window_state_type == chromeos::WindowStateType::kMaximized ||
      restore_data.window_state_type == chromeos::WindowStateType::kFullscreen;
  return not_need_bounds || restore_data.bounds_in_root.has_value() ||
         restore_data.current_bounds.has_value();
}

}  // namespace arc


text:
<?php

class Form_log_adapter extends CI_Model{

	public function __construct(){
		parent::__construct();
		$this->load->database();
		$this->load->model('metier/form_log_model');
		$this->load->helper('date');
	}

	public function insertLog($idFormFamille, $idFormType, $parametres, $membre, $idMembre){

		$dateRecord = date('Y-m-d H:i:s',now());

		try {

			$this->db->insert('form_log',array('id_form_famille'=>$idFormFamille,
													'id_form_type'=>$idFormType,
													'parametres'=>$parametres,
													'membre'=>$membre,
													'id_membre'=>$idMembre,
													'date_record'=>$dateRecord)
			);

		} catch (Exception $e) {
			echo $e->getMessage();
		}

	}

	public function getAllFormLog(){
		$query = $this->db->get('form_log');

		$liste = null;
		if($query->num_rows() > 0){
			foreach ($query->result() as $row) {
				$liste[$row->id_form_log] = new Form_log_model($row->id_form_log, $row->id_form_famille, $row->id_form_type, $row->parametres, $row->membre, $row->id_membre, $row->date_record);
			}
		}

		return $liste;
	}

}


text:
package org.anderes.web.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import static org.springframework.security.config.http.SessionCreationPolicy.*;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.provisioning.UserDetailsManager;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/users/token/**").hasAnyRole("USER")
                .antMatchers("/users/*").hasRole("ADMIN")
                .and()
                .httpBasic()
                .and()
                .sessionManagement().sessionCreationPolicy(STATELESS)
                .and()
                .csrf().disable();
    }

    @Bean
    @Override
    public UserDetailsManager userDetailsService() {
        InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
        manager.createUser(User.withUsername("userEdit").password("$2a$10$k6KIBQh4uYy0agps9zDcbeDpQHwzvVEjEs1SF/bQtAXyIX3X7tUKq").roles("USER").build());
        manager.createUser(User.withUsername("user@delete").password("$2a$10$k6KIBQh4uYy0agps9zDcbeDpQHwzvVEjEs1SF/bQtAXyIX3X7tUKq").roles("USER").build());
        manager.createUser(User.withUsername("user").password("$2a$10$k6KIBQh4uYy0agps9zDcbeDpQHwzvVEjEs1SF/bQtAXyIX3X7tUKq").roles("USER", "ANONYMOUS").build());
        manager.createUser(User.withUsername("admin").password("$2a$10$k6KIBQh4uYy0agps9zDcbeDpQHwzvVEjEs1SF/bQtAXyIX3X7tUKq").roles("ADMIN", "USER", "ANONYMOUS").build());
        return manager;
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}


text:
package com.welbits.izanrodrigo.chips.lib;

import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author RAW
 */
class FlowLayout extends ViewGroup {
   private int lineHeight;

   FlowLayout(Context context) {
      super(context);
   }

   FlowLayout(Context context, AttributeSet attrs) {
      super(context, attrs);
   }

   static int dpToPx(int dp) {
      return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
   }

   @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
      assert (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED);

      final int width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight();
      int height = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() - getPaddingBottom();
      final int count = getChildCount();
      int lineHeight = 0;

      int x = getPaddingLeft();
      int y = getPaddingTop();

      int childHeightMeasureSpec;
      if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
         childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
      } else {
         childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
      }

      for (int i = 0; i < count; i++) {
         final View child = getChildAt(i);
         if (child.getVisibility() != GONE) {
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
                  childHeightMeasureSpec);
            final int childw = child.getMeasuredWidth();
            lineHeight = Math.max(lineHeight, child.getMeasuredHeight() + lp.verticalSpacing);

            if (x + childw > width) {
               x = getPaddingLeft();
               y += lineHeight;
            }

            x += childw + lp.horizontalSpacing;
         }
      }
      this.lineHeight = lineHeight;

      if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED || (MeasureSpec.getMode(
            heightMeasureSpec) == MeasureSpec.AT_MOST && y + lineHeight < height)) {
         height = y + lineHeight;
      }
      setMeasuredDimension(width, height);
   }

   @Override protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
      return new LayoutParams(dpToPx(7), dpToPx(7));
   }

   @Override protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
      return p instanceof LayoutParams;
   }

   @Override protected void onLayout(boolean changed, int l, int t, int r, int b) {
      final int count = getChildCount();
      final int width = r - l;
      int x = getPaddingLeft();
      int y = getPaddingTop();

      for (int i = 0; i < count; i++) {
         final View child = getChildAt(i);
         if (child.getVisibility() != GONE) {
            final int childWidth = child.getMeasuredWidth();
            final int childHeight = child.getMeasuredHeight();
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (x + childWidth > width) {
               x = getPaddingLeft();
               y += lineHeight;
            }
            child.layout(x, y, x + childWidth, y + childHeight);
            x += childWidth + lp.horizontalSpacing;
         }
      }
   }

   static class LayoutParams extends ViewGroup.LayoutParams {
      final int horizontalSpacing;
      final int verticalSpacing;

      /**
       * @param horizontalSpacing Pixels between items, horizontally
       * @param verticalSpacing   Pixels between items, vertically
       */
      LayoutParams(int horizontalSpacing, int verticalSpacing) {
         super(0, 0);
         this.horizontalSpacing = horizontalSpacing;
         this.verticalSpacing = verticalSpacing;
      }
   }
}


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>PHPExcel classes » \PHPExcel_Style_Protection</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">

PHPExcel classes

                                    API Documentation

Packages

 Default

 JAMA

 JAMA
Cholesky decomposition class
For a symmetric, positive definite matrix A, the Cholesky decomposition
is an lower triangular matrix L so that A = L*L'

 JAMA
Class to obtain eigenvalues and eigenvectors of a real matrix

 JAMA
Error handling

 JAMA
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
unit lower triangular matrix L, an n-by-n upper triangular matrix U,
and a permutation vector piv of length m so that A(piv,:) = L*U

 JAMA
For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
orthogonal matrix Q and an n-by-n upper triangular matrix R so that
A = Q*R

 JAMA
For an m-by-n matrix A with m >= n, the singular value decomposition is
an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
an n-by-n orthogonal matrix V so that A = U*S*V'

 JAMA
Pythagorean Theorem:
a = 3
b = 4
r = sqrt(square(a) + square(b))
r = 5
r = sqrt(a^2 + b^2) without under/overflow

 PHPExcel

                                    Charts

 Class hierarchy diagram

                                    Reports

 Errors
                551

 Markers

todo
                19

fixme
                10

 Deprecated elements
                12

Back to top

                            Javascript is disabled; several features are only available
                            if Javascript is enabled.

<button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button>

<button class="btn details" title="Show descriptions and method names"></button><button class="btn simple" title="Show only method names"></button>

 Methods

Implement PHP __clone to create a deep clone, not just a shallow copy.
__clone()

Create a new PHPExcel_Style_Protection
__construct()

Apply styles from array
applyFromArray()

Bind parent.
bindParent()

Get the currently active cell coordinate in currently active sheet.
getActiveCell()

Get the currently active sheet.
getActiveSheet()

Get hash code
getHashCode()

Get hidden
getHidden()

Is this a supervisor or a cell style component?
getIsSupervisor()

Get locked
getLocked()

Get the currently active cell coordinate in currently active sheet.
getSelectedCells()

Get the shared style component for the currently active cell in currently active sheet.
getSharedComponent()

Build style array from subcomponents
getStyleArray()

Set hidden
setHidden()

Set locked
setLocked()

 Properties

» Protected

$_hidden

$_isSupervisor

$_locked

$_parent

 Constants

Protection styles
PROTECTION_INHERIT

PROTECTION_PROTECTED
PROTECTION_PROTECTED

PROTECTION_UNPROTECTED
PROTECTION_UNPROTECTED

\

global

\PHPExcel_Style_Protection

PHPExcel_Style_Protection

category
PHPExcel

package
PHPExcel_Style

copyright
Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

 Methods

Implement PHP __clone to create a deep clone, not just a shallow copy.

__clone()

Inherited

inherited_from
\PHPExcel_Style_Supervisor::__clone()

Create a new PHPExcel_Style_Protection

__construct(boolean $isSupervisor, boolean $isConditional)

Parameters

$isSupervisor

boolean
Flag indicating if this is a supervisor or not
								Leave this value at default unless you understand exactly what
									its ramifications are

$isConditional

boolean
Flag indicating if this is a conditional style or not
								Leave this value at default unless you understand exactly what
									its ramifications are

Apply styles from array

applyFromArray(array $pStyles) : \PHPExcel_Style_Protection

$objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
    array(
        'locked' => TRUE,
        'hidden' => FALSE
    )
);

Parameters

$pStyles

array
Array containing style information

Exceptions

\PHPExcel_Exception

Returns

\PHPExcel_Style_Protection

Bind parent.

bindParent(\PHPExcel $parent, $parentPropertyName) : \PHPExcel_Style_Supervisor

Inherited

Only used for supervisor

inherited_from
\PHPExcel_Style_Supervisor::bindParent()

Parameters

$parent

\PHPExcel

$parentPropertyName

Returns

\PHPExcel_Style_Supervisor

Get the currently active cell coordinate in currently active sheet.

getActiveCell() : string

Inherited

Only used for supervisor

inherited_from
\PHPExcel_Style_Supervisor::getActiveCell()

Returns

stringE.g. 'A1'

Get the currently active sheet.

getActiveSheet() : \PHPExcel_Worksheet

Inherited

Only used for supervisor

inherited_from
\PHPExcel_Style_Supervisor::getActiveSheet()

Returns

\PHPExcel_Worksheet

Get hash code

getHashCode() : string

Returns

stringHash code

Get hidden

getHidden() : string

Returns

string

Is this a supervisor or a cell style component?

getIsSupervisor() : boolean

Inherited

inherited_from
\PHPExcel_Style_Supervisor::getIsSupervisor()

Returns

boolean

Get locked

getLocked() : string

Returns

string

Get the currently active cell coordinate in currently active sheet.

getSelectedCells() : string

Inherited

Only used for supervisor

inherited_from
\PHPExcel_Style_Supervisor::getSelectedCells()

Returns

stringE.g. 'A1'

Get the shared style component for the currently active cell in currently active sheet.

getSharedComponent() : \PHPExcel_Style_Protection

Only used for style supervisor

Returns

\PHPExcel_Style_Protection

Build style array from subcomponents

getStyleArray(array $array) : array

Parameters

$array

array

Returns

array

Set hidden

setHidden(string $pValue) : \PHPExcel_Style_Protection

Parameters

$pValue

string

Returns

\PHPExcel_Style_Protection

Set locked

setLocked(string $pValue) : \PHPExcel_Style_Protection

Parameters

$pValue

string

Returns

\PHPExcel_Style_Protection

 Properties

$_hidden : string

$_isSupervisor : boolean

Inherited

inherited_from
\PHPExcel_Style_Supervisor::$$_isSupervisor

$_locked : string

$_parent : \PHPExcel_Style

Inherited

Only used for supervisor

inherited_from
\PHPExcel_Style_Supervisor::$$_parent

 Constants

Protection styles

PROTECTION_INHERIT

PROTECTION_PROTECTED

PROTECTION_PROTECTED

PROTECTION_UNPROTECTED

PROTECTION_UNPROTECTED

            Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.

            Documentation is powered by phpDocumentor 2.0.0a12 and

            generated on 2014-03-02T15:34:38Z.


text:
class String

  ##
  # Passes each byte in str to the given block.
  #
  def each_byte
    idx = 0
    while idx < length
      yield self.getbyte(idx)
      idx += 1
    end
    self
  end

  ##
  # Passes each character in str to the given block.
  #
  def each_char
    idx = 0
    while idx < length
      yield self[idx]
      idx += 1
    end
    self
  end

  #
  # ljust
  #
  def ljust(width, padding = ' ')
    __ljust_rjust_argcheck(width, padding)
    result = self.dup
    return result if width <= length
    while true
      padding.each_char do |char|
        result << char
        return result if result.length == width
      end
    end
  end

  #
  # rjust
  #
  def rjust(width, padding = ' ')
    __ljust_rjust_argcheck(width, padding)
    return self.dup if width <= length
    rlen = width - length
    rstr = ""
    while true
      rstr << padding
      break if rlen <= rstr.length
    end
    rstr[0, rlen] + self
  end

  # private

    def __ljust_rjust_argcheck(width, padding)
      if padding.length == 0
        raise ArgumentError, "zero width padding"
      end
      unless width.kind_of?(Integer)
        raise TypeError, "no implicit conversion into Integer"
      end
    end

end


text:
//
//  GQNetworkConsts.h
//  GQNetWorkDemo
//
//  Created by 高旗 on 16/5/27.
//  Copyright © 2016年 gaoqi. All rights reserved.
//

#ifndef GQNetworkConsts_h
#define GQNetworkConsts_h

/**
 * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
 *
 * @see http://nshipster.com/ns_enum-ns_options/
 **/
#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif

typedef NS_ENUM(NSInteger, GQNetworkStatus) {
    // Apple NetworkStatus Compatible Names.
    GQNotReachable = 0,
    GQReachableViaWiFi=2,
    GQReachableViaWWAN=1
};

typedef enum {
    GQURLParameterEncoding,             //常规post请求  可有图片
    GQJSONParameterEncoding             //parameter json化 无图片
} GQParameterEncoding;

typedef enum : NSUInteger{
    GQRequestMethodGet = 1,
    GQRequestMethodPost,           // content type = @"application/x-www-form-urlencoded"
    GQRequestMethodMultipartPost,   // content type = @"multipart/form-data"
    GQRequestMethodPut,
    GQRequestMethodDelete
} GQRequestMethod;

typedef enum:NSInteger {
    GQRequestErrorDefualt = 10000,  //默认错误
    GQRequestErrorNoNetWork,        //无网络
    GQRequestErrorNoData,           //无数据
    GQRequestErrorParse,            //解析错误
}GQRequestError;

////////////////////////////////////////////////////////////////////////////////
#ifndef SHOULDOVERRIDE
    #define SHOULDOVERRIDE(basename, subclassname){ NSAssert([basename isEqualToString:subclassname], @"subclass should override the method!");}
#endif

#ifndef GQDispatch_main_async_safe
    #define GQDispatch_main_async_safe(block)\
    if ([NSThread isMainThread]) {\
        block();\
    } else { \
        dispatch_async(dispatch_get_main_queue(),block);\
    }
#endif

#ifndef GQ_USER_DEFAULT
    #define GQ_USER_DEFAULT [NSUserDefaults standardUserDefaults]
#endif

//强弱引用
#ifndef GQWeakify
    #define GQWeakify(object) __weak __typeof__(object) weak##_##object = object
#endif

#ifndef GQStrongify
    #define GQStrongify(object) __strong __typeof__(object) object = weak##_##object
#endif

#ifndef GQVariableAssert
    #define GQVariableAssert(_Chain_)\
    NSAssert(!_Chain_, @"%@",[NSString stringWithFormat:@"The %s has initialization",#_Chain_]);
#endif

#ifndef GQChainRequestDefine
    #define GQChainRequestDefine(_key_name_,_Chain_, _type_ , _block_type_)\
    - (_block_type_)_key_name_{\
        GQVariableAssert(_##_Chain_);\
        NSAssert(!_loading, @"The request has already begun");\
        GQWeakify(self);\
        if (!_##_key_name_) {\
            _##_key_name_ = ^(_type_ value){\
                GQStrongify(self);\
                self->_##_Chain_ = value;\
                return self;\
            };\
        }\
        return _##_key_name_;\
    }
#endif

#ifndef GQMethodRequestDefine
    #define GQMethodRequestDefine( _method_ , _type_)\
    - (instancetype)_method_:(_type_)value{\
        GQVariableAssert(_##_method_);\
        _##_method_ = [value copy];\
        return self;\
    }
#endif

static NSString * GQUploadKey= @"GQUploadKey";
static NSString * GQUploadData= @"GQUploadData";
static NSString * GQUploadFileName= @"GQUploadFileName";
static NSString * GQUploadContentType= @"GQUploadContentType";

#endif /* GQNetworkConsts_h */


text:
{-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables, MultiParamTypeClasses #-}
module Program (Program(..), interpret, Interprets(..)) where
import Control.Monad

-- Generic programs, parameterised over some instruction set
data Program instr a where
    Return :: a -> Program instr a
    (:>>=) :: Program instr a -> (a -> Program instr b) -> Program instr b
    Instr  :: instr a -> Program instr a

-- Obvious instance
instance Monad (Program instr) where
    return = Return
    (>>=)  = (:>>=)

-- Obvious instance
instance Applicative (Program instr) where
    pure = return
    (<*>) = ap

-- Obvious instance
instance Functor (Program instr) where
    fmap = liftM

class Interprets m instr where
  interp :: instr b -> m b

-- Interpret
interpret :: (Monad m, Interprets m instr) => Program instr a -> m a
interpret (Return a) = return a
interpret (m :>>= f) = interpret m >>= (interpret . f)
interpret (Instr  i) = interp i


text:
/*
 * Author: 陈志杭 Caspar
 * Contact: 279397942@qq.com qq:279397942
 * Description: 数据契约实体模型文件
 * 文件由模板生成,请不要直接修改文件,如需修改请创建一个对应的partial文件
 */
using System;
using System.Collections;
using System.Collections.Generic;
using Zh.DAL.Define.Entities;
using Zh.DAL.Base.Define.Entities;
namespace Zh.DAL.Define.Entities
{
	#region Prestige_Post

	/// <summary>
    /// 车辆口碑帖子
	/// Prestige_Post object for mapped table 'Prestige_Post'.
	/// </summary>
	public partial class Prestige_Post
	{

		#region Constructors

		public Prestige_Post() { }

		public Prestige_Post( Guid iD, DateTime createdDate, int identity, Guid carMainID, Guid carItemID, Guid memberID, int wholeScore, string wholeComment, int appearanceScore, string appearanceComment, int internalViewScore, string inernalViewComment, int spaceScore, string spaceComment, int powerScore, string powerComment, int controlScore, string controlComment, int configScore, string configComment, int comfortLevelScore, string comfortLevelComment, int costPerformanceScore, string costPerformanceComment, DateTime? buyDateTime, decimal? carPrice, decimal? currentKM, decimal oilWear, decimal? carCostPerMonth )
		{
			this.ID = iD;
			this.CreatedDate = createdDate;
			this.Identity = identity;
			this.CarMainID = carMainID;
			this.CarItemID = carItemID;
			this.MemberID = memberID;
			this.WholeScore = wholeScore;
			this.WholeComment = wholeComment;
			this.AppearanceScore = appearanceScore;
			this.AppearanceComment = appearanceComment;
			this.InternalViewScore = internalViewScore;
			this.InernalViewComment = inernalViewComment;
			this.SpaceScore = spaceScore;
			this.SpaceComment = spaceComment;
			this.PowerScore = powerScore;
			this.PowerComment = powerComment;
			this.ControlScore = controlScore;
			this.ControlComment = controlComment;
			this.ConfigScore = configScore;
			this.ConfigComment = configComment;
			this.ComfortLevelScore = comfortLevelScore;
			this.ComfortLevelComment = comfortLevelComment;
			this.CostPerformanceScore = costPerformanceScore;
			this.CostPerformanceComment = costPerformanceComment;
			this.BuyDateTime = buyDateTime;
			this.CarPrice = carPrice;
			this.CurrentKM = currentKM;
			this.OilWear = oilWear;
			this.CarCostPerMonth = carCostPerMonth;
		}
		#endregion

		#region Public Properties
        /// <summary>
        /// ID
        /// </summary>
		public virtual Guid ID { get; set; }
        /// <summary>
        /// 发布时间
        /// </summary>
		public virtual DateTime CreatedDate { get; set; }
        /// <summary>
        /// 自增Id
        /// </summary>
		public virtual int Identity { get; set; }
        /// <summary>
        /// 车型ID
        /// </summary>
		public virtual Guid CarMainID { get; set; }
        /// <summary>
        /// 车款ID
        /// </summary>
		public virtual Guid CarItemID { get; set; }
        /// <summary>
        /// 会员ID
        /// </summary>
		public virtual Guid MemberID { get; set; }
        /// <summary>
        /// 总评分
        /// </summary>
		public virtual int WholeScore { get; set; }
        /// <summary>
        /// 总评价
        /// </summary>
		public virtual string WholeComment { get; set; }
        /// <summary>
        /// 外观评分
        /// </summary>
		public virtual int AppearanceScore { get; set; }
        /// <summary>
        /// 外观评价
        /// </summary>
		public virtual string AppearanceComment { get; set; }
        /// <summary>
        /// 内饰评分
        /// </summary>
		public virtual int InternalViewScore { get; set; }
        /// <summary>
        /// 内饰评价
        /// </summary>
		public virtual string InernalViewComment { get; set; }
        /// <summary>
        /// 空间评分
        /// </summary>
		public virtual int SpaceScore { get; set; }
        /// <summary>
        /// 空间评价
        /// </summary>
		public virtual string SpaceComment { get; set; }
        /// <summary>
        /// 动力评分
        /// </summary>
		public virtual int PowerScore { get; set; }
        /// <summary>
        /// 动力评价
        /// </summary>
		public virtual string PowerComment { get; set; }
        /// <summary>
        /// 控制评分
        /// </summary>
		public virtual int ControlScore { get; set; }
        /// <summary>
        /// 控制评价
        /// </summary>
		public virtual string ControlComment { get; set; }
        /// <summary>
        /// 油耗评分
        /// </summary>
		public virtual int ConfigScore { get; set; }
        /// <summary>
        /// 油耗评价
        /// </summary>
		public virtual string ConfigComment { get; set; }
        /// <summary>
        /// 舒适度评分
        /// </summary>
		public virtual int ComfortLevelScore { get; set; }
        /// <summary>
        /// 舒适度评价
        /// </summary>
		public virtual string ComfortLevelComment { get; set; }
        /// <summary>
        /// 性价比评分
        /// </summary>
		public virtual int CostPerformanceScore { get; set; }
        /// <summary>
        /// 性价比评价
        /// </summary>
		public virtual string CostPerformanceComment { get; set; }
        /// <summary>
        /// 购车时间
        /// </summary>
		public virtual DateTime? BuyDateTime { get; set; }
        /// <summary>
        /// 裸车价格(万元)
        /// </summary>
		public virtual decimal? CarPrice { get; set; }
        /// <summary>
        /// 当前里程(公里)
        /// </summary>
		public virtual decimal? CurrentKM { get; set; }
        /// <summary>
        /// 油耗(L/100km)
        /// </summary>
		public virtual decimal OilWear { get; set; }
        /// <summary>
        /// 养车费用(元/月)
        /// </summary>
		public virtual decimal? CarCostPerMonth { get; set; }

        /// <summary>
        /// 车辆主表
        /// </summary>
        public virtual Car_Main Car_Main{get;set;}
        /// <summary>
        /// 指定车辆表
        /// </summary>
        public virtual Car_MainItem Car_MainItem{get;set;}
        /// <summary>
        /// 会员账号信息
        /// </summary>
        public virtual Member_Account Member_Account{get;set;}

        /// <summary>
        /// 口碑收藏表
        /// </summary>
        public virtual IList<Prestige_PostCollection> Prestige_PostCollection{get;set;}
        /// <summary>
        /// 口碑图片表
        /// </summary>
        public virtual IList<Prestige_PostImage> Prestige_PostImage{get;set;}

		#endregion

	}
	#endregion
}


text:
package main

import (
	"encoding/json"
	"flag"
	"io/ioutil"
	"net"
	"net/http"
	"os"
	"strconv"
	"strings"
	"time"

	"code.google.com/p/go.net/websocket"
	"github.com/ziutek/glib"
	"github.com/ziutek/gst"
)

func fetchObject(uri string, obj interface{}) (interface{}, error) {
	log.Debug("fetch object: %s", uri)
	resp, err := http.Get(uri)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	err = json.Unmarshal(body, obj)
	if err != nil {
		return nil, err
	}

	return obj, nil
}

func fetchConfig(base string) (*Config, error) {
	var config Config
	_, err := fetchObject(base+"/api/config", &config)
	return &config, err
}

func readBlob(ws *websocket.Conn) ([]byte, error) {
	buf := make([]byte, 0)

	for {
		msg := make([]byte, 2048)
		var n int
		var err error
		if n, err = ws.Read(msg); err != nil {
			return nil, err
		}
		log.Debug("Received %db: %s", n, msg[:n])
		buf = append(buf, msg[:n]...)

		if len(msg) > n {
			return buf, nil
		}
	}

	// should never happen
	return nil, nil
}

func (m *Manager) readConfig(ws *websocket.Conn) error {
	buf, err := readBlob(ws)
	if err != nil {
		return err
	}

	var config Config
	err = json.Unmarshal(buf, &config)
	if err != nil {
		return err
	}

	// send new config to pipeline
	log.Debug("got new config: %s", config)
	m.NewConfig(&config)
	return nil
}

func (m *Manager) readConfigs(ws *websocket.Conn) {
	defer ws.Close()
	// read from websocket
	for {
		err := m.readConfig(ws)
		if err != nil {
			log.Error("error reading config: %s", err)
			return
		}
	}
}

func (m *Manager) watchConfig() {
	backOff := time.Second

	for {
		origin := m.ConfigUri
		url := strings.Replace(m.ConfigUri, "http", "ws", 1) + "/ws/config"
		ws, err := websocket.Dial(url, "", origin)
		if err != nil {
			log.Error("unable to reach config server: %s", err)
			time.Sleep(backOff)
			// exponential back off, max = 1h
			if backOff < time.Hour {
				backOff *= 2
			} else {
				backOff = time.Hour
			}
		} else {
			// reset back off
			backOff = time.Second
			m.readConfigs(ws)
		}
	}
}

func (m *Manager) getServer(config *Config) *Server {
	r, ok := config.Receivers[m.Receiver().Id()]
	if ok && r.ServerId != "" {
		return config.Servers[r.ServerId]
	}
	return nil
}

func (m *Manager) checkServer(server *Server) bool {
	conn, err := net.Dial("tcp", net.JoinHostPort(server.Host, strconv.Itoa(server.Port)))
	if conn != nil {
		conn.Close()
	}
	if err != nil {
		log.Error("error connecting to server: %s", err)
	}
	return err == nil
}

func (m *Manager) setVolume() {
	if m.Pipeline == nil {
		return
	}
	volume := m.Pipeline.GetByName("volume")
	if volume == nil {
		log.Error("unable to find pipeline element 'volume'")
		return
	}
	// rtp volume [0,100]
	// gst volume [0,1]
	v := float64(m.Receiver().Volume) / 100
	log.Debug("set new volume: %d", v)
	volume.SetProperty("volume", v)
}

func (m *Manager) buildPipeline(server *Server) {
	src := makeElem("tcpclientsrc")
	src.SetProperty("host", server.Host)
	src.SetProperty("port", server.Port)
	dec := makeElem("decodebin")
	volume := makeElem("volume")
	volume.SetProperty("volume", 1.0)
	sink := makeElem("autoaudiosink")
	sink.SetProperty("sync", false)

	m.Pipeline = gst.NewPipeline("pipeline")
	bus := m.Pipeline.GetBus()
	bus.AddSignalWatch()
	bus.Connect("message", m.onMessage, nil)
	dec.ConnectNoi("pad-added", onPadAdded, volume.GetStaticPad("sink"))

	addElem(m.Pipeline, src)
	addElem(m.Pipeline, dec)
	addElem(m.Pipeline, volume)
	addElem(m.Pipeline, sink)
	linkElems(src, dec)
	linkElems(dec, volume)
	linkElems(volume, sink)
	m.setVolume()
}

func (m *Manager) playPipeline(server *Server) {
	m.Pipeline = nil
	if m.checkServer(server) {
		m.RetryCount = 0
		m.buildPipeline(server)
		m.StartPipeline()
	} else if m.RetryCount >= maxRetry {
		log.Warning("max retries reached, wait for new config")
	} else {
		// schedule recheck
		m.RetryCount += 1
		time.Sleep(retryInterval)
		m.NewConfig(nil)
		m.RetryCount = 0
	}
}

func (m *Manager) updateReceiver(config *Config) {
	// update m.Backend from config.Backends.Receivers
	m.Backend = config.Receivers[m.Backend.Id()]
	// update volume of playing pipeline
	m.setVolume()
}

func (m *Manager) loop() {
	var config *Config
	var err error
	for {
		log.Debug("starting new pipeline")
		if config == nil {
			config, err = fetchConfig(m.ConfigUri)
			if err != nil {
				log.Error("error fetching config: %s", err)
				os.Exit(1)
			}
		}

		server := m.getServer(config)
		if server != nil {
			log.Info("connecting to server: %s:%d", server.Host, server.Port)
			m.playPipeline(server)
		} else {
			log.Info("unable to find suitable server for myself (%s), waiting for new config", m.Receiver().Host)
		}
		// watch state/config changes and restart pipeline
		var newServer *Server
		first := true
		for newServer == nil || (server != nil && server.Host == newServer.Host && server.Port == newServer.Port) {
			log.Debug("wait for new config")
			log.Debug("old server: %s", server)
			log.Debug("new server: %s", newServer)
			config = m.WaitForNewConfig()
			if config == nil {
				// state changed start all over
				break
			}
			m.updateReceiver(config)
			newServer = m.getServer(config)
			// exit loop if server == off
			if newServer == nil {
				if !first {
					time.Sleep(retryInterval)
				}
				break
			}
			first = false
		}
		m.StopPipeline()
	}
}

func (m *Manager) scheduleBackendTimeout(c <-chan time.Time) {
	for {
		log.Debug("ping config server")
		uri := m.ConfigUri + "/api/ping/"
		pingConfig(uri+"receiver", m.Backend)
		<-c
	}
}

func (m *Manager) startReceiver() {
	log.Debug("starting receiver")
	go m.loop()
	go m.watchConfig()
	go m.scheduleBackendTimeout(time.Tick(backendTimeout / 2))
	log.Debug("start gst loop")
	glib.NewMainLoop(nil).Run()
	log.Debug("receiver stopped")
}

func main() {
	hostname, _ := os.Hostname()
	m := NewReceiver()
	r := m.Receiver()
	flag.StringVar(&m.ConfigUri, "config-server", "http://localhost:8080", "config server base uri")
	flag.StringVar(&r.Name, "name", hostname, "receiver name")
	flag.StringVar(&r.Host, "host", hostname, "receiver host name")
	verbose := flag.Bool("verbose", false, "verbose logging")
	flag.Parse()
	initLogger(*verbose)

	m.startReceiver()
}


text:
> Pager UI component, from Upstage.

[Jump to examples ↓](./EXAMPLES.md)

## Quickstart
Install the component with either:

* `npm install upstage-pager`, or
* `bower install upstage-pager`

## Examples

_(Nothing yet)_

## Contributing
Please see the [Contributing to Upstage](https://github.com/upstage/upstage/blob/master/CONTRIBUTING.md) guide for information on contributing to this project.

## Author

+ [github.com/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter.com/jonschlinkert](http://twitter.com/jonschlinkert)

## License
Copyright (c) 2013 Upstage, Jon Schlinkert, contributors.
Released under the MIT license

***

_This file was generated on Thursday, October 24, 2013._


text:
namespace llvm {

/// A ThreadPool for asynchronous parallel execution on a defined number of
/// threads.
///
/// The pool keeps a vector of threads alive, waiting on a condition variable
/// for some work to become available.
class ThreadPool {
public:
  using TaskTy = std::function<void()>;
  using PackagedTaskTy = std::packaged_task<void()>;

  /// Construct a pool with the number of threads found by
  /// hardware_concurrency().
  ThreadPool();

  /// Construct a pool of \p ThreadCount threads
  ThreadPool(unsigned ThreadCount);

  /// Blocking destructor: the pool will wait for all the threads to complete.
  ~ThreadPool();

  /// Asynchronous submission of a task to the pool. The returned future can be
  /// used to wait for the task to finish and is *non-blocking* on destruction.
  template <typename Function, typename... Args>
  inline std::shared_future<void> async(Function &&F, Args &&... ArgList) {
    auto Task =
        std::bind(std::forward<Function>(F), std::forward<Args>(ArgList)...);
    return asyncImpl(std::move(Task));
  }

  /// Asynchronous submission of a task to the pool. The returned future can be
  /// used to wait for the task to finish and is *non-blocking* on destruction.
  template <typename Function>
  inline std::shared_future<void> async(Function &&F) {
    return asyncImpl(std::forward<Function>(F));
  }

  /// Blocking wait for all the threads to complete and the queue to be empty.
  /// It is an error to try to add new tasks while blocking on this call.
  void wait();

private:
  /// Asynchronous submission of a task to the pool. The returned future can be
  /// used to wait for the task to finish and is *non-blocking* on destruction.
  std::shared_future<void> asyncImpl(TaskTy F);

  /// Threads in flight
  std::vector<llvm::thread> Threads;

  /// Tasks waiting for execution in the pool.
  std::queue<PackagedTaskTy> Tasks;

  /// Locking and signaling for accessing the Tasks queue.
  std::mutex QueueLock;
  std::condition_variable QueueCondition;

  /// Locking and signaling for job completion
  std::mutex CompletionLock;
  std::condition_variable CompletionCondition;

  /// Keep track of the number of thread actually busy
  std::atomic<unsigned> ActiveThreads;

#if LLVM_ENABLE_THREADS // avoids warning for unused variable
  /// Signal for the destruction of the pool, asking thread to exit.
  bool EnableFlag;
#endif
};
}

#endif // LLVM_SUPPORT_THREAD_POOL_H


text:
using System;
using System.Threading.Tasks;

namespace splunk4net.TaskHelpers
{
    public interface IContinuation
    {
        Task With(Action<Task> action);
    }

    public interface IContinuation<T>
    {
        // ReSharper disable once UnusedMember.Global
        Task With(Action<Task<T>> action);
        Task<TNext> With<TNext>(Func<Task<T>, TNext> func);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

public class SoftuniCoffeeOrders
{
    static void Main()
    {
        int count = int.Parse(Console.ReadLine());
        decimal currentPrice = 0;
        decimal totalPrice = 0;

        for (int i = 0; i < count; i++)
        {
            decimal pricePerCapsule = decimal.Parse(Console.ReadLine());
            DateTime orderDate = DateTime.ParseExact(
                Console.ReadLine(),
                "d/M/yyyy",
                CultureInfo.InvariantCulture);

            decimal capsuleCount = decimal.Parse(Console.ReadLine());

            decimal daysInMount = DateTime.DaysInMonth(orderDate.Year, orderDate.Month);
            currentPrice = ((daysInMount * capsuleCount) * pricePerCapsule);
            totalPrice += currentPrice;
            Console.WriteLine($"The price for the coffee is: ${currentPrice:F2}");
        }

        Console.WriteLine($"Total: ${totalPrice:F2}");

    }
}


text:
'use strict';

/**
 * Module dependencies
 */
var acl = require('acl');

// Using the memory backend
acl = new acl(new acl.memoryBackend());

/**
 * Invoke Trackinginfos Permissions
 */
exports.invokeRolesPolicies = function () {
  acl.allow([{
    roles: ['admin'],
    allows: [{
      resources: '/api/trackinginfos',
      permissions: '*'
    }, {
      resources: '/api/trackinginfos/:trackinginfoId',
      permissions: '*'
    }]
  }, {
    roles: ['user'],
    allows: [{
      resources: '/api/trackinginfos',
      permissions: ['get', 'post']
    }, {
      resources: '/api/trackinginfos/:trackinginfoId',
      permissions: ['get']
    }]
  }, {
    roles: ['guest'],
    allows: [{
      resources: '/api/trackinginfos',
      permissions: ['get']
    }, {
      resources: '/api/trackinginfos/:trackinginfoId',
      permissions: ['get']
    }]
  }]);
};

/**
 * Check If Trackinginfos Policy Allows
 */
exports.isAllowed = function (req, res, next) {
  return next();
};


text:
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <thread>
#include <chrono>
#include <experimental/filesystem>
#include <GL/glew.h>					// NOTE: You MUST include GLEW before any other OpenGL-related libraries!
#include <GLFW/glfw3.h>
#include "glm/glm.hpp"					// NOTE: Need to compile, hence the quotes
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtx/string_cast.hpp"
#define STB_IMAGE_IMPLEMENTATION		// NOTE: This line should only appear in ONE C++ file
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION	// NOTE: This line should only appear in ONE C++ file
#include "stb_image_write.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include "Settings.h"
#include "Scene.h"
using namespace std;

/*///////////////////////////////////////////////////////////////////////////////
WARNING: The shaders are for OpenGL 3.3
///////////////////////////////////////////////////////////////////////////////*/

/*///////////////////////////////////////////////////////////////////////////////
GLOBALS
///////////////////////////////////////////////////////////////////////////////*/

Scene *scene = NULL;
bool raytracingNow = false;

// OpenGL rendering //

int windowWidth = 512;
int windowHeight = 512;

int textureWidth, textureHeight;
int framebufferWidth, framebufferHeight;

GLuint renderedTexture;					// Texture ID we will render to
GLuint renderToTextureProgramID;		// Shader program to render texture to quad

GLuint quad_vertexbuffer;				// Vertex and texture coordinate buffers for quad we will draw to screen
GLuint quad_texcoordbuffer;
GLuint quad_VAO;						// Vertex Array Object (VAO) of quad we will draw to screen

										// GLFW //

GLFWwindow* window;						// Handle for window

										/*///////////////////////////////////////////////////////////////////////////////
										FUNCTIONS - Setup and OpenGL-related
										///////////////////////////////////////////////////////////////////////////////*/

										// Loads shader code; taken from: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/
										// Returns the shader program ID
GLuint loadShaders(const char *vertex_file_path, const char *fragment_file_path) {

	// Create the shaders
	GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
	GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);

	// Read the Vertex Shader code from the file
	string VertexShaderCode;
	ifstream VertexShaderStream(vertex_file_path);
	if (VertexShaderStream.is_open())
	{
		string Line = "";
		while (getline(VertexShaderStream, Line))
			VertexShaderCode += "\n" + Line;
		VertexShaderStream.close();
	}

	// Read the Fragment Shader code from the file
	string FragmentShaderCode;
	ifstream FragmentShaderStream(fragment_file_path);
	if (FragmentShaderStream.is_open()) {
		string Line = "";
		while (getline(FragmentShaderStream, Line))
			FragmentShaderCode += "\n" + Line;
		FragmentShaderStream.close();
	}

	GLint Result = GL_FALSE;
	int InfoLogLength;

	// Compile Vertex Shader
	cout << "Compiling vertex shader : " << vertex_file_path << endl;
	char const * VertexSourcePointer = VertexShaderCode.c_str();
	//cout << VertexSourcePointer << endl;
	glShaderSource(VertexShaderID, 1, &VertexSourcePointer, NULL);
	glCompileShader(VertexShaderID);

	// Check Vertex Shader
	glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
	glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
	vector<char> VertexShaderErrorMessage(max(InfoLogLength, int(1)));
	glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
	cout << &VertexShaderErrorMessage[0] << endl;

	// Compile Fragment Shader
	cout << "Compiling fragment shader : " << fragment_file_path << endl;
	char const * FragmentSourcePointer = FragmentShaderCode.c_str();
	//cout << FragmentSourcePointer << endl;
	glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer, NULL);
	glCompileShader(FragmentShaderID);

	// Check Fragment Shader
	glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
	glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
	vector<char> FragmentShaderErrorMessage(max(InfoLogLength, int(1)));
	glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
	cout << &FragmentShaderErrorMessage[0] << endl;

	// Attach shaders
	cout << "Linking program" << endl;
	GLuint ProgramID = glCreateProgram();
	glAttachShader(ProgramID, VertexShaderID);
	glAttachShader(ProgramID, FragmentShaderID);

	// Actually link the program
	glLinkProgram(ProgramID);

	// Check the program
	glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
	glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
	vector<char> ProgramErrorMessage(max(InfoLogLength, int(1)));
	glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
	cout << &ProgramErrorMessage[0] << endl;

	// We don't need the individual shaders anymore, so delete them
	glDeleteShader(VertexShaderID);
	glDeleteShader(FragmentShaderID);

	return ProgramID;
}

// Our own function to set up all our OpenGL-specific stuff
void initOpenGL() {

	// Set display color
	glClearColor(0.0, 1.0, 1.0, 0.0);

	// TEXTURE SETUP //////////////////////////////////////////////////////////////////////////////

	// For the color buffer, we will create a 2D color texture
	// First, create the texture ID
	glGenTextures(1, &renderedTexture);

	// Bind this texture to be the current 2D texture
	glBindTexture(GL_TEXTURE_2D, renderedTexture);

	// Allocate an empty 2D texture
	// Texel = texture pixel

	glTexImage2D(GL_TEXTURE_2D,		// Target
		0,							// Mipmap level (don't worry about this)
		GL_RGB,						// Internal format of texels (Red-Green-Blue color model)
		textureWidth,				// Width and height of texture
		textureHeight,
		0,							// Border around texture (setting to 0 because we don't want one)
		GL_RGB,						// Format of texels (must match internal format)
		GL_UNSIGNED_BYTE,			// Data type of each texels
		0);							// If we wanted to copy in data right away, we would do it here (for now, passing in NULL)

									// Determine texture filtering.
									// Basically has to do with what texel we use when our texture coordinates are between texels.
									// In this case, we're using "Nearest Neighbor", which is awful under most circumstances.
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

	// Unbind texture (just to be polite)
	glBindTexture(GL_TEXTURE_2D, 0);

	// SHADER SETUP CODE //////////////////////////////////////////////////////////////////////////

	// Load shader program for rendering textured quad to screen
	renderToTextureProgramID = loadShaders("../shaders/RTT.vs", "../shaders/RTT.ps");

	// Get position of uniform variable for texture and set to first active texture unit
	GLuint uniformTextureID = glGetUniformLocation(renderToTextureProgramID, "textureID");
	glUniform1i(uniformTextureID, 0);

	// TEXTURED QUAD SETUP ////////////////////////////////////////////////////////////////////////

	static const GLfloat g_quad_vertex_buffer_data[] = {
		-1.0f, -1.0f, 0.0f,
		1.0f, -1.0f, 0.0f,
		-1.0f, 1.0f, 0.0f,
		-1.0f, 1.0f, 0.0f,
		1.0f, -1.0f, 0.0f,
		1.0f, 1.0f, 0.0f,
	};

	static const GLfloat g_quad_texcoords_buffer_data[] = {
		0.0f, 0.0f,
		1.0f, 0.0f,
		0.0f, 1.0f,
		0.0f, 1.0f,
		1.0f, 0.0f,
		1.0f, 1.0f,
	};

	// Create Vertex Array Object (VAO)
	glGenVertexArrays(1, &quad_VAO);
	glBindVertexArray(quad_VAO);

	// Create buffer for vertex coordinates
	glGenBuffers(1, &quad_vertexbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, quad_vertexbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_quad_vertex_buffer_data), g_quad_vertex_buffer_data, GL_STATIC_DRAW);

	// Create buffer for texture coordinates
	glGenBuffers(1, &quad_texcoordbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, quad_texcoordbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_quad_texcoords_buffer_data), g_quad_texcoords_buffer_data, GL_STATIC_DRAW);

	// Enable attribute array 0 and 2
	glEnableVertexAttribArray(0);
	glEnableVertexAttribArray(2);

	// Bind the vertex buffer as current buffer
	glBindBuffer(GL_ARRAY_BUFFER, quad_vertexbuffer);

	// Define how to read quad_vertexbuffer
	glVertexAttribPointer(
		0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
		3,                  // number of components (3 = 3D point)
		GL_FLOAT,           // type
		GL_FALSE,           // normalized?
		0,                  // stride
		(void*)0            // array buffer offset
	);

	// Bind the vertex buffer as current buffer
	glBindBuffer(GL_ARRAY_BUFFER, quad_texcoordbuffer);

	// Define how to read quad_texcoordbuffer
	glVertexAttribPointer(
		2,                  // attribute 2
		2,                  // number of components (2 = U,V coordinates)
		GL_FLOAT,           // type
		GL_FALSE,           // normalized?
		0,                  // stride
		(void*)0            // array buffer offset
	);

	// Unbind
	glBindVertexArray(0);
}

// Cleanup OpenGL stuff
void cleanupOpenGL() {

	// Delete texture
	glBindTexture(GL_TEXTURE_2D, 0);
	glDeleteTextures(1, &renderedTexture);

	// Delete shader program
	glUseProgram(0);
	glDeleteProgram(renderToTextureProgramID);

	// Delete vertex and texture coordinate buffers for quad
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glDeleteBuffers(1, &quad_vertexbuffer);
	glDeleteBuffers(1, &quad_texcoordbuffer);

	// Delete Vertex Array Object (VAO)
	glDeleteVertexArrays(1, &quad_VAO);
}

// This function will copy the contents of mybuffer into a texture.
void copyInBufferData() {

	// Bind the texture (since we're about to modify it)
	glBindTexture(GL_TEXTURE_2D, renderedTexture);

	// Replace texture with our own buffer
	// NOTE: This does NOT reallocate the texture; it only copies in data

	glTexSubImage2D(GL_TEXTURE_2D,					// Target
		0,								// Mipmap level
		0, 0,							// Starting (x,y) coordinates
		textureWidth, textureHeight,	// Size of area to replace
		GL_RGB,							// Format of texels
		GL_FLOAT,						// Type of pixel data you are passing in
		scene->getImageBuffer());						// Pointer to pixel data we want to copy to texture

										// Unbind texture (just to be polite)
	glBindTexture(GL_TEXTURE_2D, 0);
}

// This function will render a textured quad to the screen.
void renderWindow() {

	// RENDER TO SCREEN ///////////////////////////////////////////////////////////////////////////

	// Use default framebuffer (window) and set viewport
	// WARNING: The viewport uses ACTUAL PIXELS, so do NOT use window size here!
	glBindFramebuffer(GL_FRAMEBUFFER, 0);

	float ratio = framebufferWidth / (float)framebufferHeight;
	glViewport(0, 0, framebufferWidth, framebufferHeight);

	// Clear window
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// Use shader program for rendering a textured quad to the screen
	glUseProgram(renderToTextureProgramID);

	// Using the first 2D texture (not using multi-texturing, so this is moot, but best to be on the safe side)
	glActiveTexture(GL_TEXTURE0);

	// Use renderedTexture as the 2D texture
	glBindTexture(GL_TEXTURE_2D, renderedTexture);

	// Bind VAO
	glBindVertexArray(quad_VAO);

	// Draw the object!
	// (6 vertices = 2 triangles)
	glDrawArrays(GL_TRIANGLES, 0, 6);

	// Unbind VAO
	glBindVertexArray(0);

	// Turn off shader program
	glUseProgram(0);
}

void saveScreenshot(string filename) {

	int channelCnt = 4;
	unsigned char *imageData = new unsigned char[channelCnt * framebufferWidth*framebufferHeight];
	glReadPixels(0, 0, framebufferWidth, framebufferHeight,
		GL_RGBA, GL_UNSIGNED_BYTE, imageData);
	// Flip data
	for (int i = 0; i < framebufferHeight / 2; i++) {
		int firstRow = i*framebufferWidth * channelCnt;
		int otherRow = (framebufferHeight - 1 - i)*framebufferWidth * channelCnt;

		int byteCntInRow = framebufferWidth * channelCnt;

		for (int j = 0; j < byteCntInRow; j++) {
			unsigned char tmp = imageData[firstRow + j];
			imageData[firstRow + j] = imageData[otherRow + j];
			imageData[otherRow + j] = tmp;
		}
	}

	stbi_write_png(filename.c_str(), framebufferWidth, framebufferHeight, channelCnt,
		imageData, sizeof(unsigned char) * channelCnt * framebufferWidth);
	delete[] imageData;
}

/*///////////////////////////////////////////////////////////////////////////////
FUNCTIONS - GLFW Callbacks
///////////////////////////////////////////////////////////////////////////////*/

// Callback for errors
static void error_callback(int error, const char* description) {
	cerr << description << endl;
}

void raytraceScene() {
	scene->raytrace();
	raytracingNow = false;
}

// Callback for key press, release, and repeat
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
	if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
		glfwSetWindowShouldClose(window, GL_TRUE);

	if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) {
		if (scene && !raytracingNow) {
			raytracingNow = true;
			thread rayThread(raytraceScene);
			rayThread.detach();
		}
	}
}

// Callback when the framebuffer changes size
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
	framebufferWidth = width;
	framebufferHeight = height;
}

/*///////////////////////////////////////////////////////////////////////////////
FUNCTIONS - Testing
///////////////////////////////////////////////////////////////////////////////*/

void TEST_HitRecord() {

	HitRecord h;
	cout << "DEFAULTS:" << endl;
	cout << "\t" << "t: " << h.getT() << endl;
	cout << "\t" << "Point: " << glm::to_string(h.getPoint()) << endl;
	cout << "\t" << "Normal: " << glm::to_string(h.getNormal()) << endl;
	cout << "\t" << "Mat Index: " << h.getMatIndex() << endl;

	h = HitRecord(1.0, glm::vec3(2, 3, 4), glm::vec3(5, 6, 7), 8);

	cout << "USING CONSTRUCTOR:" << endl;
	cout << "\t" << "t: " << h.getT() << endl;
	cout << "\t" << "Point: " << glm::to_string(h.getPoint()) << endl;
	cout << "\t" << "Normal: " << glm::to_string(h.getNormal()) << endl;
	cout << "\t" << "Mat Index: " << h.getMatIndex() << endl;

	h.setT(9);
	h.setPoint(glm::vec3(10, 11, 12));
	h.setNormal(glm::vec3(13, 14, 15));
	h.setMatIndex(16);

	cout << "AFTER SET FUNCTIONS:" << endl;
	cout << "\t" << "t: " << h.getT() << endl;
	cout << "\t" << "Point: " << glm::to_string(h.getPoint()) << endl;
	cout << "\t" << "Normal: " << glm::to_string(h.getNormal()) << endl;
	cout << "\t" << "Mat Index: " << h.getMatIndex() << endl;

	cout << "MIN_DISTANCE_T: " << MIN_DISTANCE_T << endl;
}

void TEST_Sphere() {

#ifdef GRAD_VERSION
	Sphere *sphere = new Sphere(glm::vec3(3, 3, 3), 2.0);
	sphere->setMaterialIndex(3);
	Surface *s = sphere;
#else
	Sphere *s = new Sphere(glm::vec3(3, 3, 3), 2.0);
	s->setMaterialIndex(3);
#endif

	glm::vec3 E = glm::vec3(0, 0, -1);

	for (int i = -10; i <= 10; i++) {
		for (int j = -10; j <= 10; j++) {
			glm::vec3 R = glm::vec3(j, i, 1);
			HitRecord record;
			bool hit = s->getIntersection(E, R, record);
			if (hit) {
				cout << "HIT: " << j << " " << i << endl;
				cout << "\t" << "t: " << record.getT() << endl;
				cout << "\t" << "Point: " << glm::to_string(record.getPoint()) << endl;
				cout << "\t" << "Normal: " << glm::to_string(record.getNormal()) << endl;
				cout << "\t" << "Mat Index: " << record.getMatIndex() << endl;
			}
		}
	}
}

#ifdef GRAD_VERSION
void TEST_Polygon() {
	Vertex v;
	v.pos = glm::vec3(1, 2, 3);
	v.normal = glm::vec3(4, 5, 6);

	Polygon *p = new Polygon();

	cout << "Polygon material index before set: " << p->getMaterialIndex() << endl;
	p->setMaterialIndex(4);
	cout << "Polygon material index after set: " << p->getMaterialIndex() << endl;

	cout << "Polygon normal before read: " << glm::to_string(p->getPolygonNormal()) << endl;

	p->read(string("p 4") + "\n" +
		"0 0 0" + "\n" +
		"2 0 0" + "\n" +
		"2 2 0" + "\n" +
		"0 2 0");

	cout << "Polygon normal after read: " << glm::to_string(p->getPolygonNormal()) << endl;
	cout << "Polygon toString() (p):" << endl;
	cout << p->toString() << endl;

	p->read(string("pp 4") + "\n" +
		"0 0 0 0 1 1" + "\n" +
		"2 0 0 0 -1 1" + "\n" +
		"2 2 0 1 0 1" + "\n" +
		"0 2 0 -1 0 1");

	cout << "Polygon toString() (pp):" << endl;
	cout << p->toString() << endl;

	HitRecord record;
	if (p->getIntersection(glm::vec3(1, 1, 5), glm::vec3(0, 0, -1), record)) {
		cout << "HIT" << endl;
		cout << "\t" << "t: " << record.getT() << endl;
		cout << "\t" << "Point: " << glm::to_string(record.getPoint()) << endl;
		cout << "\t" << "Normal: " << glm::to_string(record.getNormal()) << endl;
		cout << "\t" << "Mat Index: " << record.getMatIndex() << endl;
	}
	else {
		cout << "ERROR: DID NOT HIT" << endl;
	}
}
#endif

/*///////////////////////////////////////////////////////////////////////////////
FUNCTIONS - Main
///////////////////////////////////////////////////////////////////////////////*/

int main(int argc, char **argv)
{
	// TESTS
	cout << "** BEGIN TESTING *****************" << endl;
	TEST_HitRecord();
	TEST_Sphere();
#ifdef GRAD_VERSION
	TEST_Polygon();
#endif
	cout << "** END TESTING *****************" << endl;

	// Read NFF file
	if (argc < 2) {
		cout << "ERROR: Need to pass in NFF filename!" << endl;
		exit(1);
	}

	// Create Scene
	scene = new Scene();

	// Get NFF filename
	string filename = string(argv[1]);

	// Load file
#ifdef GRAD_VERSION
	if (!scene->loadNFF(filename)) {
		cout << "ERROR: Could not load " << filename << endl;
		return EXIT_FAILURE;
	}
#else
	if (!scene->loadNFF(filename, windowWidth, windowHeight)) {
		cout << "ERROR: Could not load " << filename << endl;
		return EXIT_FAILURE;
	}
#endif

	// GLFW setup //

	// Set error callback
	glfwSetErrorCallback(error_callback);

	// (Try to) initialize GLFW
	if (!glfwInit()) {
		exit(EXIT_FAILURE);
	}

	// MAC-SPECIFIC: Convince Mac that, yes, we want to use OpenGL version 3.3 (and NOT 2.1)
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

	// Create our GLFW window
#ifdef GRAD_VERSION
	glm::ivec2 windowSize = scene->getCamera()->getViewportSize();

	windowWidth = windowSize.x;
	windowHeight = windowSize.y;

	textureWidth = windowSize.x;
	textureHeight = windowSize.y;
#else
	textureWidth = windowWidth;
	textureHeight = windowHeight;
#endif

	window = glfwCreateWindow(windowWidth, windowHeight, "Raytracer", NULL, NULL);

	// Were we able to make it?
	if (!window) {
		// Kill GLFW and exit program
		glfwTerminate();
		exit(EXIT_FAILURE);
	}

	// Get current framebuffer size, since that could be different from the requested window size
	glfwGetFramebufferSize(window, &framebufferWidth, &framebufferHeight);

	// We want to draw to this window, so make the OpenGL context associated with this window our current context.
	glfwMakeContextCurrent(window);

	// Basically, turning VSync on (so we will wait until the screen is updated once before swapping the back and front buffers
	glfwSwapInterval(1);

	// Set our keyboard callback function, so that we can process keyboard input!
	glfwSetKeyCallback(window, key_callback);

	// Set our callback for when the framebuffer changes size
	glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

	// GLEW setup //

	// MAC-SPECIFIC: Some issues occur with using OpenGL core and GLEW; so, we'll use the experimental version of GLEW
	glewExperimental = true;

	// (Try to) initalize GLEW
	GLenum err = glewInit();

	// Call glGetError() to clear it out (can occur after glewInit() for some reason)
	glGetError();

	if (GLEW_OK != err) {
		// We couldn't start GLEW, so we've got to go.
		// Kill GLFW and get out of here
		cout << "ERROR: GLEW could not start: " << glewGetErrorString(err) << endl;
		glfwTerminate();
		exit(EXIT_FAILURE);
	}

	cout << "GLEW initialized; version " << glewGetString(GLEW_VERSION) << endl;

	GLint glMajor, glMinor;
	glGetIntegerv(GL_MAJOR_VERSION, &glMajor);
	glGetIntegerv(GL_MINOR_VERSION, &glMinor);
	cout << "OpenGL context version: " << glMajor << "." << glMinor << endl;
	printf("Supported GLSL version is %s.\n", (char *)glGetString(GL_SHADING_LANGUAGE_VERSION));

	// Initialize OpenGL-related stuff
	initOpenGL();

	// Keep going until the window should close (explicit request in program, user clicks "X", etc.)
	while (!glfwWindowShouldClose(window)) {

		// Copy whatever we've drawn on mybuffer into a texture
		copyInBufferData();

		// Render textured quad to window
		renderWindow();

		// Swap the back and front buffers!
		glfwSwapBuffers(window);

		// See if any events need to be handled (keyboard, screen resize, mouse, etc.)
		glfwPollEvents();
	}

	// Take a screenshot before we go on to glory...
	std::experimental::filesystem::path p(filename);
	saveScreenshot(p.stem().string() + ".png");

	// Cleanup OpenGL-related stuff
	cleanupOpenGL();

	// Destroy window and stop GLFW
	glfwDestroyWindow(window);
	glfwTerminate();

	// Cleanup objects
	delete scene;

	// Exit happily!
	exit(EXIT_SUCCESS);
}


text:
{-# OPTIONS_GHC -Wall #-}
module HW06 where

import Data.List
import Data.Functor

-- Exercise 1 -----------------------------------------

fib :: Integer -> Integer
fib n
    | n == 0 || n == 1 = 1
    | otherwise = fib (n - 1) + fib (n - 2)

fibs1 :: [Integer]
fibs1 = fmap fib [0..]

-- Exercise 2 -----------------------------------------

fibs2 :: [Integer]
fibs2 = tail fibs3
  where fibs3 = scanl (+) 0 (1:fibs3)

-- Exercise 3 -----------------------------------------

data Stream a = Cons a (Stream a)

-- Show instance prints the first 20 elements followed by ellipsis
instance Show a => Show (Stream a) where
    show s = "[" ++ intercalate ", " (map show $ take 10 $ streamToList s)
             ++ ",..."

streamToList :: Stream a -> [a]
streamToList (Cons x xs) = x : streamToList xs

-- Exercise 4 -----------------------------------------

instance Functor Stream where
    fmap = undefined

-- Exercise 5 -----------------------------------------

sRepeat :: a -> Stream a
sRepeat x = Cons x $ sRepeat x

sIterate :: (a -> a) -> a -> Stream a
sIterate f x = Cons x $ sIterate f $ f x

sInterleave :: Stream a -> Stream a -> Stream a
sInterleave (Cons x xs) b = Cons x $ sInterleave b xs

sTake :: Int -> Stream a -> [a]
sTake 0 _ = []
sTake n (Cons x xs) = x : sTake (n - 1) xs

-- Exercise 6 -----------------------------------------

nats :: Stream Integer
nats = sIterate (+1) 0

ruler :: Stream Integer
ruler = undefined

-- Exercise 7 -----------------------------------------

listToStream (x:xs) = Cons x (listToStream xs)

-- | Implementation of C rand

rand :: Int -> Stream Int
rand n = listToStream $ map (prettyRand n) [0..]

prettyRand r 0 = (1103515245 * r + 12345) `mod` 2147483648
prettyRand r n = (1103515245 * (prettyRand r (n - 1)) + 12345) `mod` 2147483648

-- Exercise 8 -----------------------------------------

{- Total Memory in use: ??? MB -}
minMaxSlow :: [Int] -> Maybe (Int, Int)
minMaxSlow [] = Nothing   -- no min or max if there are no elements
minMaxSlow xs = Just (minimum xs, maximum xs)

-- Exercise 9 -----------------------------------------

{- Total Memory in use: ??? MB -}
minMax :: [Int] -> Maybe (Int, Int)
minMax (x:xs) = minMaxHelper xs (x, x)
  where
    minMaxHelper [] pair = Just pair
    minMaxHelper (x:xs) (a, b)
      | x < a = minMaxHelper xs (x, b)
      | x > b = minMaxHelper xs (a, x)
      | otherwise = minMaxHelper xs (a, b)

main :: IO ()
main = print $ minMaxSlow $ sTake 1000000 $ rand 7666532

-- Exercise 10 ----------------------------------------

fastFib :: Int -> Integer
fastFib = undefined