text:
Clazz.declarePackage ("J.api");
Clazz.declareInterface (J.api, "JmolMouseInterface");


text:
angular.module('module_media')

.controller('Module_MediaListController', function ($scope, Media) {

    $scope.loading = 0;
    $scope.list = null;

    $scope.getList = function() {
        $scope.loading++;
        Media.getAll().then(function(response) {
            $scope.loading--;
            $scope.list = response.data.data;
        });
    };

    $scope.getList();
});

redpajama_set_name: RedPajamaGithub


text:
package redhorizon.filetypes.shp;

import java.nio.ByteBuffer;

/**
 * Abstract SHP file header class containing only the parts similar between both
 * C&C SHP file and Dune 2 SHP file headers.
 *
 * @author Emanuel Rabina
 */
public abstract class ShpFileHeader {

	final short numimages;

	/**
	 * Constructor, fills-out the common number-of-images part.
	 *
	 * @param numimages The number of frames the SHP file contains.
	 */
	ShpFileHeader(short numimages) {

		this.numimages = numimages;
	}

	/**
	 * Returns this header in it's <tt>ByteBuffer</tt> representation.
	 *
	 * @return <tt>ByteBuffer</tt> containing this header's data.
	 */
	abstract ByteBuffer toByteBuffer();
}


text:
package sun.java2d.opengl;

import java.awt.BufferCapabilities;
import static java.awt.BufferCapabilities.FlipContents.*;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.Transparency;
import java.awt.image.ColorModel;

import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.X11ComponentPeer;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.BackBufferCapsProvider;
import sun.java2d.SurfaceData;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;

public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {

    private final boolean accelerationEnabled;

    public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
        super(vImg, context);

        /*
         * We will attempt to accelerate this image only under the
         * following conditions:
         *   - the image is not bitmask AND the GraphicsConfig supports the FBO
         *     extension
         */
        int transparency = vImg.getTransparency();
        GLXGraphicsConfig gc = (GLXGraphicsConfig) vImg.getGraphicsConfig();
        accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT)
                && transparency != Transparency.BITMASK;
    }

    protected boolean isAccelerationEnabled() {
        return accelerationEnabled;
    }

    /**
     * Create a FBO-based SurfaceData object (or init the backbuffer
     * of an existing window if this is a double buffered GraphicsConfig)
     */
    protected SurfaceData initAcceleratedSurface() {
        SurfaceData sData;
        Component comp = vImg.getComponent();
        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
        X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;

        try {
            boolean createVSynced = false;
            boolean forceback = false;
            if (context instanceof Boolean) {
                forceback = ((Boolean)context).booleanValue();
                if (forceback && peer instanceof BackBufferCapsProvider) {
                    BackBufferCapsProvider provider =
                        (BackBufferCapsProvider)peer;
                    BufferCapabilities caps = provider.getBackBufferCaps();
                    if (caps instanceof ExtendedBufferCapabilities) {
                        ExtendedBufferCapabilities ebc =
                            (ExtendedBufferCapabilities)caps;
                        if (ebc.getVSync() == VSYNC_ON &&
                            ebc.getFlipContents() == COPIED)
                        {
                            createVSynced = true;
                            forceback = false;
                        }
                    }
                }
            }

            if (forceback) {
                // peer must be non-null in this case
                sData = GLXSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER);
            } else {
                GLXGraphicsConfig gc =
                    (GLXGraphicsConfig)vImg.getGraphicsConfig();
                ColorModel cm = gc.getColorModel(vImg.getTransparency());
                int type = vImg.getForcedAccelSurfaceType();
                // if acceleration type is forced (type != UNDEFINED) then
                // use the forced type, otherwise choose FBOBJECT
                if (type == OGLSurfaceData.UNDEFINED) {
                    type = OGLSurfaceData.FBOBJECT;
                }
                if (createVSynced) {
                    sData = GLXSurfaceData.createData(peer, vImg, type);
                } else {
                    sData = GLXSurfaceData.createData(gc,
                                                      vImg.getWidth(),
                                                      vImg.getHeight(),
                                                      cm, vImg, type);
                }
            }
        } catch (NullPointerException ex) {
            sData = null;
        } catch (OutOfMemoryError er) {
            sData = null;
        }

        return sData;
    }

    @Override
    protected boolean isConfigValid(GraphicsConfiguration gc) {
        return ((gc == null) || (gc == vImg.getGraphicsConfig()));
    }

    @Override
    public void initContents() {
        if (vImg.getForcedAccelSurfaceType() != OGLSurfaceData.TEXTURE) {
            super.initContents();
        }
    }
}


text:
<?php
// points to Code Igniter full url. change it to your backend url
define(BASE_URL, 'http://localhost/wow/backend/');

define(INDEX_PAGE, 'index.php/');
define(UPLOAD_URL, BASE_URL.'upload/');
define(REPORT_URL, BASE_URL.'reports/');

// define Application name
define(SYSTEM_NAME, 'Wow - Application');


text:
require 'spec_helper'

describe Mytv do
end


text:
<label class="mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect" for="icon-toggle-1">
  <input type="checkbox" id="icon-toggle-1" class="mdl-icon-toggle__input" checked>
  <i class="mdl-icon-toggle__label material-icons">format_bold</i>
</label>


text:
<?php

namespace Symfony\Component\Messenger\Handler;

/**
 * Marker interface for message handlers.
 *
 * @author Samuel Roze <samuel.roze@gmail.com>
 *
 * @experimental in 4.1
 */
interface MessageHandlerInterface
{
}


text:
package net.oneandone.troilus.example;

import net.oneandone.troilus.interceptor.ConstraintsInterceptor;

public interface HotelsTable  {

    public static final String TABLE = "hotels";

    public static final String ID = "id";
    public static final String NAME = "name";
    public static final String ROOM_IDS = "room_ids";
    public static final String DESCRIPTION = "description";
    public static final String CLASSIFICATION = "classification";
    public static final String PHONE = "phone";

    public static final String DDL = "com/unitedinternet/troilus/example/hotels.ddl";

    public static ConstraintsInterceptor CONSTRAINTS = ConstraintsInterceptor.newConstraints()
                                                                             .withNotNullColumn(NAME);
}


text:
function LocalizedString(options) {
  this.id = options.id;
  this.translations = options.translations || {};
}

LocalizedString.prototype.getId = function() {
  return this.id;
};

LocalizedString.prototype.hasTranslation = function(lang) {
  return this.translations[lang] !== undefined;
};

LocalizedString.prototype.getTranslation = function(lang) {
  return this.translations[lang];
};
LocalizedString.prototype.addTranslation = function(lang, value) {
  this.translations[lang] = value;
};
LocalizedString.prototype.setTranslation = LocalizedString.prototype.addTranslation;

LocalizedString.prototype.getLanguages = function() {
  return Object.keys(this.translations);
};

LocalizedString.prototype.getTranslations = function() {
  return this.translations;
};

module.exports = LocalizedString;


text:
class Message < ApplicationRecord
  belongs_to :ticket
  validates :data, presence: true

  after_create_commit :broadcast_message

  def broadcast_message
    MessageBroadcastJob.perform_later(self)
  end

end


text:
{% extends "base.html" %}

{% block title %} Referral List {% endblock %}

{% block content %}

Your referral dashboard

You need to be logged in to add or make changes in referrals.

Use  username: 'timlee' password: 'timlee'  for test account.

          <form method="post" id="referral_create" action="." class="add_email">
            {% csrf_token %}

              Title

                <input class="textinput textInput form-control" id="id_title" maxlength="250" name="title" type="text"/>

              <button class="btn" id="submit_referral_create" name="action_add" type="submit">Add a referral</button>
          </form>

               Title
               Referral ID
               Clicks
              Edit
              Delete
              Landing

            {% for referral in referral_list %}

              {{ referral.title }}
              {{ referral.slug }}
              {{ referral.clicks }}
              Edit

                <form  class="referral_form_remove" action="#" method="post" id="{{referral.slug}}">
                  {% csrf_token %}
                  <input class="btn btn-danger" type="submit" value="Delete"/>
                </form>

              Page link

            {% endfor %}

{% endblock content %}

{% block javascript %}
  {{ block.super }}

{% endblock javascript %}


text:
<?php

namespace com\xcitestudios\Network\Server\Configuration;

use stdClass;

/**
 * A class implementing the Interfaces\UsernameAuthenticatedServerConfigurationSerializableInterface interface.
 *
 * @package com.xcitestudios.Network
 * @subpackage Server.Configuration
 */
class UsernameAuthenticatedServerConfiguration extends ServerConfiguration
    implements Interfaces\UsernameAuthenticatedServerConfigurationSerializableInterface
{
    /**
     * @var string
     */
    protected $username;

    /**
     * @var string
     */
    protected $password;

    /**
     * Set username for authentication.
     *
     * @param string $username
     * @return static
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * Get username for authentication.
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password for authentication.
     *
     * @param string $password
     * @return static
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password for authentication.
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Updates the element implementing this interface using a JSON representation.
     *
     * This means updating the state of this object with that defined in the JSON
     * as opposed to returning a new instance of this object.
     *
     * @param string $jsonString Representation of the object.
     *
     * @return stdClass
     */
    public function deserializeJSON($jsonString)
    {
        $data = parent::deserializeJSON($jsonString);

        $this->username = property_exists($data, 'username') ? $data->username : null;
        $this->password = property_exists($data, 'password') ? $data->password : null;

        return $data;
    }

    /**
     * (PHP 5 >= 5.4.0)

     * Specify data which should be serialized to JSON
     *
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
     * @return mixed data which can be serialized by json_encode,
     *       which is a value of any type other than a resource.
     */
    public function jsonSerialize()
    {
        $ret = parent::jsonSerialize();

        $ret->username = $this->username;
        $ret->password = $this->password;

        return $ret;
    }
}


text:
// This file is part of the dune-gdt project:
//   https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
//      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
//          with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
//   Felix Schindler (2020)

#ifndef DUNE_GDT_OPERATORS_BILINEAR_FORM_HH
#define DUNE_GDT_OPERATORS_BILINEAR_FORM_HH

#include <dune/xt/common/parallel/threadstorage.hh>
#include <dune/xt/common/timedlogging.hh>
#include <dune/xt/la/type_traits.hh>
#include <dune/xt/grid/type_traits.hh>
#include <dune/xt/grid/walker.hh>
#include <dune/xt/functions/grid-function.hh>

#include <dune/gdt/local/assembler/bilinear-form-accumulators.hh>
#include <dune/gdt/local/bilinear-forms/interfaces.hh>

