text:
// Example of self hosted WCF service without default configuration
// www.benjamin-abt.com

using System;

namespace SchwabenCode.Examples.WCFCalculatorServices
{
    /// <summary>
    /// Service implementation of calc service
    /// </summary>
    public class CalcService : ICalcService
    {
        /// <summary>
        /// Returns the sum of both passed numbers
        /// </summary>
        public int Add( Int32 n1, Int32 n2 )
        {
            return n1 + n2;
        }
    }
}


text:
package com.sequenceiq.cloudbreak.converter.v4.clustertemplate;

import java.util.HashSet;
import java.util.Set;

import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.api.endpoint.v4.blueprint.responses.ServiceDependencyMatrixV4Response;
import com.sequenceiq.cloudbreak.cmtemplate.generator.dependencies.domain.ServiceDependencyMatrix;

@Component
public class ServiceDependencyMatrixToServiceDependencyMatrixV4Response {

    public ServiceDependencyMatrixV4Response convert(ServiceDependencyMatrix source) {
        ServiceDependencyMatrixV4Response serviceDependencyMatrixV4Response = new ServiceDependencyMatrixV4Response();

        Set<String> dependenciesV4Responses = new HashSet<>();
        dependenciesV4Responses.addAll(source.getDependencies().getServices());
        serviceDependencyMatrixV4Response.setDependencies(dependenciesV4Responses);

        Set<String> servicesV4Responses = new HashSet<>();
        servicesV4Responses.addAll(source.getServices().getServices());
        serviceDependencyMatrixV4Response.setServices(servicesV4Responses);

        return serviceDependencyMatrixV4Response;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

class gkrellm_inet_connection
{

  private $s_remote_ip;
  private $i_local_port;
  private $i_remote_port;
  private $b_added;

/**
 * @ignore
**/
  public function __construct($s_ip, $i_local_port, $i_remote_port, $b_added = true)
  {
    $this->s_remote_ip = $s_ip;
    $this->i_local_port = $i_local_port;
    $this->i_remote_port = $i_remote_port;
    $this->b_added = $b_added;
  }

/**
 * @return string The connection's remote IP address
**/
  public function get_remote_ip()
  {
    return $this->s_remote_ip;
  }

/**
 * @return int The connection's local port
**/
  public function get_local_port()
  {
    return $this->i_local_port;
  }

/**
 * @return int The connection's remote port
**/
  public function get_remote_port()
  {
    return $this->i_remote_port;
  }

/**
 * @return bool If false, this connection has just been closed (only applicable when in the list of connection changes)
**/
  public function added()
  {
    return $this->b_added;
  }

}

/**
 * @see GKRELLM_UPDATE_INET
**/
class gkrellm_update_inet extends gkrellm_update
{

  private $a_connections;
  private $a_connection_changes;

/**
 * @ignore
**/
  public function __construct()
  {
    $this->i_type = GKRELLM_UPDATE_INET;
  }

/**
 * @return array An array of gkrellm_inet_connection objects corresponding to the current list of active connections as reported by gkrellmd
 * @see gkrellm_inet_connection
**/
  public function get_connections()
  {
    return $this->a_connections;
  }

/**
 * @return array An array of gkrellm_inet_connection objects corresponding to the connections reported as being opened/closed in the last update from gkrellmd
 * @see gkrellm_inet_connection
**/
  public function get_connection_changes()
  {
    return $this->a_connection_changes;
  }

/**
 * @ignore
**/
  public function process_line($s_line, $s_setup_line = null)
  {
    $a_line = self::split_line($s_line);

    //format +/-0 localport ip:remoteport
    if($a_line[0]{1} == '0')
    {
      $a_remote = split(':', $a_line[2]);

      $i_local_port = hexdec($a_line[1]);
      $s_ip = $a_remote[0];
      $i_remote_port = hexdec($a_remote[1]);

      if($a_line[0]{0} == '+')
      {
        //new connection
        $o_connection = new gkrellm_inet_connection($s_ip, $i_local_port, $i_remote_port);
        $this->a_connections[] = $o_connection;
        $this->a_connection_changes[] = $o_connection;
      }
      else
      {
        //closed connection
        $o_connection = new gkrellm_inet_connection($s_ip, $i_local_port, $i_remote_port, false);
        $this->a_connection_changes[] = $o_connection;
        foreach($this->get_connections() as $i_key => $o_conn)
        {
          if($o_conn->get_remote_port() == $i_remote_port && $o_conn->get_local_port() == $i_local_port
          && $o_conn->get_remote_ip() == $s_ip)
            unset($this->a_connections[$i_key]);
        }
      }
    }
  }

/**
 * @ignore
**/
  public function initialise_update()
  {
    $this->a_connection_changes = array();
  }

/**
 * @ignore
**/
  public function process_setup_line($s_line)
  {
  }
}

?>


text:
global.Promise = global.Promise || require('bluebird')

var
  Env = require('./../../../../../../lib/core/env').Env,
  settings = require('./../../../../../../bin/server/settings')(),
  BinaryVars = require('./../../../../../../lib/platforms/browserstack/tunnel/binary').BinaryVars,
  utils = require('./../../../utils'),
  chai = require('chai'),
  chaiHttp = require('chai-http'),
  chaiAsPromised = require('chai-as-promised')

chai.use(chaiAsPromised)
chai.use(chaiHttp)

var
  expect = chai.expect,
  should = chai.should(),
  request = chai.request,
  host = 'http://' + settings.server.host + ':' + settings.server.port

describe('BrowserStack', function() {

  describe('/browserstack', function() {

    describe('GET', function() {

      this.timeout(0)

      it('should fail with 404 status code', function() {
        return request(host)
        .get('/runs/testem/browserstack')
        .catch(err => {
          expect(err.status).to.equal(404)
          return true
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

    describe('DELETE', function() {

      this.timeout(0)

      it('should succeed with 200 status code', function() {
        return request(host)
        .delete('/runs/testem/browserstack')
        .send({ screenshot: true })
        .then(res => {
          expect(res.statusCode).to.equal(200)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })
    })

    describe('PUT', function() {

      this.timeout(0)

      it('should silently complete even without any input parameters', function() {
        return request(host)
        .put('/runs/testem/browserstack')
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should fail with 400 status code for invalid input parameters', function() {
        return request(host)
        .put('/runs/testem/browserstack')
        .send({capabilities:[{os:"Windows"}]})
        .catch(err => {
          expect(err.status).to.equal(400)
          expect(err.response.body).to.not.be.undefined
          expect(err.response.body).to.have.keys('error')
          expect(err.response.body.error).to.contain('option os is not allowed')
          return true
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should succeed with 200 status code with valid input parameters', function() {
        return request(host)
        .put('/runs/testem/browserstack')
        .send({capabilities:[{local: true}]})
        .then(res => {
          expect(res.body).to.not.be.undefined
          expect(res.statusCode).to.equal(200)
          return request(host)
            .delete('/runs/testem/browserstack')
        })
        .then(res => {
          expect(res.statusCode).to.equal(200)
          return true
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      if(!Env.isWindows) {
        it('should fail with 500 status code for internal errors (simulated with removing execute permissions from tunnel binary)', function() {
          return utils.safeChmod(BinaryVars.path, '0400')
          .then(() => {
            return request(host)
            .put('/runs/testem/browserstack')
            .send({capabilities:[{local:true}]})
          })
          .catch(err => {
            expect(err.status).to.equal(500)
            expect(err.response.body).to.not.be.undefined
            expect(err.response.body).to.have.keys('error')
            expect(err.response.body.error).to.contain('spawn EACCES')
            return utils.safeChmod(BinaryVars.path, '0755')
          })
          .catch(err => {
            utils.log.error('error: ', err)
            throw err
          })
          .should.be.fulfilled
        })
      }

      /*it('should succeed with 200 status code with multiple local identifiers capabilities', function() {
        return request(host)
        .put('/runs/testem/browserstack')
        .send({capabilities:[{
          local: true,
          localIdentifier: "my-id-1"
        }, {
          local: true,
          localIdentifier: "my-id-2"
        }]})
        .then(res => {
          expect(res.body).to.not.be.undefined
          expect(res.statusCode).to.equal(200)
          return request(host)
            .delete('/runs/testem/browserstack')
        })
        .then(res => {
          expect(res.statusCode).to.equal(200)
          return true
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })*/

    })

    if(!Env.isWindows) {

      describe('DELETE', function() {

        this.timeout(0)

        it('should fail with 500 status code for internal errors (simulated with removing execute permissions from tunnel binary)', function() {
          return request(host)
          .put('/runs/testem/browserstack')
          .send({capabilities:[{local: true}]})
          .then(res => {
            expect(res.body).to.not.be.undefined
            expect(res.statusCode).to.equal(200)
            return utils.safeChmod(BinaryVars.path, '0400')
          })
          .then(() => {
            return request(host)
              .delete('/runs/testem/browserstack')
          })
          .catch(err => {
            expect(err.status).to.equal(500)
            expect(err.response.body).to.not.be.undefined
            expect(err.response.body).to.have.keys('error')
            expect(err.response.body.error).to.contain('spawn EACCES')
            return utils.safeChmod(BinaryVars.path, '0755')
          })
          .then(() => {
            return request(host)
              .delete('/runs/testem/browserstack')
          })
          .then(res => {
            expect(res.statusCode).to.equal(200)
            return true
          })
          .catch(err => {
            utils.log.error('error: ', err)
            throw err
          })
          .should.be.fulfilled
        })
      })
    }

    describe('POST', function() {

      this.timeout(0)

      it('should fail with 400 status code without any input parameters', function() {
        return request(host)
        .post('/runs/testem/browserstack')
        .catch(err => {
          expect(err.status).to.equal(400)
          expect(err.response.body).to.not.be.undefined
          expect(err.response.body).to.have.keys('error')
          expect(err.response.body.error).to.contain('required option browser missing')
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should fail with 400 status code with invalid input parameters', function() {
        return request(host)
        .post('/runs/testem/browserstack')
        .send({"browser":{"os":"Windows","osVersion":"None","browser":"Firefox","browserVersion":"43.0"},"url":"http://piaxis.tech"})
        .catch(err => {
          expect(err.status).to.equal(400)
          expect(err.response.body).to.not.be.undefined
          expect(err.response.body).to.have.keys('error')
          expect(err.response.body.error).to.contain('invalid osVersion "None" for os "Windows"')
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should succeed with 200 status code with valid input parameters', function() {
        var build = utils.buildDetails()
        return request(host)
        .post('/runs/testem/browserstack')
        .send({"browser":{"os":"Windows","osVersion":"10","browser":"Firefox","browserVersion":"43.0"},"capabilities":{"build":build.build,"test":build.test,"project":build.project, "timeout": 30},"url":"http://piaxis.tech"})
        .then(res => {
          expect(res.body).to.not.be.undefined
          expect(res.body).to.have.keys('id')
          expect(res.statusCode).to.equal(200)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

  })

  describe('/browserstack/:run', function() {

    describe('GET', function() {

      this.timeout(0)

      it('should fail with 404 status code', function() {
        return request(host)
        .get('/runs/testem/browserstack/some-id')
        .catch(err => {
          expect(err.status).to.equal(404)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })
    })

    describe('POST', function() {

      this.timeout(0)

      it('should fail with 404 status code', function() {
        return request(host)
        .post('/runs/testem/browserstack/some-id')
        .catch(err => {
          expect(err.status).to.equal(404)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })
    })

    describe('DELETE', function() {

      this.timeout(0)

      it('should fail with 400 status code for a non-existent run', function() {
        return request(host)
        .delete('/runs/testem/browserstack/some-id')
        .catch(err => {
          expect(err.status).to.equal(400)
          expect(err.response.body).to.not.be.undefined
          expect(err.response.body).to.have.keys('error')
          expect(err.response.body.error).to.contain('stop: no such run some-id found')
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

      it('should succeed with 200 status code for an existing run', function() {
        var build = utils.buildDetails()
        return request(host)
        .post('/runs/testem/browserstack')
        .send({"browser":{"os":"Windows","osVersion":"10","browser":"Chrome","browserVersion":"43.0"},"capabilities":{"build":build.build,"test":build.test,"project":build.project, "timeout": 30},"url":"http://piaxis.tech"})
        .then(res => {
          expect(res.body).to.not.be.undefined
          expect(res.body).to.have.keys('id')
          expect(res.statusCode).to.equal(200)
          return request(host)
            .delete('/runs/testem/browserstack/' + res.body.id)
            .send({ screenshot: true })
        })
        .then(res => {
          expect(res.statusCode).to.equal(200)
        })
        .catch(err => {
          utils.log.error('error: ', err)
          throw err
        })
        .should.be.fulfilled
      })

    })

  })

})


text:
require "stringio"
require "rspec"
require "rspec/retry"
require "google/apis/jobs_v3"
require "securerandom"
require_relative "../V3/basic_company_sample"
require_relative "../V3/basic_job_sample"
require_relative "../V3/auto_complete_sample"
require_relative "../V3/batch_operation_sample"
require_relative "../V3/commute_search_sample"
require_relative "../V3/custom_attribute_sample"
require_relative "../V3/email_alert_search_sample"
require_relative "../V3/featured_job_sample"
require_relative "../V3/filter_search_sample"
require_relative "../V3/histogram_sample"
require_relative "../V3/location_search_sample"

RSpec.configure do |config|
  # show retry status in spec process
  config.verbose_retry = true
  # show exception that triggers a retry if verbose_retry is set to true
  config.display_try_failure_messages = true
  # set retry count and retry sleep interval to 10 seconds
  config.default_retry_count = 5
  config.default_sleep_interval = 10
end

# Start verifying
describe "Cloud Job Discovery Samples" do
  before do
    $stdout = StringIO.new
    @default_project_id = "projects/#{ENV['GOOGLE_CLOUD_PROJECT']}"
  end

  # Capture and return STDOUT output by block
  def capture
    real_stdout = $stdout
    $stdout = StringIO.new
    yield
    @captured_output = $stdout.string
  ensure
    $stdout = real_stdout
  end

  attr_reader :captured_output

  # verify basic_company_sample.rb
  it "basic_company_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      company_got = job_discovery_get_company company_name: company_created.name
      company_created.display_name = "Updated name Google"
      company_updated = job_discovery_update_company company_name:    company_created.name,
                                                     company_updated: company_created
      company_created.display_name = "Updated name with field mask Google"
      company_updated_with_field_mask =
        job_discovery_update_company_with_field_mask company_name:    company_created.name,
                                                     field_mask:      "DisplayName",
                                                     company_updated: company_created
      job_discovery_delete_company company_name: company_created.name
      # Verify status of job service
      expect(company_created).not_to be nil
      expect(company_got).not_to be nil
      expect(company_updated.display_name).to eq "Updated name Google"
      expect(company_updated_with_field_mask.display_name).to eq "Updated name with field mask Google"
      company_after_delete = job_discovery_get_company company_name: company_created.name
      expect(company_after_delete).to be nil
    end
  end
  # verify basic_job_sample.rb
  it "basic_job_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated = job_discovery_generate_job company_name:   company_created.name,
                                                 requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      job_got = job_discovery_get_job job_name: job_created.name
      job_created.description = "Updated description"
      job_updated = job_discovery_update_job job_name:          job_created.name,
                                             job_to_be_updated: job_created
      job_created.title = "Updated title software Engineer"
      job_updated_with_field_mask =
        job_discovery_update_job_with_field_mask job_name:          job_created.name,
                                                 field_mask:        "title",
                                                 job_to_be_updated: job_created
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      # Verify status of job service
      expect(job_created).not_to be nil
      expect(job_got).not_to be nil
      expect(job_updated.description).to eq "Updated description"
      expect(job_updated_with_field_mask.title).to eq "Updated title software Engineer"
      job_after_delete = job_discovery_get_job job_name: job_created.name
      expect(job_after_delete).to be nil
    end
  end
  # verify auto_complete_sample.rb
  it "auto_complete_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated = job_discovery_generate_job company_name:   company_created.name,
                                                 requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_generated.title = "software enginner"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      title_auto_complete_result = job_discovery_job_title_auto_complete company_name: company_created.name,
                                                                         query:        "sof",
                                                                         project_id:   @default_project_id
      default_auto_complete_result = job_discovery_default_auto_complete company_name: company_created.name,
                                                                         query:        "sof",
                                                                         project_id:   @default_project_id
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      # Verify status of job service
      expect(title_auto_complete_result.completion_results).not_to be nil
      expect(default_auto_complete_result.completion_results).not_to be nil
    end
  end
  # verify batch_operation_sample.rb
  it "batch_operation_sample" do
    job_names = []
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      jobs_created = job_discovery_batch_create_jobs company_name: company_created.name,
                                                     project_id:   @default_project_id
      jobs_created.each do |job|
        job.description = job.description + " updated"
      end
      job_updated = job_discovery_batch_update_jobs job_to_be_updated: jobs_created
      jobs_created.each do |job|
        job.title = job.title + " updated"
      end
      job_updated_with_mask = job_discovery_batch_update_jobs_with_mask job_to_be_updated: jobs_created
      jobs_created.each do |job|
        job_names.push job.name
      end
      job_discovery_batch_delete_jobs job_to_be_deleted: job_names
      # Verify status of job service
      expect(jobs_created).not_to be nil
      job_updated.each do |job|
        expect(job.description).to include("updated")
      end
      job_updated_with_mask.each do |job|
        expect(job.title).to include("updated")
      end
      job_names.each do |job_name|
        job_after_delete = job_discovery_get_job job_name: job_name
        expect(job_after_delete).to be nil
      end
    end
  end
  # verify commute_search_sample.rb
  it "commute_search_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated = job_discovery_generate_job company_name:   company_created.name,
                                                 requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      sleep 60
      location = company_created.derived_info.headquarters_location.lat_lng
      commute_search_result = job_discovery_commute_search commute_method:    "DRIVING",
                                                           travel_duration:   "1000s",
                                                           start_coordinates: location,
                                                           project_id:        @default_project_id
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(commute_search_result).not_to be nil
    end
  end
  # verify custom_attribute_sample.rb
  it "custom_attribute_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated =
        job_discovery_generate_job_with_custom_attribute company_name:   company_created.name,
                                                         requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      sleep 10
      long_filter_result = try_with_backoff "long filter results" do
        job_discovery_filters_on_long_value_custom_attribute project_id: @default_project_id
      end
      string_filter_result =
        job_discovery_filters_on_string_value_custom_attribute project_id:   @default_project_id
      multi_filters_result =
        job_discovery_filters_on_multi_custom_attributes project_id:   @default_project_id
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(long_filter_result.matching_jobs).not_to be nil
      expect(string_filter_result.matching_jobs).not_to be nil
      expect(multi_filters_result.matching_jobs).not_to be nil
    end
  end
  # verify email_alert_search_sample.rb
  it "email_alert_search_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated =
        job_discovery_generate_job_with_custom_attribute company_name:   company_created.name,
                                                         requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      sleep 10
      email_alert_search_result = try_with_backoff "email alert search result" do
        job_discovery_email_alert_search project_id:   @default_project_id,
                                         company_name: company_created.name
      end
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(email_alert_search_result.matching_jobs).not_to be nil
    end
  end
  # verify featured_job_sample.rb
  it "featured_job_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated =
        job_discovery_generate_featured_job company_name:   company_created.name,
                                            requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_generated.title = "Lab Technician"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      sleep 10
      search_result = try_with_backoff "search result" do
        job_discovery_featured_jobs_search company_name: company_created.name,
                                           query:        "Lab",
                                           project_id:   @default_project_id
      end
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(search_result.matching_jobs).not_to be nil
    end
  end
  # verify filter_search_sample.rb
  it "filter_search_sample" do
    headquarters_address = "1600 Amphitheatre Parkway Mountain View, CA 94043"

    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: headquarters_address
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated = job_discovery_generate_job company_name:   company_created.name,
                                                 requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id

      sleep 10
      keyword_search_result = try_with_backoff "keyword search result" do
        job_discovery_basic_keyword_search company_name: company_created.name,
                                           query:        job_created.title,
                                           project_id:   @default_project_id
      end
      filter_search_result = job_discovery_category_filter_search company_name: company_created.name,
                                                                  categories:   [:SCIENCE_AND_ENGINEERING],
                                                                  project_id:   @default_project_id
      employment_search_result = job_discovery_employment_types_filter_search company_name:     company_created.name,
                                                                              employment_types: job_created.employment_types,
                                                                              project_id:       @default_project_id
      date_search_result = job_discovery_date_range_filter_search company_name: company_created.name,
                                                                  start_time:   "1980-01-15T01:30:15.01Z",
                                                                  end_time:     "2099-01-15T01:30:15.01Z",
                                                                  project_id:   @default_project_id
      code_search_result = job_discovery_language_code_filter_search company_name:   company_created.name,
                                                                     language_codes: ["en-Us"],
                                                                     project_id:     @default_project_id
      name_search_result = job_discovery_company_display_name_search company_display_names: ["Google"],
                                                                     project_id:            @default_project_id
      compensation_search_result = job_discovery_compensation_search company_name: company_created.name,
                                                                     min_unit:     0,
                                                                     max_unit:     100,
                                                                     project_id:   @default_project_id
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(keyword_search_result.matching_jobs).not_to be nil
      expect(filter_search_result.matching_jobs).not_to be nil
      expect(employment_search_result.matching_jobs).not_to be nil
      expect(date_search_result.matching_jobs).not_to be nil
      expect(code_search_result.matching_jobs).not_to be nil
      expect(name_search_result.matching_jobs).not_to be nil
      expect(compensation_search_result.matching_jobs).not_to be nil
    end
  end
  # verify histogram_sample.rb
  it "histogram_sample" do
    capture do
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated = job_discovery_generate_job company_name:   company_created.name,
                                                 requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_created = job_discovery_create_job job_to_be_created: job_generated,
                                             project_id:        @default_project_id
      sleep 10
      search_result = try_with_backoff "search result" do
        job_discovery_histogram_search company_name: company_created.name,
                                       project_id:   @default_project_id
      end
      job_discovery_delete_job job_name: job_created.name
      job_discovery_delete_company company_name: company_created.name
      expect(search_result.matching_jobs).not_to be nil
    end
  end
  # verify location_search_sample.rb
  it "location_search_sample" do
    begin
      company_generated =
        job_discovery_generate_company display_name:         "Google",
                                       external_id:          "externalId: Google #{SecureRandom.hex}",
                                       headquarters_address: "1600 Amphitheatre Parkway " +
                                                             "Mountain View, CA 94043"
      company_created =
        job_discovery_create_company company_to_be_created: company_generated,
                                     project_id:            @default_project_id
      job_generated1 = job_discovery_generate_job company_name:   company_created.name,
                                                  requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_generated1.addresses = ["Mountain View, CA"]
      job_created1 = job_discovery_create_job job_to_be_created: job_generated1,
                                              project_id:        @default_project_id
      job_generated1 = job_discovery_generate_job company_name:   company_created.name,
                                                  requisition_id: "#{company_created.name} #{SecureRandom.hex}"
      job_generated2.addresses = ["Sunnyvale, CA"]
      job_created2 = job_discovery_create_job job_to_be_created: job_generated2,
                                              project_id:        @default_project_id
      sleep 10
      basic_search_result = try_with_backoff "basic search result" do
        job_discovery_basic_location_search company_name: company_created.name,
                                            location:     "Mountain View, CA",
                                            distance:     0.5,
                                            project_id:   @default_project_id
      end
      keyword_search_result = job_discovery_keyword_location_search company_name: company_created.name,
                                                                    location:     "Mountain View, CA",
                                                                    distance:     0.5,
                                                                    keyword:      "Lab",
                                                                    project_id:   @default_project_id
      city_search_result = job_discovery_city_location_search company_name: company_created.name,
                                                              city:         "Mountain View, CA",
                                                              project_id:   @default_project_id
      multi_search_result = job_discovery_multi_location_search company_name: company_created.name,
                                                                location1:    "Mountain View, CA",
                                                                distance1:    0.5,
                                                                city2:        "Sunnyvale",
                                                                project_id:   @default_project_id
      broadening_search_result = job_discovery_broadening_location_search company_name: company_created.name,
                                                                          city:         "Sunnyvale",
                                                                          project_id:   @default_project_id
      job_discovery_delete_job job_name: job_created1.name
      job_discovery_delete_job job_name: job_created2.name
      job_discovery_delete_company company_name: company_created.name
      expect(basic_search_result.matching_jobs).not_to be nil
      expect(keyword_search_result.matching_jobs).not_to be nil
      expect(city_search_result.matching_jobs).not_to be nil
      expect(multi_result.matching_jobs).not_to be nil
      expect(broadening_result.matching_jobs).not_to be nil
    rescue StandardError
      puts "location_search_sample not all succeeded"
    ensure
      $stdout = StringIO.new
    end
  end

  def try_with_backoff msg = nil, limit: 10
    count = 0
    loop do
      begin
        result = yield
        return result if count >= limit || !result.nil?
        count += 1
        puts "Retry (#{count}): #{msg}"
        sleep count
      end
    end
  end
end


text:
package anonymerniklasistanonym.karaokemusicvideomanager.desktopclient.gui.frames;

import anonymerniklasistanonym.karaokemusicvideomanager.desktopclient.libaries.ClassResourceReaderModule;
import javafx.application.Preloader;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.ProgressBar;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 * Preloader. Shows a image and progress bar before starting the main
 * window.

 * Preloader could only be implemented thanks to a great tutorial from
 * aron.sreder
 * from codecentric
 * Blog
 *
 * @author AnonymerNiklasistanonym <niklas.mikeler@gmail.com> | https://github.com/AnonymerNiklasistanonym
 */
public class CustomPreloader extends Preloader {

	/**
	 * Stage of this preloader
	 */
	private Stage preloaderStage;

	/**
	 * Scene of this preloader
	 */
	private Scene preloaderScene;

	/**
	 * Progress bar of this preloader
	 */
	private final ProgressBar preloaderProgressBar;

	/**
	 * Constructor
	 */
	public CustomPreloader() {

		System.out.println(">> Preloader constructor");

		this.preloaderStage = null;
		this.preloaderScene = null;
		this.preloaderProgressBar = new ProgressBar(100.00);
		;
	}

	@Override
	public void init() throws Exception {

		System.out.println(">> Preloader initialization");

		// load the preloader image
		final ImageView preloadImage = new ImageView();
		preloadImage.setImage(new Image(ClassResourceReaderModule.getInputStream("images/preload.png")));

		// set the preloader text of version and name of the program
		final Text versionAndNameText = new Text(10, 20, "KaraokeMusicVideoManager v2.0.0");
		versionAndNameText.setFont(Font.font(16));
		versionAndNameText.setFill(Color.GREY);

		// setup the preloader progress bar which starts at 0 and goes to 100
		this.preloaderProgressBar.setProgress(0);
		this.preloaderProgressBar.setStyle("-fx-padding: 10 10 10 10;");

		// create vertical box and insert the version/name text and the progress bar
		final VBox vBoxTextAndProgress = new VBox(versionAndNameText, this.preloaderProgressBar);
		vBoxTextAndProgress.setAlignment(Pos.CENTER);
		vBoxTextAndProgress.setStyle("-fx-background-color: #FFFFFF;-fx-padding: 10 10 10 10;");

		// create another vertical box and insert in it the image and the other box
		final VBox root = new VBox(preloadImage, vBoxTextAndProgress);
		root.setAlignment(Pos.CENTER);
		root.setStyle("-fx-background-color: #FFFFFF;-fx-padding: 20 0 0 0;");

		// set the scene and a window width and height
		this.preloaderScene = new Scene(root, 500, 420);

		System.out.println("<< Preloader initialization finished");

	}

	@Override
	public void start(Stage primaryStage) throws Exception {

		System.out.println(">> Open Preloader stage");

		// connect the stage to the handleStateChangeNotification method
		this.preloaderStage = primaryStage;

		// add the created scene to the primary stage
		this.preloaderStage.setScene(this.preloaderScene);

		// show only the stage no real window
		this.preloaderStage.initStyle(StageStyle.UNDECORATED);

		// show the primary stage/preloader window
		this.preloaderStage.show();

		System.out.println("PRELOADER");

	}

	@Override
	public void handleApplicationNotification(PreloaderNotification info) {

		// get the current process and change the progress bar
		if (info instanceof ProgressNotification) {
			this.preloaderProgressBar.setProgress(((ProgressNotification) info).getProgress() / 100);
		}

	}

	@Override
	public void handleStateChangeNotification(StateChangeNotification info) {

		// react to different stages while loading
		switch (info.getType()) {
		case BEFORE_LOAD:
			System.out.println(">> Preloader >> BEFORE_LOAD");
			break;
		case BEFORE_INIT:
			System.out.println(">> Preloader >> BEFORE_INIT");
			break;
		case BEFORE_START:
			System.out.println(">> Preloader >> BEFORE_START");

			System.out.println(">> Preloader hide stage");
			this.preloaderStage.hide();
			System.out.println("<< Preloader stage hidden");

			break;
		}

	}

}


text:
namespace VGGLinkedIn.Data.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    public class Project
    {
        private ICollection<User> teamMembers;

        public Project()
        {
            this.teamMembers = new HashSet<User>();
        }

        public int Id { get; set; }

        [Required]
        public string Name { get; set; }

        public string Description { get; set; }

        public DateTime Date { get; set; }

        public string Url { get; set; }

        public int OccupationExperienceId { get; set; }

        public virtual Experience OccupationExperience { get; set; }

        public virtual ICollection<User> TeamMembers
        {
            get { return this.teamMembers; }
            set { this.teamMembers = value; }
        }
    }
}


text:
package com.onegravity.contactpicker.picture;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;

import com.onegravity.contactpicker.contact.Contact;
import com.onegravity.contactpicker.picture.cache.ContactPictureCache;
import com.onegravity.contactpicker.picture.cache.ContactUriCache;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Use this class to load contact pictures for ContactBadges.
 *

 * It manages the asynchronous loading of contact pictures and caches Uris and Bitmaps to make
 * sure device resources are used efficiently.
 */
public class ContactPictureManager {
    private static final ExecutorService sExecutor = Executors.newFixedThreadPool(2);
    private static Bitmap sDummyBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
    private final ContactPictureCache sPhotoCache;

    private final boolean mRoundContactPictures;

    public ContactPictureManager(Context context, boolean roundContactPictures) {
        sPhotoCache = ContactPictureCache.getInstance(context);
        mRoundContactPictures = roundContactPictures;
        EventBus.getDefault().register(this);
    }

    /**
     * Load a contact picture and display it using the supplied {@link ContactBadge} instance.
     *

     *

     * If a picture is found in the cache, it is displayed in the {@code ContactBadge}
     * immediately. Otherwise a {@link ContactPictureLoader} is started to try to load the
     * contact picture in a background thread.
     * Depending on the result the contact picture or a fallback picture is shown (letter).
     *

     */
    public void loadContactPicture(Contact contact, ContactBadge badge) {
        String key = contact.getLookupKey();

        // retrieve or create uri for the contact picture
        Uri photoUri = contact.getPhotoUri();
        if (photoUri == null) {
            photoUri = ContactUriCache.getUriFromCache(key);
            if (photoUri == Uri.EMPTY) {
                // pseudo uri used as key to retrieve Uris from the cache
                photoUri = Uri.parse("picture://1gravity.com/" + Uri.encode(key));
                ContactUriCache.getInstance().put(key, photoUri);
            }
        }

        // retrieve contact picture from cache
        Bitmap bitmap = sPhotoCache.get(photoUri, sDummyBitmap);    // can handle Null keys

        if (bitmap != null && bitmap != sDummyBitmap) {
            // 1) picture found --> update the contact badge
            badge.setBitmap(bitmap);
        } else if (photoUri == Uri.EMPTY || bitmap == sDummyBitmap) {
            // 2) we already tried to retrieve the contact picture before (unsuccessfully)
            // --> "letter" contact image
            badge.setCharacter(contact.getContactLetter(), contact.getContactColor());
        } else {
            synchronized (badge) {
                boolean hasLoaderAssociated = hasLoaderAssociated(key, badge);

                if (!hasLoaderAssociated) {
                    // 3a) temporary "letter" contact image till the contact picture is loaded (if there's any)
                    badge.setCharacter(contact.getContactLetter(), contact.getContactColor());

                    // 3b) load the contact picture
                    ContactPictureLoader loader = new ContactPictureLoader(key, badge, contact.getPhotoUri(), mRoundContactPictures);
                    badge.setKey(key);
                    try {
                        sExecutor.execute(loader);
                    } catch (Exception ignore) {
                    }
                }
            }
        }
    }

    /**
     * @return {@code true}, if a loader with the same key has already been started for this
     * ContactBadge, {@code false} otherwise.
     */
    private boolean hasLoaderAssociated(String loaderKey, ContactBadge badge) {
        String badgeKey = badge.getKey();

        if (badgeKey == null || loaderKey == null) {
            // no loader associated with the ContactBadge
            return false;
        }

        return badgeKey.equals(loaderKey);
    }

    /**
     * A ContactPictureLoader has loaded a contact picture and wants to update the ContactBadge.
     * We use EventBus because it's a convenient way to run this on the UI thread and because it's
     * very little boilerplate code.
     */
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventMainThread(ContactPictureLoaded event) {
        ContactBadge badge = event.getBadge();
        String badgeKey = badge.getKey();
        String loaderKey = event.getKey();

        if (badgeKey != null && loaderKey != null && badgeKey.equals(loaderKey)) {
            badge.setBitmap(event.getBitmap());
        }
    }

}


text:
#include <set>
#include <string>
#include <memory>
#include "util/trace.h"

#ifndef LEAN_TRACE_OUT
#define LEAN_TRACE_OUT ".lean_trace"
#endif

namespace lean {

#ifdef LEAN_TRACE
std::ofstream tout(LEAN_TRACE_OUT);
mutex         trace_mutex;
#endif

static std::set<std::string> * g_enabled_trace_tags = nullptr;

void initialize_trace() {
    // lazy initialization
}

void finalize_trace() {
    delete g_enabled_trace_tags;
}

void enable_trace(char const * tag) {
    if (!g_enabled_trace_tags)
        g_enabled_trace_tags = new std::set<std::string>();
    g_enabled_trace_tags->insert(tag);
}

void disable_trace(char const * tag) {
    if (g_enabled_trace_tags)
        g_enabled_trace_tags->erase(tag);
}

bool is_trace_enabled(char const * tag) {
    return g_enabled_trace_tags && g_enabled_trace_tags->find(tag) != g_enabled_trace_tags->end();
}

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Norw. Jl Bot. 22: 33 (1975)

#### Original name
Stereopsis straminea Ryvarden, 1975

### Remarks
null


text:
<?php

namespace CultuurNet\UDB3\Event\Events;

use CultuurNet\UDB3\Offer\Events\AbstractLabelRemoved;

final class LabelRemoved extends AbstractLabelRemoved
{
}


text:
<?php

namespace Wishlist\CoreBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Wishlist\CoreBundle\Entity\Enum;
use Wishlist\CoreBundle\Entity\WishlistUpdate;
use Wishlist\CoreBundle\Entity\Notification;
use Wishlist\CoreBundle\Repository\WishlistUserRepository;
use \DateTime;

class LoadEnumData implements FixtureInterface
{
    /*
     * @var \Doctrine\Common\Persistence\ObjectManager
     */
    private $manager;

    public function load(\Doctrine\Common\Persistence\ObjectManager $manager)
    {
        $this->manager = $manager;

        $this->newEnum('gender', 'male', 1);
        $this->newEnum('gender', 'female', 2);

        $this->newEnum('WishlistUpdate', 'TYPE_1', WishlistUpdate::TEMPLATE_TYPE_1);
        $this->newEnum('WishlistUpdate', 'TYPE_2', WishlistUpdate::TEMPLATE_TYPE_2);
        $this->newEnum('WishlistUpdate', 'ADD_ITEM', WishlistUpdate::TYPE_ADD_ITEM);
        $this->newEnum('WishlistUpdate', 'REMOVE_ITEM', WishlistUpdate::TYPE_REMOVE_ITEM);
        $this->newEnum('WishlistUpdate', 'ADD_FRIEND', WishlistUpdate::TYPE_ADD_FRIEND);
        $this->newEnum('WishlistUpdate', 'REMOVE_FRIEND', WishlistUpdate::TYPE_REMOVE_FRIEND);

        $this->newEnum('Notification', 'STATE_UNREAD', Notification::STATE_UNREAD);
        $this->newEnum('Notification', 'STATE_READ', Notification::STATE_READ);

        $manager->flush();
    }

    public function newEnum(/*string*/ $type, /*string*/ $name, /*int*/ $value)
    {
        $enum = new Enum();
        $enum->setType($type);
        $enum->setName($name);
        $enum->setValue($value);

        $this->manager->persist($enum);
    }
}

?>


text:
'use strict'
const joi = require('joi')

// TODO schema
module.exports =  joi.array().items(joi.object().keys({
  email: joi.string().required(),
  status: joi.string().required()
}).unknown())


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Otidea violacea A.L. Sm. & Ramsb., 1916

### Remarks
null


text:
namespace Tournamentz.Host
{
    using Autofac;
    using Autofac.Integration.Mvc;
    using System.Web.Mvc;
    using System.Web.Optimization;
    using System.Web.Routing;

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            IContainer container = DependencyInjectionConfig.BuildContainer();
            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }
    }
}


text:
<?php

/**
 * @namespace
 */
namespace ShiftContentNew\Exception;

use ShiftContentNew\Exception as ContentException;

/**
 * Content component invalid argument exception
 *
 * @category    Shift
 * @package     ShiftContentNew
 * @subpackage  Exception
 */
class InvalidArgumentException
    extends \InvalidArgumentException
    implements ContentException
{
}


text:
/**
* Project
* @namespace crowdsource.project.services
* @author dmorina neilthemathguy
*/
(function () {
  'use strict';

  angular
    .module('crowdsource.project.services')
    .factory('Project', Project);

  Project.$inject = ['$cookies', '$http', '$q', '$location', 'HttpService'];

  /**
  * @namespace Project
  * @returns {Factory}
  */

  function Project($cookies, $http, $q, $location, HttpService) {
    /**
    * @name Project
    * @desc The Factory to be returned
    */
    var instance = {};
    var Project = {
      syncLocally: syncLocally,
      retrieve: retrieve,
      addProject: addProject,
      getCategories: getCategories,
      getReferenceData: getReferenceData,
      getProjects: getProjects,
      clean: clean
    };

    return Project;

    /**
    * @name addProject
    * @desc Try to create a new project
    * @returns {Promise}
    * @memberOf crowdsource.project.services.Project
    */
    function addProject(project) {
      var settings = {
        url: '/api/project/',
        method: 'POST',
        data: {
          name: project.name,
          description: project.description,
          categories: project.categories,
          modules: [
            {
              name: 'Prototype Task',
              description: project.milestoneDescription,
              template: [
                {
                  name: project.template.name,
                  share_with_others: true,
                  template_items: project.template.items
                },
              ],
              price: project.payment.wage_per_hit,
              status: 1,
              repetition: project.taskType !== "oneTask",
              number_of_hits: project.payment.number_of_hits,
              module_timeout: 0,
              has_data_set: true,
              data_set_location: ''
            }
          ]
        }
      };
      return HttpService.doRequest(settings);
    }

    function getProjects() {
      var settings = {
        url: '/api/project/',
        method: 'GET'
      };
      return HttpService.doRequest(settings);
    }

    function getCategories() {
      var settings = {
        url: '/api/category/',
        method: 'GET'
      };
      return HttpService.doRequest(settings);
    }

    function getReferenceData() {
      return $http({
        url: 'https://api.myjson.com/bins/4ovc8',
        method: 'GET'
      });
    }

    function syncLocally(projectInstance) {
      instance = projectInstance;
    }

    function retrieve() {
      return instance;
    }

    function clean() {
      instance = {};
    }

  }
})();


text:
<?php

class LayoutPlugin extends Zend_Controller_Plugin_Abstract
{
	private $config;

	/**
	 * When build, apply the following config elements.
	 *
	 * @param unknown_type $config
	 */
	public function __construct($config)
	{
		$this->config = $config;
	}

	/**
	 * Called before Zend_Controller_Front begins evaluating the
	 * request against its routes.
	 *
	 * @return void
	 */
	public function routeStartup() {}

	/**
	 * Called after Zend_Controller_Front exits from the router.
	 *
	 * This callback allows for proxy or filter behavior.  The
	 * $action must be returned for the Zend_Controller_Dispatcher_Token to enter the
	 * dispatch loop.  To abort before the dispatch loop is
	 * entered, return FALSE.
	 *
	 * @param  Zend_Controller_Dispatcher_Token|boolean $action
	 * @return Zend_Controller_Dispatcher_Token|boolean
	 */
	public function routeShutdown($action) {return $action;}

	/**
	 * Called before Zend_Controller_Front enters its dispatch loop.
	 * During the dispatch loop.
	 *
	 * This callback allows for proxy or filter behavior.  The
	 * $action must be returned for the Zend_Controller_Dispatcher_Token to enter the
	 * dispatch loop.  To abort before the dispatch loop is
	 * entered, return FALSE.
	 *
	 * @param  Zend_Controller_Dispatcher_Token|boolean $action
	 * @return Zend_Controller_Dispatcher_Token|boolean
	 */
	public function dispatchLoopStartup($action) {return $action;}

	/**
	 * Called before an action is dispatched by Zend_Controller_Dispatcher.
	 *
	 * This callback allows for proxy or filter behavior.  The
	 * $action must be returned for the Zend_Controller_Dispatcher_Token to be dispatched.
	 * To abort the dispatch, return FALSE.
	 *
	 * @param  Zend_Controller_Request_Http $action
	 * @return Zend_Controller_Dispatcher_Token|boolean
	 */
	public function preDispatch($action)
	{
	    $module = $action->getModuleName();
	    $definition = null;
	    if (isset($this->config[$module])) {
	        $definition = $this->config[$module];
	    } else if (isset($this->config['master_layout'])) {
		    $definition = $this->config['master_layout'];
	    }

	    if ($definition != null && !$action->getParam('__ignorelayout')) {
	        $view = null;

		    $layoutName = $this->getViewNameFrom($definition, strtolower($action->getControllerName()), strtolower($action->getActionName()));

            if ($layoutName) {
                $view = new MasterView($layoutName, $this->config['layout_path']);
            }

		    if ($view != null) {
    			Zend_Registry::set('MasterView', $view);
    			$baseView = Zend_Registry::get(NovemberApplication::$ZEND_VIEW);
    			$baseView->setMaster('MasterView');
		    }
		}

		return $action;
	}

	/**
	 * Gets the layout from a passed in array of layout definitions
	 *
	 * Definitions are of the form
	 *
	 * array('controller' => string) where string is the layout for ALL
	 *     of that controller's actions
	 * array('controller' => array('action' => string) where string is
	 *     the layout just for that action in that controller.
	 *
	 * @param map $layoutDefinitions
	 */
	private function getViewNameFrom($layoutDefinitions, $controllerName, $actionName)
	{
	    if (is_string($layoutDefinitions)) return $layoutDefinitions;

	    // figure out based on the controller and action which layout to use.
        // if it's not set, use the one in the 'default_layout' key.
        $default = ifset($layoutDefinitions, 'default_layout');
        $layoutName = ifset($layoutDefinitions, $controllerName, $default);

        // If there's a layout set
        if ($layoutName) {
            // if a user has specified a different layout per action
            if (is_array($layoutName)) {
                // If the layout is set for that action, use it
                if (isset($layoutName[$actionName])) {
                    $layoutName = $layoutName[$actionName];
                } else {
                    // otherwise use the default layout
                    $layoutName = $default;
                }
            }
            return $layoutName;
        }

        return null;
	}

	/**
	 * Called after an action is dispatched by Zend_Controller_Dispatcher.
	 *
	 * This callback allows for proxy or filter behavior.  The
	 * $action must be returned, otherwise the next action
	 * will not be dispatched.  To exit the dispatch loop without
	 * dispatching the action, return FALSE.
	 *
	 * @param  Zend_Controller_Dispatcher_Token|boolean $action
	 * @return Zend_Controller_Dispatcher_Token|boolean
	 */
	public function postDispatch($action) {return $action;}

	/**
	 * Called before Zend_Controller_Front exists its dispatch loop.
	 *
	 * @return void
	 */
	public function dispatchLoopShutdown() {}
}
?>


text:
require 'pathname'

class Bueller
  module Commands
    module Version
      class Base
        def self.run_for(bueller)
          command = new bueller
          command.run
          command
        end

        attr_accessor :version_helper, :gemspec
        attr_reader :bueller

        def initialize(bueller)
          @bueller = bueller
        end

        def version_helper; bueller.version_helper; end
        def gemspec_helper; bueller.gemspec_helper; end
        def repo; bueller.repo; end
        def commit; bueller.commit; end

        def run
          update_version

          gemspec_helper.set_date
          gemspec_helper.write
          version_helper.write_version

          commit_version
        end

        def update_version
          raise "Subclasses should implement this"
        end

        def commit_version
          if repo and commit
            repo.add gemspec_helper.path
            repo.add version_helper.path
            repo.commit "Version bump to #{version_helper.to_s}"
          end
        end
      end
    end
  end
end


text:
require 'rspec'
require 'arangodb.rb'

describe ArangoDB do
  api = "/_api/cursor"
  prefix = "api-cursor"

################################################################################
## query cache
################################################################################

  context "testing the query cache:" do
    before do
      doc = ArangoDB.get("/_api/query-cache/properties")
      @mode = doc.parsed_response['mode']
      ArangoDB.put("/_api/query-cache/properties", :body => "{ \"mode\" : \"demand\" }")

      ArangoDB.delete("/_api/query-cache")
    end

    after do
      ArangoDB.put("/_api/query-cache/properties", :body => "{ \"mode\" : \"#{@mode}\" }")
    end

    it "testing without cache attribute set" do
      cmd = api
      body = "{ \"query\" : \"FOR i IN 1..5 RETURN i\" }"
      doc = ArangoDB.log_post("#{prefix}-query-cache-disabled", cmd, :body => body)

      doc.code.should eq(201)
      doc.headers['content-type'].should eq("application/json; charset=utf-8")
      doc.parsed_response['error'].should eq(false)
      doc.parsed_response['code'].should eq(201)
      doc.parsed_response['id'].should be_nil
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')

      # should see same result, but not from cache
      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')
    end

    it "testing explicitly disabled cache" do
      cmd = api
      body = "{ \"query\" : \"FOR i IN 1..5 RETURN i\", \"cache\" : false }"
      doc = ArangoDB.log_post("#{prefix}-query-cache-disabled", cmd, :body => body)

      doc.code.should eq(201)
      doc.headers['content-type'].should eq("application/json; charset=utf-8")
      doc.parsed_response['error'].should eq(false)
      doc.parsed_response['code'].should eq(201)
      doc.parsed_response['id'].should be_nil
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')

      # should see same result, but not from cache
      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')
    end

    it "testing enabled cache" do
      cmd = api
      body = "{ \"query\" : \"FOR i IN 1..5 RETURN i\", \"cache\" : true }"
      doc = ArangoDB.log_post("#{prefix}-query-cache-enabled", cmd, :body => body)

      doc.code.should eq(201)
      doc.headers['content-type'].should eq("application/json; charset=utf-8")
      doc.parsed_response['error'].should eq(false)
      doc.parsed_response['code'].should eq(201)
      doc.parsed_response['id'].should be_nil
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')

      # should see same result, but now from cache
      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(true)
      doc.parsed_response['extra'].should_not have_key('stats')
    end

    it "testing clearing the cache" do
      cmd = api
      body = "{ \"query\" : \"FOR i IN 1..5 RETURN i\", \"cache\" : true }"
      doc = ArangoDB.log_post("#{prefix}-query-cache-enabled", cmd, :body => body)

      doc.code.should eq(201)
      doc.headers['content-type'].should eq("application/json; charset=utf-8")
      doc.parsed_response['error'].should eq(false)
      doc.parsed_response['code'].should eq(201)
      doc.parsed_response['id'].should be_nil
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')

      # should see same result, but now from cache
      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(true)
      doc.parsed_response['extra'].should_not have_key('stats')

      # now clear cache
      ArangoDB.delete("/_api/query-cache")

      # query again. now response should not come from cache
      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(false)
      doc.parsed_response['extra'].should have_key('stats')

      doc = ArangoDB.log_post("#{prefix}-query-cache", cmd, :body => body)
      doc.code.should eq(201)
      result = doc.parsed_response['result']
      result.should eq([ 1, 2, 3, 4, 5 ])
      doc.parsed_response['cached'].should eq(true)
      doc.parsed_response['extra'].should_not have_key('stats')
    end

  end
end


text:
template<class T>
void CudaVector<T>::ExtendStorage()
{
	if(capacity == 0) capacity = CUDA_VEC_INITIAL_CAPACITY;
	size_t newCount = static_cast<size_t>(capacity * CUDA_VEC_RESIZE_FACTOR);
	T* d_newAlloc = nullptr;
	CUDA_CHECK(cudaMalloc<T>(&d_newAlloc, sizeof(T) * newCount));
	CUDA_CHECK(cudaMemcpy(d_newAlloc, d_data, sizeof(T)  * size, cudaMemcpyDeviceToDevice));
	CUDA_CHECK(cudaFree(d_data));
	d_data = d_newAlloc;
	capacity = newCount;
}

template<class T>
CudaVector<T>::CudaVector()
	: d_data(nullptr)
	, size(0)
	, capacity(0)
{}

template<class T>
CudaVector<T>::CudaVector(size_t count)
	: d_data(nullptr)
	, size(count)
	, capacity(((count + CUDA_VEC_INITIAL_CAPACITY - 1) / CUDA_VEC_INITIAL_CAPACITY) * CUDA_VEC_INITIAL_CAPACITY)
{
	CUDA_CHECK(cudaMalloc<T>(&d_data, sizeof(T) * capacity));
}

template<class T>
CudaVector<T>::CudaVector(const CudaVector<T>& cp)
	: d_data(nullptr)
	, size(cp.size)
	, capacity(cp.capacity)
{
	CUDA_CHECK(cudaMalloc<T>(&d_data, sizeof(T) * capacity));
	CUDA_CHECK(cudaMemcpy(d_data, cp.d_data, sizeof(T) * cp.size, cudaMemcpyDeviceToDevice));
}

template<class T>
CudaVector<T>::CudaVector(CudaVector<T>&& mv)
	: d_data(mv.d_data)
	, size(mv.size)
	, capacity(mv.capacity)
{
	mv.d_data = nullptr;
	mv.size = 0;
	mv.capacity = 0;
}

template<class T>
CudaVector<T>::~CudaVector()
{
	CUDA_CHECK(cudaFree(d_data));
	d_data = nullptr;
	size = 0;
	capacity = 0;
}

template<class T>
CudaVector<T>& CudaVector<T>::operator=(CudaVector<T>&& mv)
{
	assert(this != &mv);

	d_data = mv.d_data;
	size = mv.size;
	capacity = mv.capacity;

	mv.d_data = nullptr;
	mv.size = 0;
	mv.capacity = 0;
	return *this;
}

template<class T>
CudaVector<T>& CudaVector<T>::operator=(const std::vector<T>& vector)
{
	if(vector.size() > capacity)
	{
		capacity = ((vector.size() + CUDA_VEC_INITIAL_CAPACITY - 1) / CUDA_VEC_INITIAL_CAPACITY) * CUDA_VEC_INITIAL_CAPACITY;
		T* d_newAlloc = nullptr;
		CUDA_CHECK(cudaMalloc<T>(&d_newAlloc, sizeof(T) * capacity));
		CUDA_CHECK(cudaFree(d_data));
		d_data = d_newAlloc;
	}
	CUDA_CHECK((cudaMemcpy(d_data, vector.data(), sizeof(T) * vector.size(), cudaMemcpyHostToDevice)));
	size = vector.size();
	return *this;
}

template<class T>
void CudaVector<T>::InsertEnd(const T& hostData)
{
	if(1 > capacity - size)
	{
		ExtendStorage();
	}
	CUDA_CHECK(cudaMemcpy(d_data + size, &hostData, sizeof(T), cudaMemcpyHostToDevice));
	size++;
}

template<class T>
void CudaVector<T>::RemoveEnd()
{
	size--;
	std::max<size_t>(0u, size);
}

template<class T>
void CudaVector<T>::Assign(size_t index, const T& hostData)
{
	assert(index < size);
	CUDA_CHECK(cudaMemcpy(d_data + index, &hostData, sizeof(T), cudaMemcpyHostToDevice));
	//cudaMemcpy(d_data + index, &hostData, sizeof(T), cudaMemcpyHostToDevice);
}

template<class T>
void CudaVector<T>::Assign(size_t index, const T& hostData, cudaStream_t stream)
{
	assert(index < size);
	CUDA_CHECK(cudaMemcpy(d_data + index, &hostData, sizeof(T), cudaMemcpyHostToDevice));
	//cudaMemcpyAsync(d_data + index, &hostData, sizeof(T), cudaMemcpyHostToDevice, stream);
}

template<class T>
void CudaVector<T>::Assign(size_t index, size_t dataLength, const T* hostData)
{
	assert(index + dataLength <= size);
	CUDA_CHECK(cudaMemcpy(d_data + index, hostData,
						  dataLength * sizeof(T), cudaMemcpyHostToDevice));
}

template<class T>
void CudaVector<T>::Memset(int value, size_t offset, size_t count)
{
	assert(offset + count <= size);
	CUDA_CHECK(cudaMemset(d_data + offset, value, count * sizeof(T)));
}

template<class T>
void CudaVector<T>::Reserve(size_t newSize)
{
	if(newSize > capacity)
	{
		size_t newCount = ((newSize + CUDA_VEC_INITIAL_CAPACITY - 1) / CUDA_VEC_INITIAL_CAPACITY) * CUDA_VEC_INITIAL_CAPACITY;
		T* d_newAlloc = nullptr;
		CUDA_CHECK((cudaMalloc<T>(&d_newAlloc, sizeof(T) * newCount)));
		CUDA_CHECK((cudaMemcpy(d_newAlloc, d_data, sizeof(T)  * size, cudaMemcpyDeviceToDevice)));
		CUDA_CHECK(cudaFree(d_data));
		d_data = d_newAlloc;
		capacity = newCount;
	}
}

template<class T>
void CudaVector<T>::Resize(size_t newSize)
{
	Reserve(newSize);
	size = newSize;
}

template<class T>
void CudaVector<T>::Clear()
{
	size = 0;
}

template<class T>
T* CudaVector<T>::Data()
{
	return d_data;
}

template<class T>
const T* CudaVector<T>::Data() const
{
	return d_data;
}

template<class T>
size_t CudaVector<T>::Size() const
{
	return size;
}

#include <fstream>
static std::ostream& operator<<(std::ostream& ostr, const ushort2& shrt2)
{
	ostr << "{" << shrt2.x << ", " << shrt2.y << "}";
	return ostr;
}

template<class T>
template<class O>
void CudaVector<T>::DumpToFile(const char* fName) const
{
	DumpToFile<O>(fName, 0, size);
}

template<class T>
template<class O>
void CudaVector<T>::DumpToFile(const char* fName,
							   size_t offset,
							   size_t count) const
{
	static_assert(sizeof(T) % sizeof(O) == 0 ||
				  sizeof(O) % sizeof(T) == 0, "Template and output should have same sizes");

	std::vector<O> cpuData;
	cpuData.resize(count * sizeof(T) / sizeof(O));
	CUDA_CHECK(cudaMemcpy(cpuData.data(),
						  d_data + offset,
						  count * sizeof(T),
						  cudaMemcpyDeviceToHost));

	std::ofstream fOut;
	fOut.open(fName);

	for(const O& data : cpuData)
	{
		fOut << "0x" << std::uppercase << std::hex << data;
		fOut << "\t\t\t" << std::nouppercase << std::dec << data;
		fOut << std::endl;
	}

}

//template <class T>
//template <>
//inline void CudaVector<T>::DumpToFile<unsigned char>(const char* fName,
//													 size_t offset,
//													 size_t count) const
//{
//	std::vector<unsigned char> cpuData;
//	cpuData.resize(count);
//	CUDA_CHECK(cudaMemcpy(cpuData.data(), d_data + offset, count * sizeof(unsigned char), cudaMemcpyDeviceToHost));
//
//	std::ofstream fOut;
//	fOut.open(fName);
//
//	for(const unsigned char& data : cpuData)
//		fOut << static_cast<unsigned int>(data) << "c" <<  std::endl;
//}


text:
package maxconnections

import (
	"context"
	"time"
)

// A Limiter controls starting of jobs.
type Limiter interface {
	// Start decides whether a new job can be started. The decision may be
	// returned after a delay if the limiter wants to throttle jobs.
	Start(context.Context) bool

	// Done must be called when a job is finished.
	Done()
}

// limiter ensures that there are no more than maxRunning jobs at the same
// time. It can enqueue up to maxInQueue jobs awaiting to be run, for other
// jobs Start will return false immediately.
type limiter struct {
	// running is a buffered channel. Before starting a job, an empty struct is
	// sent to the channel. When the job is finished, one element is received
	// back from the channel. If the channel's buffer is full, the job is
	// enqueued.
	running chan struct{}

	// queue is a buffered channel. An empty struct is placed into the channel
	// while a job is waiting for a spot in the running channel's buffer.
	// If the queue channel's buffer is full, the job is declined.
	queue chan struct{}

	// maxWaitInQueue is a maximum wait time in the queue, zero means forever.
	maxWaitInQueue time.Duration

	// newTimer allows to override the function time.NewTimer for tests.
	newTimer func(d time.Duration) *time.Timer
}

// NewLimiter return a limiter that allows no more than maxRunning jobs at the
// same time. It can enqueue up to maxInQueue jobs awaiting to be run, and a
// job may wait in the queue no more than maxWaitInQueue.
func NewLimiter(maxRunning, maxInQueue int, maxWaitInQueue time.Duration) Limiter {
	return &limiter{
		running:        make(chan struct{}, maxRunning),
		queue:          make(chan struct{}, maxInQueue),
		maxWaitInQueue: maxWaitInQueue,
		newTimer:       time.NewTimer,
	}
}

func (l *limiter) Start(ctx context.Context) bool {
	select {
	case l.running <- struct{}{}:
		return true
	default:
	}

	// Slow-path.
	select {
	case l.queue <- struct{}{}:
		defer func() {
			<-l.queue
		}()
	default:
		return false
	}

	var timeout <-chan time.Time
	// if l.maxWaitInQueue is 0, timeout will stay nil which practically means wait forever.
	if l.maxWaitInQueue > 0 {
		timer := l.newTimer(l.maxWaitInQueue)
		defer timer.Stop()
		timeout = timer.C
	}

	select {
	case l.running <- struct{}{}:
		return true
	case <-timeout:
	case <-ctx.Done():
	}
	return false
}

func (l *limiter) Done() {
	<-l.running
}


text:
package com.github.jvmgo.instructions.loads;

import com.github.jvmgo.instructions.base.Index8Instruction;
import com.github.jvmgo.rtda.Frame;

public class lload extends Index8Instruction {
    @Override
    public int getOpCode() {
        return 0x16;
    }

    @Override
    public void execute(Frame frame) throws Exception {
        long val = frame.getLocalVars().getLong(index);
        frame.getOperandStack().pushLong(val);
    }
}


text:
class ConversionError(Exception):
    pass

class ConfigError(Exception):
    pass

class DomainError(Exception):
    """Represents an error trying to access a grid point outside the model domain """
    pass

class QueueError(Exception):
    """Represents an queueing system error state for a job """
    pass

class NamelistError(Exception):
    """Represents an error in the namelist settings file """
    pass

class MissingFile(Exception):
    """Represents a missing file"""
    pass

class InterpolationError(Exception):
    """Interpolation outside data domain"""
    pass


text:
const {Scene, Rect} = spritejs;
const container = document.getElementById('stage');
const scene = new Scene({
  container,
  width: 1200,
  height: 600,
  // contextType: '2d',
});
const layer = scene.layer();

const rect = new Rect({
  normalize: true,
  pos: [600, 300],
  size: [300, 300],
  fillColor: 'red',
});
layer.append(rect);


text:
#include "stdafx.h"

#include <d3d9.h>
#include <d3dx9.h>

#include "../ComObject.h"
#include "../Utilities.h"

#include "Direct3D9Exception.h"

#include "Device.h"
#include "Resource.h"

#include "Surface.h"
#include "Volume.h"
#include "Texture.h"
#include "VolumeTexture.h"
#include "CubeTexture.h"
#include "VertexBuffer.h"
#include "IndexBuffer.h"

using namespace System;

namespace SlimDX
{
namespace Direct3D9
{
	Resource^ Resource::FromPointer( System::IntPtr pointer )
	{
		if( pointer == System::IntPtr::Zero )
			throw gcnew System::ArgumentNullException( "pointer" );

		Resource^ tableEntry = safe_cast<Resource^>( SlimDX::ObjectTable::Find( static_cast<System::IntPtr>( pointer ) ) );
		if( tableEntry != nullptr )
		{
			return tableEntry;
		}

		void* result = 0;
		IUnknown* unknown = static_cast<IUnknown*>( pointer.ToPointer() );
		HRESULT hr = unknown->QueryInterface(IID_IDirect3DResource9, &result);
		if( FAILED( hr ) )
			throw gcnew InvalidCastException( "Failed to QueryInterface on user-supplied pointer." );

		//find out what this thing actually is
		IDirect3DResource9* resource = static_cast<IDirect3DResource9*>( unknown );
		D3DRESOURCETYPE type = resource->GetType();
		resource->Release();

		//chain to the correct ctor (not the fastest way to do this, but good enough for now)
		switch(type)
		{
		case D3DRTYPE_SURFACE:
			return Surface::FromPointer( pointer );
		case D3DRTYPE_VOLUME:
			return Volume::FromPointer( pointer );
		case D3DRTYPE_TEXTURE:
			return Texture::FromPointer( pointer );
		case D3DRTYPE_VOLUMETEXTURE:
			return VolumeTexture::FromPointer( pointer );
		case D3DRTYPE_CUBETEXTURE:
			return CubeTexture::FromPointer( pointer );
		case D3DRTYPE_VERTEXBUFFER:
			return VertexBuffer::FromPointer( pointer );
		case D3DRTYPE_INDEXBUFFER:
			return IndexBuffer::FromPointer( pointer );

		default:
			throw gcnew InvalidCastException( "Unrecognized resource type." );
		}
	}

	SlimDX::Direct3D9::Device^ Resource::Device::get()
	{
		IDirect3DDevice9* device;
		HRESULT hr = InternalPointer->GetDevice( &device );

		if( RECORD_D3D9( hr ).IsFailure )
			return nullptr;

		return SlimDX::Direct3D9::Device::FromPointer( device );
	}

	void Resource::Preload()
	{
		InternalPointer->PreLoad();
	}

	System::String^ Resource::DebugName::get()
	{
		char name[1024];
		DWORD size = sizeof(name) - 1;

		if (FAILED(InternalPointer->GetPrivateData(WKPDID_D3DDebugObjectName, &name[0], &size)))
			return "";

		name[size] = 0;
		return gcnew System::String(name);
	}

	void Resource::DebugName::set(System::String^ value)
	{
		if (!String::IsNullOrEmpty(value))
		{
			array<Byte>^ valueBytes = System::Text::ASCIIEncoding::ASCII->GetBytes(value);
			pin_ptr<Byte> pinnedValue = &valueBytes[0];

			InternalPointer->SetPrivateData(WKPDID_D3DDebugObjectName, pinnedValue, value->Length, 0);
		}
		else
		{
			InternalPointer->SetPrivateData(WKPDID_D3DDebugObjectName, 0, 0, 0);
		}
	}

	generic<typename T> where T : value class
	Result Resource::SetPrivateData(Guid guid, T data)
	{
		HRESULT hr = InternalPointer->SetPrivateData(Utilities::ConvertManagedGuid(guid), &data, sizeof(T), 0);
		return RECORD_D3D9(hr);
	}

	generic<typename T> where T : value class
	T Resource::GetPrivateData(Guid guid)
	{
		T result;
		DWORD size = sizeof(T);

		HRESULT hr = InternalPointer->GetPrivateData(Utilities::ConvertManagedGuid(guid), &result, &size);
		RECORD_D3D9(hr);

		return result;
	}
}
}


text:
import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { LoginComponent } from './components/login/login.component';

// Guards
import { LoginGuard } from './components/login/login.guard.component';
import { AuthGuard } from './utils/authGuard.component';

// Route Configuration
export const routes: Routes = [
  { path: '', component: LoginComponent, canActivate: [LoginGuard]},
  { path: 'login', component: LoginComponent, canActivate: [LoginGuard]},
  // Lazy loading Admin module
  { path: 'admin', loadChildren: 'app/modules/admin/admin.module#AdminModule', canActivate: [AuthGuard], data: {roles: ['admin']}},
  { path: 'home', loadChildren: 'app/modules/home/home.module#HomeModule', canActivate: [AuthGuard], data: {roles:  ['customer']}},
  { path: 'staff', loadChildren: 'app/modules/staff/staff.module#StaffModule', canActivate: [AuthGuard], data: {roles:  ['staff']}},
  // otherwise redirect to login
  { path: '**', redirectTo: '/' }
];

// Export
export const Routing: ModuleWithProviders = RouterModule.forRoot(routes);


text: Template for SQL like FreeMarker for HTML


text:
@if(\Illuminate\Support\Facades\Route::current()->getName() == 'training.edit')
    {{ Form::model($training->toArray() + $positions->toArray(), ['action' => ['TrainingController@update', $training->id], 'method' => 'PUT']) }}
@else
    {{ Form::model($training->toArray() + $positions->toArray(), ['action' => ['TrainingController@store', $training->id]]) }}
@endif

has('date') ? 'has-error' : ''}}">

                    {{ Form::label('date', 'Von:') }}
                    {{ Form::text('date', old('date', !empty($training->date) ? $training->date->format('d m Y H:i') : ''), ['id' => 'date-start', 'class' => 'date-start form-control', 'placeholder'=>'Datum auswählen...', 'required'=>"true"]) }}
                    {!! $errors->first('date', '
:message
') !!}

has('dateEnd') ? 'has-error' : ''}}">

                    {{ Form::label('dateEnd', 'Bis:') }}
                    {{ Form::text('dateEnd', old('dateEnd', !empty($training->dateEnd) ? $training->dateEnd->format('d m Y H:i') : ''), ['id' => 'date-end', 'class' => 'date-end form-control', 'placeholder'=>'Datum auswählen...']) }}
                    {!! $errors->first('dateEnd', '
:message
') !!}

has('title') ? 'has-error' : ''}}">

                    {{ Form::label('title', 'Titel:') }}
                    {{ Form::text('title', old('title'), ['placeholder' => "Titel...", 'class' => 'form-control no-resize', 'required'=>"true"]) }}
                    {!! $errors->first('title', '
:message
') !!}

has('content') ? 'has-error' : ''}}">

                    {{ Form::textarea('content', old('content'), ['class' => 'form-control', 'id'=>"tinymce"]) }}
                    {!! $errors->first('content', '
:message
') !!}

has('location') ? 'has-error' : ''}}">

                    {{ Form::label('location', 'Ort (Mit Koordinaten darstellbar auf Karte):') }}
                    {{ Form::text('location', old('location', $training->location), ['id' => 'location', 'class' => 'location form-control', 'placeholder'=>'Ort eingeben...']) }}
                    {!! $errors->first('location', '
:message
') !!}

has('sendbydatetime') ? 'has-error' : ''}}">

                    {{ Form::label('sendbydatetime', 'Automatisch E-Mail versenden am (Leer = deaktiviert):') }}
                    {{ Form::text('sendbydatetime', old('sendbydatetime', !empty($training->sendbydatetime) ? $training->sendbydatetime->format('d m Y H:i') : ''), ['id' => 'sendbydatetime', 'class' => 'sendbydatetime form-control', 'placeholder'=>'Datum auswählen...']) }}
                    {!! $errors->first('sendbydatetime', '
:message
') !!}

                <button type="button" class="btn btn-danger waves-effect btn-success" id="add_qualification">add Position Hinzufügen </button>

                Qualifikation
                Kommentar
                Punkte
                Aktion

            @if(isset($positions) && $positions instanceof \Illuminate\Database\Eloquent\Collection)
                @foreach($positions as $position)

id}}" class="strikeout">

                            {{Form::hidden('position[]',$position->id)}}
                            <select class="bootstrap-select show-tick" data-live-search="true" name="qualification[]">
                                @foreach($qualifications as $qualification)
                                    <option value="{{$qualification->id}}" @if($position->qualification_id == $qualification->id) selected @endif>{{$qualification->name}}</option>
                                @endforeach
                            </select>

                            <input class="form-control" placeholder="Kommentar..." type="text" value="{{$position->comment}}" name="position_comment[]" >

                            <input class="form-control" placeholder="Punkte..." type="number" step="0.01" name="credit[]" required="" aria-required="true" aria-invalid="true" value="{{$position->getCredit->points}}">

                            <button type="button" class="btn btn-danger waves-effect btn-delete delete_position">
                                delete
                            </button>

                @endforeach
            @endif

            {{ Form::button('Speichern', ['class' => 'form-control btn btn-success waves-effect', 'type' => "submit"]) }}

{{ Form::close() }}

@section('post_body')

@endsection


text:
namespace rdo { namespace gui { namespace editor {

// --------------------------------------------------------------------------------
// -------------------- ParserStyle
// --------------------------------------------------------------------------------
class ParserStyle: public EditStyle
{
public:
    ParserStyle();
    ~ParserStyle();

    ParserStyle& operator =(const ParserStyle& style);
    bool operator ==(const ParserStyle& style) const;
    bool operator !=(const ParserStyle& style) const;

    virtual bool styleDefault(const int styleType) const;
    virtual bool styleUsing(const int styleType) const;
    virtual bool styleBold(const int styleType = STYLE_DEFAULT) const;
    virtual bool styleItalic(const int styleType = STYLE_DEFAULT) const;
    virtual std::string styleFGColorToHEX(const int styleType = STYLE_DEFAULT) const;

    static ParserStyle getDefaultStyle();
    static ParserStyle getCppStyle();
    static ParserStyle getPascalStyle();
    static ParserStyle getHtmlStyle();
    static ParserStyle getClassicStyle();
    static ParserStyle getTwilightStyle();
    static ParserStyle getOceanStyle();

    QColor identifierColor;
    QColor keywordColor;
    QColor functionsColor;
    QColor traceColor;
    QColor colorColor;
    QColor commentColor;
    QColor numberColor;
    QColor stringColor;
    QColor operatorColor;

    style::StyleFont::Style identifierStyle;
    style::StyleFont::Style keywordStyle;
    style::StyleFont::Style functionsStyle;
    style::StyleFont::Style traceStyle;
    style::StyleFont::Style colorStyle;
    style::StyleFont::Style commentStyle;
    style::StyleFont::Style numberStyle;
    style::StyleFont::Style stringStyle;
    style::StyleFont::Style operatorStyle;
};

QSettings& operator<< (QSettings& settings, const ParserStyle& style);
QSettings& operator>> (QSettings& settings,       ParserStyle& style);

}}} // namespace rdo::gui::editor


text:
//
// Taken from PodSleuth (http://git.gnome.org/cgit/podsleuth)
//
// Author:
//       Aaron Bockover <abockover@novell.com>
//
// Copyright (c) 2007-2009 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using System.Collections;

namespace Cocos2D
{
	public abstract class PlistObjectBase
	{
		public abstract void Write (System.Xml.XmlWriter writer);

		protected static PlistObjectBase ObjectToPlistObject (object value)
		{
			if (value is string) {
				return new PlistString ((string)value);
			} else if (value is bool) {
				return new PlistBoolean ((bool)value);
			} else if (value is double) {
				return new PlistReal ((float)value);
			} else if (value is int) {
				return new PlistInteger ((int)value);
			} else if (value is IEnumerable) {
				return new PlistArray ((IEnumerable)value);
			} else if (value is IDictionary) {
				return new PlistDictionary ((IDictionary)value);
			}

			throw new InvalidCastException (String.Format ("`{0}' cannot be converted to a PlistObjectBase", value.GetType ()));
		}

		public static implicit operator PlistObjectBase (string value)
		{
			return new PlistString (value);
		}

		public static implicit operator PlistObjectBase (int value)
		{
			return new PlistInteger (value);
		}

		public static implicit operator PlistObjectBase (float value)
		{
			return new PlistReal (value);
		}

		public static implicit operator PlistObjectBase (bool value)
		{
			return new PlistBoolean (value);
		}

		public static implicit operator PlistObjectBase (object[] value)
		{
			return new PlistArray (value);
		}
        /*
        public static implicit operator PlistObjectBase(ArrayList value)
		{
			return new PlistArray (value);
		}

		public static implicit operator PlistObjectBase (Hashtable value)
		{
			return new PlistDictionary (value);
		}
        */

        public abstract byte[] AsBinary { get; }
	    public abstract int AsInt { get; }
        public abstract float AsFloat { get; }
        public abstract string AsString { get; }
        public abstract DateTime AsDate { get; }
        public abstract bool AsBool { get; }
        public abstract PlistArray AsArray { get; }
        public abstract PlistDictionary AsDictionary { get; }
	}
}


text:
using System.Collections.Generic;
using System.Linq;
using IRunes.Models;
using IRunes.Services;
using SIS.MvcFramework;
using SIS.MvcFramework.Attributes;
using SIS.MvcFramework.Attributes.Security;
using SIS.MvcFramework.Mapping;
using SIS.MvcFramework.Result;

namespace IRunes.App.Controllers
{
    using ViewModels.Albums;

    public class AlbumsController : Controller
    {
        private readonly IAlbumService albumService;

        public AlbumsController(IAlbumService albumService)
        {
            // new is glue
            this.albumService = albumService;
        }

        [Authorize]
        public IActionResult All()
        {
            ICollection<Album> allAlbums = this.albumService.GetAllAlbums();

            if (allAlbums.Count != 0)
            {
                return this.View(allAlbums.Select(ModelMapper.ProjectTo<AlbumAllViewModel>).ToList());
            }

            return this.View(new List<AlbumAllViewModel>());
        }

        [Authorize]
        public IActionResult Create()
        {
            return this.View();
        }

        [Authorize]
        [HttpPost]
        public IActionResult Create(AlbumCreateInputModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.Redirect("/Albums/Create");
            }

            Album album = ModelMapper.ProjectTo<Album>(model);
            this.albumService.CreateAlbum(album);

            return this.Redirect("/Albums/All");
        }

        [Authorize]
        public IActionResult Details(string id)
        {
            Album albumFromDb = this.albumService.GetAlbumById(id);

            AlbumDetailsViewModel albumViewModel = ModelMapper.ProjectTo<AlbumDetailsViewModel>(albumFromDb);

            if (albumFromDb == null)
            {
                return this.Redirect("/Albums/All");
            }

            return this.View(albumViewModel);
        }
    }
}