text:
@interface PodsDummy_Pods_ChocolateTests : NSObject
@end
@implementation PodsDummy_Pods_ChocolateTests
@end


text:
require 'spec_helper'

require 'puppet/pops'
require 'puppet/pops/evaluator/evaluator_impl'

# relative to this spec file (./) does not work as this file is loaded by rspec
require File.join(File.dirname(__FILE__), '/evaluator_rspec_helper')

describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
  include EvaluatorRspecHelper

  context "When evaluator performs string interpolation" do
    it "should interpolate a bare word as a variable name, \"${var}\"" do
      a_block = block(var('a').set(10), string('value is ', text(fqn('a')), ' yo'))
      evaluate(a_block).should == "value is 10 yo"
    end

    it "should interpolate a variable in a text expression, \"${$var}\"" do
      a_block = block(var('a').set(10), string('value is ', text(var(fqn('a'))), ' yo'))
      evaluate(a_block).should == "value is 10 yo"
    end

    it "should interpolate a variable, \"$var\"" do
      a_block = block(var('a').set(10), string('value is ', var(fqn('a')), ' yo'))
      evaluate(a_block).should == "value is 10 yo"
    end

    it "should interpolate any expression in a text expression, \"${$var*2}\"" do
      a_block = block(var('a').set(5), string('value is ', text(var(fqn('a')) * 2) , ' yo'))
      evaluate(a_block).should == "value is 10 yo"
    end

    it "should interpolate any expression without a text expression, \"${$var*2}\"" do
      # there is no concrete syntax for this, but the parser can generate this simpler
      # equivalent form where the expression is not wrapped in a TextExpression
      a_block = block(var('a').set(5), string('value is ', var(fqn('a')) * 2 , ' yo'))
      evaluate(a_block).should == "value is 10 yo"
    end

    # TODO: Add function call tests - Pending implementation of calls in the evaluator
  end
end

redpajama_set_name: RedPajamaGithub


text:
require 'rubygems'
require 'bundler/setup'
require 'poro_plus'


text:
#pragma once

#include <folly/Portability.h>

#include <chrono>
#include <cstdint>

#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
extern "C" std::uint64_t __rdtsc();
#pragma intrinsic(__rdtsc)
#endif

namespace folly {

inline std::uint64_t hardware_timestamp() {
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
  return __rdtsc();
#elif defined(__GNUC__) && (defined(__i386__) || FOLLY_X64)
  return __builtin_ia32_rdtsc();
#elif defined(__aarch64__)
  uint64_t cval;
  asm volatile("mrs %0, cntvct_el0" : "=r"(cval));
  return cval;
#else
  // use steady_clock::now() as an approximation for the timestamp counter on
  // non-x86 systems
  return std::chrono::steady_clock::now().time_since_epoch().count();
#endif
}

} // namespace folly


text:
<?php

declare(strict_types=1);

return [
    'meta' => [
        'title' => 'Global constant declaration & usage in the global scope with the global constants whitelisted',
        // Default values. If not specified will be the one used
        'prefix' => 'Humbug',
        'whitelist' => [],
        'exclude-namespaces' => [],
        'expose-global-constants' => true,
        'expose-global-classes' => false,
        'expose-global-functions' => false,
        'exclude-constants' => [],
        'exclude-classes' => [],
        'exclude-functions' => [],
        'registered-classes' => [],
        'registered-functions' => [],
    ],

    'Constants declaration in the global namespace' => [
        'payload' => <<<'PHP'
<?php

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\BAR_CONST, foo());
----
<?php

namespace Humbug;

const FOO_CONST = foo();
\define('BAR_CONST', foo());
\define('Humbug\\Acme\\BAR_CONST', foo());
\define(\FOO_CONST, foo());
\define(\FOO_CONST, foo());
\define(\Humbug\Acme\BAR_CONST, foo());

PHP
    ],

    'Constants declaration in the global namespace which is whitelisted' => [
        'whitelist' => ['*'],
        'payload' => <<<'PHP'
<?php

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\BAR_CONST, foo());
----
<?php

namespace {
    const FOO_CONST = \foo();
    \define('BAR_CONST', \foo());
    \define('Acme\\BAR_CONST', \foo());
    \define(\FOO_CONST, \foo());
    \define(\FOO_CONST, \foo());
    \define(\Acme\BAR_CONST, \foo());
}

PHP
    ],

    'Whitelisted constants declaration in the global namespace' => [
        'whitelist' => ['FOO_CONST', 'BAR_CONST', 'Acme\BAR_CONST'],
        'payload' => <<<'PHP'
<?php

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\BAR_CONST, foo());
----
<?php

namespace Humbug;

\define('FOO_CONST', foo());
\define('BAR_CONST', foo());
\define('Acme\\BAR_CONST', foo());
\define(\FOO_CONST, foo());
\define(\FOO_CONST, foo());
\define(\Acme\BAR_CONST, foo());

PHP
    ],

    'Constants declaration in a namespace' => [
        'payload' => <<<'PHP'
<?php

namespace Acme;

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\FOO_CONST, foo());
----
<?php

namespace Humbug\Acme;

const FOO_CONST = foo();
\define('BAR_CONST', foo());
\define('Humbug\\Acme\\BAR_CONST', foo());
\define(FOO_CONST, foo());
\define(\FOO_CONST, foo());
\define(\Humbug\Acme\FOO_CONST, foo());

PHP
    ],

    'Constants declaration in a whitelisted namespace' => [
        'whitelist' => ['Acme\*'],
        'payload' => <<<'PHP'
<?php

namespace Acme;

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\BAR_CONST, foo());
----
<?php

namespace Acme;

const FOO_CONST = foo();
\define('BAR_CONST', foo());
\define('Acme\\BAR_CONST', foo());
\define(FOO_CONST, foo());
\define(\FOO_CONST, foo());
\define(\Acme\BAR_CONST, foo());

PHP
    ],

    'Whitelisted constants declaration in a namespace' => [
        'whitelist' => ['Acme\BAR_CONST'],
        'payload' => <<<'PHP'
<?php

namespace Acme;

const FOO_CONST = foo();
define('BAR_CONST', foo());
define('Acme\BAR_CONST', foo());
define(FOO_CONST, foo());
define(\FOO_CONST, foo());
define(\Acme\BAR_CONST, foo());
----
<?php

namespace Humbug\Acme;

const FOO_CONST = foo();
\define('BAR_CONST', foo());
\define('Acme\\BAR_CONST', foo());
\define(FOO_CONST, foo());
\define(\FOO_CONST, foo());
\define(\Acme\BAR_CONST, foo());

PHP
    ],
];


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestingWithXUnit
{
    using Xunit;

    [CollectionDefinition("Database collection")]
    public class DatabaseCollection : ICollectionFixture<MyDbSetupCode>
    {
        // A class with no code, only used to define the collection
    }

    [Collection("Database collection")]
    public class CleanupAfterCollection
    {
        MyDbSetupCode fixture;

        public CleanupAfterCollection(MyDbSetupCode fixture)
        {
            this.fixture = fixture;
        }

        [Fact]
        public void A() { }

        [Fact]
        public void B() { }
    }

    [Collection("Database collection")]
    public class MoreTestsWithDatabase
    {
        [Fact]
        public void C() { }
    }

}


text:
package lic.swifter.note.pattern.c1.imageloader_e2;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.ImageView;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ImageLoader使用单一职责原则后的改版
 * 本类仅仅负责图片的展示和下载,缓存部分由{@link ImageCache}负责
 */
public class ImageLoader {

    /**
     * 这种写法也没有实现依赖倒置原则,因为依赖于图片缓存类的具体实现
     * 如果需要修改,那么这个类就需要依据图片缓存的实现细节来修改了
     */
    private ImageCache imageCache = new ImageCache();
    private ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

    public void displayImage(final String url, final ImageView imageView) {
        Bitmap bitmap = imageCache.get(url);
        if(bitmap != null) {
            imageView.setImageBitmap(bitmap);
            return ;
        }

        imageView.setTag(url);
        executorService.submit(new Runnable() {
            @Override
            public void run() {
                Bitmap bitmap = downloadImage(url);
                if(bitmap == null)
                    return ;
                if(imageView.getTag().equals(url)) {
                    imageView.setImageBitmap(bitmap);
                }
                imageCache.put(url, bitmap);
            }
        });
    }

    private Bitmap downloadImage(String imageUrl) {
        Bitmap bitmap = null;
        try {
            URL url = new URL(imageUrl);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            bitmap = BitmapFactory.decodeStream(connection.getInputStream());
            connection.disconnect();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return bitmap;
    }
}


text:
;*******************************************************************************
; @INSTITUTION
;  University of Sao Paulo | Sao Carlos School of Engineering | SEL
;------------------------------------------------------------------------------
; @DISCIPLINE
;  Name: SEL0433 | Applications of Microprocessors I
;  Professor: Evandro Luis Linhari Rodrigues
;  Semester: 2017\01
;------------------------------------------------------------------------------
; @DEVELOPMENT
;  MCU:	Intel 8052
;  IDE: MCU 8051 v1.5.7
;  Compiler: IDE native assembler
;------------------------------------------------------------------------------
; @WARRANTY
;  Copyright (c) 2017 Andre Marcos Perez
;  The software is provided by "as is", without warranty of any kind, express or
;  implied, including but not limited to the warranties of merchantability,
;  fitness for a particular purpose and noninfringement. In no event shall the
;  authors or copyright holders be liable for any claim, damages or other
;  liability, whether in an action of contract, tort or otherwise, arising from,
;  out of or in connection with the software or the use or other dealings in the
;  software.
;------------------------------------------------------------------------------
; @EXERCISE
;  List: #2
;  Ex. : #1
;------------------------------------------------------------------------------
; @AUTHOR
;  Name:  Andre Marcos Perez
;  Email: andre.marcos.perez@usp.br
;  #USP:  8006891
;*******************************************************************************

;*******************************************************************************
; @CONSTANT
;  Code's constants
;------------------------------------------------------------------------------
	EXTERNAL_RAM_ADDRESS_EVEN_NUMBERS	EQU	60H
	INTERNAL_RAM_ADDRESS_EVEN_NUMBERS	EQU	60H
;*******************************************************************************

;*******************************************************************************
; @VARIABLE
;  Code's variables
;------------------------------------------------------------------------------
	NUMBER	EQU	20H
;*******************************************************************************

;*******************************************************************************
; @CODE
;  Main code
;------------------------------------------------------------------------------
	ORG	0
	MOV	DPTR,#EXTERNAL_RAM_ADDRESS_EVEN_NUMBERS
	MOV	R0,#INTERNAL_RAM_ADDRESS_EVEN_NUMBERS
	MOV	R1,#NUMBER
	MOV	NUMBER,#20H
LOOP:	JB	NUMBER.0,NUMBER_IS_ODD
	MOV	A,@R1
	MOV	@R0,A
	MOVX	@DPTR,A
	INC	R0
	INC	DPTR
NUMBER_IS_ODD:
	INC	NUMBER
	CJNE	@R1,#41H,LOOP
	SJMP	$
;*******************************************************************************
	END


text:
require "happy-mimi/core-ext/hash"
require "net/https"

module HappyMimi
  require "happy-mimi/action-mailer" if defined?(Rails)