namespace Dune {
namespace GDT {

template <class GridView,
          size_t source_range_dim = 1,
          size_t source_range_dim_cols = 1,
          class SourceRangeField = double,
          class Result = double,
          size_t range_range_dim = source_range_dim,
          size_t range_range_dim_cols = source_range_dim_cols,
          class RangeRangeField = SourceRangeField>
class BilinearForm
  : public XT::Grid::ElementAndIntersectionFunctor<GridView>
  , XT::Common::ThreadResultPropagator<BilinearForm<GridView,
                                                    source_range_dim,
                                                    source_range_dim_cols,
                                                    SourceRangeField,
                                                    Result,
                                                    range_range_dim,
                                                    range_range_dim_cols,
                                                    RangeRangeField>,
                                       Result>
  , public XT::Common::WithLogger<BilinearForm<GridView,
                                               source_range_dim,
                                               source_range_dim_cols,
                                               SourceRangeField,
                                               Result,
                                               range_range_dim,
                                               range_range_dim_cols,
                                               RangeRangeField>>
{
  static_assert(XT::Grid::is_view<GridView>::value, "");

  using ThisType = BilinearForm;
  using BaseType = XT::Grid::ElementAndIntersectionFunctor<GridView>;
  using Propagator = XT::Common::ThreadResultPropagator<BilinearForm<GridView,
                                                                     source_range_dim,
                                                                     source_range_dim_cols,
                                                                     SourceRangeField,
                                                                     Result,
                                                                     range_range_dim,
                                                                     range_range_dim_cols,
                                                                     RangeRangeField>,
                                                        Result>;
  friend Propagator;

  using Logger = XT::Common::WithLogger<BilinearForm<GridView,
                                                     source_range_dim,
                                                     source_range_dim_cols,
                                                     SourceRangeField,
                                                     Result,
                                                     range_range_dim,
                                                     range_range_dim_cols,
                                                     RangeRangeField>>;

public:
  using GV = GridView;
  using typename BaseType::E;
  using typename BaseType::GridViewType;
  using typename BaseType::I;
  using ResultType = Result;

  static const constexpr size_t s_r = source_range_dim;
  static const constexpr size_t s_rC = source_range_dim_cols;
  using SR = SourceRangeField;
  using SourceType = XT::Functions::GridFunctionInterface<E, s_r, s_rC, SR>;

  static const constexpr size_t r_r = range_range_dim;
  static const constexpr size_t r_rC = range_range_dim_cols;
  using RR = RangeRangeField;
  using RangeType = XT::Functions::GridFunctionInterface<E, r_r, r_rC, RR>;

  using ElementFilterType = XT::Grid::ElementFilter<GV>;
  using IntersectionFilterType = XT::Grid::IntersectionFilter<GV>;

  BilinearForm(GridViewType grd_vw,
               XT::Functions::GridFunction<E, s_r, s_rC, SR> src,
               XT::Functions::GridFunction<E, r_r, r_rC, RR> rng,
               const std::string& logging_prefix = "")
    : BaseType()
    , Propagator(this)
    , Logger(logging_prefix.empty() ? "BilinearForm" : logging_prefix,
             /*logging_disabled=*/logging_prefix.empty())
    , grid_view_(grd_vw)
    , source_(src.copy_as_grid_function())
    , range_(rng.copy_as_grid_function())
    , local_source_in_(source_->local_function())
    , local_source_out_(source_->local_function())
    , local_range_in_(range_->local_function())
    , local_range_out_(range_->local_function())
    , bilinear_form_value_in_in_(1, 1, 0.)
    , bilinear_form_value_in_out_(1, 1, 0.)
    , bilinear_form_value_out_in_(1, 1, 0.)
    , bilinear_form_value_out_out_(1, 1, 0.)
    , result_(0)
  {
    LOG__(Logger, info) << Logger::logger.prefix << "BilinearForm(grid_view=" << &grd_vw << ", src=" << &src
                        << ", rng=" << &rng << ")" << std::endl;
  }

  BilinearForm(const ThisType& other)
    : BaseType(other)
    , Propagator(other)
    , Logger(other)
    , grid_view_(other.grid_view_)
    , source_(other.source_->copy_as_grid_function())
    , range_(other.range_->copy_as_grid_function())
    , local_source_in_(source_->local_function())
    , local_source_out_(source_->local_function())
    , local_range_in_(range_->local_function())
    , local_range_out_(range_->local_function())
    , bilinear_form_value_in_in_(other.bilinear_form_value_in_in_)
    , bilinear_form_value_in_out_(other.bilinear_form_value_in_out_)
    , bilinear_form_value_out_in_(other.bilinear_form_value_out_in_)
    , bilinear_form_value_out_out_(other.bilinear_form_value_out_out_)
    , result_(other.result_)
  {
    for (auto& data : other.element_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      this->append(local_bilinear_form, param, filter);
    }
    for (auto& data : other.coupling_intersection_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      this->append(local_bilinear_form, param, filter);
    }
    for (auto& data : other.intersection_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      this->append(local_bilinear_form, param, filter);
    }
  } // BilinearForm(...)

  BilinearForm(ThisType&&) = default;

  BaseType* copy() override final
  {
    return Propagator::copy_imp();
  }

  const GridViewType& grid_view() const
  {
    return grid_view_;
  }

  const SourceType& source() const
  {
    return *source_;
  }

  const RangeType& range() const
  {
    return *range_;
  }

  /// \name These methods allow to append local element bilinear forms
  ///\{

  ThisType&
  append(const LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>& local_bilinear_form,
         const XT::Common::Parameter& param = {},
         const ElementFilterType& filter = XT::Grid::ApplyOn::AllElements<GV>())
  {
    LOG__(Logger, info) << Logger::logger.prefix << ".append(local_element_bilinear_form=" << &local_bilinear_form
                        << ", param=" << param << ", filter=" << &filter << ")" << std::endl;
    element_data_.emplace_back(local_bilinear_form.copy(), param, std::unique_ptr<ElementFilterType>(filter.copy()));
    return *this;
  }

  ThisType&
  operator+=(const LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>& local_bilinear_form)
  {
    this->append(local_bilinear_form);
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<const LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                              const XT::Common::Parameter&>& local_bilinear_form__param)
  {
    this->append(std::get<0>(local_bilinear_form__param), std::get<1>(local_bilinear_form__param));
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<const LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                              const ElementFilterType&>& local_bilinear_form__filter)
  {
    this->append(std::get<0>(local_bilinear_form__filter), {}, std::get<1>(local_bilinear_form__filter));
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<const LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                              const XT::Common::Parameter&,
                              const ElementFilterType&>& local_bilinear_form__param__filter)
  {
    this->append(std::get<0>(local_bilinear_form__param__filter),
                 std::get<1>(local_bilinear_form__param__filter),
                 std::get<2>(local_bilinear_form__param__filter));
    return *this;
  }

  ///\}
  /// \name These methods allow to append local coupling intersection bilinear forms
  ///\{

  ThisType& append(const LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&
                       local_bilinear_form,
                   const XT::Common::Parameter& param = {},
                   const IntersectionFilterType& filter = XT::Grid::ApplyOn::AllIntersections<GV>())
  {
    LOG__(Logger, info) << Logger::logger.prefix
                        << ".append(local_coupling_intersection_bilinear_form=" << &local_bilinear_form
                        << ", param=" << param << ", filter=" << &filter << ")" << std::endl;
    coupling_intersection_data_.emplace_back(
        local_bilinear_form.copy(), param, std::unique_ptr<IntersectionFilterType>(filter.copy()));
    return *this;
  }

  ThisType&
  operator+=(const LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&
                 local_bilinear_form)
  {
    this->append(local_bilinear_form);
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<
             const LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
             const XT::Common::Parameter&>& local_bilinear_form__param)
  {
    this->append(std::get<0>(local_bilinear_form__param), std::get<1>(local_bilinear_form__param));
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<
             const LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
             const IntersectionFilterType&>& local_bilinear_form__filter)
  {
    this->append(std::get<0>(local_bilinear_form__filter), {}, std::get<1>(local_bilinear_form__filter));
    return *this;
  }

  ThisType&
  operator+=(const std::tuple<
             const LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
             const XT::Common::Parameter&,
             const IntersectionFilterType&>& local_bilinear_form__param__filter)
  {
    this->append(std::get<0>(local_bilinear_form__param__filter),
                 std::get<1>(local_bilinear_form__param__filter),
                 std::get<2>(local_bilinear_form__param__filter));
    return *this;
  }

  ///\}
  /// \name These methods allow to append local intersection bilinear forms
  ///\{

  ThisType&
  append(const LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>& local_bilinear_form,
         const XT::Common::Parameter& param = {},
         const IntersectionFilterType& filter = XT::Grid::ApplyOn::AllIntersections<GV>())
  {
    LOG__(Logger, info) << Logger::logger.prefix << ".append(local_intersection_bilinear_form=" << &local_bilinear_form
                        << ", param=" << param << ", filter=" << &filter << ")" << std::endl;
    intersection_data_.emplace_back(
        local_bilinear_form.copy(), param, std::unique_ptr<IntersectionFilterType>(filter.copy()));
    return *this;
  }

  ThisType& operator+=(
      const LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>& local_bilinear_form)
  {
    this->append(local_bilinear_form);
    return *this;
  }

  ThisType& operator+=(
      const std::tuple<const LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                       const XT::Common::Parameter&>& local_bilinear_form__param)
  {
    this->append(std::get<0>(local_bilinear_form__param), std::get<1>(local_bilinear_form__param));
    return *this;
  }

  ThisType& operator+=(
      const std::tuple<const LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                       const IntersectionFilterType&>& local_bilinear_form__filter)
  {
    this->append(std::get<0>(local_bilinear_form__filter), {}, std::get<1>(local_bilinear_form__filter));
    return *this;
  }

  ThisType& operator+=(
      const std::tuple<const LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>&,
                       const XT::Common::Parameter&,
                       const IntersectionFilterType&>& local_bilinear_form__param__filter)
  {
    this->append(std::get<0>(local_bilinear_form__param__filter),
                 std::get<1>(local_bilinear_form__param__filter),
                 std::get<2>(local_bilinear_form__param__filter));
    return *this;
  }

  ///\}

  void prepare() override final
  {
    result_ = 0;
  }

  /// \brief Variant of compute_locally to apply all local element bilinear forms
  ResultType compute_locally(const E& element)
  {
    Result ret = 0;
    local_source_in_->bind(element);
    local_range_in_->bind(element);
    for (auto& data : element_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      if (filter.contains(this->grid_view_, element)) {
        assert(local_source_in_->size(param) == 1);
        assert(local_range_in_->size(param) == 1);
        local_bilinear_form.apply2(*local_range_in_, *local_source_in_, bilinear_form_value_in_in_, param);
        assert(bilinear_form_value_in_in_.rows() >= 1);
        assert(bilinear_form_value_in_in_.cols() >= 1);
        ret += bilinear_form_value_in_in_[0][0];
      }
    }
    return ret;
  } // ... compute_locally(...)

  /// \brief Variant of compute_locally to apply all local intersection and coupling intersection bilinear forms
  ///
  /// \attention Make sure to call this method only on suitable intersections, neither intersection.neighbor() not
  ///            the validity of outside_element are checked!
  ResultType compute_locally(const I& intersection, const E& inside_element, const E& outside_element)
  {
    Result ret = 0;
    local_source_in_->bind(inside_element);
    local_range_in_->bind(inside_element);
    local_source_out_->bind(outside_element);
    local_range_out_->bind(outside_element);
    for (auto& data : coupling_intersection_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      if (filter.contains(this->grid_view_, intersection)) {
        assert(local_source_in_->size(param) == 1);
        assert(local_source_out_->size(param) == 1);
        assert(local_range_in_->size(param) == 1);
        assert(local_range_out_->size(param) == 1);
        local_bilinear_form.apply2(intersection,
                                   *local_range_in_,
                                   *local_source_in_,
                                   *local_range_out_,
                                   *local_source_out_,
                                   bilinear_form_value_in_in_,
                                   bilinear_form_value_in_out_,
                                   bilinear_form_value_out_in_,
                                   bilinear_form_value_out_out_,
                                   param);
        assert(bilinear_form_value_in_in_.rows() * bilinear_form_value_in_in_.cols() >= 1);
        assert(bilinear_form_value_in_out_.rows() * bilinear_form_value_in_out_.cols() >= 1);
        assert(bilinear_form_value_out_in_.rows() * bilinear_form_value_out_in_.cols() >= 1);
        assert(bilinear_form_value_out_out_.rows() * bilinear_form_value_out_out_.cols() >= 1);
        ret += bilinear_form_value_in_in_[0][0] + bilinear_form_value_in_out_[0][0] + bilinear_form_value_out_in_[0][0]
               + bilinear_form_value_out_out_[0][0];
      }
    }
    for (auto& data : intersection_data_) {
      const auto& local_bilinear_form = *std::get<0>(data);
      auto& param = std::get<1>(data);
      const auto& filter = *std::get<2>(data);
      auto apply_bilinear_form_to_one_side = [&](const auto& test_basis, const auto& ansatz_basis) {
        assert(test_basis.size(param) == 1);
        assert(ansatz_basis.size(param) == 1);
        // it does not matter which of the tmp matrices we pick here
        local_bilinear_form.apply2(intersection, test_basis, ansatz_basis, bilinear_form_value_in_in_, param);
        assert(bilinear_form_value_in_in_.rows() * bilinear_form_value_in_in_.cols() >= 1);
        return bilinear_form_value_in_in_[0][0];
      };
      if (filter.contains(this->grid_view_, intersection)) {
        if (local_bilinear_form.inside())
          ret += apply_bilinear_form_to_one_side(*local_range_in_, *local_source_in_);
        else
          ret += apply_bilinear_form_to_one_side(*local_range_out_, *local_source_out_);
      }
    }
    return ret;
  } // ... compute_locally(...)

  void apply_local(const E& element) override final
  {
    result_ += compute_locally(element);
  }

  void apply_local(const I& intersection, const E& inside_element, const E& outside_element) override final
  {
    result_ += compute_locally(intersection, inside_element, outside_element);
  }

  void finalize() override final
  {
    Propagator::finalize_imp();
  }

  const ResultType& result() const
  {
    return result_;
  }

  Result apply2(const bool use_tbb = false)
  {
    this->prepare();
    XT::Grid::Walker<GV> walker(this->grid_view_);
    walker.append(*this);
    walker.walk(use_tbb);
    return this->result_;
  }

protected:
  void set_result(Result res)
  {
    result_ = res;
  }

  const GridViewType grid_view_;
  const std::unique_ptr<XT::Functions::GridFunctionInterface<E, s_r, s_rC, SR>> source_;
  const std::unique_ptr<XT::Functions::GridFunctionInterface<E, r_r, r_rC, RR>> range_;
  std::unique_ptr<typename SourceType::LocalFunctionType> local_source_in_;
  std::unique_ptr<typename SourceType::LocalFunctionType> local_source_out_;
  std::unique_ptr<typename RangeType::LocalFunctionType> local_range_in_;
  std::unique_ptr<typename RangeType::LocalFunctionType> local_range_out_;
  DynamicMatrix<Result> bilinear_form_value_in_in_;
  DynamicMatrix<Result> bilinear_form_value_in_out_;
  DynamicMatrix<Result> bilinear_form_value_out_in_;
  DynamicMatrix<Result> bilinear_form_value_out_out_;
  ResultType result_;
  std::list<std::tuple<std::unique_ptr<LocalElementBilinearFormInterface<E, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>>,
                       XT::Common::Parameter,
                       std::unique_ptr<ElementFilterType>>>
      element_data_;
  std::list<std::tuple<
      std::unique_ptr<LocalCouplingIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>>,
      XT::Common::Parameter,
      std::unique_ptr<IntersectionFilterType>>>
      coupling_intersection_data_;
  std::list<
      std::tuple<std::unique_ptr<LocalIntersectionBilinearFormInterface<I, r_r, r_rC, RR, ResultType, s_r, s_rC, SR>>,
                 XT::Common::Parameter,
                 std::unique_ptr<IntersectionFilterType>>>
      intersection_data_;
}; // class BilinearForm

template <class GV, size_t s_r, size_t s_rC, class SR, size_t r_r, size_t r_rC, class RR>
std::enable_if_t<XT::Grid::is_view<GV>::value, BilinearForm<GV, s_r, s_rC, SR, double, r_r, r_rC, RR>>
make_bilinear_form(GV grid_view,
                   const XT::Functions::GridFunctionInterface<XT::Grid::extract_entity_t<GV>, s_r, s_rC, SR>& source,
                   const XT::Functions::GridFunctionInterface<XT::Grid::extract_entity_t<GV>, r_r, r_rC, RR>& range,
                   const std::string& logging_prefix = "")
{
  return BilinearForm<GV, s_r, s_rC, SR, double, r_r, r_rC, RR>(grid_view, source, range, logging_prefix);
}

} // namespace GDT
} // namespace Dune

