text:
using namespace primecount;

namespace {

/// Compute the contribution of the hard special leaves using a
/// segmented sieve. Each thread processes the interval
/// [low, low + segments * segment_size[.
///
/// Note that in the Deleglise-Rivat paper it is suggested to use a
/// segment size of y. In practice however this uses too much memory
/// especially when using multi-threading. Hence we are using a
/// segment size of sqrt(z) as suggested in Xavier Gourdon's paper.
/// In primecount's implementation a segment size of sqrt(z) seems
/// ideal since slightly increasing the segment size decreases
/// performance because of cache misses and slightly decreasing the
/// segment size also decreases performance.
///
template <typename T, typename Primes, typename FactorTable>
T S2_hard_thread(T x,
                 int64_t y,
                 int64_t z,
                 int64_t c,
                 const Primes& primes,
                 const PiTable& pi,
                 const FactorTable& factor,
                 ThreadData& thread)
{
  T sum = 0;

  int64_t low = thread.low;
  int64_t low1 = max(low, 1);
  int64_t segments = thread.segments;
  int64_t segment_size = thread.segment_size;
  int64_t limit = min(low + segments * segment_size, z);
  int64_t pi_sqrty = pi[isqrt(y)];
  int64_t max_b = (limit <= y) ? pi_sqrty
      : pi[min3(isqrt(x / low1), isqrt(z), y)];
  int64_t min_b = pi[min(z / limit, primes[max_b])];
  min_b = max(c, min_b) + 1;

  if (min_b > max_b)
    return 0;

  auto phi = generate_phi(low, max_b, primes, pi);
  Sieve sieve(low, segment_size, max_b);
  thread.init_finished();

  // Segmented sieve of Eratosthenes
  for (; low < limit; low += segment_size)
  {
    // current segment [low, high[
    int64_t high = min(low + segment_size, limit);
    low1 = max(low, 1);

    // For b < min_b there are no special leaves:
    // low <= x / (primes[b] * m) < high
    sieve.pre_sieve(primes, min_b - 1, low, high);
    int64_t b = min_b;

    // For c + 1 <= b <= pi_sqrty
    // Find all special leaves in the current segment that are
    // composed of a prime and a square free number:
    // low <= x / (primes[b] * m) < high
    for (int64_t last = min(pi_sqrty, max_b); b <= last; b++)
    {
      int64_t prime = primes[b];
      T xp = x / prime;
      int64_t xp_high = min(fast_div(xp, high), y);
      int64_t min_m = max(xp_high, y / prime);
      int64_t max_m = min(fast_div(xp, low1), y);

      if (prime >= max_m)
        goto next_segment;

      min_m = factor.to_index(min_m);
      max_m = factor.to_index(max_m);

      for (int64_t m = max_m; m > min_m; m--)
      {
        // mu(m) != 0 && prime < lpf(m)
        if (prime < factor.mu_lpf(m))
        {
          int64_t xpm = fast_div64(xp, factor.to_number(m));
          int64_t stop = xpm - low;
          int64_t phi_xpm = phi[b] + sieve.count(stop);
          int64_t mu_m = factor.mu(m);
          sum -= mu_m * phi_xpm;
        }
      }

      phi[b] += sieve.get_total_count();
      sieve.cross_off_count(prime, b);
    }

    // For pi_sqrty < b <= pi_sqrtz
    // Find all special leaves in the current segment
    // that are composed of 2 primes:
    // low <= x / (primes[b] * primes[l]) < high
    for (; b <= max_b; b++)
    {
      int64_t prime = primes[b];
      T xp = x / prime;
      int64_t xp_low = min(fast_div(xp, low1), y);
      int64_t xp_high = min(fast_div(xp, high), y);
      int64_t l = pi[min(xp_low, z / prime)];
      int64_t min_hard = max(xp_high, prime);

      if (prime >= primes[l])
        goto next_segment;

      for (; primes[l] > min_hard; l--)
      {
        int64_t xpq = fast_div64(xp, primes[l]);
        int64_t stop = xpq - low;
        int64_t phi_xpq = phi[b] + sieve.count(stop);
        sum += phi_xpq;
      }

      phi[b] += sieve.get_total_count();
      sieve.cross_off_count(prime, b);
    }

    next_segment:;
  }

  return sum;
}

/// Calculate the contribution of the hard special leaves.
///
/// This is a parallel S2_hard(x, y) implementation with advanced load
/// balancing. As most special leaves tend to be in the first segments
/// we start off with a tiny segment size and one segment per thread.
/// After each iteration we dynamically increase the segment size (until
/// it reaches some limit) or the number of segments.
///
/// S2_hard(x, y) has been parallelized using an idea devised by Xavier
/// Gourdon. The idea is to make the individual threads completely
/// independent from each other so that no thread depends on values
/// calculated by another thread. The benefit of this approach is that
/// the algorithm will scale well up to a very large number of CPU
/// cores. In order to make the threads independent from each other
/// each thread needs to precompute a lookup table of phi(x, a) values
/// (this is done in S2_hard_thread(x, y)) every time the thread starts
/// a new computation.
///
template <typename T, typename Primes, typename FactorTable>
T S2_hard_OpenMP(T x,
                 int64_t y,
                 int64_t z,
                 int64_t c,
                 T s2_hard_approx,
                 const Primes& primes,
                 const FactorTable& factor,
                 int threads,
                 bool is_print)
{
  // These load balancing settings work well on my
  // dual-socket AMD EPYC 7642 server with 192 CPU cores.
  int64_t thread_threshold = 1 << 20;
  int max_threads = (int) std::pow(z, 1 / 3.7);
  threads = std::min(threads, max_threads);
  threads = ideal_num_threads(z, threads, thread_threshold);

  LoadBalancerS2 loadBalancer(x, z, s2_hard_approx, threads, is_print);
  int64_t max_prime = min(y, z / isqrt(y));
  PiTable pi(max_prime, threads);

  #pragma omp parallel num_threads(threads)
  {
    ThreadData thread;

    while (loadBalancer.get_work(thread))
    {
      // Unsigned integer division is usually slightly
      // faster than signed integer division
      using UT = typename std::make_unsigned<T>::type;

      thread.start_time();
      UT sum = S2_hard_thread((UT) x, y, z, c, primes, pi, factor, thread);
      thread.sum = (T) sum;
      thread.stop_time();
    }
  }

  T sum = (T) loadBalancer.get_sum();

  return sum;
}

} // namespace

namespace primecount {

int64_t S2_hard(int64_t x,
                int64_t y,
                int64_t z,
                int64_t c,
                int64_t s2_hard_approx,
                int threads,
                bool is_print)
{
  double time;

  if (is_print)
  {
    print("");
    print("=== S2_hard(x, y) ===");
    print_vars(x, y, c, threads);
    time = get_time();
  }

  FactorTable<uint16_t> factor(y, threads);
  int64_t max_prime = min(y, z / isqrt(y));
  auto primes = generate_primes<int32_t>(max_prime);
  int64_t sum = S2_hard_OpenMP(x, y, z, c, s2_hard_approx, primes, factor, threads, is_print);

  if (is_print)
    print("S2_hard", sum, time);

  return sum;
}

#ifdef HAVE_INT128_T

int128_t S2_hard(int128_t x,
                 int64_t y,
                 int64_t z,
                 int64_t c,
                 int128_t s2_hard_approx,
                 int threads,
                 bool is_print)
{
  double time;

  if (is_print)
  {
    print("");
    print("=== S2_hard(x, y) ===");
    print_vars(x, y, c, threads);
    time = get_time();
  }

  int128_t sum;

  // uses less memory
  if (y <= FactorTable<uint16_t>::max())
  {
    FactorTable<uint16_t> factor(y, threads);
    int64_t max_prime = min(y, z / isqrt(y));
    auto primes = generate_primes<uint32_t>(max_prime);
    sum = S2_hard_OpenMP(x, y, z, c, s2_hard_approx, primes, factor, threads, is_print);
  }
  else
  {
    FactorTable<uint32_t> factor(y, threads);
    int64_t max_prime = min(y, z / isqrt(y));
    auto primes = generate_primes<int64_t>(max_prime);
    sum = S2_hard_OpenMP(x, y, z, c, s2_hard_approx, primes, factor, threads, is_print);
  }

  if (is_print)
    print("S2_hard", sum, time);

  return sum;
}

#endif

} // namespace


text:
<!DOCTYPE html>

        <title>Billbo login</title>

        <link rel="shortcut icon" href="../favicon.ico">
        <link rel="stylesheet" type="text/css" href="login/css/style.css" />
        <link rel="stylesheet" type="text/css" href="css/landing-page.css" />

        <link href="css/style.css" rel="stylesheet">

        <link href="css/bootstrap.min.css" rel="stylesheet">

        <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
        <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                BillBo

                        About

                        Features

                        Support

                         Login/SignUp

                       <form class="form-logout" role="form" style="display:none;">
                       <input type="submit" value="Logout" id="logout" class="btn btn-info btn-lg">
                    </form>

                <form class="form-2">

Login

                        Username:
                        <form name="login"><input type="text" name="id" placeholder="Username or email">

                        Password
                        <input type="password" name="pass" placeholder="Password" class="showpassword">

                        Register

                        <input type="submit" name="submit" value="Login" onClick="pasuser(this.form)">

                </form>