  BASE_URI = "https://api.madmimi.com"

  def self.default_parameters=(new_default_parameters = {})
    @default_parameters ||= {}
    @default_parameters.merge!(new_default_parameters)
  end

  def self.default_parameters
    @default_parameters ||= {}
  end

  def self.clear_default_parameters!
    @default_parameters = {}
  end

  def self.call_api(url, *args)
    arg_params = args.last.is_a?(Hash) ? args.pop : {}
    request_params = default_parameters.merge(arg_params)
    http_method = args.shift || :get

    request_uri = URI.parse(BASE_URI)
    arg_uri = URI.parse(url)

    request_uri = request_uri.merge(arg_uri)
    request_uri.query = hash_to_http_pairs(request_params) if http_method == :get

    http = Net::HTTP.new(request_uri.host, request_uri.port)
    http.use_ssl = true if request_uri.scheme == "https"
    response = http.start do |http|
      path = (http_method == :get ? request_uri.request_uri : request_uri.path)
      data = (http_method == :post ? hash_to_http_pairs(request_params) : "")
      http.send(http_method, path, data)
    end

    response
  end

  def self.hash_to_http_pairs(hash)
    pairs = hash.inject([]) do |http_pairs, (key, value)|
      http_pairs << "#{cgi_escape(key.to_s)}=#{cgi_escape(value.to_s)}"
    end

    pairs.join("&")
  end