#endif // DUNE_GDT_OPERATORS_BILINEAR_FORM_HH


text:
#include <fstream>
#include <ctime>

#include "gtest/gtest.h"
#include "utils/auto_trace.h"
#include "utils/logger.h"
#include "utils/log_message_loop_thread.h"
#include "utils/threads/message_loop_thread.h"
#include "utils/file_system.h"
#include "utils/threads/thread.h"
#include "utils/date_time.h"
#include "utils/logger_status.h"
#include "utils/helpers.h"

namespace test {
namespace components {
namespace utils_test {

using namespace ::logger;

CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog")

namespace {
const std::string kFileName =
    file_system::CurrentWorkingDirectory() + "/AutoTraceTestLogFile.log";
}  // namespace

void Preconditions() {
  // Delete file with previous logs
  if (file_system::FileExists(kFileName)) {
    // If logger is active now deleting log file cause undefined befaviour.
    DEINIT_LOGGER();
    ASSERT_TRUE(file_system::DeleteFile(kFileName))
        << "Can't delete AutoTraceTestLogFile.log";
  }
}

void InitLogger() {
  // Set enabled logs
  INIT_LOGGER("log4cxx.properties", true);
  // DEINIT_LOGGER will be called in test_main.cc
}

void CreateDeleteAutoTrace(const std::string& testlog) {
  LOG4CXX_AUTO_TRACE(logger_);
  LOG4CXX_DEBUG(logger_, testlog);
}

/**
 * @brief IsLogLineContains cheks if log line contains debug message with
 * specified debug message
 * @param log_line line to search in
 * @param debug_level expected debug level
 * @param debug_log_message expected debug message
 * @return true if debug_message exist in log_line with debug_level
 */
bool IsLogLineContains(const std::string& log_line,
                       const std::string& debug_level,
                       const std::string& debug_message) {
  return log_line.find(debug_level) != std::string::npos &&
         log_line.find(debug_message) != std::string::npos;
}

/**
 * @brief CheckAutoTraceDebugInFile chacks if logfile contains autotrace and
 * debug for test AutoTrace_WriteToFile_ReadCorrectString
 * @param debug_message message that should be logged with DEBUG level
 * @return true if trace enter, trace exit, debug message exist in log file
 */
bool CheckAutoTraceDebugInFile(const std::string& debug_message) {
  using namespace helpers;
  const std::string debug_log_level = "DEBUG";
  const std::string trace_log_level = "TRACE";
  const std::string enter_message = ": Enter";
  const std::string exit_message = ": Exit";
  std::ifstream file_log(kFileName);
  if (!file_log.is_open()) {
    return false;
  }

  bool debug_found = false;
  bool trace_enter = false;
  bool trace_exit = false;
  for (std::string line;
       Compare<bool, EQ, ONE>(false, debug_found, trace_enter, trace_exit) &&
           getline(file_log, line);) {
    debug_found = debug_found
                      ? debug_found
                      : IsLogLineContains(line, debug_log_level, debug_message);
    trace_enter = trace_enter
                      ? trace_enter
                      : IsLogLineContains(line, trace_log_level, enter_message);
    trace_exit = trace_exit
                     ? trace_exit
                     : IsLogLineContains(line, trace_log_level, exit_message);
  }
  file_log.close();
  return Compare<bool, EQ, ALL>(true, debug_found, trace_enter, trace_exit);
}
// TODO(DTrunov) : Enable after APPLINK-25006 will be resolved
TEST(AutoTraceTest, DISABLED_AutoTrace_WriteToFile_ReadCorrectString) {
  const std::string testlog = "Test trace is working!";
  Preconditions();
  InitLogger();
  CreateDeleteAutoTrace(testlog);

  FLUSH_LOGGER();
  ASSERT_TRUE(CheckAutoTraceDebugInFile(testlog));
}

}  // namespace utils_test
}  // namespace components
}  // namespace test


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Publications on DEVELACKER</title>
    <link>/publication/</link>
    <description>Recent content in Publications on DEVELACKER</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>&copy; 2018</copyright>
    <lastBuildDate>Sun, 01 Jan 2017 00:00:00 +0900</lastBuildDate>

	<atom:link href="/publication/index.xml" rel="self" type="application/rss+xml" />

  </channel>
</rss>


text:
<?php

/**
 * @namespace
 */
namespace ZendTest\Uri;

use Zend\Uri\Http as HttpUri,
    PHPUnit_Framework_TestCase as TestCase;

/**
 * @category   Zend
 * @package    Zend_Uri
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Uri
 * @group      Zend_Uri_Http
 * @group      Zend_Http
 */
class HttpTest extends TestCase
{
    /**
     * Data Providers
     */

    /**
     * Valid HTTP schemes
     *
     * @return array
     */
    static public function validSchemeProvider()
    {
        return array(
            array('http'),
            array('https'),
            array('HTTP'),
            array('Https'),
        );
    }

    /**
     * Invalid HTTP schemes
     *
     * @return array
     */
    static public function invalidSchemeProvider()
    {
        return array(
            array('file'),
            array('mailto'),
            array('g'),
            array('http:')
        );
    }

    static public function portNormalizationTestsProvider()
    {
        return array(
            array('http://www.example.com:80/foo/bar', 'http://www.example.com/foo/bar'),
            array('http://www.example.com:1234/foo/bar', 'http://www.example.com:1234/foo/bar'),
            array('https://www.example.com:443/foo/bar', 'https://www.example.com/foo/bar'),
            array('https://www.example.com:80/foo/bar', 'https://www.example.com:80/foo/bar'),
            array('http://www.example.com:443/foo/bar', 'http://www.example.com:443/foo/bar'),
        );
    }

    /**
     * Tests
     */