USER INFORMATION

                       Name
                       Account
                       Email
                       Location
                       instacheckImg
                       CreateAt
                       UpdatedAt

Do you want enter into Billbo?

                    <button type="button" class="btn btn-warning btn-lg">Click Me</button>

Copyright © Billbo Website 2015

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace SpareParts\Overseer\Tests\Assembly;

use SpareParts\Overseer\Assembly\VotingAbilityAwareAssembly;
use SpareParts\Overseer\Context\IIdentityContext;
use SpareParts\Overseer\Context\IVotingContext;
use SpareParts\Overseer\StrategyEnum;

class VotingAbilityAwareAssemblyCanVoteOnTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @test
     */
    public function canVoteOnPass()
    {
        $assembly = new VotingAbilityAwareAssembly(
            StrategyEnum::ALLOW_UNLESS_DENIED(),
            [],
            'read',
            'SomeKindOfArticle',
            IVotingContext::class
        );

        $result = $assembly->canVoteOn('read', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertTrue($result);
    }

    /**
     * @test
     */
    public function canVoteOnRejectsSubject()
    {
        $assembly = new VotingAbilityAwareAssembly(
            StrategyEnum::ALLOW_UNLESS_DENIED(),
            [],
            'read',
            'SomeKindOfArticle',
            IIdentityContext::class
        );

        $result = $assembly->canVoteOn('read', $this->prepareSubject('product'), $this->prepareContext());
        $this->assertFalse($result);
    }

    /**
     * @test
     */
    public function canVoteOnRejectsAction()
    {
        $assembly = new VotingAbilityAwareAssembly(
            StrategyEnum::ALLOW_UNLESS_DENIED(),
            [],
            'read',
            'SomeKindOfArticle',
            IVotingContext::class
        );

        $result = $assembly->canVoteOn('write', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertFalse($result);
    }

    /**
     * @test
     */
    public function canVoteOnRejectsContext()
    {
        $assembly = new VotingAbilityAwareAssembly(
            StrategyEnum::ALLOW_UNLESS_DENIED(),
            [],
            'read',
            'SomeKindOfArticle',
            IIdentityContext::class
        );

        $result = $assembly->canVoteOn('read', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertFalse($result);
    }

    /**
     * @test
     */
    public function canVoteOnWorksWithMultipleActions()
    {
        $assembly = new VotingAbilityAwareAssembly(
            StrategyEnum::ALLOW_UNLESS_DENIED(),
            [],
            ['read', 'write'],
            'SomeKindOfArticle',
            IVotingContext::class
        );

        $result = $assembly->canVoteOn('read', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertTrue($result);
        $result = $assembly->canVoteOn('write', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertTrue($result);
        $result = $assembly->canVoteOn('delete', $this->prepareSubject('category'), $this->prepareContext());
        $this->assertFalse($result);
    }

    /**
     * @param string $subject
     *
     * @return \Mockery\MockInterface|SomeKindOfArticle
     */
    private function prepareSubject($subject)
    {
        $subject = \Mockery::mock('SomeKindOfArticle');
        return $subject;
    }

    /**
     * @param mixed $id
     * @param string[] $roles
     *
     * @return \Mockery\MockInterface|IVotingContext
     */
    private function prepareContext()
    {
        $context = \Mockery::mock(IVotingContext::class);
        return $context;
    }

    public function tearDown()
    {
        \Mockery::close();
    }
}


text:
"use strict";

var assert = require('assert');
var factoryMethod = require('./{fileName}');

describe('{fileName}', function() {
    it("should exist", function() {
        assert.equal(typeof factoryMethod, 'function');
        assert.equal(typeof factoryMethod(), 'object');
    });
});


text:
<?php
/**
*
*/
namespace Fmw;

use Fmw\Connection;

class Model extends Connection{

	function __construct() {
		parent::__construct();
		$this->install();
	}
	public function install(){
		if (!is_null($data = $this->get_table_list())) {
			foreach ($data as $key => $value) {
				$this->{$value} = new Queries($value);
			}
		}
	}
}


text:
<?php

namespace App\Http\Controllers\Admin;

use App\Anmeldung;
use App\Teilnehmer;
use App\Veranstaltung;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class TeilnehmerController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('admin.teilnehmer.index', ['teilnehmer' => Veranstaltung::find(1)->Anmeldungen()]);
    }

    public function AnmeldeBtn($id)
    {
        $anmeldung = Anmeldung::find($id);
        $anmeldung->angemeldet = true;
        $anmeldung->save();
        return back()->withInput();
    }

    public function BezahltBtn($id)
    {
        $anmeldung = Anmeldung::find($id);
        $anmeldung->bezahlt = true;
        $anmeldung->save();
        return back()->withInput();
    }

    public function HelferBtn($id)
    {
        $anmeldung = Anmeldung::find($id);
        $anmeldung->helfer = true;
        $anmeldung->save();
        return back();
    }

    public function BescheinigungBtn($id)
    {
        $anmeldung = Anmeldung::find($id);
        $anmeldung->elternerklaerung = true;
        $anmeldung->save();
        return back();
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function Add()
    {
        return view('admin.teilnehmer.add');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $teilnehmer = new Teilnehmer();
        $teilnehmer->Nachname = $request->get("Nachname");
        $teilnehmer->Vorname = $request->get("Vorname");
        $teilnehmer->Alter = $request->get("Alter");
        $teilnehmer->PLZ = 27283;
        $teilnehmer->Ort = "Verden";
        $teilnehmer->Strasse = "Heisterkamp 10";
        $teilnehmer->Telefon = "0123456";
        $teilnehmer->Mobil = "0123456";
        $teilnehmer->save();
        return redirect()->intended(route('admin.teilnehmer'));
    }

    /**
     * Display the specified resource.
     *
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        return view('admin.teilnehmer.show', ['user' => $user = Teilnehmer::find($id)]);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}


text:
package com.blackboxgaming.engine.components;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Disposable;
import com.blackboxgaming.engine.managers.AssetManager;

/**
 *
 * @author Adrian
 */
public class Sound implements IComponent, Disposable {

    public final com.badlogic.gdx.audio.Sound sound;

    public Sound(com.badlogic.gdx.audio.Sound sound) {
        this.sound = sound;
    }

    public Sound(String soundName) {
        this.sound = Gdx.audio.newSound(Gdx.files.internal(AssetManager.pathToSounds + soundName));
    }

    @Override
    public void dispose() {
        sound.dispose();
    }

}


text:
<?php

namespace Linok\VideogameBundle\Event\Videogame;

use Symfony\Component\EventDispatcher\Event;

class FilterputEvent extends Event
{

    public function __construct()
    {

    }
}


text:
{% extends "_base.html" %}
{% import '_chart.html' as chart with context %}

{% set active_page = "Move %d" % move.id -%}

{% block styles %}
{{super()}}
    <link rel="stylesheet" href="{{url_for('.static', filename='css/ol.css')}}">
    <link rel="stylesheet" href="{{url_for('.static', filename='css/ol3-layerswitcher.css')}}">
    <link rel="stylesheet" href="{{url_for('.static', filename='css/map.css')}}">
{% endblock %}

{% block content %}
{{super()}}

{{macros.editable_activity(move)}}

    {% block subheader -%}{%- endblock %}

    {% if move.location_address -%}

{{move.location_raw|short_location}}

{{move.location_address}}

    {%- endif %}

      <button class="btn btn-default dropdown-toggle" type="button" id="dropdownExport" data-toggle="dropdown" aria-expanded="true">
         Export Move
      </button>

          as GPX

          as CSV

         Delete Move

                {% block table_header %}
                Time
                {% block table_header_after_time %}
                {% endblock %}
                Avg. Speed
                {% if move.speed_max %}Max. Speed	{% endif %}
                Duration
                Distance
                Avg. Temperature
                {% if move.hr_avg %}Avg. Heart Rate	{% endif %}
                {% if move.recovery_time %}Recovery	{% endif %}
                {% if move.time_to_first_fix %}First fix	{% endif %}
                {% endblock %}

                {% block table_entry %}
                {{move.date_time | date_time}}
                {% block table_entry_after_time %}
                {% endblock %}
                {{macros.kmh(move.speed_avg)}}
                {% if move.speed_max %}{{macros.kmh(move.speed_max)}}	{% endif %}
                {{move.duration | duration}}
                {{macros.format_move_distance(move, move.distance)}}
                {{macros.temperature(move.temperature_avg)}}
                {% if move.hr_avg %}{{macros.hr(move.hr_avg)}}	{% endif %}
                {% if move.recovery_time %}{{move.recovery_time | duration}}	{% endif %}
                {% if move.time_to_first_fix %}{{move.time_to_first_fix | duration}}	{% endif %}
                {% endblock %}

    {% if move.ascent or move.descent %}

                {% block ascent_descent_table_header %}
                {% if move.ascent %}Ascent	{% endif %}
                {% if move.descent %}Descent	{% endif %}
                {% if move.ascent_time %}Ascent Time	{% endif %}
                {% if move.descent_time %}Descent Time	{% endif %}
                {% if move.altitude_min_time %}Altitude Max. Time	{% endif %}
                {% if move.altitude_max_time %}Altitude Min. Time	{% endif %}
                {% endblock %}

            {% block ascent_descent_table_entry %}

                {% if move.ascent %}{{macros.format_hm(move.ascent)}}	{% endif %}
                {% if move.descent %}{{macros.format_hm(move.descent)}}	{% endif %}
                {% if move.ascent_time %}{{move.ascent_time| duration}}	{% endif %}
                {% if move.descent_time %}{{move.descent_time| duration}}	{% endif %}
                {% if move.altitude_min_time %}{{move.altitude_min_time| duration}}	{% endif %}
                {% if move.altitude_max_time %}{{move.altitude_max_time| duration}}	{% endif %}

            {% endblock %}

    {% endif %}

    {% if pauses %}

Pauses

            Start
            End
            Duration

        {% for pause in pauses %}

            {% set start = pause[0].time %}
            {% set end = pause[1].time %}
            {{macros.date_time_offset(start)}}
            {{macros.date_time_offset(end)}}
            {{(end - start) | duration}}

        {%- endfor %}

    {% endif %}

    {% block Laps %}
    {% if laps %}

Laps

            Lap
            Timestamp
            Duration
            Distance
            Type

        {%- for sample in laps -%}

            {{loop.index}}
            {{macros.date_time_offset(sample.time)}}
            {{sample.events.lap.duration | duration}}
            {{macros.format_move_distance(move, sample.events.lap.distance | float)}}
            {{sample.events.lap.type}}

        {%- endfor -%}

    {% endif %}
    {% endblock %}

    {% block events %}

Events

            Timestamp
            Event
            Data

        {%- for sample in events -%}
        {%- if not sample.events.swimming %}

            {% set event = (sample.events.keys()|list)[0] %}
            {{macros.date_time_offset(sample.time)}}
            {{event}}
            {{sample.events[event] | tojson}}

        {%- endif -%}
        {%- endfor -%}

    {% endblock %}

    {% if gps_samples %}

Map

    {% endif %}

    {% block chart_blocks %}
    {{chart.chart_block('temperature')}}
    {{chart.chart_block('altitude')}}
    {{chart.chart_block('hr')}}
        {% block speed_chart_blocks %}
        {{chart.chart_block('speed')}}
        {{chart.chart_block('speed_equidistant')}}
        {% endblock %}
    {% endblock %}

    {% block additional_information %}
    {% endblock %}

{% endblock %}

{% block scripts %}
{{super()}}

{% endblock %}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 297028 $ -->
<refentry xml:id="function.newt-clear-key-buffer" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>newt_clear_key_buffer</refname>
  <refpurpose>Discards the contents of the terminal's input buffer without
  waiting for additional input</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>void</type><methodname>newt_clear_key_buffer</methodname>
   <void/>
  </methodsynopsis>
  <para>
   Discards the contents of the terminal's input buffer without waiting for
   additional input.
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.void;
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>newt_wait_for_key</function></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
layout: post
title: Link for our final video & instructions
---

[finalvideo](https://www.youtube.com/watch?v=qWmK1KjUkKI&feature=youtu.be "Finalvideoformahimahi")

[finalinstruction](http://www.instructables.com/id/MAHI-MAHI-Lamp/ "mahimahiInstructable")

MAHI-MAHI Lamp made by Team illumination. Fin Lewis, Kate Eyles, MinJoo Bai.
MAHI-MAHI Lamp is under "Attribution-Noncommercial-ShareAlike 2.5 Generic (CC BY-NC-SA 2.5)" license same license as kerf Table lamp group.


text:
$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "")
Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan
. "$PSScriptRoot\constants.ps1"

Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
    Context "Validate parameters" {
        [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')}
        [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Credential', 'IncludeWindows', 'EnableException'
        $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
        It "Should only contain our specific parameters" {
            (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0
        }
    }
}

Describe "$commandname Integration Tests" -Tags "IntegrationTests" {

    Context "Gets SQL Server Install Date" {
        $results = Get-DbaInstanceInstallDate -SqlInstance $script:instance2
        It "Gets results" {
            $results | Should Not Be $null
        }
    }
    Context "Gets SQL Server Install Date and Windows Install Date" {
        $results = Get-DbaInstanceInstallDate -SqlInstance $script:instance2 -IncludeWindows
        It "Gets results" {
            $results | Should Not Be $null
        }
    }
}


text:
extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
  std::vector<uint8_t> uncompressed_buf(128 << 10);
  size_t uncompressed_size = uncompressed_buf.size();
  BrotliDecompressBuffer(size, data, &uncompressed_size, &uncompressed_buf[0]);
  return 0;
}


text:
module Waitress

  # The DirHandler class is an instance of +Waitress::Handler+ that is responsible
  # for loading files from the filesystem and serving them if they exist in the VHost's
  # root. It automatically handles mimetypes, evaluation and almost everything about
  # the serving process for files in the FileSystem.
  class DirHandler < Handler

    attr_accessor :priority
    attr_accessor :directory

    # Get the instance of DirHandler that will load Waitress' resources
    # such as the default 404 and index pages, as well as CSS and JS
    def self.resources_handler
      @@resources_handler ||= Waitress::DirHandler.new(Waitress::Chef.resources_http, -1000)
      @@resources_handler
    end

    # Create a new DirHandler, with the given FileSystem directory as a root
    # and priority.
    def initialize directory, priority=50
      @directory = File.absolute_path(directory)
      @priority = priority
    end

    def respond? request, vhost
      path = File.expand_path File.join("#{directory}", request.path)
      res = Waitress::Chef.find_file(path)[:result]
      path.include?(directory) && (res == :ok)
    end

    def serve request, response, client, vhost
      path = File.expand_path File.join("#{directory}", request.path)
      file = Waitress::Chef.find_file(path)[:file]
      Waitress::Chef.serve_file request, response, client, vhost, file
    end

  end
end


text:
SQLEXECUTED_FLAG_FILE="/home/vagrant/tmp/sqlexecuted"
if [[ ! -e $SQLEXECUTED_FLAG_FILE ]]; then
	find /vagrant/myserverconfigs/mysql/ -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch -u root -proot
	touch $SQLEXECUTED_FLAG_FILE
else
	echo Sql already imported. Please delete the $SQLEXECUTED_FLAG_FILE file/clean the databases to import again.
fi


text:
if(!dojo._hasResource["dijit.form.Form"]){
dojo._hasResource["dijit.form.Form"]=true;
dojo.provide("dijit.form.Form");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dijit.form._FormMixin");
dojo.declare("dijit.form.Form",[dijit._Widget,dijit._Templated,dijit.form._FormMixin],{name:"",action:"",method:"",encType:"","accept-charset":"",accept:"",target:"",templateString:"<form dojoAttachPoint='containerNode' dojoAttachEvent='onreset:_onReset,onsubmit:_onSubmit' ${!nameAttrSetting}></form>",attributeMap:dojo.delegate(dijit._Widget.prototype.attributeMap,{action:"",method:"",encType:"","accept-charset":"",accept:"",target:""}),postMixInProperties:function(){
this.nameAttrSetting=this.name?("name='"+this.name+"'"):"";
this.inherited(arguments);
},execute:function(_1){
},onExecute:function(){
},_setEncTypeAttr:function(_2){
this.encType=_2;
dojo.attr(this.domNode,"encType",_2);
if(dojo.isIE){
this.domNode.encoding=_2;
}
},postCreate:function(){
if(dojo.isIE&&this.srcNodeRef&&this.srcNodeRef.attributes){
var _3=this.srcNodeRef.attributes.getNamedItem("encType");
if(_3&&!_3.specified&&(typeof _3.value=="string")){
this.set("encType",_3.value);
}
}
this.inherited(arguments);
},reset:function(e){
var _4={returnValue:true,preventDefault:function(){
this.returnValue=false;
},stopPropagation:function(){
},currentTarget:e?e.target:this.domNode,target:e?e.target:this.domNode};
if(!(this.onReset(_4)===false)&&_4.returnValue){
this.inherited(arguments,[]);
}
},onReset:function(e){
return true;
},_onReset:function(e){
this.reset(e);
dojo.stopEvent(e);
return false;
},_onSubmit:function(e){
var fp=dijit.form.Form.prototype;
if(this.execute!=fp.execute||this.onExecute!=fp.onExecute){
dojo.deprecated("dijit.form.Form:execute()/onExecute() are deprecated. Use onSubmit() instead.","","2.0");
this.onExecute();
this.execute(this.getValues());
}
if(this.onSubmit(e)===false){
dojo.stopEvent(e);
}
},onSubmit:function(e){
return this.isValid();
},submit:function(){
if(!(this.onSubmit()===false)){
this.containerNode.submit();
}
}});
}


text:
var express = require('express');

var statuspage = require('../lib');

var app = express();

app.use(statuspage({
    page: process.env.API_STATUSPAGE_PAGEID,
    key: process.env.API_STATUSPAGE_KEY,
    failedOnError: true
}))
app.get('/', function(req, res){
    if (!req.statuspage.currentIncident) {
        res.send('No incident!');
    } else {
        res.send("Current incient: "+req.statuspage.currentIncident.name)
    }
});

app.listen(3000);


text:
from elina_auxiliary_imports import *

# ====================================================================== #
# Datatypes
# ====================================================================== #

ElinaDim = c_uint
ElinaDimPtr = POINTER(ElinaDim)
ELINA_DIM_MAX = c_uint(-1)

class ElinaDimension(Structure):
    """
    ElinaDimension ctype compatible with elina_dimension_t from elina_dimension.h.
    Datatype for specifying the dimensionality of an abstract value.

    Fields:
    -------
    intdim : c_size_t
    realdim : c_size_t

    """

    _fields_ = [('intdim', c_size_t), ('realdim', c_size_t)]

class ElinaDimchange(Structure):
    """
    ElinaDimchange ctype compatible with elina_dimchange_t from elina_dimension.h.
    Datatype for specifying change of dimension (addition or removal).

    Fields:
    -------
    dim : ElinaDimPtr
        Assumed to be an array of size intdim+realdim.
    intdim : c_size_t
        Number of integer dimensions to add/remove.
    realdim : c_size_t
        Number of real dimensions to add/remove.

    """

    _fields_ = [('dim', ElinaDimPtr), ('intdim', c_size_t), ('realdim', c_size_t)]

ElinaDimchangePtr = POINTER(ElinaDimchange)

class ElinaDimchange2(Structure):
    """
    ElinaDimchange2 ctype compatible with elina_dimchange2_t from elina_dimension.h.
    Datatype for specifying double changes of dimensions (combination of addition and then removal).
    Used by level 1 function change_environment.

    Fields:
    -------
    add : ElinaDimchangePtr
        If not NULL, specifies the adding new dimensions.
    remove : ElinaDimchangePtr
        If not NULL, specifies the removal of dimensions.

    """

    _fields_ = [('add', ElinaDimchangePtr), ('remove', ElinaDimchangePtr)]

ElinaDimchange2Ptr = POINTER(ElinaDimchange2)

class ElinaDimperm(Structure):
    """
    ElinaDimperm ctype compatible with elina_dimperm_t from elina_dimension.h.
    Datatype for permutations, representint the permutation i -> dimperm.p[i] for 0<=i<dimperm.size.

    Fields:
    -------
    dim : ElinaDimPtr
        Array assumed to be of size size.
    size : c_size_t

    """

    _fields_ = [('dim', ElinaDimPtr), ('size', c_size_t)]

ElinaDimpermPtr = POINTER(ElinaDimperm)


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>base</artifactId>
        <groupId>com.ggj.java</groupId>
        <version>0.0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>netflix</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-serialization</artifactId>
        </dependency>
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-metrics-event-stream</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.netflix.hystrix</groupId>
                    <artifactId>hystrix-serialization</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <!-- logging begin -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>
</project>


text:
package org.elasticsearch.action.admin.cluster.snapshots.restore;

import org.elasticsearch.action.Action;

/**
 * Restore snapshot action
 */
public class RestoreSnapshotAction extends Action<RestoreSnapshotResponse> {

    public static final RestoreSnapshotAction INSTANCE = new RestoreSnapshotAction();
    public static final String NAME = "cluster:admin/snapshot/restore";

    private RestoreSnapshotAction() {
        super(NAME);
    }

    @Override
    public RestoreSnapshotResponse newResponse() {
        return new RestoreSnapshotResponse();
    }
}


text:
<?php
namespace Workshop\Plugins\Plugin\Checkout\Block\Cart\Item;

class Renderer
{
    public function aroundGetProductName(
        \Magento\Checkout\Block\Cart\Item\Renderer $renderer,
        \Closure $proceed
    )
    {
        if ($renderer->getProduct()->getTypeId() == 'configurable') {
            return __('Mistery product. Click to view');
        }
        return $proceed();
    }
}


text:
FROM python:3.7-stretch
RUN touch /etc/in-docker
RUN pip install git+https://github.com/databricks-edu/build-tooling@master
RUN apt-get update && apt-get install -y less zip unzip vim nano jq
RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
RUN unzip awscli-bundle.zip
RUN ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws


text:
class Font
{
public:
    Font();
    Font(string filename, int sz);
    ~Font();

    void draw(string text);
    void use();
private:
    int sz;
    struct dtx_font* fnth;
};

#endif // FONT_H


text:
def wiki_json(name):
    name = name.strip().title()
    url = 'https://en.wikipedia.org/w/api.php?action=query&titles={0}&continue=&prop=categories&format=json'.format(name)
    return url

def categories(response):
	return response.json()["query"]["pages"].values()[0]["categories"]

def is_ambiguous(dic):
    for item in dic:
        if 'disambiguation' in item["title"]:
            return True
    return False

def is_dead(dic):
    for item in dic:
        if 'deaths' in item["title"]:
            return True
    return False

def was_born(dic):
    for item in dic:
        if 'births' in item["title"]:
            return True
    return False


text:
from PyObjCTools.TestSupport import *

import AppKit

try:
    unicode
except NameError:
    unicode = str

class TestNSTextAlternatives (TestCase):
    @min_os_level('10.8')
    def testConstants10_8(self):
        self.assertIsInstance(AppKit.NSTextAlternativesSelectedAlternativeStringNotification, unicode)

if __name__ == "__main__":
    main()


text: module.exports = 'YYYY-MM-DD';


text:
from .branch import BranchInstruction

class BranchIfSetInstruction(BranchInstruction):
    flag_name = None

    def meets_branch_condition(self, processor):
        return bool(processor.p.flags[self.flag_name])


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>Maintenance Tracker: /Users/Kalai/Desktop/classes/UIPickerActionSheet.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

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

Maintenance Tracker
    1.0

Main Page

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

File Members

 All Classes Files Functions Variables Properties

UIPickerActionSheet.h

Go to the documentation of this file.

    1 //

    2 // UIPickerActionSheet.h

    3 // Version 0.1

    4 //

    5 // This code is distributed under the terms and conditions of the MIT license.

    6 //

    7 // Copyright (c) 2013 José Enrique Bolaños Gudiño

    8 //

    9 // Permission is hereby granted, free of charge, to any person obtaining a copy

   10 // of this software and associated documentation files (the "Software"), to deal

   11 // in the Software without restriction, including without limitation the rights

   12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

   13 // copies of the Software, and to permit persons to whom the Software is

   14 // furnished to do so, subject to the following conditions:

   15 //

   16 // The above copyright notice and this permission notice shall be included in

   17 // all copies or substantial portions of the Software.

   18 //

   19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

   20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

   21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

   22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

   23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

   24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

   25 // THE SOFTWARE.

   26 //

   27

   28 #import <Foundation/Foundation.h>

   29

   30 @protocol UIPickerActionSheetDelegate;

   31

   32 @interface UIPickerActionSheet : NSObject<UIPickerViewDataSource, UIPickerViewDelegate>

   33

   34 @property (nonatomic, assign) id<UIPickerActionSheetDelegate> delegate;

   35 @property (nonatomic, strong) UIView *containerView;

   36 @property (nonatomic, strong) UIActionSheet *sheet;

   37 @property (nonatomic, strong) UIPickerView *picker;

   38 @property (nonatomic, strong) NSArray *items;

   39 @property (nonatomic, strong) id selectedItem;

   40

   41 - (id)initForView:(UIView*)aView;

   42 - (void)show:(NSArray*)aItems;

   43

   44 @end

   45

   46 @protocol UIPickerActionSheetDelegate <NSObject>

   47 @optional

   48 - (void)pickerActionSheet:(UIPickerActionSheet*)aPickerActionSheet didSelectItem:(id)aItem;

   49 - (void)pickerActionSheetDidCancel:(UIPickerActionSheet*)aPickerActionSheet;

   50 @end

classes

UIPickerActionSheet.h

Generated on Sun Jul 28 2013 17:51:22 for Maintenance Tracker by

     1.8.4


text:
<?php
	_deprecated_file( __FILE__, '3.10', 'Tribe__Events__Pro__Recurrence_Permalinks' );

	class TribeEventsPro_RecurrencePermalinks extends Tribe__Events__Pro__Recurrence_Permalinks {

	}


text:
#ifndef _MAIN_C_
#define _MAIN_C_

#include "collision.h"
#include "streaming.h"
#include "initLB.h"
#include "visualLB.h"
#include "boundary.h"
#include <stdio.h>

int main(int argc, char *argv[]){
	double *collideField = NULL;
	double *streamField = NULL;
	int *flagField = NULL;
	int xlength = 0;
	double tau = 0.0;
	double velocityWall[3] = {0};
	int timesteps = 0;
	int timestepsPerPlotting = 0;
	int t = 0;
	int readParamError = 0;
	const char *szProblem = "data_CFD_Assignment_02";

	readParamError = readParameters(&xlength, &tau, velocityWall, &timesteps, &timestepsPerPlotting, argc, argv);
	if(readParamError != 0)
	{
		printf("Please provide only one argument to the program; the path to the input file.");
		return -1;
	}

	/* Initialize pointers according to the D3Q19 discretization scheme */
	collideField 	= malloc(19*(xlength+2)*(xlength+2)*(xlength+2)*sizeof(*collideField));
	streamField 	= malloc(19*(xlength+2)*(xlength+2)*(xlength+2)*sizeof(*streamField));
	flagField 		= malloc((xlength+2)*(xlength+2)*(xlength+2)*sizeof(*flagField));

	initialiseFields(collideField, streamField, flagField, xlength);

	for(t = 0; t < timesteps; t++)
	{
		double *swap = NULL;

		doStreaming(collideField, streamField, flagField, xlength);

		swap = collideField;
		collideField = streamField;
		streamField = swap;

		doCollision(collideField, flagField, &tau, xlength);

		treatBoundary(collideField, flagField, velocityWall, xlength);

		if (t % timestepsPerPlotting == 0)
		{
			writeVtkOutput(collideField, flagField, szProblem, t, xlength);
		}
	}

	/* Free heap memory */
	free(collideField);
	free(streamField);
	free(flagField);

	return 0;
}

#endif


text:
fn main() {
    let y = 0;
    //~^ ERROR unknown start of token: \u{37e}
    //~^^ HELP Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not
}


text:
#pragma once

#include <memory>

#ifndef HAS_MAKE_UNIQUE
#define HAS_MAKE_UNIQUE

namespace std {

	template <typename T, typename ... Args>
	std::unique_ptr<T> make_unique(Args&& ... args) {
		return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
	}

} // namespace std

#endif

namespace sbsmanip {

inline std::string FormatImpl(boost::format& formatter) {
    return formatter.str();
}

template<typename Head, typename... Tail>
std::string FormatImpl(boost::format& formatter, Head&& h, Tail&& ... args) {
    formatter % std::forward<Head>(h);
    return FormatImpl(formatter, std::forward<Tail>(args)...);
}

/**
* Variadic wrapper for boost.format.
*/
template<typename... Args>
std::string Format(std::string fmt, Args&& ... args) {
	boost::format message(fmt);
	try {
		return FormatImpl(message, std::forward<Args>(args)...);
	} catch (...) {}
	return std::string("[invalid format]: ") + fmt;
}

} // namespace sbsmanip


text:
<?php

namespace Backup\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;

class MysqlDump extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'backup:mysql-dump
                            {filename? : Mysql backup filename}
                            {--no-compress : Disable file compression regardless if is enabled in the configuration file. This option will be always overwrited by --compress option}
                            {--compress : Enable file compression regardless if is disabled in the configuration file. This option will always overwrite --no-compress option}
                            {--connection=mysql : Specify database connection name}
                            ';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Dump your Mysql database to a file';

    /**
     * The database connection data.
     *
     * @var array
     */
    protected $connection;

    /**
     * The path to mysql dump.
     *
     * @var string
     */
    protected $mysqldumpPath;

    /**
     * Dump file name.
     *
     * @var string
     */
    protected $filename;

    /**
     * Local disk where backups will be stored.
     *
     * @var string
     */
    protected $localDisk;

    /**
     * Local path where the backups will be stored.
     *
     * @var array
     */
    protected $localPath;

    /**
     * Determine if backup will be cloud synced.
     *
     * @var bool
     */
    protected $cloudSync;

    /**
     * Cloud disk name.
     *
     * @var string
     */
    protected $cloudDisk;

    /**
     * Cloud path where the backups will be stored.
     *
     * @var array
     */
    protected $cloudPath;

    /**
     * The path where backups will be stored.
     *
     * @var array
     */
    protected $keepLocal;

    /**
     * Determine if the file will be compressed.
     *
     * @var array
     */
    protected $isCompressionEnabled = false;

    public function __construct()
    {
        parent::__construct();

        $this->mysqldumpPath = config('backup.mysql.mysqldump_path', 'mysqldump');

        $this->localDisk = config('backup.mysql.local-storage.disk', 'local');
        $this->localPath = config('backup.mysql.local-storage.path', null);
        $this->cloudSync = config('backup.mysql.cloud-storage.enabled', false);
        $this->cloudDisk = config('backup.mysql.cloud-storage.disk', null);
        $this->cloudPath = config('backup.mysql.cloud-storage.path', null);
        $this->keepLocal = config('backup.mysql.cloud-storage.keep-local', true);
    }

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->handleOptions();
        $this->dumpDatabase();
    }

    protected function handleOptions()
    {
        $compress = $this->option('compress');
        $noCompress = $this->option('no-compress');

        $this->validateAndSetConnection($this->option('connection'));

        if ($compress) {
            $this->isCompressionEnabled = true;
        } elseif ($noCompress) {
            $this->isCompressionEnabled = false;
        } else {
            $this->isCompressionEnabled = config('backup.mysql.compress', false);
        }

        $this->setFilename();
    }

    protected function validateAndSetConnection($connection)
    {
        if (is_array($connectionData = config("database.connections.{$connection}"))) {
            if ($connectionData['driver'] == 'mysql') {
                $this->connection = [
                    'host'     => $connectionData['host'],
                    'database' => $connectionData['database'],
                    'port'     => $connectionData['port'],
                    'username' => $connectionData['username'],
                    'password' => $connectionData['password'],
                ];
            } else {
                $this->error("Connection '{$connection}' should use MySQL driver!");
                exit();
            }
        } else {
            $this->error("Connection '{$connection}' does not exists!");
            exit();
        }
    }

    protected function setFilename()
    {
        $filename = trim($this->argument('filename'));
        if (empty($filename)) {
            $filename = $this->connection['database'].'_'.\Carbon\Carbon::now()->format('YmdHis');
        }
        $filename = explode('.', $filename)[0];
        $this->filename = $filename.'.sql'.($this->isCompressionEnabled ? '.gz' : '');
    }

    protected function getFilePath()
    {
        $localPath = $this->cleanPath($this->localPath);

        return $localPath.DIRECTORY_SEPARATOR.$this->filename;
    }

    protected function getFileCloudPath()
    {
        $cloudPath = $this->cleanPath($this->cloudPath);

        return $cloudPath.DIRECTORY_SEPARATOR.$this->filename;
    }

    protected function isPathAbsolute($path)
    {
        return starts_with($path, DIRECTORY_SEPARATOR);
    }

    protected function cleanPath($path)
    {
        return ltrim(rtrim($path, DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
    }

    protected function storeDumpFile($data)
    {
        if ($this->keepLocal) {
            Storage::disk($this->localDisk)->put($this->getFilePath(), $data);
        }
        $compressionMessage = $this->isCompressionEnabled ? 'and compressed' : '';
        $this->info("Database '{$this->connection['database']}' dumped {$compressionMessage} successfully");
        if ($this->cloudSync) {
            Storage::disk($this->cloudDisk)->put($this->getFileCloudPath(), $data);
            $this->info("Database dump '{$this->filename}' synced successfully with '{$this->cloudDisk}' disk");
        }
    }

    protected function dumpDatabase()
    {
        $hostname = escapeshellarg($this->connection['host']);
        $port = $this->connection['port'];
        $database = $this->connection['database'];
        $username = escapeshellarg($this->connection['username']);
        $password = $this->connection['password'];

        $databaseArg = escapeshellarg($database);
        $portArg = !empty($port) ? '-P '.escapeshellarg($port) : '';
        $passwordArg = !empty($password) ? '-p'.escapeshellarg($password) : '';

        $dumpCommand = "{$this->mysqldumpPath} -C -h {$hostname} {$portArg} -u{$username} {$passwordArg} --single-transaction --skip-lock-tables --quick {$databaseArg}";

        exec($dumpCommand, $dumpResult, $result);

        if ($result == 0) {
            $dumpResult = implode(PHP_EOL, $dumpResult);
            $dumpResult = $this->isCompressionEnabled ? gzencode($dumpResult, 9) : $dumpResult;
            $this->storeDumpFile($dumpResult);
        } else {
            $this->error("Database '{$database}' cannot be dumped");
        }
    }
}


text:
//// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.ts]
class A<T1, T2> {
    constructor(private map: (value: T1) => T2) {

    }
}

class B extends A<number> {
    constructor() { super(value => String(value)); }
}

//// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js]
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    }
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var A = /** @class */ (function () {
    function A(map) {
        this.map = map;
    }
    return A;
}());
var B = /** @class */ (function (_super) {
    __extends(B, _super);
    function B() {
        return _super.call(this, function (value) { return String(value); }) || this;
    }
    return B;
}(A));


text:
import { expect } from 'chai';
// import R from 'ramda';

import {
  fixInvalidWords,
  generateCrosswordPattern,
} from '../../lib/crossword_utils.js';

const h = row => row.replace(/0/g, '-');
const z = row => row.replace(/\-/g, '0');
const setRow = (grid, rowNumber, row) => grid[rowNumber - 1] = row;
const getRow = (grid, rowNumber) => grid[rowNumber - 1];

describe('fixInvalidWords', () => {
  let grid;

  beforeEach(() => {
    grid = generateCrosswordPattern();
  });

  it('joins a leading invalid pattern to a valid pattern', () => {
    setRow(grid, 1, z('-111-1111-1111-'));
    expect(h(getRow(fixInvalidWords(grid), 1))).to.equal('-11111111-1111-');
  });

  it('joins a trailing invalid pattern to a valid pattern', () => {
    setRow(grid, 1, z('-111111111-111-'));
    expect(h(getRow(fixInvalidWords(grid), 1))).to.equal('-1111111111111-');
  });

  it('joins two leading invalid patterns together', () => {
    setRow(grid, 1, z('-1-111-11111'));
    expect(h(getRow(fixInvalidWords(grid), 1))).to.equal('-11111-11111');
  });

  it('joins two starting invalid patterns together', () => {
    setRow(grid, 1, z('1-111-11111'));
    expect(h(getRow(fixInvalidWords(grid), 1))).to.equal('11111-11111');
  });

  it('joins to trailing invalid patterns together', () => {
    setRow(grid, 1, z('11111-11-111'));
    expect(h(getRow(fixInvalidWords(grid), 1))).to.equal('11111-111111');
  });
});

// import {
//   adjustCenterTile,
//   generateCrosswordPattern,
//   toString,
//   validMiddleRowPatterns,
//   validWordPatterns,
// } from '../../lib/crossword_utils.js';
//
// // const forEachIndex = R.addIndex(R.forEach);
// // const indexedMap = R.addIndex(R.map);
//
// describe('generateCrosswordPattern', () => {
//   let grid;
//
//   beforeEach(() => {
//     grid = generateCrosswordPattern();
//   });
//
//   it('returns an array of 15 strings with 15 characters', () => {
//     expect(grid.length).to.equal(15);
//     grid.forEach(l => expect(l).to.be.a('String'));
//   });
//
//   it('returns values of either 1 or 0', () => {
//     grid.forEach(p => expect(p).to.match(/^[10]+$/));
//   });
//
//   it('returns different numbers each time', () => {
//     const grid1 = toString(grid);
//     const grid2 = toString(generateCrosswordPattern());
//     expect(grid1).to.not.equal(grid2);
//   });
//
//   it('returns a symmetrical grid pattern', () => {
//     const gridString = toString(grid);
//     const formerHalf = gridString.substring(0, parseInt(gridString.length / 2, 10));
//     const latterHalf = gridString.substring(parseInt(gridString.length / 2, 10) + 1);
//     expect(formerHalf).to.equal(R.reverse(latterHalf));
//   });
//
//   it('starts with a word row', () => {
//     expect(validWordPatterns).to.include(grid[0]);
//   });
//
//   it('has a valid middle row', () => {
//     const middleRow = grid[7].substring(0, 7);
//     expect(middleRow).not.to.match(/11/g);
//     expect(validMiddleRowPatterns).to.include(middleRow);
//   });
//
//   // it('returns a grid with no completely disconnected tiles', () => {
//   //   let isolatedCellFound = false;
//   //   forEachIndex((row, rowIdx) => {
//   //     forEachIndex((cell, colIdx) => {
//   //       const topCell = colIdx - 1 >= 0 ? grid[rowIdx][colIdx - 1] : 0;
//   //       const leftCell = rowIdx - 1 >= 0 ? grid[rowIdx - 1][colIdx] : 0;
//   //       const rightCell = rowIdx + 1 < 15 ? grid[rowIdx + 1][colIdx] : 0;
//   //       const bottomCell = colIdx + 1 < 15 ? grid[rowIdx][colIdx + 1] : 0;
//   //       if (bottomCell === 0 && leftCell === 0 && topCell === 0 && rightCell === 0) {
//   //         isolatedCellFound = true;
//   //       }
//   //     }, row);
//   //   }, grid);
//   //   expect(isolatedCellFound).to.equal(false);
//   // });
// });
//
// describe('adjustCenterTile', () => {
//   let grid;
//
//   beforeEach(() => {
//     grid = generateCrosswordPattern();
//   });
//
//   it('should be 1 if the sides are 0', () => {
//     grid[7] = '000000000000000';
//     expect(adjustCenterTile(grid)[7]).to.equal('000000010000000');
//   });
//
//   it('should be 0 if the sides are 1', () => {
//     grid[7] = '000000111000000';
//     expect(adjustCenterTile(grid)[7]).to.equal('000000101000000');
//   });
// });
//
// describe('validWordPatterns', () => {
//   it('should be an array', () => {
//     expect(validWordPatterns).to.be.a('Array');
//   });
//
//   it('has a length of 15 items', () => {
//     validWordPatterns.forEach(pattern => {
//       expect(pattern.length).to.equal(15);
//     });
//   });
//
//   it('should have at least one black (zero) tile', () => {
//     validWordPatterns.forEach(pattern => {
//       expect(pattern).to.include(0);
//     });
//   });
//
//   it('does not have two or more consecutive black tiles', () => {
//     validWordPatterns.forEach(pattern => {
//       expect(pattern).not.to.include('00');
//     });
//   });
//
//   it('can have a word length of at least 4 characters', () => {
//     validWordPatterns.forEach(pattern => {
//       expect(pattern).not.to.match(/^1110|01110|0111$/);
//     });
//   });
//
//   it('cannot have a word length greater than 10 characters', () => {
//     validWordPatterns.forEach(pattern => {
//       expect(pattern).not.to.match(/1{11}/);
//     });
//   });
// });


text:
package org.lwjgl.opencl;

/**
 * Native bindings to the intel_packed_yuv extension.
 *
 *
The purpose of this extension is to provide OpenCL support for packed YUV images.

 *
 *
Requires {@link CL12 CL12}.

 */
public final class INTELPackedYUV {

    /** Accepted as {@code image_channel_order} of {@code cl_image_format}. */
    public static final int
        CL_YUYV_INTEL = 0x4076,
        CL_UYVY_INTEL = 0x4077,
        CL_YVYU_INTEL = 0x4078,
        CL_VYUY_INTEL = 0x4079;

    private INTELPackedYUV() {}

}


text:
<?php

namespace Schmechel\WebsiteBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Schmechel\WebsiteBundle\Entity\Skill;
use Schmechel\WebsiteBundle\Form\SkillType;

/**
 * Skill controller.
 *
 * @Route("admin/skill")
 */
class SkillController extends Controller
{

    /**
     * Lists all Skill entities.
     *
     * @Route("/", name="skill")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('SchmechelWebsiteBundle:Skill')->findAll();

        return array(
            'entities' => $entities,
        );
    }
    /**
     * Creates a new Skill entity.
     *
     * @Route("/", name="skill_create")
     * @Method("POST")
     * @Template("SchmechelWebsiteBundle:Skill:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity = new Skill();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('skill_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Creates a form to create a Skill entity.
     *
     * @param Skill $entity The entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createCreateForm(Skill $entity)
    {
        $form = $this->createForm(new SkillType(), $entity, array(
            'action' => $this->generateUrl('skill_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Skill entity.
     *
     * @Route("/new", name="skill_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Skill();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Skill entity.
     *
     * @Route("/{id}", name="skill_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SchmechelWebsiteBundle:Skill')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Skill entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Skill entity.
     *
     * @Route("/{id}/edit", name="skill_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SchmechelWebsiteBundle:Skill')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Skill entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
    * Creates a form to edit a Skill entity.
    *
    * @param Skill $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Skill $entity)
    {
        $form = $this->createForm(new SkillType(), $entity, array(
            'action' => $this->generateUrl('skill_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
    /**
     * Edits an existing Skill entity.
     *
     * @Route("/{id}", name="skill_update")
     * @Method("PUT")
     * @Template("SchmechelWebsiteBundle:Skill:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SchmechelWebsiteBundle:Skill')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Skill entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('skill_edit', array('id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
    /**
     * Deletes a Skill entity.
     *
     * @Route("/{id}", name="skill_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('SchmechelWebsiteBundle:Skill')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Skill entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('skill'));
    }

    /**
     * Creates a form to delete a Skill entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('skill_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }
}


text:
""" Module: writer

Provide an API for storing data in a graph database, including create,
update, and delete actions on nodes and edges.

Provides:
    def create_node
    def update_node
    def delete_node
    def create_edge
    def update_edge
    def delete_edge

"""
from time import time

from model.constants import NODE_PROPERTY, EDGE_PROPERTY
from model.data import database_manager
from model.data.data_errors import DbInputError, DbWriteError

from constants import GRAPH_PROPERTY
from model.graph import GraphEdge, GraphNode, GraphInputError

# TODO: change functions and definitions to use GraphProto*

def database():
    """ Get a database from the data layer's database_manager. """
    return database_manager.database()

def create_node(prototype_node):
    """ Create a node in a graph database.

    Required:
    GraphProtoNode  prototype_node  unwritten version of GraphNode

    Returns:
    GraphNode                       newly created GraphNode

    Raises:
    GraphInputError                 bad input

    """
    graph_node = None

    try:
        # isolate the GraphProtoNode members we need
        properties = prototype_node.properties()

        # TODO: move this error checking into GraphPrototype subclasses

        # make sure callers don't usurp power over data input
        bad_properties = [
                NODE_PROPERTY.ID,
                NODE_PROPERTY.TYPE,
                GRAPH_PROPERTY.CREATED_TS,
                GRAPH_PROPERTY.UPDATED_TS,
                GRAPH_PROPERTY.DELETED_TS
                ]

        input_errors = set(bad_properties).intersection(set(properties))

        if input_errors:
            raise GraphInputError(
                    input_errors,
                    "Invalid input supplied to create_node().")

        # initialize some required properties
        current_ts = int(time())
        properties[GRAPH_PROPERTY.CREATED_TS] = current_ts
        properties[GRAPH_PROPERTY.UPDATED_TS] = current_ts
        properties[GRAPH_PROPERTY.DELETED_TS] = False

        # issue a call to the data layer
        node = database().create_node(prototype_node.type(), properties)

        graph_node = GraphNode(
                node[NODE_PROPERTY.ID],
                node[NODE_PROPERTY.TYPE],
                node[NODE_PROPERTY.PROPERTIES],
                node[NODE_PROPERTY.EDGES])

    except DbInputError as e:
        #logger.debug(e.reason)
        print e.reason
        graph_node = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print e.reason
        graph_node = None

    return graph_node

# TODO: replace new_properties with GraphProtoEdge
def update_node(node_id, new_properties):
    """ Update a node in a graph database.

    Required:
    id      node_id         id of the node to update
    dict    new_properties  dict of optional GraphNode properties

    Returns:
    GraphNode               updated GraphNode

    Raises:
    GraphInputError         bad input

    """
    graph_node = None

    try:
        # make sure callers don't usurp power over data input
        bad_properties = [
                NODE_PROPERTY.ID,
                NODE_PROPERTY.TYPE,
                GRAPH_PROPERTY.CREATED_TS,
                GRAPH_PROPERTY.UPDATED_TS,
                GRAPH_PROPERTY.DELETED_TS
                ]

        input_errors = set(bad_properties).intersection(set(new_properties))

        if input_errors:
            raise GraphInputError(
                    input_errors,
                    "Invalid input supplied to update_node().")

        # make required changes
        new_properties[GRAPH_PROPERTY.UPDATED_TS] = int(time())

        # issue a call to the data layer
        node = database().update_node(node_id, new_properties)

        graph_node = GraphNode(
                node[NODE_PROPERTY.ID],
                node[NODE_PROPERTY.TYPE],
                node[NODE_PROPERTY.PROPERTIES],
                node[NODE_PROPERTY.EDGES])

    except DbInputError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_node = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_node = None

    return graph_node

def delete_node(node_id):
    """ Delete a node in a graph database.

    Required:
    id          node_id     id of the node to update

    Returns:
    GraphNode               deleted GraphNode

    """
    graph_node = None

    try:
        # issue a call to the data layer with the required changes
        node = database().delete_node(node_id, {"deleted_ts": int(time())})

        graph_node = GraphNode(
                node[NODE_PROPERTY.ID],
                node[NODE_PROPERTY.TYPE],
                node[NODE_PROPERTY.PROPERTIES],
                node[NODE_PROPERTY.EDGES])

    except DbInputError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_node = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_node = None

    return graph_node

def create_edge(prototype_edge):
    """ Create an edge connecting two nodes in a graph database.

    Required:
    GraphProtoEdge  prototype_edge  unwritten version of GraphEdge

    Returns:
    GraphEdge                       newly created GraphEdge

    Raises:
    GraphInputError                 bad input

    """
    graph_edge = None

    try:
        properties = prototype_edge.properties()

        # make sure callers don't usurp power over data input
        bad_properties = [
                EDGE_PROPERTY.ID,
                EDGE_PROPERTY.FROM_NODE_ID,
                EDGE_PROPERTY.TO_NODE_ID,
                EDGE_PROPERTY.TYPE,
                #GRAPH_PROPERTY.IS_ONE_WAY,
                #GRAPH_PROPERTY.IS_UNIQUE,
                GRAPH_PROPERTY.CREATED_TS,
                GRAPH_PROPERTY.UPDATED_TS,
                GRAPH_PROPERTY.DELETED_TS
                ]

        input_errors = set(bad_properties).intersection(set(properties))

        if input_errors:
            raise GraphInputError(
                    input_errors,
                    "Invalid input supplied to create_edge().")

        # initialize some required properties

        #properties["is_one_way"] = is_one_way
        #properties["is_unique"] = is_unique

        current_ts = int(time())
        properties[GRAPH_PROPERTY.CREATED_TS] = current_ts
        properties[GRAPH_PROPERTY.UPDATED_TS] = current_ts
        properties[GRAPH_PROPERTY.DELETED_TS] = False

        # issue a call to the data layer
        edge = database().create_edge(
                prototype_edge.from_node_id(),
                prototype_edge.to_node_id(),
                prototype_edge.type(),
                properties)

        graph_edge = GraphEdge(
                edge[EDGE_PROPERTY.ID],
                edge[EDGE_PROPERTY.TYPE],
                edge[EDGE_PROPERTY.PROPERTIES],
                edge[EDGE_PROPERTY.FROM_NODE_ID],
                edge[EDGE_PROPERTY.TO_NODE_ID])

    except DbInputError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    return graph_edge

# TODO: replace new_properties with GraphProtoEdge
def update_edge(edge_id, new_properties):
    """ Update an edge connecting two nodes in a graph database.

    Required:
    id          edge_id         id of the edge to update
    dict        new_properties  dict of optional GraphEdge properties

    Returns:
    GraphEdge                   updated GraphEdge

    Raises:
    GraphInputError             bad input

    """
    graph_edge = None

    try:
        # make sure callers don't usurp power over data input
        bad_properties = [
                EDGE_PROPERTY.ID,
                EDGE_PROPERTY.FROM_NODE_ID,
                EDGE_PROPERTY.TO_NODE_ID,
                EDGE_PROPERTY.TYPE,
                #GRAPH_PROPERTY.IS_ONE_WAY,
                #GRAPH_PROPERTY.IS_UNIQUE,
                GRAPH_PROPERTY.CREATED_TS,
                GRAPH_PROPERTY.UPDATED_TS,
                GRAPH_PROPERTY.DELETED_TS
                ]

        input_errors = set(bad_properties).intersection(set(new_properties))

        if input_errors:
            raise GraphInputError(
                    input_errors,
                    "Invalid input supplied to update_edge().")

        # make required changes
        new_properties[GRAPH_PROPERTY.UPDATED_TS] = int(time())

        # issue a call to the data layer
        edge = database().update_edge(edge_id, new_properties)

        graph_edge = GraphEdge(
                edge[EDGE_PROPERTY.ID],
                edge[EDGE_PROPERTY.TYPE],
                edge[EDGE_PROPERTY.PROPERTIES],
                edge[EDGE_PROPERTY.FROM_NODE_ID],
                edge[EDGE_PROPERTY.TO_NODE_ID])

    except DbInputError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    return graph_edge

def delete_edge(edge_id):
    """ Delete an edge connecting two nodes in a graph database.

    Required:
    id          edge_id     id of the edge to update

    Returns:
    GraphEdge               deleted GraphEdge

    """
    graph_edge = None

    try:
        # issue a call to the data layer with the required changes
        edge = database().delete_edge(
                edge_id,
                {GRAPH_PROPERTY.DELETED_TS: int(time())})

        graph_edge = GraphEdge(
                edge[EDGE_PROPERTY.ID],
                edge[EDGE_PROPERTY.TYPE],
                edge[EDGE_PROPERTY.PROPERTIES],
                edge[EDGE_PROPERTY.FROM_NODE_ID],
                edge[EDGE_PROPERTY.TO_NODE_ID])

    except DbInputError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    except DbWriteError as e:
        #logger.debug(e.reason)
        print(e.reason)
        graph_edge = None

    return graph_edge


text:
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
import { browser, element, by, ExpectedConditions } from 'aurelia-protractor-plugin/protractor';
var PageObject_Welcome = (function () {
    function PageObject_Welcome() {
    }
    PageObject_Welcome.prototype.getGreeting = function () {
        return element(by.tagName('h2')).getText();
    };
    PageObject_Welcome.prototype.setFirstname = function (value) {
        var firstName = element(by.valueBind('firstName'));
        return firstName.clear().then(function () { return firstName.sendKeys(value); });
    };
    PageObject_Welcome.prototype.setLastname = function (value) {
        var lastName = element(by.valueBind('lastName'));
        return lastName.clear().then(function () { return lastName.sendKeys(value); });
    };
    PageObject_Welcome.prototype.getFullname = function () {
        return element(by.css('.help-block')).getText();
    };
    PageObject_Welcome.prototype.pressSubmitButton = function () {
        return element(by.css('button[type="submit"]')).click();
    };
    PageObject_Welcome.prototype.openAlertDialog = function () {
        var _this = this;
        return browser.wait(function () { return __awaiter(_this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.pressSubmitButton()];
                    case 1:
                        _a.sent();
                        return [4 /*yield*/, browser.wait(ExpectedConditions.alertIsPresent(), 5000)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/, browser.switchTo().alert().then(
                            // use alert.accept instead of alert.dismiss which results in a browser crash
                            function (alert) { alert.accept(); return true; }, function () { return false; })];
                }
            });
        }); });
    };
    return PageObject_Welcome;
}());
export { PageObject_Welcome };
//# sourceMappingURL=welcome.po.js.map