  def self.cgi_escape(string)
    string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
      '%' + $1.unpack('H2' * $1.size).join('%').upcase
    end.tr(' ', '+')
  end
end


text:
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Classes used to support Message's in ProtoRpc.
 * @author joetyson@gmail.com (Joe Tyson)
 */

goog.provide('ProtoRpc.BooleanField');
goog.provide('ProtoRpc.BytesField');
goog.provide('ProtoRpc.Enum');
goog.provide('ProtoRpc.EnumField');
goog.provide('ProtoRpc.EnumValue');
goog.provide('ProtoRpc.Field');
goog.provide('ProtoRpc.FloatField');
goog.provide('ProtoRpc.IntegerField');
goog.provide('ProtoRpc.Message');
goog.provide('ProtoRpc.MessageField');
goog.provide('ProtoRpc.StringField');
goog.provide('ProtoRpc.Variant');

goog.require('ProtoRpc.Util.Error');

/**
 * Invalid value for message error.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.ValidationError = function(pattern, args) {
  this.name = 'ValidationError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.ValidationError, ProtoRpc.Util.Error);

/**
 * Enumeration definition error.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.EnumDefinitionError = function(pattern, args) {
  this.name = 'EnumDefinitionError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.EnumDefinitionError, ProtoRpc.Util.Error);

/**
 * Field definition error.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.FieldDefinitionError = function(pattern, args) {
  this.name = 'FieldDefinitionError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.FieldDefinitionError, ProtoRpc.Util.Error);

/**
 * Invalid variant provided to field.
 * @constructor
 * @extends {ProtoRpc.FieldDefinitionError}
 */
ProtoRpc.InvalidVariantError = function(pattern, args) {
  this.name = 'InvalidVariantError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.InvalidVariantError, ProtoRpc.FieldDefinitionError);

/**
 * Invalid number provided to field.
 * @constructor
 * @extends {ProtoRpc.FieldDefinitionError}
 */
ProtoRpc.InvalidNumberError = function(pattern, args) {
  this.name = 'InvalidNumberError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.InvalidNumberError, ProtoRpc.FieldDefinitionError);

/**
 * Duplicate number assigned to field.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.DuplicateNumberError = function(pattern, args) {
  this.name = 'DuplicateNumberError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.DuplicateNumberError, ProtoRpc.Util.Error);

/**
 * Raised when definition is not found.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.DefinitionNotFoundError = function(pattern, args) {
  this.name = 'DefinitionNotFoundError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.DefinitionNotFoundError, ProtoRpc.Util.Error);

/**
 * Error found decoding message from encoded form.
 * @constructor
 * @extends {ProtoRpc.Util.Error}
 */
ProtoRpc.DecodeError = function(pattern, args) {
  this.name = 'DecodeError';
  goog.base(this, pattern, args);
};
goog.inherits(ProtoRpc.DecodeError, ProtoRpc.Util.Error);

/**
 * Enumeration which allows inversing of values by name or number.
 *
 * @param {Array.<ProtoRpc.EnumValueDescriptor>} values Enum values.
 * @constructor
 * @export
 */
ProtoRpc.Enum = function(values) {
  for (var number in values) {
    var value = new ProtoRpc.EnumValue(values[number], parseInt(number, 10));
    this[values[number]] = value;
  }
};

/**
 * Lookup value by its number.
 *
 * @param {Number} number
 * @return {ProtoRpc.EnumValue}
 * @export
 */
ProtoRpc.Enum.prototype.getValueFromNumber = function(number) {
  for (var key in this) {
    if (this.hasOwnProperty(key) &&
        this[key].valueOf() == number) {
      return this[key];
    }
  }
  return null;
};

/**
 * Represents a single value in an enumeration.
 *
 * Provides an API for getting both the value as a string as well
 * as the corresponding number:
 *
 *   VALUE = ProtoRpc.EnumValue('VALUE', 1)
 *   Number(VALUE); // returns 2
 *   String(VALUE); // returns 'VALUE'
 *
 * @param {string} name The value's name.
 * @param {Number} number the value's number.
 * @constructor
 */
ProtoRpc.EnumValue = function(name, number) {
  /**
   * @type {string}
   * @private
   */
  this.name_ = name;

  /**
   * @type {Number}
   * @private
   */
  this.number_ = number;
};

/**
 * @inheritDoc
 */
ProtoRpc.EnumValue.prototype.toString = function() {
  return this.name_;
};

/**
 * @return {Number}
 */
ProtoRpc.EnumValue.prototype.valueOf = function() {
  return this.number_;
};

/**
 * Wire Variants.
 * @type {ProtoRpc.Enum}
 */
ProtoRpc.Variant = new ProtoRpc.Enum({
  1: 'DOUBLE',
  2: 'FLOAT',
  3: 'INT64',
  4: 'UINT64',
  5: 'INT32',
  8: 'BOOL',
  9: 'STRING',
  11: 'MESSAGE',
  12: 'BYTES',
  13: 'UINT32',
  14: 'ENUM',
  17: 'SINT32',
  18: 'SINT64'
});

/**
 * @private
 * @constructor
 */
ProtoRpc.Definition_ = function() {

};

/**
 * @private
 * @constructor
 * @extends {ProtoRpc.Definition_}
 */
ProtoRpc.MessageDefinition_ = function(name) {
  goog.base(this);

  /**
   * @type {string}
   */
  this.name = null;

  /**
   * @type {Object.<Number, ProtoRpc.Field>}
   */
  this.fieldMap = {};
};
goog.inherits(ProtoRpc.MessageDefinition_, ProtoRpc.Definition_);

/**
 * Create a getter/setter proxy this message definition.
 * @param {ProtoRpc.Message_} instance Message instance.
 */
ProtoRpc.MessageDefinition_.prototype.createProxy = function(instance) {
  /** @constructor */
  var proxy = function() {};
  var proto = proxy.prototype;

  for (var number in this.fieldMap) {
    var field = this.fieldMap[number];
    if (field.isRepeated()) {
      var adder = ProtoRpc.Util.toCamelCase(field.getName(), 'add');
      proto[adder] = goog.bind(instance.addValue, instance, number);
    } else {
      var setter = ProtoRpc.Util.toCamelCase(field.getName(), 'set');
      proto[setter] = goog.bind(instance.setValue, instance, number);
    }
    var getter = ProtoRpc.Util.toCamelCase(field.getName(), 'get');
    proto[getter] = goog.bind(instance.getValue, instance, number);
  }
  return new proxy();
};

ProtoRpc.MessageDefinition_.prototype.getFieldByNumber = function(number) {
  return this.fieldMap[number];
};

/**
 * Message Factory.
 * @param {ProtoRpc.Message.Options} options Message options.
 * @export
 */
ProtoRpc.Message = function(name, options) {
  var def = new ProtoRpc.MessageDefinition_(name);

  for (var fieldName in options.fields || []) {
    var field = options.fields[fieldName];
    field.name_ = fieldName;
    def.fieldMap[field.getNumber()] = field;
  }

  /** @constructor */
  return function(opt_values) {
    var instance = new ProtoRpc.Message_(def);
    return def.createProxy(instance);
  };
};

/**
 * @typedef {{fields: Object.<string, ProtoRpc.Field>,
 *            enums: Object.<string, ProtoRpc.Enum>,
 *            messages: Object.<string, ProtoRpc.Message>}}
 */
ProtoRpc.Message.Options;

/**
 * @private
 * @constructor
 */
ProtoRpc.Message_ = function(definition) {
  /**
   * @type {Object.<Number, *>}
   * @private
   */
  this.values_ = {};

  /**
   * @type {ProtoRpc.MessageDefinition_}
   * @private
   */
  this.definition_ = definition;
};

ProtoRpc.Message_.prototype.getFieldByNumber_ = function(number) {
  return this.definition_.getFieldByNumber(number);
};

ProtoRpc.Message_.prototype.checkInitialized = function() {
  for (var number in this.fields_) {
    var field = this.fields_[number];

    if (field.isRequired()) {
      if (goog.isNull(this.values_[number])) {
        throw new ProtoRpc.ValidationError(
          'Message %s is missing required field %s', [
            this.getName(),
            field.getName()]);
      }
    }

    var value = this.values_[field.getNumber()];
    for (var j = 0; j < value.length; j++) {
      value[j].checkInitialized();
    }

    if (field.getVariant() == ProtoRpc.Variant.MESSAGE) {
      this.getValue(field.getNumber()).checkInitialized();
    }

  }
};

/**
 * @return {string} The name of the Message.
 */
ProtoRpc.Message_.prototype.getName = function() {
  return this.definition_.name;
};

/**
 * Get fields value by field's number.
 *
 * @param {number} number The field's number.
 * @return {*} The value found or undefined if no value.
 */
ProtoRpc.Message_.prototype.getValue = function(number, opt_idx) {
  var value = this.values_[number];
  if (value) {
    return value;
  }
  var field = this.getFieldByNumber_(number);
  return field.getDefaultValue();
};

/**
 * Set the value of a field on the message.
 * @param {Number} number The field's number.
 * @param {*} value The fields value.
 */
ProtoRpc.Message_.prototype.setValue = function(number, value) {
  this.values_[number] = value;
};

/**
 * Append an item to repeated list.
 * @param {number} number Field number.
 * @param {*} value Value to append.
 */
ProtoRpc.Message_.prototype.addValue = function(number, value) {
  throw Error('Not Implemented');
};

/**
 * @typedef {{repeated: (boolean|undefined),
 *            required: (boolean|undefined),
 *            defaultValue: (*|undefined)}}
 */
ProtoRpc.Field.Options;

/**
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options=} options Field options.
 * @constructor
 */
ProtoRpc.Field = function(number, options) {
  options = options || {
    repeated: false,
    required: false
  };

  // TODO: add more validation.

  /**
   * @type {Number}
   * @private
   */
  this.number_ = number;

  if (options.repeated && options.required) {
    // TODO: throw ProtoRpc.FieldDefinitionError(
    throw Error(
        'Cannot set both repeated and required');
  }

  /**
   * @type {boolean}
   * @private
   */
  this.required_ = options.required || false;

  /**
   * @type {boolean}
   * @private
   */
  this.repeated_ = options.repeated || false;

  /**
   * @type {boolean}
   * @private
   */
  this.optional_ = !this.required_;

  /**
   * @type {*}
   * @private
   */
  this.defaultValue_ = options.defaultValue || null;
};

/**
 * @type {string}
 * @private
 */
ProtoRpc.Field.prototype.name_ = null;

/**
 * Possble variants for this field definition.
 * @type {Array.<ProtoRpc.EnumValue>}
 * @private
 */
ProtoRpc.Field.prototype.variants_ = null;

/**
 * Default variant for this field definition.
 * @type {ProtoRpc.EnumValue}
 * @private
 */
ProtoRpc.Field.prototype.defaultVariant_ = null;

/**
 * The native type for this field definition.
 * @type {Object}
 * @private
 */
ProtoRpc.Field.prototype.nativeType_ = null;

/**
 * The Message definition that contains this Field definition.
 * @type {ProtoRpc.MessageDefinition_}
 * @private
 */
ProtoRpc.Field.prototype.messageDefinition_ = null;

/**
 * Get Message definiton that contains this field definition.
 * @return {ProtoRpc.MessageDefinition_} the Containing message definiton
 *   for field, null if no message defines this field.
 */
ProtoRpc.Field.prototype.getMessageDefinition = function() {
  return this.messageDefiniton_;
};

ProtoRpc.Field.prototype.getNumber = function() {
  return this.number_;
};

ProtoRpc.Field.prototype.getName = function() {
  return this.name_;
};

ProtoRpc.Field.prototype.isRequired = function() {
  return this.required_;
};

ProtoRpc.Field.prototype.isRepeated = function() {
  return this.repeated_;
};

ProtoRpc.Field.prototype.getDefaultValue = function() {
  return this.defaultValue_;
};

/**
 * Validate single element of field.
 * @param {*} value a value to validate.
 */
ProtoRpc.Field.prototype.validateElement = function(value) {
  throw Error('Not implemented');
};

/**
 * Field definition for an Integer.
 *
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.IntegerField = function(number, options) {
  goog.base(this, number, options);
};
goog.inherits(ProtoRpc.IntegerField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.IntegerField.prototype.variants_ = [
  ProtoRpc.Variant.INT32,
  ProtoRpc.Variant.INT64,
  ProtoRpc.Variant.UINT32,
  ProtoRpc.Variant.UINT64,
  ProtoRpc.Variant.SINT32,
  ProtoRpc.Variant.SINT64
];

/** @inheritDoc */
ProtoRpc.IntegerField.prototype.defaultVariant_ = ProtoRpc.Variant.INT64;

/** @inheritDoc */
ProtoRpc.IntegerField.prototype.nativeType_ = Number;

/**
 * Field definition for an Float.
 *
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.FloatField = function(number, options) {
  goog.base(this, number, options);
};
goog.inherits(ProtoRpc.FloatField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.FloatField.prototype.variants_ = [
  ProtoRpc.Variant.FLOAT,
  ProtoRpc.Variant.DOUBLE
];

/** @inheritDoc */
ProtoRpc.FloatField.prototype.defaultVariant_ = ProtoRpc.Variant.DOUBLE;

/** @inheritDoc */
ProtoRpc.FloatField.prototype.nativeType_ = Number;

/**
 * Field definition for an Boolean.
 *
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.BooleanField = function(number, options) {
  goog.base(this, number, options);
};
goog.inherits(ProtoRpc.BooleanField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.BooleanField.prototype.variants_ = [
  ProtoRpc.Variant.BOOL
];

/** @inheritDoc */
ProtoRpc.BooleanField.prototype.defaultVariant_ = ProtoRpc.Variant.BOOL;

/** @inheritDoc */
ProtoRpc.BooleanField.prototype.nativeType_ = Boolean;

/**
 * Field definition for byte string values.
 *
 * Note: Javascript does not have a native bytestring format, so for
 *   now this will do nothing clever.
 *
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.BytesField = function(number, options) {
  goog.base(this, number, options);
};
goog.inherits(ProtoRpc.BytesField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.BytesField.prototype.variants_ = [
  ProtoRpc.Variant.BYTES
];

/** @inheritDoc */
ProtoRpc.BytesField.prototype.defaultVariant_ = ProtoRpc.Variant.BYTES;

/** @inheritDoc */
ProtoRpc.BytesField.prototype.nativeType_ = String;

/**
 * Field definition for string values.
 *
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.StringField = function(number, options) {
  goog.base(this, number, options);
};
goog.inherits(ProtoRpc.StringField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.StringField.prototype.variants_ = [
  ProtoRpc.Variant.STRING
];

/** @inheritDoc */
ProtoRpc.StringField.prototype.defaultVariant_ = ProtoRpc.Variant.STRING;

/** @inheritDoc */
ProtoRpc.StringField.prototype.nativeType_ = String;

/**
 * Field definition for sub-message values.
 *
 * @param {ProtoRpc.Message} message_type Message type for field.
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.MessageField = function(message_type, number, options) {
  goog.base(this, number, options);

  this.nativeType_ = message_type;
};
goog.inherits(ProtoRpc.MessageField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.MessageField.prototype.variants_ = [
  ProtoRpc.Variant.MESSAGE
];

/** @inheritDoc */
ProtoRpc.MessageField.prototype.defaultVariant_ = ProtoRpc.Variant.MESSAGE;

/**
 * Field definition for enum values.
 *
 * @param {ProtoRpc.Enum} enum_type Enumeration type.
 * @param {Number} number Field number.
 * @param {ProtoRpc.Field.Options} options Field's options.
 * @constructor
 * @extends {ProtoRpc.Field}
 * @export
 */
ProtoRpc.EnumField = function(enum_type, number, options) {
  goog.base(this, number, options);

  /** @inheritDoc */
  this.nativeType_ = enum_type;
};
goog.inherits(ProtoRpc.EnumField, ProtoRpc.Field);

/** @inheritDoc */
ProtoRpc.EnumField.prototype.variants_ = [
  ProtoRpc.Variant.ENUM
];

/** @inheritDoc */
ProtoRpc.EnumField.prototype.defaultVariant_ = ProtoRpc.Variant.ENUM;


text:
MathJax.Extension["TeX/HTML"] = {
  version: "2.1"
};

MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {

  var TEX = MathJax.InputJax.TeX;
  var TEXDEF = TEX.Definitions;

  TEXDEF.Add({
    macros: {
      href:    'HREF_attribute',
      "class": 'CLASS_attribute',
      style:   'STYLE_attribute',
      cssId:   'ID_attribute'
    }
  },null,true);

  TEX.Parse.Augment({

    //
    //  Implements \href{url}{math}
    //
    HREF_attribute: function (name) {
      var url = this.GetArgument(name),
          arg = this.GetArgumentMML(name);
      this.Push(arg.With({href:url}));
    },

    //
    //  Implements \class{name}{math}
    //
    CLASS_attribute: function (name) {
      var CLASS = this.GetArgument(name),
          arg   = this.GetArgumentMML(name);
      if (arg["class"] != null) {CLASS = arg["class"] + " " + CLASS}
      this.Push(arg.With({"class":CLASS}));
    },

    //
    //  Implements \style{style-string}{math}
    //
    STYLE_attribute: function (name) {
      var style = this.GetArgument(name),
          arg   = this.GetArgumentMML(name);
      // check that it looks like a style string
      if (arg.style != null) {
        if (style.charAt(style.length-1) !== ";") {style += ";"}
        style = arg.style + " " + style;
      }
      this.Push(arg.With({style: style}));
    },

    //
    //  Implements \cssId{id}{math}
    //
    ID_attribute: function (name) {
      var ID  = this.GetArgument(name),
          arg = this.GetArgumentMML(name);
      this.Push(arg.With({id:ID}));
    },

    //
    //  returns an argument that is a single MathML element
    //  (in an mrow if necessary)
    //
    GetArgumentMML: function (name) {
      var arg = this.ParseArg(name);
      if (arg.inferred && arg.data.length == 1)
        {arg = arg.data[0]} else {delete arg.inferred}
      return arg;
    }

  });

  MathJax.Hub.Startup.signal.Post("TeX HTML Ready");

});

MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");


text:
package org.springframework.social.facebook.api;

import org.springframework.social.ApiException;
import org.springframework.social.InsufficientPermissionException;
import org.springframework.social.MissingAuthorizationException;

/**
 * Defines the operations for interacting with a user's Facebook checkins.
 * @author Craig Walls
 */
public interface PlacesOperations {

	/**
	 * Retrieves a list of up to 25 recent checkins for the authenticated user.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @return a list {@link Checkin}s for the user, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	PagedList<Checkin> getCheckins();

	/**
	 * Retrieves a list of checkins for the authenticated user.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @param offset the offset into the list of checkins
	 * @param limit the maximum number of checkins to return
	 * @return a list {@link Checkin}s for the user, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 * @deprecated Use {@link #getCheckins(PagingParameters)} instead.
	 */
	@Deprecated
	PagedList<Checkin> getCheckins(int offset, int limit);

	/**
	 * Retrieves a list of checkins for the authenticated user.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @param pagedListParameters the parameters defining the bounds of the list to return.
	 * @return a list {@link Checkin}s for the user, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	PagedList<Checkin> getCheckins(PagingParameters pagedListParameters);

	/**
	 * Retrieves a list of up to 25 recent checkins for the specified object.
	 * If the object is a user, this returns checkins for places the user has checked into.
	 * If the object is a page, then this returns checkins that the user's friends has made to the location that the page represents.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @param objectId either a Facebook user ID or page ID
	 * @return a list {@link Checkin}s, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	PagedList<Checkin> getCheckins(String objectId);

	/**
	 * Retrieves a list of checkins for the specified object.
	 * If the object is a user, this returns checkins for places the user has checked into.
	 * If the object is a page, then this returns checkins that the user's friends has made to the location that the page represents.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @param objectId either a Facebook user ID or page ID
	 * @param offset the offset into the list of checkins
	 * @param limit the maximum number of checkins to return
	 * @return a list {@link Checkin}s, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 * @deprecated Use {@link #getCheckins(String, PagingParameters)} instead.
	 */
	@Deprecated
	PagedList<Checkin> getCheckins(String objectId, int offset, int limit);

	/**
	 * Retrieves a list of checkins for the specified object.
	 * If the object is a user, this returns checkins for places the user has checked into.
	 * If the object is a page, then this returns checkins that the user's friends has made to the location that the page represents.
	 * Requires "user_checkins" or "friends_checkins" permission.
	 * @param objectId either a Facebook user ID or page ID
	 * @param pagedListParameters the parameters defining the bounds of the list to return.
	 * @return a list {@link Checkin}s, or an empty list if not available.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "user_checkins" or "friends_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	PagedList<Checkin> getCheckins(String objectId, PagingParameters pagedListParameters);

	/**
	 * Retrieves details for a single checkin.
	 * @param checkinId the checkin ID
	 * @return a {@link Checkin}
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	Checkin getCheckin(String checkinId);

	/**
	 * Checks the authenticated user into the specified location.
	 * Requires "publish_checkins" permission.
	 * @param placeId the ID of the place to check into.
	 * @param latitude the latitude of the place.
	 * @param longitude the longitude of the place.
	 * @return the ID of the checkin.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "publish_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	String checkin(String placeId, double latitude, double longitude);

	/**
	 * Checks the authenticated user into the specified location.
	 * Requires "publish_checkins" permission.
	 * @param placeId the ID of the place to check into.
	 * @param latitude the latitude of the place.
	 * @param longitude the longitude of the place.
	 * @param message a message to post along with the checkin.
	 * @param tags a varargs list of user IDs to tag on the checkin.
	 * @return the ID of the checkin.
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws InsufficientPermissionException if the user has not granted "publish_checkins" permission.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	String checkin(String placeId, double latitude, double longitude, String message, String... tags);

	/**
	 * Searches for places near a given coordinate.
	 * @param query the search query (e.g., "Burritos")
	 * @param latitude the latitude of the point to search near
	 * @param longitude the longitude of the point to search near
	 * @param distance the radius to search within (in feet)
	 * @return a list of {@link Page}s matching the search
	 * @throws ApiException if there is an error while communicating with Facebook.
	 * @throws MissingAuthorizationException if FacebookTemplate was not created with an access token.
	 */
	PagedList<Page> search(String query, double latitude, double longitude, long distance);
}


text:
package org.irmacard.credentials.info;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.Arrays;

public class BasicFileReader implements FileReader {
	URI coreLocation;

	public BasicFileReader(URI location) {
		this.coreLocation = location;
	}

	@Override
	public InputStream retrieveFile(String path) throws InfoException {
		try {
			return coreLocation.resolve(path).toURL().openStream();
		} catch (IOException e) {
			throw new InfoException("Tried to read file " + path, e);
		}
	}

	@Override
	public String[] list(String path) {
		return new File(coreLocation.resolve(path)).list();
	}

	@Override
	public boolean isEmpty(String path) {
		String[] files = list(path);
		return files == null || files.length == 0;
	}

	@Override
	public boolean containsFile(String path, String filename) {
		String[] files = list(path);
		return files != null && Arrays.asList(files).contains(filename);
	}

	@Override
	public boolean containsFile(String path) {
		String[] parts = path.split("/");
		String filename = parts[parts.length-1];
		path = path.substring(0, path.length() - filename.length() - 1);
		return containsFile(path, filename);
	}
}


text:
category: posts
draft: false

title: Idiots Out Walking Around - III
date: 2021-01-11 16:56:50
tags:
    - iowa
    - covid
    - politics
    - pandemic
    - sad
    - the worst
    - pandemic
    - twitter

---

At the Iowa Statehouse. Via [State Senator Joe Bolkcom](https://twitter.com/JoeBolkcom/status/1348654950121926656). Installments [One](/links/30760c28e27853faa60ed75bfe6c4d62) and [Two](/posts/306344cbbd2350b7a1bea53e93dd3480) (the latter features the verysame "Informed Choice" idiots.) [More on this tantrum by The Register](https://www.desmoinesregister.com/story/news/politics/2021/01/11/covid-19-in-iowa-legislature-hundreds-protest-mask-order-state-capitol/6624209002/).

![Idiots Out Walking Around](/misc/i/iowa-idiots-1.jpeg)

![Idiots Out Walking Around](/misc/i/iowa-idiots-2.jpeg)

![Idiots Out Walking Around](/misc/i/iowa-idiots-3.jpeg)

/misc/i/iowa-idiots-facts-over-fear.mp4

![Idiots Out Walking Around](/misc/f/freedom-cart.png)


text:
'use strict';

// MODULES //

var logger = require( 'debug' );

// VARIABLES //

var debug = logger( 'sparkline:push' );

// MAIN //

/**
* Appends data.
*
* @private
* @param {*} datum - data to append
* @returns {Sparkline} class instance
*/
function push( datum ) {
	/* eslint-disable no-invalid-this */
	debug( 'Current value: %s.', JSON.stringify( this._data ) );
	if ( this._data.length >= this._bufferSize ) {
		this._data.shift();
	}
	this._data.push( datum );

	debug( 'New value: %s.', JSON.stringify( this._data ) );
	this.emit( 'change' );

	return this;
}

// EXPORTS //

module.exports = push;


text:
package org.syphr.mythtv.commons.socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import junit.framework.Assert;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.syphr.mythtv.commons.exception.ResponseTimeoutException;
import org.syphr.mythtv.test.Settings;

public class DefaultSocketManagerTest
{
    private static final String FIRST_RESPONSE = "first response";
    private static final String SECOND_RESPONSE = "second response";

    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSocketManagerTest.class);

    private static ServerSocket server;
    private static ConnectionHandler handler;

    private DefaultSocketManager socketManager;

    @BeforeClass
    public static void setUpBeforeClass() throws IOException
    {
        Settings.createSettings();

        server = new ServerSocket(0);

        new Thread()
        {
            @Override
            public void run()
            {
                try
                {
                    while (true)
                    {
                        Socket client = server.accept();
                        LOGGER.info("Client connected");

                        BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
                        PrintWriter writer = new PrintWriter(client.getOutputStream());

                        while (client.isConnected())
                        {
                            String input = reader.readLine();
                            if (input == null)
                            {
                                break;
                            }
                            LOGGER.trace("Server received input: " + input);

                            String output = handler.handle(input);
                            LOGGER.trace("Server sending output: " + output);
                            writer.print(output + "\n");
                            writer.flush();
                        }

                        LOGGER.info("Client disconnected");
                    }
                }
                catch (SocketException e)
                {
                    // time to quit
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }.start();
    }

    @AfterClass
    public static void tearDownAfterClass() throws IOException
    {
        server.close();
    }

    @Before
    public void setUp() throws IOException
    {
        socketManager = new DefaultSocketManager(new DefaultPacket());
        socketManager.connect(server.getInetAddress().getHostName(), server.getLocalPort(), 0);
    }

    @After
    public void tearDown()
    {
        socketManager.disconnect();
        handler = null;
    }

    @Test
    public void testSendAndWaitTimeout() throws IOException
    {
        final AtomicInteger messageCounter = new AtomicInteger();
        handler = new ConnectionHandler()
        {
            @Override
            public String handle(String input)
            {
                switch (messageCounter.getAndIncrement())
                {
                    case 0:
                        try
                        {
                            TimeUnit.SECONDS.sleep(1);
                        }
                        catch (InterruptedException e)
                        {
                            // ignore
                        }
                        return FIRST_RESPONSE;

                    case 1:
                        return SECOND_RESPONSE;

                    default:
                        throw new IllegalStateException("Too many messages received");
                }
            }
        };

        try
        {
            socketManager.sendAndWait("first message", 10, TimeUnit.MILLISECONDS);
            Assert.fail();
        }
        catch (ResponseTimeoutException e)
        {
            // expected
            LOGGER.info("Timeout {}", e.getMessage());
        }

        String secondResponse = socketManager.sendAndWait("second message", 3, TimeUnit.SECONDS);
        Assert.assertEquals(SECOND_RESPONSE, secondResponse);
    }

    @Test
    public void testEmptyResponse() throws IOException
    {
        handler = new ConnectionHandler()
        {
            @Override
            public String handle(String input)
            {
                return "";
            }
        };

        String response = socketManager.sendAndWait("message", 100, TimeUnit.MILLISECONDS);
        Assert.assertEquals("", response);
    }

    @Test
    public void testMultipleMessages() throws IOException
    {
        final String responseMessage = "response";

        handler = new ConnectionHandler()
        {
            @Override
            public String handle(String input)
            {
                return responseMessage;
            }
        };

        for (int i = 0; i < 3; i++)
        {
            String response = socketManager.sendAndWait("message", 100, TimeUnit.MILLISECONDS);
            Assert.assertEquals(responseMessage, response);
        }
    }

    private static interface ConnectionHandler
    {
        public String handle(String input);
    }

}


text:
<?php require_once('app/inc/init.php'); ?><!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Template</title>

    <base href="<?php echo base_folder(); ?>">

    <link rel="stylesheet" href="<?php echo url_rev('css/all.css'); ?>"></link>


text:
<OpenRosaResponse>
    <message nature="ota_restore_success">Successfully restored account test!</message>
    <Sync xmlns="http://commcarehq.org/sync">
        <restore_id>sync_token</restore_id>
    </Sync>
    <Registration xmlns="http://openrosa.org/user/registration">
        <username>test</username>
        <password>sha1$60441$53cf77c2ac3608a944db96af177a6dfe1579e4ba</password>
        <uuid>test_user</uuid>
        <date>2012-04-30</date>
    </Registration>
    <case case_id="case_one"
          date_modified="2014-08-04T21:09:07.000000Z"
          user_id="test_user"
          xmlns="http://commcarehq.org/case/transaction/v2">
        <create>
            <case_type>adult</case_type>
            <case_name>Saul</case_name>
            <owner_id>test_user</owner_id>
        </create>
        <update>
            <potential_duplicate_id>dupe1</potential_duplicate_id>
        </update>
    </case>
</OpenRosaResponse>


text:
package enums;// enums/SpaceShip.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
import java.util.stream.*;

public enum SpaceShip {
  SCOUT, CARGO, TRANSPORT,
  CRUISER, BATTLESHIP, MOTHERSHIP;
  @Override
  public String toString() {
    String id = name();
    String lower = id.substring(1).toLowerCase();
    return id.charAt(0) + lower;
  }
  public static void main(String[] args) {
    Stream.of(values())
      .forEach(System.out::println);
  }
}
/* Output:
Scout
Cargo
Transport
Cruiser
Battleship
Mothership
*/


text:
"""User-friendly exception handler for swood."""
import http.client
import traceback
import sys
import os

__file__ = os.path.abspath(__file__)

class ComplainToUser(Exception):
    """When used with ComplaintFormatter, tells the user what error (of theirs) caused the failure and exits."""
    pass

def can_submit():
    if not os.path.isdir(os.path.expanduser("~/.swood")):
        os.mkdir(os.path.expanduser("~/.swood"))
    sbpath = os.path.expanduser("~/.swood/submit-bugs")
    if os.path.isfile(sbpath):
        try:
            with open(sbpath) as sb:
                resp = sb.read(1)
                if resp == "1":
                    return 1
                elif resp == "0":
                    return 0
        except:
            pass
    while True:
        resp = input(
            "Something went wrong. Do you want to send an anonymous bug report? (Type Y or N): ").lower()
        if resp in ("yes", "y", "true"):
            try:
                with open(sbpath, "w") as sb:
                    sb.write("1")
            except:
                pass
            return 1
        elif resp in ("no", "n", "false"):
            try:
                with open(sbpath, "w") as sb:
                    sb.write("0")
            except:
                pass
            return 0

class ComplaintFormatter:
    """Notifies the user when the program fails predictably and uploads bug reports.

    When used in a with statement, ComplaintFormatter catches all exceptions. If the
    exception is a ComplainToUser exception, it will simply print the error message
    and exit (with an exit code of 1). If the exception is something else (i.e. an
    actual, unexpected exception), it will upload the traceback to the swood debug
    server (unless the user has opted out of sending bug reports.)
    """

    def __init__(self, version=None):
        self.version = version

    def __enter__(self):
        pass

    def __exit__(self, exc_type, exc, tb):
        if isinstance(exc, ComplainToUser):
            print("Error: {}".format(exc), file=sys.stderr)
            sys.exit(1)
        elif isinstance(exc, Exception):
            # scrub stack of full path names for extra privacy
            # also normalizes the paths, helping to detect dupes
            scrubbed_stack = traceback.extract_tb(tb)
            # cut off traces of stuff that isn't ours
            others_cutoff = next(idx for idx, fs in enumerate(scrubbed_stack) if os.path.samefile(
                os.path.dirname(fs.filename), os.path.dirname(__file__)))
            scrubbed_stack = scrubbed_stack[others_cutoff:]
            # rewrite paths so they contain only relative directories
            # (hides username on Windows and Linux)
            dirstart = os.path.abspath(
                os.path.join(os.path.dirname(__file__), ".."))
            for fs in scrubbed_stack:
                fs.filename = os.path.relpath(
                    fs.filename, start=dirstart).replace("\\", "/")
            str_tb = "Traceback (most recent call last):\n" + \
                "".join(traceback.format_list(scrubbed_stack)) + \
                "".join(traceback.format_exception_only(exc_type, exc))

            if self.version is not None:
                str_tb = "# " + self.version + "\n" + str_tb

            if "--optout" in sys.argv or "-o" in sys.argv:
                print(
                    "Something went wrong. A bug report will not be sent because of your command-line flag.", file=sys.stderr)
                return False
            elif os.environ.get("SWOOD_OPTOUT") == "1":
                print(
                    "Something went wrong. A bug report will not be sent because of your environment variable.", file=sys.stderr)
                return False
            elif not can_submit():
                print(
                    "Something went wrong. A bug report will not be sent because of your config setting.", file=sys.stderr)
                return False
            else:
                print(
                    "Something went wrong. A bug report will be sent to help figure it out. (see --optout)", file=sys.stderr)
                try:
                    conn = http.client.HTTPSConnection("meme.institute")
                    conn.request("POST", "/swood/bugs/submit", str_tb)
                    resp = conn.getresponse().read().decode("utf-8")
                    if resp == "done":
                        print("New bug submitted!", file=sys.stderr)
                    elif resp == "dupe":
                        print(
                            "This bug is already in the queue to be fixed.", file=sys.stderr)
                    else:
                        raise Exception
                except Exception:
                    print("Submission of bug report failed.", file=sys.stderr)
                    traceback.print_exc()
        return True


text:
#include "topping.h"
#include <vector>
#include <iostream>

using namespace std;

/**
 * program to create pizza toppings
 */
int main() {
  Topping pepperoni("pepperoni", false);
  Topping cheese("cheese", false);
  Topping extra_cheese("extra cheese", true);

  vector<Topping> myToppins;
  myToppins.push_back(pepperoni);
  myToppins.push_back(cheese);
  myToppins.push_back(extra_cheese);

  cout << "Topping #1 is " << myToppins[1].getName() << " premium? "
      << myToppins[1].isPremium() << endl;
}


text:
title: The homework for the more media lesson
layout: post
author: rhys.evans
permalink: /the-homework-for-the-'more-media'lesson/
source-id: 1Nu35js_2DhAzG9UfAJ0P5azFbBd3OR6SF8UPly8_ow4
published: true
---
The homework for the more media lesson

for homework after the lesson we had to find a fantasy advert and answer 3 questions about it 'what is in reality in this ad?what is fantasy in this ad?and if you searched what things were real in this ad what did you find?

For my advert I did the ribena advert.


text:
=head1 NAME

Selenium::Support - Helper routines for testing ajax Web Apps with Selenium

=head1 SYNOPSIS

To wait for a page's processing to be complete (including ajax requests):

  my $driver = Selenium::Remote::Driver->new();
  prepare_driver($driver);
  $driver->get("https://www.example.com/");
  try_wait_for_page($driver);

=cut

package Selenium::Support;

use Carp;
use Exporter;
use Time::HiRes qw(time);
use Test::More;

use Selenium::Waiter qw(wait_until);

@ISA = qw(Exporter);
@EXPORT_OK = qw(
    find_element_by_label
    find_button
    find_dropdown
    find_option
    try_wait_for_page prepare_driver
    element_has_class element_is_dropdown);

# In order to estimate the number of running ajax requests, we need
# to patch the XMLHttpRequest object prototype: that way we can install
# an open() method which adds an event listener.

sub _monkeypatch_xml_http_prototype {
    my ($driver) = @_;

    # my thanks go to
    # http://stackoverflow.com/questions/9267451/how-to-check-if-http-requests-are-open-in-browser

    $driver->execute_script(qq(
(function() {
    var oldOpen = XMLHttpRequest.prototype.open;
    window.__SELENIUM_538268 = 0;
    XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
      window.__SELENIUM_538268++;
      this.addEventListener("readystatechange", function() {
          if(this.readyState == 4) {
            window.__SELENIUM_538268--;
          }
        }, false);
      oldOpen.call(this, method, url, async, user, pass);
    }
  })();
));

}

=head1 METHODS

=over

=item prepare_driver($driver)

Installs some hooks in the browser(window) owned by the driver
to allow better waiting for any page activity to complete.

=cut

sub prepare_driver {
    my ($driver) = @_;
    &_monkeypatch_xml_http_prototype($driver);
}

=item find_element_by_label($driver, $label)

Finds a label with the text equal to $label. Then looks up the
associated element through the 'for' attribute of the label.

=cut

sub find_element_by_label {
    my ($driver, $label) = @_;

    my $label_element = $driver->find_element("//label[text()='$label']");
    do {
        croak "no label with text '$label'";
        return;
    } unless defined $label_element;

    my $element_id = $label_element->get_attribute('for');
    do {
        croak "no 'for' attribute of element with label '$label'";
        return;
    } unless defined $element_id;

    my $element = $driver->find_element("//*[\@id='$element_id']");
    do {
        croak "no element with label '$label' and id '$element_id' found";
        return;
    } unless defined $element;

    return $element;
}

=item element_has_class($element, $class)

Returns false if the element's 'class' attribute doesn't contain $class.

=cut

sub element_has_class {
    my ($element, $class) = @_;

    my $class_attr = $element->get_attribute('class');
    my $rv =
        grep { $_ eq $class }
        split /[\s\t\n]+/, $class_attr;

    return $rv;
}

=item find_button($driver, $text)

=cut

sub find_button {
    my ($driver, $text) = @_;

    my $btn = $driver->find_element(
        "//span[text()='$text'
                and contains(concat(' ',normalize-space(\@class),' '),
                             ' dijitButtonText ')]
         | //button[text()='$text']
         | //input[\@value='$text'
                   and (\@type='submit' or \@type='image' or \@type='reset')]");
    ok($btn, "found button tag '$button_text'");

    return $btn;
}

=item element_is_dropdown($element)

=cut

sub element_is_dropdown {
    my ($elm) = @_;

    return ($elm->get_tag_name eq 'select'
            || element_has_class($elm, 'dijitSelect'));
}

=item find_dropdown($driver, $text)

=cut

sub find_dropdown {
    my ($driver, $label) = @_;

    my $elm = find_element_by_label($driver,$label);
    ok(element_is_dropdown($elm),
       "Found drop down element '$label'");

    return $elm;
}

=item find_option($driver, $text, $dropdown)

=cut

sub find_option {
    my ($driver, $text, $dropdown) = @_;

    my $elm = find_dropdown($driver, $dropdown);

    my $dd;
    if ($elm->get_tag_name ne 'select') {
        # dojo
        my $id = $elm->get_attribute('id');
        $elm->click;
        $elm->click;
        $dd = $driver->find_element("//*[\@dijitpopupparent='$id']");
    }
    else {
        $dd = $elm;
    }
    my $option =
        $driver->find_child_element($dd,".//*[text()='$text']");
    ok($option, "Found option with value '$text' of dropdown '$dropdown'");
    if (! $option->is_displayed) {
        $elm->click;
        $driver->execute_script(qq#arguments[0].scrollIntoView();#, $option);
    }

    return $option;
}

=item try_wait_for_page($driver)

Waits for page activity to quiet down. Takes Dojo's page activity into account
as well as any runnnig ajax requests.

When the page is estimated to be busy, sleeps for a short period and tries
again.

Bails out after waiting more than 10 seconds.

=cut

our $max_wait_secs = 10;
my $page_generation = 0;
sub try_wait_for_page {
    my ($driver) = @_;

    wait_until { $driver->find_element('body.done-parsing', 'css') };

    $page_generation++;
    $driver->execute_script(qq(
if (dojo && require) {
  require(["dojo/ready"], function(ready) {
     ready(9999, function() { window.__SELENIUM_5382645 = $page_generation; })
  });
}
else {
   // detection failed
   window.__SELENIUM_5382645 = $page_generation;
}
));

    my $start_time = time();
    while (((time() - $start_time) < $max_wait_secs)
           && $driver->execute_script(qq(
 return ((window.__SELENIUM_5382645 < $page_generation)
         || (window.__SELENIUM_538268 > 0))
       ))){
        sleep(0.05);
    };
}

1;


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<title>InputHandler</title>

InputHandler

Overview

When a task wants to prompt a user for input, it doesn't simply
read the input from the console as this would make it impossible to
embed Apache Ant in an IDE.  Instead it asks an implementation of the
org.apache.tools.ant.input.InputHandler interface to
prompt the user and hand the user input back to the task.

To do this, the task creates an InputRequest object
and passes it to the InputHandler Such an
InputRequest may know whether a given user input is valid
and the InputHandler is supposed to reject all invalid
input.

Exactly one InputHandler instance is associated with
every Ant process, users can specify the implementation using the
-inputhandler command line switch.

InputHandler

The InputHandler interface contains exactly one
method

    void handleInput(InputRequest request)
        throws org.apache.tools.ant.BuildException;

with some pre- and postconditions.  The main postcondition is that
this method must not return unless the request considers
the user input valid, it is allowed to throw an exception in this
situation.

Ant comes with three built-in implementations of this interface:

DefaultInputHandler

This is the implementation you get, when you don't use the
-inputhandler command line switch at all.  This
implementation will print the prompt encapsulated in the
request object to Ant's logging system and re-prompt for
input until the user enters something that is considered valid input
by the request object.  Input will be read from the
console and the user will need to press the Return key.

PropertyFileInputHandler

This implementation is useful if you want to run unattended build
processes.  It reads all input from a properties file and makes the
build fail if it cannot find valid input in this file.  The name of
the properties file must be specified in the Java system property
ant.input.properties.

The prompt encapsulated in a request will be used as
the key when looking up the input inside the properties file.  If no
input can be found, the input is considered invalid and an exception
will be thrown.

Note that ant.input.properties must
be a Java system property, not an Ant property.  I.e. you cannot
define it as a simple parameter to ant, but you can
define it inside the ANT_OPTS environment variable.

GreedyInputHandler

Like the default implementation, this InputHandler reads from standard
input. However, it consumes all available input. This behavior is
useful for sending Ant input via an OS pipe. Since Ant 1.7.

SecureInputHandler

This InputHandler calls System.console().readPassword(),
available since Java 1.6.  On earlier platforms it falls back to the
behavior of DefaultInputHandler. Since Ant 1.7.1.

InputRequest

Instances of org.apache.tools.ant.input.InputRequest
encapsulate the information necessary to ask a user for input and
validate this input.

The instances of InputRequest itself will accept any
input, but subclasses may use stricter validations.
org.apache.tools.ant.input.MultipleChoiceInputRequest
should be used if the user input must be part of a predefined set of
choices.


text:
/** \file
 * Trie optimized for cache utilization.
 *
 * This trie is a standard implementation that stores elements in the order defined
 * by the key.
 *
 * It needs an external allocator for the inner nodes in the trie.
 *
 * You can control the number of branches of each node using the ::TOMMY_TRIE_TREE_MAX
 * define. More branches imply more speed, but a bigger memory occupation.
 *
 * Compared to ::tommy_trie_inplace you have to provide a ::tommy_allocator allocator.
 * Note that the C malloc() is too slow to futfill this role.
 *
 * To initialize the trie you have to call tommy_allocator_init() to initialize
 * the allocator, and tommy_trie_init() for the trie.
 *
 * \code
 * tommy_allocator alloc;
 * tommy_trie trie;
 *
 * tommy_allocator_init(&alloc, TOMMY_TRIE_BLOCK_SIZE, TOMMY_TRIE_BLOCK_SIZE);
 *
 * tommy_trie_init(&trie, &alloc);
 * \endcode
 *
 * To insert elements in the trie you have to call tommy_trie_insert() for
 * each element.
 * In the insertion call you have to specify the address of the node, the
 * address of the object, and the key value to use.
 * The address of the object is used to initialize the tommy_node::data field
 * of the node, and the key to initialize the tommy_node::key field.
 *
 * \code
 * struct object {
 *     int value;
 *     // other fields
 *     tommy_node node;
 * };
 *
 * struct object* obj = malloc(sizeof(struct object)); // creates the object
 *
 * obj->value = ...; // initializes the object
 *
 * tommy_trie_insert(&trie, &obj->node, obj, obj->value); // inserts the object
 * \endcode
 *
 * To find and element in the trie you have to call tommy_trie_search() providing
 * the key to search.
 *
 * \code
 * int value_to_find = 1;
 * struct object* obj = tommy_trie_search(&trie, value_to_find);
 * if (!obj) {
 *     // not found
 * } else {
 *     // found
 * }
 * \endcode
 *
 * To iterate over all the elements in the trie with the same key, you have to
 * use tommy_trie_bucket() and follow the tommy_node::next pointer until NULL.
 *
 * \code
 * int value_to_find = 1;
 * tommy_node* i = tommy_trie_bucket(&trie, value_to_find);
 * while (i) {
 *     struct object* obj = i->data; // gets the object pointer
 *
 *     printf("%d\n", obj->value); // process the object
 *
 *     i = i->next; // goes to the next element
 * }
 * \endcode
 *
 * To remove an element from the trie you have to call tommy_trie_remove()
 * providing the key to search and remove.
 *
 * \code
 * struct object* obj = tommy_trie_remove(&trie, value_to_remove);
 * if (obj) {
 *     free(obj); // frees the object allocated memory
 * }
 * \endcode
 *
 * To destroy the trie you have to remove all the elements, and deinitialize
 * the allocator using tommy_allocator_done().
 *
 * \code
 * tommy_allocator_done(&alloc);
 * \endcode
 *
 * Note that you cannot iterate over all the elements in the trie using the
 * trie itself. You have to insert all the elements also in a ::tommy_list,
 * and use the list to iterate. See the \ref multiindex example for more detail.
 */

#ifndef __TOMMYTRIE_H
#define __TOMMYTRIE_H

#include "tommytypes.h"
#include "tommyalloc.h"

/******************************************************************************/
/* trie */

/**
 * Number of branches on each inner node. It must be a power of 2.
 * Suggested values are 8, 16 and 32.
 * Any inner node, excluding leafs, contains a pointer to each branch.
 *
 * The default size is choosen to exactly fit a typical cache line of 64 bytes.
 */
#define TOMMY_TRIE_TREE_MAX (64 / sizeof(void*))

/**
 * Trie block size.
 * You must use this value to initialize the allocator.
 */
#define TOMMY_TRIE_BLOCK_SIZE (TOMMY_TRIE_TREE_MAX * sizeof(void*))

/** \internal
 * Number of bits for each branch.
 */
#define TOMMY_TRIE_TREE_BIT TOMMY_ILOG2(TOMMY_TRIE_TREE_MAX)

/** \internal
 * Number of bits of the first level.
 */
#define TOMMY_TRIE_BUCKET_BIT ((TOMMY_KEY_BIT % TOMMY_TRIE_TREE_BIT) + TOMMY_TRIE_TREE_BIT)

/** \internal
 * Number of branches of the first level.
 * It's like a inner branch, but bigger to get any remainder bits.
 */
#define TOMMY_TRIE_BUCKET_MAX (1 << TOMMY_TRIE_BUCKET_BIT)

/**
 * Trie node.
 * This is the node that you have to include inside your objects.
 */
typedef tommy_node tommy_trie_node;

/**
 * Trie container type.
 * \note Don't use internal fields directly, but access the container only using functions.
 */
typedef struct tommy_trie_struct {
	tommy_trie_node* bucket[TOMMY_TRIE_BUCKET_MAX]; /**< First tree level. */
	tommy_count_t count; /**< Number of elements. */
	tommy_count_t node_count; /**< Number of nodes. */
	tommy_allocator* alloc; /**< Allocator for internal nodes. */
} tommy_trie;

/**
 * Initializes the trie.
 * You have to provide an allocator initialized with *both* the size and align with TOMMY_TRIE_BLOCK_SIZE.
 * You can share this allocator with other tries.
 *
 * The tries is completely allocated through the allocator, and it doesn't need to be deinitialized.
 * \param alloc Allocator initialized with *both* the size and align with TOMMY_TRIE_BLOCK_SIZE.
 */
void tommy_trie_init(tommy_trie* trie, tommy_allocator* alloc);

/**
 * Inserts an element in the trie.
 * You have to provide the pointer of the node embedded into the object,
 * the pointer to the object and the key to use.
 * \param node Pointer to the node embedded into the object to insert.
 * \param data Pointer to the object to insert.
 * \param key Key to use to insert the object.
 */
void tommy_trie_insert(tommy_trie* trie, tommy_trie_node* node, void* data, tommy_key_t key);

/**
 * Searches and removes the first element with the specified key.
 * If the element is not found, 0 is returned.
 * If more equal elements are present, the first one is removed.
 * This operation is faster than calling tommy_trie_bucket() and tommy_trie_remove_existing() separately.
 * \param key Key of the element to find and remove.
 * \return The removed element, or 0 if not found.
 */
void* tommy_trie_remove(tommy_trie* trie, tommy_key_t key);

/**
 * Gets the bucket of the specified key.
 * The bucket is guaranteed to contain ALL and ONLY the elements with the specified key.
 * You can access elements in the bucket following the ::next pointer until 0.
 * \param key Key of the element to find.
 * \return The head of the bucket, or 0 if empty.
 */
tommy_trie_node* tommy_trie_bucket(tommy_trie* trie, tommy_key_t key);

/**
 * Searches an element in the trie.
 * You have to provide the key of the element you want to find.
 * If more elements with the same key are present, the first one is returned.
 * \param key Key of the element to find.
 * \return The first element found, or 0 if none.
 */
tommy_inline void* tommy_trie_search(tommy_trie* trie, tommy_key_t key)
{
	tommy_trie_node* i = tommy_trie_bucket(trie, key);

	if (!i)
		return 0;

	return i->data;
}

/**
 * Removes an element from the trie.
 * You must already have the address of the element to remove.
 * \return The tommy_node::data field of the node removed.
 */
void* tommy_trie_remove_existing(tommy_trie* trie, tommy_trie_node* node);

/**
 * Gets the number of elements.
 */
tommy_inline tommy_count_t tommy_trie_count(tommy_trie* trie)
{
	return trie->count;
}

/**
 * Gets the size of allocated memory.
 * It includes the size of the ::tommy_trie_node of the stored elements.
 */
tommy_size_t tommy_trie_memory_usage(tommy_trie* trie);

#endif


text:
namespace tigl
{
class CTiglUIDManager;
class CTiglUIDObject;

namespace generated
{
    class CPACSSheet3D;

    // This class is used in:
    // CPACSSheet3D

    /// @brief sheetPointsType
    ///
    ///
    ///
    class CPACSSheetPoints : public ITiglUIDRefObject
    {
    public:
        TIGL_EXPORT CPACSSheetPoints(CPACSSheet3D* parent, CTiglUIDManager* uidMgr);

        TIGL_EXPORT virtual ~CPACSSheetPoints();

        TIGL_EXPORT CPACSSheet3D* GetParent();

        TIGL_EXPORT const CPACSSheet3D* GetParent() const;

        TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent();
        TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const;

        TIGL_EXPORT CTiglUIDManager& GetUIDManager();
        TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const;

        TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath);
        TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const;

        TIGL_EXPORT virtual const std::vector<std::string>& GetSheetPointUIDs() const;
        TIGL_EXPORT virtual void AddToSheetPointUIDs(const std::string& value);
        TIGL_EXPORT virtual bool RemoveFromSheetPointUIDs(const std::string& value);

    protected:
        CPACSSheet3D* m_parent;

        CTiglUIDManager* m_uidMgr;

        std::vector<std::string> m_sheetPointUIDs;

    private:
        TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final;
        TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final;

        CPACSSheetPoints(const CPACSSheetPoints&) = delete;
        CPACSSheetPoints& operator=(const CPACSSheetPoints&) = delete;

        CPACSSheetPoints(CPACSSheetPoints&&) = delete;
        CPACSSheetPoints& operator=(CPACSSheetPoints&&) = delete;
    };
} // namespace generated

// Aliases in tigl namespace
using CCPACSSheetPoints = generated::CPACSSheetPoints;
using CCPACSSheet3D = generated::CPACSSheet3D;
} // namespace tigl


text:
#include <DGLCommon/def.h>

/**
 * Class implementing detour-based hooking mechanism
 *
 * This class provides API for mHook (or Detours, if compiled in) library
 */
class HookSession {
public:
    /**
     * Construct a hook session.
     *
     * Session is required to start code patching.
     * Some hooks are not guaranteed to be active until sessions is destructed.
     */
    HookSession();

    /**
     * Destruct a hook session.
     *
     * Commit all pending hooks, guarantee all are active since now.
     */
    ~HookSession();

    /**
     * Hook a function pointer
     *
     * @param from original API function to be hooked. The trampoline address is returned here.
     * @param to hook to install into 'from' function code
     * @return true if success
     */
    bool hook(dgl_func_ptr* from, dgl_func_ptr to);
};


text:
Conquer your enemy!

## **Synopsis**

In Game of Drones there are two players trying to conquer each other.

Players take turns to make their move, choosing Paper, Rock or Scissors. Each move beats another, just like the game "Paper, rock, scissors".

Like so:

* Paper beats Rock
* Rock beats scissors
* Scissors beat Paper

### **Note**: The first player to beat the other player 3 times wins the battle.

## **Installation**

   * Install **[Node.js](https://nodejs.org)**.
   * Install **[MongoDB](https://www.mongodb.com/)**.

  ### **1. FrontEnd**:

  * To run the application on browser, you can execute the following commands using CLI:
    - npm install
    - gulp
    - ionic serve

  * To run the application on mobile devices via USB, you can execute the following commands using CLI:

    **On Android**
      - ionic platform add android
      - ionic run android

    **On iOS (Mac)**
      - ionic platform add ios
      - ionic run ios

    *To debug the application, you can use some tools:*
      - **[GapDebug](https://www.genuitec.com/products/gapdebug/)**
      - **[Ionic View App](http://view.ionic.io/)**

  ### **2. BackEnd**:

   * To run the application using CLI, you can execute the following commands:
    - npm install
    - npm start

   *To debug the application, you can use:*
    - **[Visual Studio Code](https://code.visualstudio.com/)**

## Template Structure

  Path         | Explanation
  ----------   | -------------
  `./app/img/` | Images in the app.
  `./app/js/`  | Scripts (Controllers, Services, Directives, etc).
  `./app/scss/` | The styles of the app using Sass.
  `./app/templates/` | Views in the app.
  `./app/index.html` | The init page.
  `./www/css/` | Other css styles like **[Animate.css](https://daneden.github.io/animate.css/)**, etc.
  `./www/lib` | Scripts downloaded using bower.

## Tests

**1. Unit Tests With Jasmine & Karma**:

  To run the unit tests, you can execute the following commands using CLI:

  * cd tests
  * karma start unit-tests.conf.js

**2. End-To-End Tests With Jasmine & Protractor**:

  * To run the E2E tests on Chrome, you can execute the following commands using CLI:
    - ionic serve --nobrowser

  * Using another command line
    - cd tests
    - protractor e2e-tests.conf.js

## Supporting
I believe in Unicorns 🦄
Support [me](http://www.paypal.me/jdnichollsc/2), if you do too.

## Happy coding
Made with <3


text:
#  Creating a MEAN application with Teradata Covalent (Angular 2+)

Covalent angular 2 boilerplate with express server and social authentication

https://teradata.github.io/covalent/#/docs

```bash
git clone https://github.com/Teradata/covalent-quickstart.git ng2-express-auth
cd ng2-express-auth
rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin
git push -u origin master
npm i -g @angular/cli@latest yarn
```

Install packages with NPM:

```bash
npm i
```

Or using YARN:

```bash
  npm i -g yarn
  yarn
```

If you get this error:

> error An unexpected error occurred: "https://registry.yarnpkg.com/@angular%2fplatform-browser: self signed certificate in certificate chain".

You probably is behind an company firewall. You can disable strict-ssl using the following command:

```bash
yarn config set "strict-ssl" false
```

Time to serve the app:

```bash
ng serve
```

 npm install --save express body-parser

 Then create a file server.js and a folder server in the root of our angular project. The server.js file will have the server code, that will point to the server folder, where the rest of the server implementation is.

```js
 Get dependencies
const express = require('express');
const path = require('path');
const http = require('http');
const bodyParser = require('body-parser');

// Get our API routes
const api = require('./server/routes/api');

const app = express();

// Parsers for POST data
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

// Point static path to dist
app.use(express.static(path.join(__dirname, 'dist')));

// Set our api routes
app.use('/api', api);

// Catch all other routes and return the index file
app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, 'dist/index.html'));
});

/**
 * Get port from environment and store in Express.
 */
const port = process.env.PORT || '3000';
app.set('port', port);

/**
 * Create HTTP server.
 */
const server = http.createServer(app);

/**
 * Listen on provided port, on all network interfaces.
 */
server.listen(port, () => console.log(`API running on localhost:${port}`));
```

The above code sets up a simple express app, with an /api route and all other routes are directed towards the dist/index.html page. This catch all route, denoted with *, MUST come last after all other API routes have been defined.

The /api route points to a file ./server/routes/api.js. Let's create this file.

```js
const express = require('express');
const router = express.Router();

/* GET api listing. */
router.get('/', (req, res) => {
  res.send('api works');
});

module.exports = router;
```

One last thing before we run this. Since the catch all route is pointing to dist/index.html, we need to do a build of the angular app.

    ng build

This creates the dist folder with the angular 2 app built files. Now we can serve the app with express.

    node server.js

Going to http://localhost:3000 should load the app, and http://localhost:3000/api should show as below.

References:

-[MEAN App with Angular 2 and the Angular CLI](https://scotch.io/tutorials/mean-app-with-angular-2-and-the-angular-cli)

1 setup Angular 2 boilerplate using covalent
2 setup server for static files and api with express
3 setup authentication

---

# 3 Authentication

References:

- [Easy Node Authentication](https://github.com/scotch-io/easy-node-authentication)

https://github.com/auth0-blog/nodejs-jwt-authentication-sample
https://github.com/auth0-blog/angular2-authentication-sample

*** https://github.com/CuppaLabs/angular2-social-login
*** https://github.com/nitishvu/angular2-login-seed/

# 3.2 Google Authentication

Go to https://console.developers.google.com/

Create a new project

Enable 'Google+ API'

In the menu select **Credentials** then create new **OAuth Client ID** credentials

Configure consent screen

Choose Web Application

https://github.com/auth0/express-jwt


text:
<!DOCTYPE html>

    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <title>
      Lothrazar's Pixel Fortress
    </title>
    <meta content="" name="description" />
    <meta content="" name="keywords" />

Back to homepage

  This game and all code open source, starting on CraftyJS v0.5.3, currently v0.6.2.  Created by Samson Bassett

     Open Source Licence!
     Open Source Textures used are from here or here
     http://hasgraphics.com/free-sprites/
     Open Source Audio files used are from here or  here

Special thanks to this tutorial

If the game does not load, try Chrome

This is pre-alpha.  Mostly just a testing ground.

    Move with WASD or arrow keys.  Collect all coins.

Beware of zombies and fire.

   Also, use Number pad to fire in directions different from movement (8 for north, 3 for south-west)

      Health:
      0

      Coins:
      0

      Ammo:
      0

      Kills:
      0

      Misses:
      0


text:
import Tools
import sys
import argparse
ap = argparse.ArgumentParser(description="Find reads with secondary alignments that do not overlap on the read with the primary alignment.")


text:
package de.learnlib.alex.learning.services.connectors;

import de.learnlib.alex.auth.entities.User;
import de.learnlib.alex.common.exceptions.NotFoundException;
import de.learnlib.alex.data.dao.CounterDAO;
import de.learnlib.alex.data.entities.Counter;
import de.learnlib.alex.data.entities.Project;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Connector to store and manage counters.
 */
public class CounterStoreConnector implements Connector, Cloneable {

    private static final Logger logger = LoggerFactory.getLogger(CounterStoreConnector.class);

    /** The map that keeps track of all counters used by different urls. url -> (counterName -> counterValue). */
    private final Map<String, Integer> countersMap;

    /** An instance of the counterDAO. */
    private final CounterDAO counterDAO;

    /** The current project. */
    private final Project project;

    /** The user that executes the experiment. */
    private final User user;

    /**
     * Constructor.
     *
     * @param counterDAO
     *         An instance of the counterDAO.
     * @param user
     *         The current user.
     * @param project
     *         The current project.
     * @param counterList
     *         The list of counters in the database to initialize the map with.
     */
    public CounterStoreConnector(CounterDAO counterDAO, User user, Project project, List<Counter> counterList) {
        this.counterDAO = counterDAO;
        this.project = project;
        this.user = user;
        this.countersMap = new HashMap<>();
        counterList.forEach(counter -> this.countersMap.put(counter.getName(), counter.getValue()));
    }

    @Override
    public void reset() {
    }

    @Override
    public void dispose() {
        if (countersMap.isEmpty()) {
            return;
        }

        // get all counters from the db
        final Map<String, Counter> counters = new HashMap<>();
        try {
            counterDAO.getAll(user, project.getId()).forEach(c -> counters.put(c.getName(), c));
        } catch (NotFoundException ignored) {
        }

        // create counters that have not yet been created
        // update counters that have been created
        for (String name : countersMap.keySet()) {
            try {
                boolean counterExists = counters.containsKey(name);
                if (counterExists) {
                    counters.get(name).setValue(Math.max(counters.get(name).getValue(), countersMap.get(name)));
                    counters.put(name, counterDAO.update(user, counters.get(name)));
                } else {
                    Counter counter = createCounter(project.getId(), name, countersMap.get(name));
                    counterDAO.create(user, counter);
                }
            } catch (NotFoundException e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void post() {
    }

    private Counter createCounter(Long projectId, String name, Integer value) {
        Counter counter = new Counter();
        counter.setProject(new Project(projectId));
        counter.setName(name);
        counter.setValue(value);
        return counter;
    }

    /**
     * Set the value of an existing counter. Creates a new counter implicitly with the specified name and value if it
     * does not exist yet.
     *
     * @param projectId
     *         The id of the project.
     * @param name
     *         The name of the counter.
     * @param value
     *         The value of the counter.
     */
    public void set(Long projectId, String name, Integer value) {
        countersMap.put(name, value);
        logger.debug("Set the counter '{}' in the project <{}> to '{}'.", name, projectId, value);
    }

    /**
     * Increment a counter by a positive or negative value.
     *
     * @param projectId
     *         The id of the project.
     * @param name
     *         The name of the counter.
     * @param incrementBy
     *         The value to increment or decrement the counter by.
     * @throws IllegalStateException
     *         If the counter 'name' has not been set yet.
     */
    public void incrementBy(Long projectId, String name, int incrementBy) {
        if (!countersMap.containsKey(name)) {
            throw new IllegalStateException("Undefined counter: " + name);
        }

        countersMap.put(name, countersMap.get(name) + incrementBy);

        logger.debug("Incremented the counter '{}' in the project <{}> of user <{}>.", name, projectId,
                countersMap.get(name));
    }

    /**
     * Get the value of an existing counter.
     *
     * @param name
     *         The name of the counter.
     * @return The positive value of the counter.
     * @throws IllegalStateException
     *         If the counter 'name' has not been set yet.
     */
    public Integer get(String name) throws IllegalStateException {
        if (!countersMap.containsKey(name)) {
            throw new IllegalStateException("Undefined counter: " + name);
        }
        return countersMap.get(name);
    }

    public boolean contains(String name) {
        return countersMap.containsKey(name);
    }

    /**
     * Get the store as read only map.
     *
     * @return The store.
     */
    public Map<String, Integer> getStore() {
        return Collections.unmodifiableMap(countersMap);
    }

    /**
     * Copies the connector.
     *
     * @return A copy of the connector.
     */
    @Override
    public CounterStoreConnector clone() {
        return new CounterStoreConnector(counterDAO, user, project, new ArrayList<>());
    }
}


text:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\User;
class Permissions extends Model {

    public $table = 'permissions';

    public $dateFormat = 'U';

    protected $guarded = ['updated_at','created_at'];

    public function scopeDev($query){
        return $query->where('is_dev', 0);
    }

    public function getListByUid($uid){

        $roles = User::find($uid)->roles;
        $permissions = [];
        foreach ($roles as $role){
            $permissionsArr = $role->permissions ? explode(',', $role->permissions) : [];
            $permissions[] = $permissionsArr;
        }

        $permissions = array_unique(array_collapse($permissions));

        $rules = Permissions::whereIn('id',$permissions)->orderBy('sort')->get()->toArray();

        return $rules;
    }

}


text:
@class LocationRetriever, NSString, ScanProductItem;

@interface ProductDetailLogicHelper : MMObject <LocationRetrieveDelegate, PBMessageObserverDelegate, IMsgExt>
{
    LocationRetriever *m_locationRetriver;
    ScanProductItem *m_productItem;
    unsigned long long lastMsgSvrId;
    id <ProductDetailLogicHelperDelegate> _delegate;
}

@property(nonatomic) __weak id <ProductDetailLogicHelperDelegate> delegate; // @synthesize delegate=_delegate;
- (void).cxx_destruct;
- (void)OnGetNewXmlMsg:(id)arg1 Type:(id)arg2 MsgWrap:(id)arg3;
- (void)MessageReturn:(id)arg1 Event:(unsigned int)arg2;
- (void)onRetrieveLocationError:(int)arg1;
- (void)onRetrieveLocationTimeOut:(id)arg1;
- (void)onRetrieveLocationOK:(id)arg1;
- (void)sendGetActionInfoRequest:(id)arg1;
- (void)startAsyncGetActionInfo;
- (void)dealloc;
- (id)initWithProductItem:(id)arg1;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
package com.malleamus.ctp;

public interface Decline extends Response {

}


text:
import sys
import os
import pprint

def index_directory(path):
    files = {}
    count = 0
    for dirpath, dirnames, filenames in os.walk(path):
        for filename in filenames:
            full_path = os.path.join(dirpath, filename)
            size = os.stat(full_path).st_size
            key = '{},{}'.format(size, filename)
            if files.get(key) is None:
                files[key] = set([])
            files[key] |= set([full_path])
            if count % 1000 == 0:
                print('    Indexing {}...'.format(dirpath))
            count += 1
    return files

def compare_indexes(old_files, new_files):
    old_keys = set(old_files.keys())
    new_keys = set(new_files.keys())

    print('    Comparing contents...')

    missing_in_new = old_keys - new_keys
    both = old_keys & new_keys
    missing_in_old = new_keys - old_keys

    #print('Missing in old:')
    #for key in missing_in_old:
    #    pprint.pprint(new_files[key])
    #    print()

    print('Missing in new:')
    for key in missing_in_new:
        pprint.pprint(old_files[key])
        print()

    #print('Present in both:')
    #for key in both:
    #    pprint.pprint(old_files[key])
    #    pprint.pprint(new_files[key])
    #    print()

def run_check(old, new):
    print('Indexing new directory...')
    new_files = index_directory(new)
    #pprint.pprint(new_files)

    print('Indexing old directory...')
    old_files = index_directory(old)
    #pprint.pprint(old_files)

    compare_indexes(old_files, new_files)

if __name__ == '__main__':
    old = sys.argv[1]
    new = sys.argv[2]
    print('Comparing old location {} to new location {}'.format(old, new))
    run_check(old, new)


text:
namespace API.Models
{
    public class ChangePasswordRequest
    {
        public string Email { get; set; }

        public string CurrentPassword { get; set; }

        public string NewPassword { get; set; }
    }
}


text:
<!doctype html>

      <meta charset="UTF-8">
      <title>Sound Machine</title>

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

KUUSI
PALAA

Reader status:

        <button id="main_menu">←</button>

Returning to the beginning in a few seconds....

        <button id="quit_kiosk">Quit</button>