    /**
     * Test that specific schemes are valid for this class
     *
     * @param string $scheme
     * @dataProvider validSchemeProvider
     */
    public function testValidScheme($scheme)
    {
        $uri = new HttpUri;
        $uri->setScheme($scheme);
        $this->assertEquals($scheme, $uri->getScheme());
    }

    /**
     * Test that specific schemes are invalid for this class
     *
     * @param string $scheme
     * @dataProvider invalidSchemeProvider
     */
    public function testInvalidScheme($scheme)
    {
        $uri = new HttpUri;
        $this->setExpectedException('Zend\Uri\Exception\InvalidUriPartException');
        $uri->setScheme($scheme);
    }

    /**
     * Test that validateScheme returns false for schemes not valid for use
     * with the HTTP class
     *
     * @param string $scheme
     * @dataProvider invalidSchemeProvider
     */
    public function testValidateSchemeInvalid($scheme)
    {
        $this->assertFalse(HttpUri::validateScheme($scheme));
    }

    /**
     * Test that normalizing an HTTP URL removes the port depending on scheme
     *
     * @param string $orig
     * @param string $expected
     * @dataProvider portNormalizationTestsProvider
     */
    public function testNormalizationRemovesPort($orig, $expected)
    {
        $uri = new HttpUri($orig);
        $uri->normalize();
        $this->assertEquals($expected, $uri->toString());
    }

    public function testUserIsNullByDefaultWhenNoUserInfoIsProvided()
    {
        $uri = new HttpUri('http://example.com/');
        $uri->normalize();
        $this->assertNull($uri->getUser());
    }

    public function testPasswordIsNullByDefaultWhenNoUserInfoIsProvided()
    {
        $uri = new HttpUri('http://example.com/');
        $uri->normalize();
        $this->assertNull($uri->getPassword());
    }

    public function testCanParseUsernameAndPasswordFromUriNotContainingPort()
    {
        $uri = new HttpUri('http://user:pass@example.com/');
        $uri->normalize();
        $this->assertEquals('user', $uri->getUser());
        $this->assertEquals('pass', $uri->getPassword());
        $this->assertEquals('example.com', $uri->getHost());
    }

    public function testCanParseUsernameAndPasswordFromUriContainingPort()
    {
        $uri = new HttpUri('http://user:pass@example.com:80/');
        $uri->normalize();
        $this->assertEquals('user', $uri->getUser());
        $this->assertEquals('pass', $uri->getPassword());
        $this->assertEquals('example.com', $uri->getHost());
    }

    public function testCanParseUsernameContainingAtMarkFromUri()
    {
        $uri = new HttpUri('http://user@foo.com:pass@example.com/');
        $uri->normalize();
        $this->assertEquals('user@foo.com', $uri->getUser());
        $this->assertEquals('pass', $uri->getPassword());
        $this->assertEquals('example.com', $uri->getHost());
    }

    public function testCanParsePasswordContainingAtMarkFromUri()
    {
        $uri = new HttpUri('http://user:p@ss@example.com/');
        $uri->normalize();
        $this->assertEquals('user', $uri->getUser());
        $this->assertEquals('p@ss', $uri->getPassword());
        $this->assertEquals('example.com', $uri->getHost());
    }

    public function testUserInfoCanOmitPassword()
    {
        $uri = new HttpUri('http://user@example.com@example.com/');
        $uri->normalize();
        $this->assertEquals('user@example.com', $uri->getUser());
        $this->assertNull($uri->getPassword());
        $this->assertEquals('example.com', $uri->getHost());
    }

    public function testGetPortReturnsDefaultPortHttp()
    {
        $uri = new HttpUri('http://www.example.com/');
        $this->assertEquals(80, $uri->getPort());
    }

    public function testGetPortReturnsDefaultPortHttps()
    {
        $uri = new HttpUri('https://www.example.com/');
        $this->assertEquals(443, $uri->getPort());
    }

    public function testGetPortDoesntModifyUrlHttp()
    {
        $origUri = 'http://www.example.com/foo';
        $uri = new HttpUri($origUri);
        $uri->getPort();
        $this->assertEquals($origUri, $uri->toString());
    }

    public function testGetPortDoesntModifyUrlHttps()
    {
        $origUri = 'https://www.example.com/foo';
        $uri = new HttpUri($origUri);
        $uri->getPort();
        $this->assertEquals($origUri, $uri->toString());
    }
}


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.5
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package rhcad.touchvg.core;