text:
require 'uri'

module Kickscraper
    class Client
        include Connection

        attr_accessor :user

        CLIENT_ID = '2II5GGBZLOOZAA5XBU1U0Y44BU57Q58L8KOGM7H0E0YFHP3KTG'

        def initialize
            @more_projects_available = false

            if Kickscraper.email.nil?
                @user = nil
            else
                if Kickscraper.token.nil?
                    token_response = connection.post("xauth/access_token?client_id=#{CLIENT_ID}", {'email' => Kickscraper.email, 'password' => Kickscraper.password }.to_json)
                    if token_response.body.error_messages
                        raise token_response.body.error_messages.join("\n")
                        return
                    end
                    Kickscraper.token = token_response.body.access_token
                    @user = User.coerce(token_response.body.user)
                end
            end
        end

        def find_user(id)
            self::process_api_call "user", id.to_s
        end

        def find_project(id_or_slug)
            self::process_api_call "project", id_or_slug.to_s
        end

        def search_projects(search_terms, page = nil, category_id = nil, state = nil)
            self::process_api_call "projects", "advanced", search_terms, page, category_id, state
        end

        def ending_soon_projects(page = nil)
            self::process_api_call "projects", "ending-soon", "", page
        end

        def popular_projects(page = nil)
            self::process_api_call "projects", "popular", "", page
        end

        def recently_launched_projects(page = nil)
            self::process_api_call "projects", "recently-launched", "", page
        end

        alias_method :newest_projects, :recently_launched_projects

        def more_projects_available?
            @more_projects_available
        end

        alias_method :can_load_more_projects, :more_projects_available?

        def load_more_projects
            if self::more_projects_available?
                self::process_api_call @last_api_call_params[:request_for], @last_api_call_params[:additional_path], @last_api_call_params[:search_terms], (@last_api_call_params[:page] + 1),  @last_api_call_params[:category_id],  @last_api_call_params[:state]
            else
                []
            end
        end

        def categories
            self::process_api_call "categories", ""
        end

        def category(id_or_name = nil)
            return categories.find{|i| i.name.downcase.start_with? id_or_name.downcase} if id_or_name.is_a? String
                self::process_api_call "category", id_or_name.to_s
        end

        def process_api_call(request_for, additional_path, search_terms = "", page = nil, category_id = nil, state = nil)

            # save the parameters for this call, so we can repeat it to get the next page of results
            @last_api_call_params = {
                request_for: request_for,
                additional_path: additional_path,
                search_terms: search_terms,
                page: page.nil? ? 1 : page,
                category_id: category_id,
                state: state
            }

            # make the api call (to the API resource we want)
            response = self::make_api_call(request_for, additional_path, search_terms, page, category_id,state)

            # handle the response, returning an object with the results
            self::coerce_api_response(request_for, response)
        end

        def process_api_url(request_for, api_url, coerce_response = true)

            # make the api call to whatever url we specified
            response = connection.get(api_url)

            # if we want to coerce the response, do it now
            if coerce_response

                self::coerce_api_response(request_for, response)

            # else, just return the raw body
            else

                response.body
            end
        end

        def coerce_api_response(expected_type, response)

            # define what we should return as an empty response, based on the expected type
            types_that_should_return_an_array = ["projects", "comments", "updates", "categories"]
            empty_response = (types_that_should_return_an_array.include? expected_type) ? [] : nil

            # get the body from the response
            body = response.body

            # if we got an error response back, stop here and return an empty response
            return empty_response if response.headers['status'].to_i >= 400 || !response.headers['content-type'].start_with?('application/json')
            return empty_response if (body.respond_to?("error_messages") && !body.error_messages.empty?) || (body.respond_to?("http_code") && body.http_code == 404)

            # otherwise, take the response from the api and coerce it to the type we want
            case expected_type.downcase
            when "user"

                User.coerce body

            when "project"

                Project.coerce body

            when "projects"

                # if the body is just an array of projects, with no root keys, then coerce
                # the array
                if body.is_a?(Array)

                    @more_projects_available = false
                    body.map { |project| Project.coerce project }

                # else, if the body doesn't have any projects, return an empty array
                elsif body.projects.nil?

                    @more_projects_available = false
                    return empty_response

                # else, determine if we can load more projects and then return an array of projects
                else

                    if @last_api_call_params && !body.total_hits.nil?
                        @more_projects_available = @last_api_call_params[:page] * 12 < body.total_hits # (there is a huge assumption here that Kickstarter will always return 12 projects per full page!) (in fact, this has changed over the years from 20 to 24 to 12)
                    end

                    return body.projects.map { |project| Project.coerce project }
                end

            when "comments"

                return empty_response if body.comments.nil?
                body.comments.map { |comment| Comment.coerce comment }

            when "updates"

                return empty_response if body.updates.nil?
                body.updates.map { |update| Update.coerce update }

            when "categories"

                return empty_response if body.categories.nil?
                body.categories.map { |category| Category.coerce category }

            when "category"

                Category.coerce body

            else
                raise ArgumentError, "invalid api request type"
            end
        end

        def make_api_call(request_for, additional_path = "", search_terms = "", page = nil, category_id = nil, state = nil)

            # set the url/path differently for each type of request
            case request_for.downcase
            when "user"
                api_or_search = "api"
                path = "/v1/users"
            when "project"
                api_or_search = "api"
                path = "/v1/projects"
            when "projects"
                api_or_search = "search"
                path = "/discover"
            when "category", "categories"
                api_or_search = "api"
                path = "/v1/categories"
            end

            # add the additional path if we have it
            path += "/" + CGI.escape(additional_path) unless additional_path.empty?

            # create the params hash and add the params we want
            params = {}
            params[:term] = search_terms unless search_terms.empty?
            params[:page] = page unless page.nil?
            params[:category_id] = category_id unless category_id.nil?
            params[:state] = state unless state.nil?
            params[:client_id] = CLIENT_ID if api_or_search == "api"

            # make the connection and return the response
            connection(api_or_search).get(path, params)
        end
    end