public class MgStringCallback {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected MgStringCallback(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(MgStringCallback obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        touchvgJNI.delete_MgStringCallback(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  protected void swigDirectorDisconnect() {
    swigCMemOwn = false;
    delete();
  }

  public void swigReleaseOwnership() {
    swigCMemOwn = false;
    touchvgJNI.MgStringCallback_change_ownership(this, swigCPtr, false);
  }

  public void swigTakeOwnership() {
    swigCMemOwn = true;
    touchvgJNI.MgStringCallback_change_ownership(this, swigCPtr, true);
  }

  public void onGetString(String text) {
    touchvgJNI.MgStringCallback_onGetString(swigCPtr, this, text);
  }

  public MgStringCallback() {
    this(touchvgJNI.new_MgStringCallback(), true);
    touchvgJNI.MgStringCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
  }

}


text:
\chapter{The Basic (Flat) Relational Model}

\section{Relational Model Concepts}
Een \textbf{relationele database} bestaat uit verschillende \textit{relaties}.
\begin{description}
	\item[Mathematisch] Een tabel uit simpele lineaire rijen, ook wel eens naar een \textit{flat file} genoemd voor de simpele, lineaire structuur. Rijen hebben elk hun eigen kolom met informatie erin.
	\item[Formeel] Formeel gezien spreken we over \textbf{tupels} i.p.v. \textit{rijen} en over \textit{attributen} i.p.v. \textit{kolommen}, elk met een \textit{domein}. De tabel wordt een \textbf{relation} genoemd.
\end{description}

\subsection{Domains, Attributes, Tuples, and Relations}
\begin{description}
	\item[Domein] Een domein $D$ is een verzameling van onafscheidelijke (of \textbf{atomische}) waardes, bijvoorbeeld een \textit{``Naam''} bestaande uit letters. Deze waardes zijn volgens de database niet meer te scheiden. Bij een domein hoort altijd een \textit{logische definitie}.\\
	Elk domein heeft ook een \textbf{data type} of \textbf{formaat}. Een naam zal uit het datatype \textit{string} bestaan, dat zelf uit letters bestaat. Elke tupel zal zich aan dit domein moeten houden. De \textbf{kardinaliteit} $|D|$ van een domein is het aantal verschillende values dat het kan hebben.
	\item[Attributen] Een rol (eigenschap) gespeeld door een domein $D$. Het domein van een attribuut $A_i$ wordt genoteerd als $\text{dom}(A_i)$.\\
	Formeel: $t = \{(A_1, w_1), \dots, (A_n, w_n)\}$ met elke $w_i \in \text{dom}(A_i)$ of $w_i =$ \texttt{NULL}.
	\item[Relationeel schema] Een relationeel schema $R$ is een $n$-tupel over een lijst attributen. Een tupel of rij is een object of verband tussen de attributen. De \textit{graad} of \textbf{ariteit} van $R$ stelt het aantal attributen van $R$ voor.\\
	De relatie van een relationeel schema (\textbf{relational intension}) bestaat uit \textit{tupels} met elk dezelfde \textit{attributen} (\textbf{relational extension}).\\
	$r(R) \subseteq ( \text{dom}(A_1) \times \dots \times \text{dom}(A_n))$ is een \textbf{instantie} (\textit{instance}) van een relatie.
\end{description}

\subsection{Characteristics of Relations}
\begin{description}
	\item[Ordenen van tupels] Abstract gezien hebben tupels geen volgorde. Fysiek gezien moet er wel een volgorde bestaan (voor het opslaan op de harde schijf).
	\item[Ordenen van waardes in een tupel] De ordening van attributen (waardes) in een tupel heeft abstract gezien geen belang, toch wordt meestal een ordening meegegeven.\\
	Een tupel kan ook gezien worden als een set van ($<$attribuut$>$,$<$waarde$>$) paren waar elk paar de waarde geeft van een mapping van een attribuut $A_i$ tot een waarde $w_i$ van $\text{dom}(A_i)$.
	\item[Waardes van tupels] Elke waarde is steeds atomair en van de eerste normaalvorm (cfr. hoofdstuk 14). Multivalued attributen moeten voorgesteld worden met aparte relaties. Samengestelde attributen worden voorgesteld door hun afzonderlijke attributen.\\
	Een \texttt{NULL}-waarde heeft drie mogelijke betekenissen.
	\begin{enumerate}
		\item De waarde is onbekend.
		\item De waarde bestaat maar is niet beschikbaar.
		\item De waarde is niet van toepassing (is ongedefini\"eerd.)
	\end{enumerate}
	\item[Interpretatie van een relatie] Relaties kunnen gezien worden als predicaten. De waardes van elke tupel worden gezien als de waardes die aan de predicaat voldoen.\\
Een relatie kan ook gezien worden als een declaratie van een type of \textbf{assertie}. Iedere waarde in die tupel kan dan gezien worden als een feit.
\end{description}

\subsection{Relational Model Notation}
Een relationeel schema $R$ van graad $n$ wordt genoteerd als $R(A_1, A_2, \dots, A_n)$. Voorbeelden van relatienamen zijn $Q$, $R$ of $S$, instanties van relaties worden geschreven als $q$, $r$ of $s$. Tupels worden genoteerd als $t$, $u$ of $v$.

Een $n$-tupel $t$ in een relatie $r(R)$ wordt genoteerd als $t =\, <w_1, w_2, \dots, w_n>$.

Een attribuut $A$ van een relatie $R$ wordt soms genoteerd als $R.A$. De waarden van een attribuut $A_i$ worden genoteerd als $t.A_i$ of $t[A_i]$.

\section{Relational Model Constraints and Relational Database Schemas}
Er bestaan drie soorten constraints in een database.
\begin{itemize}
	\item \textbf{Implicit constraints:} de constraints die bij het data model horen.
	\item \textbf{Explicit constraints:} de constraints die rechtstreeks uitgedrukt worden in de schema's van het datamodel, gespecifieerd in de \textbf{data definition language} (DDL).
	\item \textbf{Application-based constraints:} de constraints die niet rechtstreeks in de schema's kunnen worden uitgedrukt. Ook wel \textbf{business constraints} genoemd.
\end{itemize}

\subsection{Domain Constraints}
De \textbf{domeinrestricties} beperken de mogelijke waarden van attributen: booleans, integers, doubles, strings. Het domein van een attribuut is altijd enkelvoudig.

Bijvoorbeeld: een attribuut \textit{``leeftijd''} is een geheel positief getal tussen 18 en 65.

\subsection{Key Constraints and Constraints on \texttt{NULL} values}
Een set van tupels moet uniek zijn, twee tupels mogen dus niet exact dezelfde waarden hebben. Het gebruik van een (unieke) \textbf{key} lost dit probleem op.

Als $U$ alle attributen van $R$ voorstelt, dus $U = \{A_1,\dots,A_n\}$, dan defini\"eren we de supersleutel $K \subseteq U$: de verzameling van attributen die een tupel in $R$ ondubbelzinnig maken (in elke extensie).

Een \textbf{kandidaatsleutel} $K$ is een supersleutel zonder de overtollige attributen. Deze is ook uniek, er bestaat geen supersleutel $K' \subset K$. Een sleutel kan samengesteld of enkelvoudig zijn.

Uit de kandidaatsleutels wordt de \textbf{primaire sleutel} gekozen, deze wordt onderlijnd in het schema. De andere kandidaatsleutels zijn de \textbf{alternatieve sleutels}, deze worden niet onderlijnd.

~

\noindent Er worden ook constraints vastgelegd die bepalen of een attribuut de waarde \texttt{NULL} mag bevatten.

\subsection{Relational Databases and Relational Database Schemas}
Een \textbf{relationeel databaseschema} $S$ is een set van relatieschema's $S = \{R_1, \dots, R_m\}$ en een set van \textbf{integrity constraints} \textit{IC}. Een \textbf{relationele databasetoestand} \textit{DB} van $S$ is een set van relatietoestanden \textit{DB}$\,= \{r_1, \dots, r_m\}$ waarbij elke $r_i$ de integriteitconstraints in \textit{IC} volgt.

De \textbf{statica-regels} slaan op 1 toestand van \textit{DB} en gelden in elke extensie. De \textbf{dynamica-regels} slaan op toestandsovergangen en gelden voor elke overgang tussen extensies.

\subsection{Integrity, Referential Integrity and Foreign Keys}
Volgens de \textbf{entitity integrity constraint} kan een primaire sleutel nooit \texttt{NULL} zijn. Deze constraint bepaalt ook dat een tupel niet meer dan 1 keer mag voorkomen in een extensie.

De \textbf{referential integrity constraint} bepaalt dat een verwijzing naar een andere tupel geldig moet zijn. Als een tupel naar een andere tupel verwijst, moet die andere ook tupel bestaan.

~

\noindent Een verzameling attributen \textit{FK} van $R_1$ is een \textbf{foreign key} (\textit{verwijssleutel}) dat refereert naar $R_2$ als en slechts als:
\begin{itemize}
	\item De attributen van \textit{FK} hebben dezelfde domeinen als de de primaire sleutelattributen \textit{PK} van relatie $R_2$.
	\item Elke waarde van \textit{FK} in $R_1$ komt voor als de waarde van een tupel in $R_2$ of is \texttt{NULL}.\\
	$\forall t_1 \in R_1 : t_1[\mathit{FK}] = \mathtt{NULL} \; \cup \; \exists t_2 \in R_2 :  t_1[\mathit{FK}] = t_2[\mathit{PK}]$
\end{itemize}

\noindent Een verwijssleutel kan naar een eigen relatie verwijzen, dit is dus een recursieve relatie.

\subsection{Other Types of Constraints}
\textbf{Semantic integrity constraints} zijn algemene constraints die niet opgelegd kunnen worden door de \textit{data definition language}, deze worden opgelegd door de applicaties zelf. Ook een \textbf{constraint specification language} kan hiervoor zorgen. Een voorbeeld van zo'n constraint is het maximum aantal werkuren dat een werknemer kan werken.

De \textbf{functional dependency constraint} cre\"eert een functionele relatie tussen 2 sets attributen $X$ en $Y$. Een waarde van $X$ bepaalt een unieke waarde van $Y$ in alle toestanden van een relatie: $X \rightarrow Y$. Zie hoofdstukken 14 en 15.

~

\noindent De constraints die tot nu vernoemd werden, zijn \textbf{state constraints} omdat ze bepalen of een database zich een een geldige toestand bevindt.

Een andere soort constraints zijn de \textbf{transition constraints} en bepalen welke overgangen tussen databasetoestanden geldig zijn.

~

\noindent Er zijn verscheidene dynamica-regels. De \textbf{autorisatieregels} bepalen welke acties een bepaalde gebruiker mag uitvoeren. Er bestaan ook \textbf{precondities} en \textbf{postcondities}.

De \textbf{overgangsregels} beschrijven welke volgordes van extensies zijn toegestaan. Bijvoorbeeld: enkel loonsverhogingen zijn toegestaan, geen verlagingen.

\textbf{Intrarelationele restricties} werken intern, dus binnen 1 relatie. Deze zijn meestal gemakkelijker te controleren. Hier tegenover staan de \textbf{interrelationele restricties} waarbij verschillende relaties betrokken zijn. Een voorbeeld van deze laatste soort: het salaris van een werknemer moet altijd kleiner zijn dan het loon van zijn overste.

~

\noindent Tegenwoordig laat men meer soorten restricties automatisch controleren door het DBMS.

\section[Update Operations, Transactions and Dealing with Constraint Violations]{Update Operations, Transactions and Dealing with\\Constraint Violations}

\subsection{The Insert Operation}
Bij het invoegen van nieuwe data moet gekeken worden dat alle bovenstaande constraints niet overschreden worden. Moest er een constraint overschreden worden, zal het DBMS \textbf{cascaden}. De toevoeging wordt dan geweigerd en de gebruiker krijgt een melding.

\subsection{The Delete Operation}
Deze operatie kan alleen de \textit{referential integrity} overschrijden (verwijzing naar een onbestaande of ongeldige tupel). Het DBMS kan verscheidene dingen doen bij een overschreden constraint:
\begin{itemize}
	\item De verwijdering weigeren.
	\item De verwijzende tupels ook weglaten.
	\item De verwijzende waarden aanpassen (bijvoorbeeld op \texttt{NULL} of default zetten).
	\item Verschillend reageren in verschillende situaties (ingesteld door de gebruiker).
\end{itemize}

\subsection{The Update Operation}
Voornamelijk een primaire sleutel aanpassen kan problemen opleveren, er is namelijk een gevaar voor de uniciteit van de sleutel. De beste oplossing is het verwijderen en direct terug toevoegen van de tupel.

Bij een wijziging van een verwijssleutel, moet ook de referenti\"ele integriteit gecontroleerd worden.

\subsection{The Transaction Concept}
Een database voert operaties meestal uit in de vorm van transactie zodat er altijd terug naar een \textit{valid state} gegaan kan worden moest de huidige operatie mislukken.


text:
This example illustrates how to deploy a container to a [managed instance group](https://cloud.google.com/compute/docs/instance-groups/#managed_instance_groups) in GCP. Also includes SSH key configuration, so a user can be provisioned on the fly for future logins.

## Requirements

This example requires that some python libraries be installed, as outlined in `requirements.txt`. Depending on your environment, you should be able to run `pip install -r requirements.txt` to satisfy these requirements.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_metadata | Additional metadata to attach to the instance | `map(any)` | `{}` | no |
| image | The Docker image to deploy to GCE instances | `string` | `"gcr.io/google-samples/hello-app:1.0"` | no |
| image\_port | The port the image exposes for HTTP requests | `number` | `8080` | no |
| mig\_instance\_count | The number of instances to place in the managed instance group | `string` | `"2"` | no |
| mig\_name | The desired name to assign to the deployed managed instance group | `string` | `"mig-test"` | no |
| network | The GCP network | `string` | `"mig-net"` | no |
| project\_id | The project ID to deploy resource into | `string` | n/a | yes |
| region | The GCP region to deploy instances into | `string` | n/a | yes |
| service\_account | n/a |
object({
    email  = string,
    scopes = list(string)
  })
 |
{
  "email": "",
  "scopes": [
    "cloud-platform"
  ]
}
 | no |
| subnetwork | The name of the subnetwork to deploy instances into | `string` | `"mig-subnet"` | no |
| zone | The GCP zone to deploy instances into | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| container | The container metadata provided to the module |
| http\_address | The IP address on which the HTTP service is exposed |
| http\_port | The port on which the HTTP service is exposed |
| vm\_container\_label | The instance label containing container configuration |
| volumes | The volume metadata provided to the module |

## Running

To provision this example, run the following from within this directory:

- `terraform init` to get plugins
- `terraform plan` to dry-run the infrastructure changes
- `terraform apply` to apply the infrastructure changes
- `terraform destroy` to tear down the created infrastructure


text:
package com.alachisoft.tayzgrid.common.threading;

import com.alachisoft.tayzgrid.common.logger.ILogger;
import com.alachisoft.tayzgrid.runtime.exceptions.CacheException;
import com.alachisoft.tayzgrid.runtime.exceptions.LockingException;
import com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException;

/**
 * A class that helps doing things that can be done asynchronously
 */
public class AsyncProcessor implements Runnable
{

    /**
     * Interface to be implemented by all async events.
     */
    public interface IAsyncTask
    {

        /**
         * Process itself.
         * @throws Alachisoft.NCache.Cluster.ChannelClosedException
         */
        void Process() throws OperationFailedException, java.io.IOException,CacheException,LockingException;
    }
    /**
     * The worker thread.
     */
    /**
     * The queue of events.
     */
    private java.util.LinkedList _eventsHi, _eventsLow;
    private ILogger NCacheLog;

    private boolean _started;
    private int _numProcessingThreads = 1;
    private Thread[] _workerThreads;

    Boolean _isShutdown = false;
    Object _shutdownMutex = new Object();

    /**
     * Constructor
     * @param NCacheLog Logger
     */
    public AsyncProcessor(ILogger NCacheLog)
    {
        this();
        this.NCacheLog = NCacheLog;
    }

    public AsyncProcessor()
    {
        this(1);
    }

    public AsyncProcessor(int numProcessingThread)
    {
        if(numProcessingThread < 1)
            numProcessingThread = 1;

        _workerThreads = null;
        _numProcessingThreads = numProcessingThread;
        _eventsHi = new java.util.LinkedList();
        _eventsLow = new java.util.LinkedList();
    }

    public final void WindUpTask()
    {
            NCacheLog.CriticalInfo("AsyncProcessor", "WindUp Task Started.");

            if (_eventsHi != null)
            {
                    NCacheLog.CriticalInfo("AsyncProcessor", "Async operation(s) Queue Count: " + _eventsHi.size());
            }

            _isShutdown = true;
            synchronized (this)
            {
                    com.alachisoft.tayzgrid.common.threading.Monitor.pulse(this);
            }
            NCacheLog.CriticalInfo("AsyncProcessor", "WindUp Task Ended.");
    }

    public final void WaitForShutDown(long interval)
    {
            NCacheLog.CriticalInfo("AsyncProcessor", "Waiting for  async process queue shutdown task completion.");
            if (interval > 0)
            {
                    boolean waitlock = false;
                    synchronized (_shutdownMutex)
                    {
                            if (_eventsHi.size() > 0)
                            {
                                try
                                {
                                    waitlock = com.alachisoft.tayzgrid.common.threading.Monitor.wait(_shutdownMutex, (int)((interval-1) * 1000));
                                }
                                catch(Exception ex)
                                {
                                     NCacheLog.Error("AsyncProcessor", "Asyncronous operations has intruppted. " + ex.getMessage());
                                }
                            }
                    }

                    if (!waitlock)
                    {
                            if (_eventsHi.size() > 0)
                            {
                                    NCacheLog.CriticalInfo("AsyncProcessor", "Remaining Async operations in queue: " + _eventsHi.size());
                            }
                    }
            }

       NCacheLog.CriticalInfo("AsyncProcessor", "Shutdown task completed.");
    }

    /**
     * Add a low priority event to the event queue
     *
     * @param evnt event
     */
    public final void Enqueue(IAsyncTask evnt)
    {
        synchronized (this)
        {
            _eventsHi.offer(evnt);
            //: Monitor.Pulse(this) changed to this.notify()
            //Monitor.Pulse(this);
            com.alachisoft.tayzgrid.common.threading.Monitor.pulse(this);// this.notifyAll();
        }
    }

    /**
     * Add a low priority event to the event queue
     *
     * @param evnt event
     */
    public final void EnqueueLowPriority(IAsyncTask evnt)
    {
        synchronized (this)
        {
            _eventsLow.offer(evnt);
            com.alachisoft.tayzgrid.common.threading.Monitor.pulse(this);//this.notify();
        }
    }

    /**
     * Start processing
     */
    public final void Start() {
        try {
            synchronized (this) {
                if (!_started) {
                    _workerThreads = new Thread[_numProcessingThreads];
                    _started = true;

                    for (int i=0; i< _workerThreads.length; i++) {
                        Thread tThread = new Thread(this);
                        tThread.setDaemon(true);
                        tThread.setName("AsyncProcessor");
                        tThread.start();
                        _workerThreads[i] = tThread;
                    }

                }
            }
        } catch (Exception ex) {
            if (NCacheLog != null) {
                NCacheLog.Error("AsyncProcessor.Start)_", ex.getMessage());
            }
        }
    }

    /**
     * Stop processing.
     */
    public final void Stop()
    {
        synchronized (this)
        {
            for(Thread tThread : _workerThreads)
            {
                if(tThread != null && tThread.isAlive())
                {
                    if (NCacheLog != null)
                    {
                        NCacheLog.Flush();
                    }
                    tThread.interrupt();
                    tThread = null;
                }
            }
        }
    }

    /**
     * Thread function, keeps running.
     */
    @Override
    public void run()
    {
        while (_workerThreads != null && !Thread.currentThread().isInterrupted())
        {
            IAsyncTask evnt = null;
            try
            {
                synchronized (this)
                {
                    if ((_eventsHi.size() < 1) && (_eventsLow.size() < 1) && !_isShutdown)
                    {

                            com.alachisoft.tayzgrid.common.threading.Monitor.wait(this);//this.wait();

                    }

                    if ((_eventsHi.size() < 1) && _isShutdown)
                    {
                            synchronized (_shutdownMutex)
                            {
                               com.alachisoft.tayzgrid.common.threading.Monitor.pulse(_shutdownMutex);
                               break;
                            }
                    }

                    if (_eventsHi.size() > 0)
                    {
                        evnt = (IAsyncTask) _eventsHi.poll();
                    }
                    else if (_eventsLow.size() > 0)
                    {
                        evnt = (IAsyncTask) _eventsLow.poll();
                    }
                }

                if (evnt == null && _eventsHi.size() < 1 && _isShutdown)
                {
                        synchronized (_shutdownMutex)
                        {
                                 com.alachisoft.tayzgrid.common.threading.Monitor.pulse(_shutdownMutex);
                                break;
                        }
                }

                if (evnt == null)
                {
                    continue;
                }
                evnt.Process();
            }
            catch (NullPointerException e)
            {
            }
            catch(InterruptedException e){
                break;
            }
            catch (Exception e)
            {
                String exceptionString = e.toString();
                if (!exceptionString.equals("ChannelNotConnectedException") && !exceptionString.equals("ChannelClosedException"))
                {
                    if (NCacheLog != null)
                    {
                        NCacheLog.Error("AsyncProcessor.Run()", exceptionString);

                    }
                }
            }
        }
    }
}


text:
require_relative "shared/enumerable_shared"

describe "Enumerable#any?" do
    include_context "Enumerable shared"

    it "returns true if the block is true for at least one item" do
      expect(digits.any? {|n| n.even?}).to be_true
    end

end


text:
/* global angular */
(function () {
    'use strict';

    angular.module('sky.filter.button.component', ['sky.resources'])
        .component('bbFilterButton', {
            templateUrl: 'sky/templates/filter/filter.button.component.html',
            bindings: {
                bbFilterButtonOnClick: '&',
                bbFilterButtonActive: '<?'
            }
        });
})();


text:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/types.h>

#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/setup.h>

#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
#include <asm/mach/map.h>

static void at91_aic_mask_irq(unsigned int irq)
{
	/* Disable interrupt on AIC */
	at91_sys_write(AT91_AIC_IDCR, 1 << irq);
}

static void at91_aic_unmask_irq(unsigned int irq)
{
	/* Enable interrupt on AIC */
	at91_sys_write(AT91_AIC_IECR, 1 << irq);
}

unsigned int at91_extern_irq;

#define is_extern_irq(irq) ((1 << (irq)) & at91_extern_irq)

static int at91_aic_set_type(unsigned irq, unsigned type)
{
	unsigned int smr, srctype;

	switch (type) {
	case IRQT_HIGH:
		srctype = AT91_AIC_SRCTYPE_HIGH;
		break;
	case IRQT_RISING:
		srctype = AT91_AIC_SRCTYPE_RISING;
		break;
	case IRQT_LOW:
		if ((irq == AT91_ID_FIQ) || is_extern_irq(irq))		/* only supported on external interrupts */
			srctype = AT91_AIC_SRCTYPE_LOW;
		else
			return -EINVAL;
		break;
	case IRQT_FALLING:
		if ((irq == AT91_ID_FIQ) || is_extern_irq(irq))		/* only supported on external interrupts */
			srctype = AT91_AIC_SRCTYPE_FALLING;
		else
			return -EINVAL;
		break;
	default:
		return -EINVAL;
	}

	smr = at91_sys_read(AT91_AIC_SMR(irq)) & ~AT91_AIC_SRCTYPE;
	at91_sys_write(AT91_AIC_SMR(irq), smr | srctype);
	return 0;
}

#ifdef CONFIG_PM

static u32 wakeups;
static u32 backups;

static int at91_aic_set_wake(unsigned irq, unsigned value)
{
	if (unlikely(irq >= 32))
		return -EINVAL;

	if (value)
		wakeups |= (1 << irq);
	else
		wakeups &= ~(1 << irq);

	return 0;
}

void at91_irq_suspend(void)
{
	backups = at91_sys_read(AT91_AIC_IMR);
	at91_sys_write(AT91_AIC_IDCR, backups);
	at91_sys_write(AT91_AIC_IECR, wakeups);
}

void at91_irq_resume(void)
{
	at91_sys_write(AT91_AIC_IDCR, wakeups);
	at91_sys_write(AT91_AIC_IECR, backups);
}

#else
#define at91_aic_set_wake	NULL
#endif

static struct irq_chip at91_aic_chip = {
	.name		= "AIC",
	.ack		= at91_aic_mask_irq,
	.mask		= at91_aic_mask_irq,
	.unmask		= at91_aic_unmask_irq,
	.set_type	= at91_aic_set_type,
	.set_wake	= at91_aic_set_wake,
};

/*
 * Initialize the AIC interrupt controller.
 */
void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS])
{
	unsigned int i;

	/*
	 * The IVR is used by macro get_irqnr_and_base to read and verify.
	 * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred.
	 */
	for (i = 0; i < NR_AIC_IRQS; i++) {
		/* Put irq number in Source Vector Register: */
		at91_sys_write(AT91_AIC_SVR(i), i);
		/* Active Low interrupt, with the specified priority */
		at91_sys_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);

		set_irq_chip(i, &at91_aic_chip);
		set_irq_handler(i, handle_level_irq);
		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);

		/* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */
		if (i < 8)
			at91_sys_write(AT91_AIC_EOICR, 0);
	}

	/*
	 * Spurious Interrupt ID in Spurious Vector Register is NR_AIC_IRQS
	 * When there is no current interrupt, the IRQ Vector Register reads the value stored in AIC_SPU
	 */
	at91_sys_write(AT91_AIC_SPU, NR_AIC_IRQS);

	/* No debugging in AIC: Debug (Protect) Control Register */
	at91_sys_write(AT91_AIC_DCR, 0);

	/* Disable and clear all interrupts initially */
	at91_sys_write(AT91_AIC_IDCR, 0xFFFFFFFF);
	at91_sys_write(AT91_AIC_ICCR, 0xFFFFFFFF);
}


text:
<?

class Snazzware_View_Helper_Widget_Paginated_Pagination extends Zend_View_Helper_Abstract {

	public function Widget_Paginated_Pagination($view, $widget, $position = 'top') {
		$xhtml = '';

		$options = $widget->getOptions();

		$controlsHelper = $widget->getPaginationControlsHelper();

		$controls['center'] = $view->$controlsHelper($view, $widget, $position);
		$controls['right'] = $view->$controlsHelper($view, $widget, $position, 'right');

		$zfext = __ZFEXT_PREFIX;

		$xhtml .= "

getId()}_pagination' class='{$zfext}-widget-paginated-pagination {$zfext}-widget-paginated-pagination-{$position} {$zfext}-widget-paginated-pagination-{$widget->getName()}'>

						{$options['caption']}
						Page {$options['page']} of {$options['pages']}

						{$controls['center']}

						{$controls['right']}

						Showing {$options['itemstart']} thru {$options['itemend']} of {$options['itemcount']} total

		";

		if ($widget->getOption('stickyControls',false)==true) {
			$xhtml .= "

			";
		}

		return $xhtml;
	}

}


text:
int printf(const char *restrict, ...);

@interface NSString
@end

void test_os_log_format(const char *pc, int i, void *p, void *buf) {
  __builtin_os_log_format(buf, "");
  __builtin_os_log_format(buf, "%d"); // expected-warning {{more '%' conversions than data arguments}}
  __builtin_os_log_format(buf, "%d", i);
  __builtin_os_log_format(buf, "%P", p); // expected-warning {{using '%P' format specifier without precision}}
  __builtin_os_log_format(buf, "%.10P", p);
  __builtin_os_log_format(buf, "%.*P", p); // expected-warning {{field precision should have type 'int', but argument has type 'void *'}}
  __builtin_os_log_format(buf, "%.*P", i, p);
  __builtin_os_log_format(buf, "%.*P", i, i); // expected-warning {{format specifies type 'void *' but the argument has type 'int'}}
  __builtin_os_log_format(buf, "%n");         // expected-error {{os_log() '%n' format specifier is not allowed}}
  __builtin_os_log_format(buf, pc);           // expected-error {{os_log() format argument is not a string constant}}

  printf("%{private}s", pc); // expected-warning {{using 'private' format specifier annotation outside of os_log()/os_trace()}}
  __builtin_os_log_format(buf, "%{private}s", pc);

  // <rdar://problem/23835805>
  __builtin_os_log_format_buffer_size("no-args");
  __builtin_os_log_format(buf, "%s", "hi");

  // <rdar://problem/24828090>
  wchar_t wc = 'a';
  __builtin_os_log_format(buf, "%C", wc);
  printf("%C", wc);
  wchar_t wcs[] = {'a', 0};
  __builtin_os_log_format(buf, "%S", wcs);
  printf("%S", wcs);

  struct { char data[0x100]; } toobig;
  __builtin_os_log_format(buf, "%s", toobig); // expected-error {{os_log() argument 2 is too big (256 bytes, max 255)}}

  __builtin_os_log_format(buf, "%{mask.xyz}s", "abc");
  __builtin_os_log_format(buf, "%{mask.}s", "abc"); // expected-error {{mask type size must be between 1-byte and 8-bytes}}
  __builtin_os_log_format(buf, "%{mask.abcdefghi}s", "abc"); // expected-error {{mask type size must be between 1-byte and 8-bytes}}
}