end


text:
#include "SDL_config.h"

#ifndef SDL_POWER_DISABLED
#if SDL_POWER_NINTENDODS

#include "SDL_power.h"

SDL_bool
SDL_GetPowerInfo_NintendoDS(SDL_PowerState * state, int *seconds,
                            int *percent)
{
    /* !!! FIXME: write me. */

    *state = SDL_POWERSTATE_UNKNOWN;
    *percent = -1;
    *seconds = -1;

    return SDL_TRUE;            /* always the definitive answer on Nintendo DS. */
}

#endif /* SDL_POWER_NINTENDODS */
#endif /* SDL_POWER_DISABLED */

/* vi: set ts=4 sw=4 expandtab: */


text:
class CTelekinesis : public CPHUpdateObject {

protected:
    using TELE_OBJECTS = xr_vector<CTelekineticObject*>;
    using TELE_OBJECTS_IT = TELE_OBJECTS::iterator;
    TELE_OBJECTS objects;
    xr_vector<CObject*> m_nearest;
    bool active;

public:
    CTelekinesis();
    virtual ~CTelekinesis();

    // allocates relevant TelekineticObject

    // àêòèâèðîâàòü îáúåêò
    virtual CTelekineticObject* activate(CPhysicsShellHolder* obj, float strength, float height,
                                         u32 max_time_keep, bool rot = true);