// Test os_log_format primitive with ObjC string literal format argument.
void test_objc(const char *pc, int i, void *p, void *buf, NSString *nss) {
  __builtin_os_log_format(buf, @"");
  __builtin_os_log_format(buf, @"%d"); // expected-warning {{more '%' conversions than data arguments}}
  __builtin_os_log_format(buf, @"%d", i);
  __builtin_os_log_format(buf, @"%P", p); // expected-warning {{using '%P' format specifier without precision}}
  __builtin_os_log_format(buf, @"%.10P", p);
  __builtin_os_log_format(buf, @"%.*P", p); // expected-warning {{field precision should have type 'int', but argument has type 'void *'}}
  __builtin_os_log_format(buf, @"%.*P", i, p);
  __builtin_os_log_format(buf, @"%.*P", i, i); // expected-warning {{format specifies type 'void *' but the argument has type 'int'}}

  __builtin_os_log_format(buf, @"%{private}s", pc);
  __builtin_os_log_format(buf, @"%@", nss);
}

// Test the os_log format attribute.
void MyOSLog(const char *format, ...) __attribute__((format(os_log, 1, 2)));
void test_attribute(void *p) {
  MyOSLog("%s\n", "Hello");
  MyOSLog("%d");    // expected-warning {{more '%' conversions than data arguments}}
  MyOSLog("%P", p); // expected-warning {{using '%P' format specifier without precision}}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the size of the IV of the opened algorithm</title>

mcrypt_enc_get_block_size

mcrypt_enc_get_key_size

Mcrypt Functions

PHP Manual

mcrypt_enc_get_iv_size

(PHP 4 >= 4.0.2, PHP 5)

mcrypt_enc_get_iv_size — Returns the size of the IV of the opened algorithm

Description

   int mcrypt_enc_get_iv_size
    ( resource $td
   )

   This function returns the size of the IV of the algorithm specified by the
   encryption descriptor in bytes. An IV is used in cbc, cfb and ofb modes,
   and in some algorithms in stream mode.

Parameters

td

       The encryption descriptor.

Return Values

   Returns the size of the IV, or 0 if the IV is ignored by the algorithm.

mcrypt_enc_get_block_size

mcrypt_enc_get_key_size

Mcrypt Functions

PHP Manual


text:
require 'spec_helper'

require 'hasta/identity_mapper'
require 'hasta/execution_context'
require 'hasta/in_memory_data_sink'
require 'hasta/in_memory_data_source'

describe Hasta::IdentityMapper do
  describe '#map' do
    subject { described_class }

    let(:sink) { Hasta::InMemoryDataSink.new }
    let(:lines) { [["First\n"], ["Second\n", "Third\n"]] }
    let(:exp_lines) { lines.flatten.map(&:rstrip).map { |line| "#{line}\t" } }
    let(:sources) { lines.map { |source_lines| Hasta::InMemoryDataSource.new(source_lines) } }
    let(:context) { double(Hasta::ExecutionContext) }

    it { expect(subject.map(context, sources, sink).data_source.to_a).to eq(exp_lines) }
  end
end


text:
<template name="message">

{{ sentBy }}: {{ message }}

</template>


text:
{% extends 'templates/nhs_transaction_layout.html' %}

{% block pageTitle %}NHS.UK prototyping kit{% endblock %}

{% block content %}

Prescribed

             Surname

             {{patientName}}

             Date of birth

             {{patientDob}}

             NHS Patient Number

             {{patientNhsNum}}

             Item information

{{selectedProductName}}

{{selectedStrength}}

{{selectedPresentation}}

{{selectedQty}}

             Prescription Number

             2133212

Dispensed item

			{% if packSizeError=='true' || supplierError=='true' %}

				There are errors top of page

			{% endif %}

Complete the missing information

             <form id="form" action="../submit/{{selectedItemId}}" method="get" class="form">

              <fieldset>

<legend  class="form-label">Presentation</legend>

              {{selectedPresentation}}

<legend  class="form-label" >Supplier/manufacturer</legend>

		  {% if supplierError=='true' %}
				supplier field error message
			{% endif %}
            <input name="supplierInput" type="text" id="first-label" class="form-control {% if supplierError=='true' %} field-error {% endif %}">

<legend  class="form-label">Quantity</legend>

              {{selectedQty}}

<legend  class="form-label" >Pack size</legend>

			{% if packSizeError=='true' %}
				pack size field error message
			{% endif %}

            <input name="packSizeInput" type="text" id="first-label" class="form-control {% if packSizeError=='true' %} field-error {% endif %}">

<legend  class="form-label">Pack price</legend>

              £1.99

        </fieldset>

		 <input type="hidden" name="after" value="{{after}}">

SubmitSkip

  </form>

{% endblock %}


text:
"use strict"

var Converter = module.exports = (function() {

    var keyMap = {
	createdAt: 'parseCreateAt'
	, updatedAt: 'parseUpdateAt'
	, objectId: 'parseObjectId'
    };

    function Converter(ncmb, type, name) {
	this.__proto__.ncmb = ncmb;
	this._type = type;
	this._name = name;
    }

    Converter.prototype.convert = function(obj) {
	switch (this._type) {
	case 'installation':
	    return this.convInstallation(obj);
	    break;
	case 'user':
	    return this.convUser(obj);
	    break;
	case 'role':
	case 'product':
	case 'join':
	    return this.convDummy(obj);
	    break;
	default:
	    return this.convObject(obj);
	    break;
	}
    };

    Converter.prototype.objCopy = function(obj, map) {
	let attrs = {};
	Object.keys(obj).forEach(function(key) {
	    if (map[key] == undefined) {
		attrs[key] = obj[key];
	    } else {
		attrs[map[key]] = obj[key];
	    }
	});
	return attrs;
    };

    Converter.prototype.convInstallation = function(obj) {
	let map = keyMap;
	// add key depends on installations
	map['appName'] = 'applicationName';
	let attrs = this.objCopy(obj, map);

	let NCMBInstallationEx = require('./installation_ex');
	let installation = new NCMBInstallationEx(this.ncmb);

	return new Promise(function(resolve, reject) {
	    installation
		.register(attrs)
		.then(function() {
		    resolve();
		})
		.catch(function(err) {
		    reject(err);
		});
	});
    }

    Converter.prototype.convUser = function(obj) {
	let map = keyMap;
	// add keys depends on user
	map['username'] = 'userName';
	map['email'] = 'mailAddress';
	map['emailVerified'] = 'parseEmailVerified';
	map['sessionToken'] = 'parseSessionToken';
	let attrs = this.objCopy(obj, map);

	// override password as dummy
	attrs['password'] = 'ncmb_dummy_password';

	let user = new this.ncmb.User(attrs);

	return new Promise(function(resolve, reject) {
	    user.save()
	    .then(function() {
		resolve();
	    })
	    .catch(function(err) {
		reject(err);
	    });
	});
    }

    Converter.prototype.convObject = function(obj) {
	let attrs = this.objCopy(obj, keyMap);

	let klass = this.ncmb.DataStore(this._name);
	let object = new klass(attrs);
	return new Promise(function(resolve, reject) {
	    object.save()
	    .then(function() {
		resolve();
	    })
	    .catch(function(err) {
		reject(err);
	    });
	});
    }

    Converter.prototype.convDummy = function(obj) {
	return new Promise(function(resolve, reject) {
	    resolve();
	});
    }

    return Converter;
})();


text:
namespace NegroniGame.Handlers
{
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using System;
    using System.Linq;
    using System.Collections.Generic;

    public sealed class GameOverHandler
    {
        // Singleton !
        private static GameOverHandler instance;

        private readonly static Texture2D gameOverTexture = GameScreen.Instance.GameOverTex;

        private GameOverHandler()
        { }

        public static GameOverHandler Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new GameOverHandler();
                }
                return instance;
            }
        }

        public void Update(GameTime gameTime)
        {
            if (Player.Instance.HpPointsCurrent <= 0)
            {
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary<string, Color>() { { String.Format(">> No more Negroni!"), Color.Red } });
                Toolbar.SystemMsg.Instance.AllMessages.Add(new Dictionary<string, Color>() { { String.Format(">> The Bar closed!"), Color.Red } });
                GameScreen.Instance.GameState = 3;
            }
        }

        public void Draw()
        {
            if (GameScreen.Instance.GameState == 3)
            {
                new SystemFunctions.Sprite(gameOverTexture, new Vector2((GameScreen.ScreenWidth - gameOverTexture.Width) / 2, (GameScreen.ScreenHeight - gameOverTexture.Height) / 2 - 50), Color.Red).Draw();
            }
        }
    }
}


text:
package org.apache.commons.imaging.formats.pnm;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.imaging.ImageFormat;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.common.ImageBuilder;

abstract class FileInfo {
    final int width;
    final int height;
    final boolean rawBits;

    FileInfo(final int width, final int height, final boolean rawBits) {
        this.width = width;
        this.height = height;
        this.rawBits = rawBits;
    }

    abstract boolean hasAlpha();

    abstract int getNumComponents();

    abstract int getBitDepth();

    abstract ImageFormat getImageType();

    abstract String getImageTypeDescription();

    abstract String getMIMEType();

    abstract ImageInfo.ColorType getColorType();

    abstract int getRGB(WhiteSpaceReader wsr) throws IOException;

    abstract int getRGB(InputStream is) throws IOException;

    void newline() {
        // do nothing by default.
    }

    static int readSample(final InputStream is, final int bytesPerSample) throws IOException {
        int sample = 0;
        for (int i = 0; i < bytesPerSample; i++) {
            final int nextByte = is.read();
            if (nextByte < 0) {
                throw new IOException("PNM: Unexpected EOF");
            }
            sample <<= 8;
            sample |= nextByte;
        }
        return sample;
    }

    static int scaleSample(int sample, final float scale, final int max) throws IOException {
        if (sample < 0) {
            // Even netpbm tools break for files like this
            throw new IOException("Negative pixel values are invalid in PNM files");
        }
        if (sample > max) {
            // invalid values -> black
            sample = 0;
        }
        return (int) ((sample * scale / max) + 0.5f);
    }

    void readImage(final ImageBuilder imageBuilder, final InputStream is)
            throws IOException {
        // is = new BufferedInputStream(is);
        // int count = 0;
        //
        // try
        // {

        if (!rawBits) {
            final WhiteSpaceReader wsr = new WhiteSpaceReader(is);

            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    final int rgb = getRGB(wsr);

                    imageBuilder.setRGB(x, y, rgb);
                    // count++;
                }
                newline();
            }
        } else {
            for (int y = 0; y < height; y++) {
                // System.out.println("y: " + y);
                for (int x = 0; x < width; x++) {
                    final int rgb = getRGB(is);
                    imageBuilder.setRGB(x, y, rgb);
                    // count++;
                }
                newline();
            }
        }
        // }
        // finally
        // {
        // System.out.println("count: " + count);
        // dump();
        // }
    }
}