    // äåàêòèâèðîâàòü âñå îáúåêòû
    void deactivate();

    // clear objects (does not call release, but call switch to TS_None)
    void clear_deactivate();
    // clear
    virtual void clear();
    virtual void clear_notrelevant();
    // äåàêòèâèðîâàòü îáúåêò
    void deactivate(CPhysicsShellHolder* obj);
    void remove_object(TELE_OBJECTS_IT it);
    void remove_object(CPhysicsShellHolder* obj);
    // áðîñèòü âñå îáúåêòû â ïîçèöèþ 'target'
    void fire_all(const Fvector& target);

    // áðîñèòü îáúåêò 'obj' â ïîçèöèþ 'target' ñ ó÷åòîì êîýô ñèëû
    void fire(CPhysicsShellHolder* obj, const Fvector& target, float power);

    // áðîñèòü îáúåêò 'obj' â ïîçèöèþ 'target' ñ ó÷åòîì êîýô ñèëû
    void fire_t(CPhysicsShellHolder* obj, const Fvector& target, float time);

    // âåðíóòü àêòèâíîñòü òåëåêèíåçà
    bool is_active() const { return active; }

    // âåðíóòü àêòèâíîñòü îáúåêòà
    bool is_active_object(CPhysicsShellHolder* obj);

    // âåðíóòü êîëè÷åñòâî êîíòðîëèðóåìûõ îáúåêòîâ (â ñîñòîÿíèè TS_Raise & TS_Keep)
    u32 get_objects_count();

    // âåðíóòü êîëè÷åñòâî êîíòðîëèðóåìûõ îáúåêòîâ (âñåõ)
    u32 get_objects_total_count() { return objects.size(); }

    // âåðíóòü îáúåêò ïî èíäåêñó â ìàññèâå
    // a	copy of the object!
    CTelekineticObject get_object_by_index(u32 index) {
        VERIFY(objects.size() > index);
        return *objects[index];
    }

    // îáíîâèòü ñîñòîíÿèå íà shedule_Update
    void schedule_update();

    // îáúåêò áûë óäàëåí - óäàëèòü âñå ñâÿçè íà îáúåêò
    void remove_links(CObject* O);

protected:
    virtual CTelekineticObject* alloc_tele_object() { return xr_new<CTelekineticObject>(); }

private:
    // îáíîâëåíèå íà øàãàõ ôèçèêè
    virtual void PhDataUpdate(float step);
    virtual void PhTune(float step);
};


text:
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack import fakes

class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase):
    sample_dir = "os-assisted-volume-snapshots"

    def test_create(self):
        """Create a volume snapshots."""
        self.stub_out('nova.compute.api.API.volume_snapshot_create',
                      fakes.stub_compute_volume_snapshot_create)

        subs = {
            'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c',
            'snapshot_id': '421752a6-acf6-4b2d-bc7a-119f9148cd8c',
            'type': 'qcow2',
            'new_file': 'new_file_name'
        }

        response = self._do_post("os-assisted-volume-snapshots",
                                 "snapshot-create-assisted-req",
                                 subs)
        self._verify_response("snapshot-create-assisted-resp",
                              subs, response, 200)

    def test_snapshots_delete_assisted(self):
        self.stub_out('nova.compute.api.API.volume_snapshot_delete',
                      fakes.stub_compute_volume_snapshot_delete)

        snapshot_id = '100'
        response = self._do_delete(
                'os-assisted-volume-snapshots/%s?delete_info='
                '{"volume_id":"521752a6-acf6-4b2d-bc7a-119f9148cd8c"}'
                % snapshot_id)
        self.assertEqual(204, response.status_code)
        self.assertEqual('', response.text)