text:
class AddUniquenessConstraintToCategories < ActiveRecord::Migration[5.0]
  def change
    add_index :categories, :name, unique: true
  end
end


text:
@implementation UIColor (HexColor)

+ (UIColor *)colorWithHexString:(NSString *)hexString {
    NSMutableString *mHexColor = [NSMutableString stringWithString:hexString];
    if ([hexString hasPrefix:@"#"]) {
        [mHexColor replaceCharactersInRange:[hexString rangeOfString:@"#" ] withString:@"0x"];
    }
    long colorLong = strtoul([mHexColor cStringUsingEncoding:NSUTF8StringEncoding], 0, 16);
    // 通过位与方法获取三色值
    int R = (colorLong & 0xFF0000) >> 16;
    int G = (colorLong & 0x00FF00) >> 8;
    int B = colorLong & 0x0000FF;

    return [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0];
}

+ (UIColor *)colorAlphaWithHexString:(NSString *)hexString {
    NSString *realHexString = [hexString hasPrefix:@"#"] ? [hexString substringFromIndex:1] : hexString;
    unsigned long colorLong = strtoul([realHexString cStringUsingEncoding:NSUTF8StringEncoding], 0, 16);

    // 通过位与方法获取三色值
    unsigned int B = colorLong & 0xff;
    unsigned int G = (colorLong = colorLong >> 8) & 0xff;
    unsigned int R = (colorLong = colorLong >> 8) & 0xff;
    unsigned int A = (colorLong = colorLong >> 8) & 0xff;

    return [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A/255.0];
}

@end


text:
from collections import OrderedDict
import re

#------------------------
# shared variables:
#------------------------

words = OrderedDict()

outputFilename = 'output.txt'

filename1 = 'data.txt'

allophones = {
    'aeiou' : 'a',
    'bp' : 'b',
    'cjsz' : 'z',
    'dt' : 'd',
    'fv' : 'v',
    'gkq' : 'g',
    'hx' : 'h',
    'lr' : 'l',
    'mn' : 'm',
    'w' : 'w',
    'y' : 'y'
    }

#------------------------
# functions:
#------------------------

def respellWithInitialVowelAndConsonants(word):
    for char in word[1:]:
        if char in 'aeiou':
            word = word[0] + word[1:].replace(char,'')
    return word

def respellWithAllophones(word):
    for char in word:
        for allo in allophones:
            if char in allo:
                word = word.replace(char,allophones[allo])
    return word

def combineOverlappingWords(shortList):
    for language in shortList:
        for otherlanguage in shortList:
            if language != otherlanguage and language != 'Eng' and otherlanguage != 'Eng':
                a = shortList[language]
                b = shortList[otherlanguage]
                for i in range(1, len(b)):
                    if a.endswith(b[:i]):
                        shortList[otherlanguage] = ''
                        shortList[language] = a+b[i:]
    return shortList

def createWord():

    # function variables:

    wordsMinusNoninitialVowels = words
    shortList = []
    newWord = ''

    # the words spelt with just the initial vowel and consonants:

    for language in words:
        if language != 'Eng':
            words[language] = respellWithInitialVowelAndConsonants(words[language])

    wordsMinusNoninitialVowels = words.copy() # must explicitly make copy of dictionary in Python (instead of a reference)

    # the words with allophonic spelling:

    for language in words:
        if language != 'Eng':
            words[language] = respellWithAllophones(words[language])

    # ignore repeats:

    shortList = words

    for language in shortList:
        for otherlanguage in shortList:
            if language != otherlanguage and language != 'Eng' and otherlanguage != 'Eng':
                if shortList[language] == shortList[otherlanguage]:
                    shortList[otherlanguage] = ''

    # ignore words embedded in other words:

    for language in shortList:
        for otherlanguage in shortList:
            if language != otherlanguage and language != 'Eng' and otherlanguage != 'Eng':
                if shortList[language] in shortList[otherlanguage]:
                    shortList[language] = ''

    # find overlaps in words:

    for tries in range(5):
        shortList = combineOverlappingWords(shortList)

    # append remaining words:

    for language in shortList:
        if language != 'Eng':
            newWord += shortList[language]

    # put original consonants back in, using 1st letters of higher-priority words:

    for language in reversed(words.keys()):
        if language != 'Eng':
            patternCompressedAllo = respellWithAllophones(wordsMinusNoninitialVowels[language])
            if wordsMinusNoninitialVowels[language] not in newWord:
                if patternCompressedAllo in respellWithAllophones(newWord): # replace with compressed word in allophone form
                    index = respellWithAllophones(newWord).find(patternCompressedAllo)
                    newWord = newWord[:index] + wordsMinusNoninitialVowels[language] + newWord[index+len(patternCompressedAllo):]
                else:
                    pattern = respellWithAllophones(wordsMinusNoninitialVowels[language])
                    newWord = newWord.replace(pattern, wordsMinusNoninitialVowels[language])

    # put original vowels (& consonants) back in, favouring higher-priority words:

    for language in reversed(words.keys()):
        if language != 'Eng':
            if originalWords[language] not in newWord:
                replacer = originalWords[language]
                # types of patterns:  (priorities: original word in allophonic form > compressed word in allophonic form > compressed original word, to enable vowel overwrites)
                patternOrigAllo = respellWithAllophones(originalWords[language])
                patternCompressedAllo = respellWithAllophones(wordsMinusNoninitialVowels[language])
                patternOrigCompressed = wordsMinusNoninitialVowels[language]
                tempWord = newWord
                # check if allophones exist that can be replaced, before checking for replacing compressed original word:
                if patternOrigAllo in respellWithAllophones(newWord):
                    index = respellWithAllophones(newWord).find(patternOrigAllo)
                    newWord = newWord[:index] + replacer + newWord[index+len(patternOrigAllo):]
                elif patternCompressedAllo in respellWithAllophones(newWord):
                    index = respellWithAllophones(newWord).find(patternCompressedAllo)
                    newWord = newWord[:index] + replacer + newWord[index+len(patternCompressedAllo):]
                else:
                    newWord = newWord.replace(patternOrigCompressed, replacer,1)
    # print ()
    # print (newWord)
    return newWord

def simpNonChiWordMaker(word):
    indexVowel = -1
    # find (next) vowel:
    for letter in word:
        if letter in 'aeiou':
            indexVowel = word.find(letter)
            break
    # if still have next letter after get first vowel, then get first one (consonant) after it:
    if indexVowel < len(word)-1:
        indexVowelConsonant = indexVowel + 1
        word = word[:1+indexVowelConsonant]
    return word

#def simpChiWordMaker(word):
#    word = simpNonChiWordMaker(word)
#    #print word,'before'
#    patterns = [r'[dt](\_[cjsz]){1}',r'(\_[^aeiou])+[wy]']
#    replacers = ['','']
#    if word[0] in 'aeiou':
#        word = word[1:]
#    for i, pattern in enumerate(patterns):
#        word = re.sub(pattern,replacers[i],word,1)
#        #print word,'after',pattern
#    return word
#
#
#def removeHForHin(word,lang):
#    if lang == 'Hin':
#        word = re.sub(r'(\_[^aeiou])+h','',word)
#    return word

def createWord_DummyTest():
    return 'abcd'

def createWord_Alternate():

    # function variables:

    words = originalWords.copy()
    shortList = []
    newWord = ''
    indexVowel = -1
    indexVowelConsonant = -1

    # use only 1 (simplified) syllable of each word (only one ending consonant if any), with no intial vowel
    # CCCVC if not Chi. / CVC if Chi.
    for lang in words:
        if lang != 'Eng':
            word = words[lang]
            if word != '' and (word[0] in 'aeiou'): # no initial vowel
                words[lang] = word[1:]
            #if lang != 'Chi': # get first, simplified syllable
            words[lang] = simpNonChiWordMaker(words[lang])
            #elif lang == 'Chi':
            #words[lang] = simpChiWordMaker(words[lang])
            # print (word)
            #removeHForHin(word,lang)

    wordsInitSyllables = words.copy()

    # the words with allophonic spelling:

    for language in words:
        if language != 'Eng':
            words[language] = respellWithAllophones(words[language])

    # ignore repeats:

    shortList = words

    for language in shortList:
        for otherlanguage in shortList:
            if language != otherlanguage and language != 'Eng' and otherlanguage != 'Eng':
                if shortList[language] == shortList[otherlanguage]:
                    shortList[otherlanguage] = ''

    # ignore words embedded in other words:

    for language in shortList:
        for otherlanguage in shortList:
            if language != otherlanguage and language != 'Eng' and otherlanguage != 'Eng':
                if shortList[language] in shortList[otherlanguage]:
                    shortList[language] = ''

    # find overlaps in words:

    for tries in range(5):
        shortList = combineOverlappingWords(shortList)

    # append remaining words:

    for language in shortList:
        if language != 'Eng':
            newWord += shortList[language]

    # put original consonants back in, using 1st letters of higher-priority words:

    for language in reversed(words.keys()):
        if language != 'Eng':
            patternCompressedAllo = respellWithAllophones(wordsInitSyllables[language])
            if wordsInitSyllables[language] not in newWord:
                if patternCompressedAllo in respellWithAllophones(newWord): # replace with compressed word in allophone form
                    index = respellWithAllophones(newWord).find(patternCompressedAllo)
                    if index == 0 and (originalWords[language][0] in 'aeiou'):
                        print ("head vowel used!!! : " + originalWords['Eng'])
                        newWord = originalWords[language][0] + wordsInitSyllables[language] + newWord[index+len(patternCompressedAllo):]
                    else:
                        newWord = newWord[:index] + wordsInitSyllables[language] + newWord[index+len(patternCompressedAllo):]
                else:
                    pattern = respellWithAllophones(wordsInitSyllables[language])
                    newWord = newWord.replace(pattern, wordsInitSyllables[language])

    # print (newWord)
    return newWord

#------------------------
# main part of the program:
#------------------------

# get lines of file into a list:
with open(filename1,'r') as f1:
    data = f1.readlines()

# get language headers:
langs = data[0].replace(',\n','').split(',')[1:] # "0,Eng,...,...,...," -> "..., ..., ..." (no 'Eng' and no final comma or '\n')

# put those language headers into the ordered dictionary:
for lang in langs:
    words[lang] = ''

# fill arrays:
for line in data:
    i = 0
    for lang in words:
        i += 1
        words[lang] = line.split(',')[i]
    originalWords = words.copy()
    originalWords_Alt = words.copy()
    if words['Eng'] != 'Eng':
        newWord = createWord_Alternate() # here is the major function call!
        with open(outputFilename,'a') as f2:
            entry = newWord.strip()
            for lang in langs:
                entry += ',' + originalWords[lang]
            entry += ',\n'
            f2.write(entry)