text:
using UnityEngine;
using System.Collections;
using UnityEditor;

[CanEditMultipleObjects]
[CustomEditor(typeof(AutoRotate))]
public class AutoRotateInspector : InspectorBase
{
	private string explanation = "The GameObject rotates automatically.";
	private string tip = "TIP: Use negative value to rotate in the other direction.";

	public override void OnInspectorGUI()
	{
		GUILayout.Space(10);
		EditorGUILayout.HelpBox(explanation, MessageType.Info);

		base.OnInspectorGUI();

		EditorGUILayout.HelpBox(tip, MessageType.Info);
	}
}


text:
// Copyright 2013 Square, Inc.
package retrofit.client;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Provides POJO behavior for all of the APIs {@link retrofit.client.UrlConnectionClient}
 * interacts with.
 */
public class DummyHttpUrlConnection extends HttpURLConnection {
  private final Map<String, List<String>> responseHeaders =
      new LinkedHashMap<String, List<String>>();
  private final Map<String, List<String>> requestHeaders =
      new LinkedHashMap<String, List<String>>();
  private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  private int responseCode;
  private String responseMessage;
  private InputStream inputStream;
  private InputStream errorStream;

  protected DummyHttpUrlConnection(String url) throws MalformedURLException {
    super(new URL(url));
  }

  public void setResponseCode(int responseCode) {
    this.responseCode = responseCode;
  }

  @Override public int getResponseCode() throws IOException {
    return responseCode;
  }

  public void setResponseMessage(String responseMessage) {
    this.responseMessage = responseMessage;
  }

  @Override public String getResponseMessage() throws IOException {
    return responseMessage;
  }

  @Override public ByteArrayOutputStream getOutputStream() throws IOException {
    return outputStream;
  }

  public void setInputStream(InputStream inputStream) {
    this.inputStream = inputStream;
  }

  @Override public InputStream getInputStream() throws IOException {
    return inputStream;
  }

  public void setErrorStream(InputStream errorStream) {
    this.errorStream = errorStream;
  }

  @Override public InputStream getErrorStream() {
    return errorStream;
  }

  public void addResponseHeader(String name, String value) {
    List<String> values = responseHeaders.get(name);
    if (values == null) {
      values = new ArrayList<String>();
      responseHeaders.put(name, values);
    }
    values.add(value);
  }

  @Override public Map<String, List<String>> getHeaderFields() {
    return responseHeaders;
  }

  @Override public void addRequestProperty(String name, String value) {
    List<String> values = requestHeaders.get(name);
    if (values == null) {
      values = new ArrayList<String>();
      requestHeaders.put(name, values);
    }
    values.add(value);
  }

  @Override public Map<String, List<String>> getRequestProperties() {
    return requestHeaders;
  }

  @Override public String getRequestProperty(String name) {
    List<String> values = requestHeaders.get(name);
    if (values == null || values.isEmpty()) {
      return null;
    }
    return values.get(0);
  }

  @Override public void disconnect() {
    throw new AssertionError("Not implemented.");
  }

  @Override public boolean usingProxy() {
    return false;
  }

  @Override public void connect() throws IOException {
    throw new AssertionError("Not implemented.");
  }
}

redpajama_set_name: RedPajamaGithub


text:
using System.Windows.Forms;
using System.Runtime.InteropServices;

public class Form1
{

    private void Button1_Click(object sender, EventArgs e)
    {
        SolidEdgeFramework.Application objApp = null;
        Type objType = null;
        SolidEdgeFramework.MatTable objMatTable = null;
        string strLibrary = "Materials";
        SolidEdgePart.PartDocument objDocument = null;
        string strMaterial = null;
        SolidEdgeConstants.MatTablePropIndexConstants iMatPropIndex = null;
        object varGetPropVal = null;

        try
        {
            // Get SE handle
            objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

            if (objApp == null)
            {
                // Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application");
                // Start Solid Edge
                objApp = Activator.CreateInstance(objType);
                // Make Solid Edge visible
                objApp.Visible = true;
            }

            // Get material table object handle
            objMatTable = objApp.GetMaterialTable();
            strMaterial = "Galvanized steel";
            iMatPropIndex = SolidEdgeConstants.MatTablePropIndexConstants.seYieldStress;
            varGetPropVal = 225000000.56;
            objMatTable.SetMaterialPropValueToLibrary(strMaterial, strLibrary, iMatPropIndex, varGetPropVal);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }

    }

    public Form1()
    {
    	SubscribeToEvents();
    }

	private bool EventsSubscribed = false;
	private void SubscribeToEvents()
	{
		if (EventsSubscribed)
			return;
		else
			EventsSubscribed = true;

		Button1.Click += Button1_Click;
	}

}


text:
extern "C"{
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/glu.h>
}
class Shader
{
public:
        // The program ID
        GLuint Program;
        GLuint vertex, fragment;
        // Constructor reads and builds the shader
        Shader(const GLchar* vertexSourcePath, const GLchar* fragmentSourcePath);
        // Use the program
        void Use();
        ~Shader();
};

#endif // SHADER


text:
title: Adding a Database
pageTitle: "Creating a Prisma Database Service Tutorial"
description: "Learn how to add a database to your GraphQL server. The database is powered by Prisma and connected to the server via GraphQL bindings."
question: Why is a second GraphQL API (defined by the application schema) needed in a GraphQL server architecture with Prisma?
answers: ["To increase performance of the server", "When using two APIs, the GraphQL server can be scaled better", "The Prisma API only is an interface to the database, but doesn't allow for any sort of application logic which is needed in most apps", "It is required by the GraphQL specification"]
correctAnswer: 2
---

In this section, you're going to setup Prisma along with a connected database to be used by your GraphQL server.

### Why Prisma

By now, you already understand the basic mechanics of how GraphQL servers work under the hood - surprisingly simple right? That's part of the beauty of GraphQL, that it actually only follows a few very simple rules. The strongly typed schema and the GraphQL engine that's resolving the queries inside the server are taking away major pain points commonly dealt with in API development.

So, what's then the difficulty in building GraphQL servers?

Well, in real-world applications you're likely to encounter many scenarios where implementing the resolvers can become extremely complex. Especially because GraphQL queries can be nested multiple levels deep, the implementation often becomes tricky and can easily lead to performance problems.

Most of the time, you also need to take care of many additional workflows such as authentication, authorization (permissions), pagination, filtering, realtime, integrating with 3rd-party services or legacy systems...

Typically, when implementing resolvers and connecting to the database, you have two options - both of which are not very compelling:

- Access the database directly (by writing SQL or using another NoSQL database API)
- Use an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) that provides an abstraction for your database and lets you access it directly from your programming language

The first option is problematic since dealing with SQL in resolvers is complex and quickly gets out-of-hand. Another issue is that SQL queries are commonly submitted to the database as plain _strings_. Strings don't adhere to any structure, they're just raw sequences of characters. Therefore, your tooling won't be able to help you find any issues with them or provide additional perks like autocompletion in editors. Writing SQL queries is thus tedious and error-prone.

The second option is to use an ORM which might seem like a good solution at first. However, this approach usually falls short as well. ORMs typically have the problem that they're implementing rather simple solutions for database access, which when using GraphQL won't work due to the complexities of queries and the various edge cases that can arise.

Prisma solves this problem by providing you with a convenient data access layer which is taking care of resolving queries for you. When using Prisma, you're implementing your resolvers such that they're simply forwarding incoming queries to the underlying Prisma engine which in turn resolves the query against the actual database. Thanks to the [Prisma client](https://www.prisma.io/docs/prisma-client/), this is a straightforward process where most resolvers can be implemented as simple one-liners.

### Architecture

Here's an overview of the architecture that's used when building GraphQL servers with Prisma:

![](https://imgur.com/OyIQQxF.png)

The Prisma server provides the _data access layer_ in your application architecture, making it easy for your API server to talk to the database through Prisma. The API of the Prisma server is consumed by the Prisma client inside your _API server_ implementation (similar to an ORM). The API server is what you've started building throughout the previous chapters using `graphql-yoga`.

In essence, Prisma lets you easily connect the GraphQL resolvers in your API server with your database.

### Setting up Prisma with a demo database

In this tutorial, you're going to build everything entirely from scratch! For your Prisma configuration, you're going to start with the most minimal setup that's possible.

The first thing you need to do is create two files, which you're going to put into a new directory called `prisma`.

<Instruction>

First, create the `prisma` directory and then two files called `prisma.yml` and `datamodel.prisma` by running the following commands in your terminal:

```bash(path=".../hackernews-node/")
mkdir prisma
touch prisma/prisma.yml
touch prisma/datamodel.prisma
```

</Instruction>

[`prisma.yml`](https://www.prisma.io/docs/-5cy7/) is the main configuration file for your Prisma setup. `datamodel.prisma` on the other hand contains the definition of your [datamodel](https://www.prisma.io/docs/-knul). The Prisma datamodel defines your application's _models_. Each model will be mapped to a table in the underlying database.

So far, the datamodel for your Hacker News app only contains one data type: `Link`. Because Prisma uses [GraphQL SDL](https://www.prisma.io/blog/graphql-sdl-schema-definition-language-6755bcb9ce51) for model definitions, you can basically copy the existing `Link` definition from `schema.graphql` into `datamodel.prisma`.

<Instruction>

Open `datamodel.prisma` and add the following code:

```graphql{2,3}(path=".../hackernews-node/prisma/datamodel.prisma")
type Link {
  id: ID! @unique
  createdAt: DateTime!
  description: String!
  url: String!
}
```

</Instruction>

There are two main differences compared to the previous `Link` version from `schema.graphql`.

First, you're adding the `@unique` directive to the `id: ID!` field. This directive generally tells Prisma that you never want any two `Link` elements in the database that have the same value for that field. In fact, `id: ID!` is a special field in the Prisma datamodel since Prisma will auto-generate globally unique IDs for the types that have this field.

Second, you're adding a new field called `createdAt: DateTime!`. This field is also managed by Prisma and will be read-only in the API. It stores the time for when a specific `Link` was created.

Now, let's see what you need to do with `prisma.yml`.

<Instruction>

Add the following contents to `prisma.yml`:

```graphql(path=".../hackernews-node/prisma/prisma.yml")
# The HTTP endpoint for your Prisma API
endpoint: ''

# Points to the file that contains your datamodel
datamodel: datamodel.prisma

# Specifies language & location for the generated Prisma client
generate:
  - generator: javascript-client
    output: ../src/generated/prisma-client
```

</Instruction>

To learn more about the structure of `prisma.yml`, feel free to check out the [documentation](https://www.prisma.io/docs/-5cy7#reference).

Here's a quick explanation of each property you see in that file:

- `endpoint`: The HTTP endpoint for your Prisma API.
- `datamodel`: Points to the datamodel file which is the foundation for the Prisma client API that you'll use in your API server.
- `generate`: Specifies in which language the Prisma client should be generated and where it will be located.

Before deploying the service, you need to install the Prisma CLI.

<Instruction>

To install the Prisma CLI globally with Yarn, use the following command:

```bash
yarn global add prisma
```

</Instruction>

All right, you're finally ready to deploy your Prisma datamodel and the database that comes along! 🙌 Note that for this tutorial, you'll use a free _demo database_ ([AWS Aurora](https://aws.amazon.com/de/rds/aurora/)) that's hosted in Prisma Cloud. If you want to learn more about setting up Prisma locally or with your own database, you can check the documentation [here](https://www.prisma.io/docs/-a002/).

<Instruction>

Now run [`prisma deploy`](https://www.prisma.io/docs/-xcv9/):

```bash(path=".../hackernews-node/")
prisma deploy
```

</Instruction>

The `prisma deploy` command starts an interactive process:

<Instruction>

First select the **Demo server**. When the browser opens, **register with Prisma Cloud** and go back to your terminal.

</Instruction>

<Instruction>

Then you need to select the **region** for your Demo server. Once that's done, you can just hit enter twice to use the suggested values for **service** and **stage**.

</Instruction>

> **Note**: [Prisma is open-source](https://github.com/prisma/prisma). You can deploy it with [Docker](http://docker.com/) to a cloud provider of your choice (such as Digital Ocean, AWS, Google Cloud, ...).

Once the command has finished running, the CLI writes the endpoint for the Prisma API to your `prisma.yml`. It will look similar to this: `https://eu1.prisma.sh/john-doe/hackernews-node/dev`.

The last step is to generate the Prisma client for your datamodel. The Prisma client is an auto-generated client library that lets you read and write data in your database through the Prisma API. You can generate it using the `prisma generate` command. This command reads the information from `prisma.yml` and generates the Prisma client accordingly.

<Instruction>

Run the following command in your terminal:

```bash(path=".../hackernews-node/prisma")
prisma generate
```

</Instruction>

The Prisma client is now generated and located in `hackernews-node/src/generated/prisma-client`. To use the client, you can import the `prisma` instance that's exported from the generated folder. Here's some sample code that you could use in a simple Node script:

```js(nocopy)
const { prisma } = require('./generated/prisma-client')

async function main() {

  // Create a new link
  const newLink = await prisma.createLink({
    url: 'www.prisma.io',
    description: 'Prisma replaces traditional ORMs',
  })
  console.log(`Created new link: ${newLink.url} (ID: ${newLink.id})`)

  // Read all links from the database and print them to the console
  const allLinks = await prisma.links()
  console.log(allLinks)
}

main().catch(e => console.error(e))
```

Notice that the generated directory also contains a file with TypeScript definitions (`index.d.ts`). This file is there so that your IDE (i.e. Visual Studio Code) can help you with auto-completion when reading and writing data using the Prisma client:

![](https://imgur.com/kwGNPN4.png)

In the next chapters, you will evolve the API or your GraphQL server and use the Prisma client to access the database inside your resolver functions.


text:
var gulp = require('gulp')
var exec = require('child_process').exec;

gulp.task('rjsBuild', function(cb) {
    exec('node r.js -o build.js', function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
    });

});

gulp.task('default', ['rjsBuild']);


text:
// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
//    conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
//    of conditions and the following disclaimer in the documentation and/or other
//    materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
//    used to endorse or promote products derived from this software without specific
//    prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers

#pragma once

#include <boost/program_options.hpp>
#include <boost/logic/tribool_fwd.hpp>
#include <atomic>
#include "cryptonote_basic.h"
#include "difficulty.h"
#include "math_helper.h"
#ifdef _WIN32
#include <windows.h>
#elif defined(__linux__)
#include <unistd.h>
#include <sys/resource.h>
#include <sys/times.h>
#include <time.h>
#endif

namespace cryptonote
{

  struct i_miner_handler
  {
    virtual bool handle_block_found(block& b) = 0;
    virtual bool get_block_template(block& b, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce) = 0;
  protected:
    ~i_miner_handler(){};
  };

  /************************************************************************/
  /*                                                                      */
  /************************************************************************/
  class miner
  {
  public:
    miner(i_miner_handler* phandler);
    ~miner();
    bool init(const boost::program_options::variables_map& vm, bool testnet);
    static void init_options(boost::program_options::options_description& desc);
    bool set_block_template(const block& bl, const difficulty_type& diffic, uint64_t height);
    bool on_block_chain_update();
    bool start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs, bool do_background = false, bool ignore_battery = false);
    uint64_t get_speed() const;
    uint32_t get_threads_count() const;
    void send_stop_signal();
    bool stop();
    bool is_mining() const;
    const account_public_address& get_mining_address() const;
    bool on_idle();
    void on_synchronized();
    //synchronous analog (for fast calls)
    static bool find_nonce_for_given_block(block& bl, const difficulty_type& diffic, uint64_t height);
    void pause();
    void resume();
    void do_print_hashrate(bool do_hr);
    bool get_is_background_mining_enabled() const;
    bool get_ignore_battery() const;
    uint64_t get_min_idle_seconds() const;
    bool set_min_idle_seconds(uint64_t min_idle_seconds);
    uint8_t get_idle_threshold() const;
    bool set_idle_threshold(uint8_t idle_threshold);
    uint8_t get_mining_target() const;
    bool set_mining_target(uint8_t mining_target);

    static constexpr uint8_t  BACKGROUND_MINING_DEFAULT_IDLE_THRESHOLD_PERCENTAGE       = 90;
    static constexpr uint8_t  BACKGROUND_MINING_MIN_IDLE_THRESHOLD_PERCENTAGE           = 50;
    static constexpr uint8_t  BACKGROUND_MINING_MAX_IDLE_THRESHOLD_PERCENTAGE           = 99;
    static constexpr uint16_t BACKGROUND_MINING_DEFAULT_MIN_IDLE_INTERVAL_IN_SECONDS    = 10;
    static constexpr uint16_t BACKGROUND_MINING_MIN_MIN_IDLE_INTERVAL_IN_SECONDS        = 10;
    static constexpr uint16_t BACKGROUND_MINING_MAX_MIN_IDLE_INTERVAL_IN_SECONDS        = 3600;
    static constexpr uint8_t  BACKGROUND_MINING_DEFAULT_MINING_TARGET_PERCENTAGE        = 40;
    static constexpr uint8_t  BACKGROUND_MINING_MIN_MINING_TARGET_PERCENTAGE            = 5;
    static constexpr uint8_t  BACKGROUND_MINING_MAX_MINING_TARGET_PERCENTAGE            = 50;
    static constexpr uint8_t  BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS       = 10;
    static constexpr uint64_t BACKGROUND_MINING_DEFAULT_MINER_EXTRA_SLEEP_MILLIS        = 400; // ramp up
    static constexpr uint64_t BACKGROUND_MINING_MIN_MINER_EXTRA_SLEEP_MILLIS            = 5;

  private:
    bool worker_thread();
    bool request_block_template();
    void  merge_hr();

    struct miner_config
    {
      uint64_t current_extra_message_index;

      BEGIN_KV_SERIALIZE_MAP()
        KV_SERIALIZE(current_extra_message_index)
      END_KV_SERIALIZE_MAP()
    };

    volatile uint32_t m_stop;
    epee::critical_section m_template_lock;
    block m_template;
    std::atomic<uint32_t> m_template_no;
    std::atomic<uint32_t> m_starter_nonce;
    difficulty_type m_diffic;
    uint64_t m_height;
    volatile uint32_t m_thread_index;
    volatile uint32_t m_threads_total;
    std::atomic<int32_t> m_pausers_count;
    epee::critical_section m_miners_count_lock;

    std::list<boost::thread> m_threads;
    epee::critical_section m_threads_lock;
    i_miner_handler* m_phandler;
    account_public_address m_mine_address;
    epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval;
    epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval;
    std::vector<blobdata> m_extra_messages;
    miner_config m_config;
    std::string m_config_folder_path;
    std::atomic<uint64_t> m_last_hr_merge_time;
    std::atomic<uint64_t> m_hashes;
    std::atomic<uint64_t> m_current_hash_rate;
    epee::critical_section m_last_hash_rates_lock;
    std::list<uint64_t> m_last_hash_rates;
    bool m_do_print_hashrate;
    bool m_do_mining;

    // background mining stuffs ..

    bool set_is_background_mining_enabled(bool is_background_mining_enabled);
    void set_ignore_battery(bool ignore_battery);
    bool background_worker_thread();
    std::atomic<bool> m_is_background_mining_enabled;
    bool m_ignore_battery;
    boost::mutex m_is_background_mining_enabled_mutex;
    boost::condition_variable m_is_background_mining_enabled_cond;
    std::atomic<bool> m_is_background_mining_started;
    boost::mutex m_is_background_mining_started_mutex;
    boost::condition_variable m_is_background_mining_started_cond;
    boost::thread m_background_mining_thread;
    uint64_t m_min_idle_seconds;
    uint8_t m_idle_threshold;
    uint8_t m_mining_target;
    std::atomic<uint64_t> m_miner_extra_sleep;
    static bool get_system_times(uint64_t& total_time, uint64_t& idle_time);
    static bool get_process_time(uint64_t& total_time);
    static uint8_t get_percent_of_total(uint64_t some_time, uint64_t total_time);
    static boost::logic::tribool on_battery_power();
  };
}


text:
package com.microsoft.azure.management.iotcentral.v2017_07_01_privatepreview;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Information about the SKU of the IoT Central application.
 */
public class AppSkuInfo {
    /**
     * The name of the SKU. Possible values include: 'F1', 'S1'.
     */
    @JsonProperty(value = "name", required = true)
    private AppSku name;

    /**
     * Get the name of the SKU. Possible values include: 'F1', 'S1'.
     *
     * @return the name value
     */
    public AppSku name() {
        return this.name;
    }

    /**
     * Set the name of the SKU. Possible values include: 'F1', 'S1'.
     *
     * @param name the name value to set
     * @return the AppSkuInfo object itself.
     */
    public AppSkuInfo withName(AppSku name) {
        this.name = name;
        return this;
    }

}


text:
/* PR middle-end/28473.  */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-original" } */

extern double round(double);
extern double floor(double);
extern double ceil(double);

unsigned long long test1(double x)
{
  return (unsigned long long) round(x);
}

unsigned long long test2(double x)
{
  return (unsigned long long) floor(x);
}
unsigned long long test3(double x)
{
  return (unsigned long long) ceil(x);
}

/* { dg-final { scan-tree-dump-times "__builtin_lround" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llround" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_lfloor" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llfloor" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_lceil" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "__builtin_llceil" 0 "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */


text:
@class MatchaViewController;
@class GPBAny;

@interface MatchaButtonGestureRecognizer : UIGestureRecognizer
- (id)initWithMatchaVC:(MatchaViewController *)viewRoot viewId:(int64_t)viewId protobuf:(GPBAny *)pb;
- (void)disable;
- (void)updateWithProtobuf:(GPBAny *)pb;
@end


text:
<?php

namespace Moip\Resource;

use stdClass;

/**
 * Class Holder.
 */
class Holder extends MoipResource
{
    /**
     * Address Type.
     *
     * @const string
     */
    const ADDRESS_BILLING = 'BILLING';

    /**
     * Standard country .
     *
     * @const string
     */
    const ADDRESS_COUNTRY = 'BRA';

    /**
     * Standard document type.
     *
     * @const string
     */
    const TAX_DOCUMENT = 'CPF';

    /**
     * Initialize a new instance.
     */
    public function initialize()
    {
        $this->data = new stdClass();
    }

    /**
     * Add a new address to the holder.
     *
     * @param string $type       Address type: BILLING.
     * @param string $street     Street address.
     * @param string $number     Number address.
     * @param string $district   Neighborhood address.
     * @param string $city       City address.
     * @param string $state      State address.
     * @param string $zip        The zip code billing address.
     * @param string $complement Address complement.
     * @param string $country    Country ISO-alpha3 format, BRA example.
     *
     * @return $this
     */
    public function setAddress($type, $street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)
    {
        $address = new stdClass();
        $address->street = $street;
        $address->streetNumber = $number;
        $address->complement = $complement;
        $address->district = $district;
        $address->city = $city;
        $address->state = $state;
        $address->country = $country;
        $address->zipCode = $zip;

        $this->data->billingAddress = $address;

        return $this;
    }

    /**
     * Get holder address.
     *
     * @return \stdClass Holder's address.
     */
    public function getBillingAddress()
    {
        return $this->getIfSet('billingAddress');
    }

    /**
     * Get holser fullname.
     *
     * @return string Holder's full name.
     */
    public function getFullname()
    {
        return $this->getIfSet('fullname');
    }

    /**
     * Get birth date from holder.
     *
     * @return \DateTime|null Date of birth of the credit card holder.
     */
    public function getBirthDate()
    {
        return $this->getIfSetDate('birthDate');
    }

    /**
     * Get phone area code from holder.
     *
     * @return int DDD telephone.
     */
    public function getPhoneAreaCode()
    {
        return $this->getIfSet('areaCode', $this->data->phone);
    }

    /**
     * Get phone country code from holder.
     *
     * @return int Country code.
     */
    public function getPhoneCountryCode()
    {
        return $this->getIfSet('countryCode', $this->data->phone);
    }

    /**
     * Get phone number from holder.
     *
     * @return int Telephone number.
     */
    public function getPhoneNumber()
    {
        return $this->getIfSet('number', $this->data->phone);
    }

    /**
     * Get tax document type from holder.
     *
     * @return string Type of value: CPF and CNPJ
     */
    public function getTaxDocumentType()
    {
        return $this->getIfSet('type', $this->data->taxDocument);
    }

    /**
     * Get tax document number from holder.
     *
     * @return string Document Number.
     */
    public function getTaxDocumentNumber()
    {
        return $this->getIfSet('number', $this->data->taxDocument);
    }

    /**
     * Mount the buyer structure from holder.
     *
     * @param \stdClass $response
     *
     * @return Holder information.
     */
    protected function populate(stdClass $response)
    {
        $holder = clone $this;
        $holder->data = new stdClass();
        $holder->data->fullname = $this->getIfSet('fullname', $response);
        $holder->data->phone = new stdClass();

        $phone = $this->getIfSet('phone', $response);

        $holder->data->phone->countryCode = $this->getIfSet('countryCode', $phone);
        $holder->data->phone->areaCode = $this->getIfSet('areaCode', $phone);
        $holder->data->phone->number = $this->getIfSet('number', $phone);
        $holder->data->birthDate = $this->getIfSet('birthDate', $response);
        $holder->data->taxDocument = new stdClass();
        $holder->data->taxDocument->type = $this->getIfSet('type', $this->getIfSet('taxDocument', $response));
        $holder->data->taxDocument->number = $this->getIfSet('number', $this->getIfSet('taxDocument', $response));
        $holder->data->billingAddress = $this->getIfSet('billingAddress', $response);

        return $holder;
    }

    /**
     * Set fullname from holder.
     *
     * @param string $fullname Holder's full name.
     *
     * @return $this
     */
    public function setFullname($fullname)
    {
        $this->data->fullname = $fullname;

        return $this;
    }

    /**
     * Set birth date from holder.
     *
     * @param \DateTime|string $birthDate Date of birth of the credit card holder.
     *
     * @return $this
     */
    public function setBirthDate($birthDate)
    {
        if ($birthDate instanceof \DateTime) {
            $birthDate = $birthDate->format('Y-m-d');
        }

        $this->data->birthDate = $birthDate;

        return $this;
    }

    /**
     * Set tax document from holder.
     *
     * @param string $number Document number.
     * @param string $type   Document type.
     *
     * @return $this
     */
    public function setTaxDocument($number, $type = self::TAX_DOCUMENT)
    {
        $this->data->taxDocument = new stdClass();
        $this->data->taxDocument->type = $type;
        $this->data->taxDocument->number = $number;

        return $this;
    }

    /**
     * Set phone from holder.
     *
     * @param int $areaCode    DDD telephone.
     * @param int $number      Telephone number.
     * @param int $countryCode Country code.
     *
     * @return $this
     */
    public function setPhone($areaCode, $number, $countryCode = 55)
    {
        $this->data->phone = new stdClass();
        $this->data->phone->countryCode = $countryCode;
        $this->data->phone->areaCode = $areaCode;
        $this->data->phone->number = $number;

        return $this;
    }
}


text:
class StlFile;

class GLWidget : public QGLWidget
{

    Q_OBJECT

 public:
    enum LeftMouseButtonMode
    {
        INACTIVE,
        ROTATE,
        PANNING
    };
    GLWidget(QWidget *parent = 0);
    ~GLWidget();
    QSize minimumSizeHint() const;
    QSize sizeHint() const;
    void makeObjectFromStlFile(StlFile*);
    void deleteObject();
    void setDefaultView();
    void zoomIn();
    void zoomOut();
    void setDefaultZoom();
    void setBackView();
    void setFrontView();
    void setLeftView();
    void setRightView();
    void setTopView();
    void setBottomView();
    void setTopFrontLeftView();
    bool isWireframeModeActivated() const { return wireframeMode; };
    static bool isYAxisReversed() { return GLWidget::yAxisReversed; };
    int getXRot() const { return xRot; };
    int getYRot() const { return yRot; };
    int getZRot() const { return zRot; };

 public slots:
    void setXRotation(int angle);
    void setYRotation(int angle);
    void setZRotation(int angle);
    void setXTranslation(const float distance);
    void setYTranslation(const float distance);
    void setZoomLevel(const float level);
    void setLeftMouseButtonMode(const GLWidget::LeftMouseButtonMode);
    void setWireframeMode(const bool state);
    static void setYAxisMode(const bool isReversed);

 signals:
    void xRotationChanged(const int angle) const;
    void yRotationChanged(const int angle) const;
    void zRotationChanged(const int angle) const;
    void xTranslationChanged(const float distance) const;
    void yTranslationChanged(const float distance) const;
    void zoomChanged(const float zoom);

 protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int width, int height);
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void wheelEvent(QWheelEvent *event);

 private:
    void triangle(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble,
                  GLdouble, GLdouble, GLdouble);
    void normalizeAngle(int *angle);
    void drawAxes();
    void updateCursor();
    //GLfloat panMatrix[16];
    int width, height;
    GLuint object;
    bool wireframeMode;
    LeftMouseButtonMode leftMouseButtonMode;
    int xRot, yRot, zRot;
    int xPos, yPos, zPos;
    float xTrans, yTrans, zTrans;
    float zoomFactor;
    float zoomInc;
    float defaultZoomFactor;
    static bool yAxisReversed;
    QPoint lastPos;
    QColor grey, black, purple;
};

#endif  // GLWIDGET_H


text:
namespace crashpad {
namespace internal {

namespace {

void MaybeCaptureMemoryAround(CaptureMemory::Delegate* delegate,
                              uint64_t address) {
  constexpr uint64_t non_address_offset = 0x10000;
  if (address < non_address_offset)
    return;

  const uint64_t max_address = delegate->Is64Bit() ?
      std::numeric_limits<uint64_t>::max() :
      std::numeric_limits<uint32_t>::max();
  if (address > max_address - non_address_offset)
    return;

  constexpr uint64_t kRegisterByteOffset = 128;
  const uint64_t target = address - kRegisterByteOffset;
  constexpr uint64_t size = 512;
  static_assert(kRegisterByteOffset <= size / 2,
                "negative offset too large");
  auto ranges =
      delegate->GetReadableRanges(CheckedRange<uint64_t>(target, size));
  for (const auto& range : ranges) {
    delegate->AddNewMemorySnapshot(range);
  }
}

template <class T>
void CaptureAtPointersInRange(uint8_t* buffer,
                              uint64_t buffer_size,
                              CaptureMemory::Delegate* delegate) {
  for (uint64_t address_offset = 0; address_offset < buffer_size;
       address_offset += sizeof(T)) {
    uint64_t target_address = *reinterpret_cast<T*>(&buffer[address_offset]);
    MaybeCaptureMemoryAround(delegate, target_address);
  }
}

}  // namespace

// static
void CaptureMemory::PointedToByContext(const CPUContext& context,
                                       Delegate* delegate) {
#if defined(ARCH_CPU_X86_FAMILY)
  if (context.architecture == kCPUArchitectureX86_64) {
    MaybeCaptureMemoryAround(delegate, context.x86_64->rip);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rax);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rbx);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rcx);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rdx);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rdi);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rsi);
    MaybeCaptureMemoryAround(delegate, context.x86_64->rbp);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r8);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r9);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r10);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r11);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r12);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r13);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r14);
    MaybeCaptureMemoryAround(delegate, context.x86_64->r15);
    // Note: Shadow stack region is directly captured.
  } else {
    MaybeCaptureMemoryAround(delegate, context.x86->eip);
    MaybeCaptureMemoryAround(delegate, context.x86->eax);
    MaybeCaptureMemoryAround(delegate, context.x86->ebx);
    MaybeCaptureMemoryAround(delegate, context.x86->ecx);
    MaybeCaptureMemoryAround(delegate, context.x86->edx);
    MaybeCaptureMemoryAround(delegate, context.x86->edi);
    MaybeCaptureMemoryAround(delegate, context.x86->esi);
    MaybeCaptureMemoryAround(delegate, context.x86->ebp);
  }
#elif defined(ARCH_CPU_ARM_FAMILY)
  if (context.architecture == kCPUArchitectureARM64) {
    MaybeCaptureMemoryAround(delegate, context.arm64->pc);
    for (size_t i = 0; i < std::size(context.arm64->regs); ++i) {
      MaybeCaptureMemoryAround(delegate, context.arm64->regs[i]);
    }
  } else {
    MaybeCaptureMemoryAround(delegate, context.arm->pc);
    for (size_t i = 0; i < std::size(context.arm->regs); ++i) {
      MaybeCaptureMemoryAround(delegate, context.arm->regs[i]);
    }
  }
#elif defined(ARCH_CPU_MIPS_FAMILY)
  for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
    MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
  }
#else
#error Port.
#endif
}

// static
void CaptureMemory::PointedToByMemoryRange(const MemorySnapshot& memory,
                                           Delegate* delegate) {
  if (memory.Size() == 0)
    return;

  const size_t alignment =
      delegate->Is64Bit() ? sizeof(uint64_t) : sizeof(uint32_t);
  if (memory.Address() % alignment != 0 || memory.Size() % alignment != 0) {
    LOG(ERROR) << "unaligned range";
    return;
  }

  std::unique_ptr<uint8_t[]> buffer(new uint8_t[memory.Size()]);
  if (!delegate->ReadMemory(memory.Address(), memory.Size(), buffer.get())) {
    LOG(ERROR) << "ReadMemory";
    return;
  }

  if (delegate->Is64Bit())
    CaptureAtPointersInRange<uint64_t>(buffer.get(), memory.Size(), delegate);
  else
    CaptureAtPointersInRange<uint32_t>(buffer.get(), memory.Size(), delegate);
}

}  // namespace internal
}  // namespace crashpad


text:
SYNONYM

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

#### Published in
Bot. Mater. Gerb. Bot. Inst. Komarova Akad. Nauk S. S. S. R. 18:129. 1957

#### Original name
null

### Remarks
null


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.eventhubs.generated;

import com.azure.core.util.Context;

/** Samples for EventHubs Delete. */
public final class EventHubsDeleteSamples {
    /*
     * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubDelete.json
     */
    /**
     * Sample code: EventHubDelete.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void eventHubDelete(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .eventHubs()
            .manager()
            .serviceClient()
            .getEventHubs()
            .deleteWithResponse("ArunMonocle", "sdk-Namespace-5357", "sdk-EventHub-6547", Context.NONE);
    }
}


text:
package org.jlcf.example.simplecalculator;

/**
 * @author Petros Pissias
 *
 */
public interface INumberCalculator {

	public Double doCalculation(String expression) throws Exception;

}


text:
export default {
  SET_ACCOUNT_STATUS: "ACCOUNTS.SET_ACCOUNT_STATUS",
  SET_DATA: "ACCOUNTS.SET_DATA",
  REMOVE_DATA: "ACCOUNTS.REMOVE_DATA",
  SET_FORGOT: "ACCOUNTS.SET_FORGOT",
  SET_STATE: "ACCOUNTS.SET_STATE",
  SET_ERROR: "ACCOUNTS.SET_ERROR",
  REMOVE_ERROR: "ACCOUNTS.REMOVE_ERROR",
  SET_ERRORS: "ACCOUNTS.SET_ERRORS",
  REMOVE_ERRORS: "ACCOUNTS.REMOVE_ERRORS",
  SET_SUCCESS: "ACCOUNTS.SET_SUCCESS",
  IS_AUTHORIZED: "ACCOUNTS.IS_AUTHORIZED",
  SET_PERSON: "ACCOUNTS.SET_PERSON",
  SHOW_WELCOME: "ACCOUNTS.SHOW_WELCOME",
  SET_ALTERNATE_ACCOUNTS: "ACCOUNTS.SET_ALTERNATE_ACCOUNTS",
  SET_PEOPLE_WITHOUT_ACCOUNTS: "ACCOUNTS.SET_PEOPLE_WITHOUT_ACCOUNTS",
  COMPLETE_ACCOUNT: "ACCOUNTS.COMPLETE_ACCOUNT",
  RESET_ACCOUNT: "ACCOUNTS.RESET_ACCOUNT",
};


text:
import { Injectable } from '@angular/core';
import { Http } from '@angular/http'
import {
  CanActivate, Router,
  ActivatedRouteSnapshot,
  RouterStateSnapshot,
  CanActivateChild,
  NavigationExtras,
  CanLoad, Route
} from '@angular/router';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
import { AppService } from '../app.service';

const API_LOGIN_URL = "./assets/dummy/login.json";
@Injectable()
export class LoginService {

  constructor(private http: Http,
    private appService: AppService,
    private router: Router) {
    console.info(" #LoginService# ");
  }

  login(body) {
    return this.http.get(API_LOGIN_URL, body) // TODO: change http.post
      .map(response => {
        let body = response.json();
        console.log(body);
        return body || {};
      }) // {result:OK | NG}
      .catch(this.handleError);
  }

  handleError(error) {
    console.error(error);
    return Observable.throw(error.json().error || 'Login Service error');
  }

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
    let url: string = state.url;
    console.log("### canActivate ### URL:" + url);
    return this.checkLogin(url);
  }

  canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
    console.info("### canActivateChild ### URL:" + state.url);
    return this.canActivate(route, state);
  }

  canLoad(route: Route): boolean {
    let url = `/${route.path}`;
    console.info("### canLoad ### URL:" + url);
    return this.checkLogin(url);
  }

  checkLogin(url: string): boolean {
    console.info("### checkLogin ### URL: " + url);
    if (this.appService.isLoggedIn) {
      return true;
    }
    this.appService.redirectUrl = url;
    this.router.navigate(['login']);
    return false;
  }

}


text:
#pragma once

#include "EventTarget.h"
#include "UIEvent.h"

namespace WebCore {

class Node;

class FocusEvent final : public UIEvent {
public:
    static Ref<FocusEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, RefPtr<EventTarget>&& relatedTarget)
    {
        return adoptRef(*new FocusEvent(type, canBubble, cancelable, view, detail, WTFMove(relatedTarget)));
    }

    static Ref<FocusEvent> createForBindings()
    {
        return adoptRef(*new FocusEvent);
    }

    struct Init : UIEventInit {
        RefPtr<EventTarget> relatedTarget;
    };

    static Ref<FocusEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
    {
        return adoptRef(*new FocusEvent(type, initializer, isTrusted));
    }

    EventTarget* relatedTarget() const final { return m_relatedTarget.get(); }

private:
    FocusEvent() = default;
    FocusEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int, RefPtr<EventTarget>&&);
    FocusEvent(const AtomicString& type, const Init&, IsTrusted);

    EventInterface eventInterface() const final;
    bool isFocusEvent() const final;

    void setRelatedTarget(EventTarget& relatedTarget) final { m_relatedTarget = &relatedTarget; }

    RefPtr<EventTarget> m_relatedTarget;
};

} // namespace WebCore

SPECIALIZE_TYPE_TRAITS_EVENT(FocusEvent)


text:
<?php

class ehough_epilog_handler_CouchDBHandlerTest extends ehough_epilog_TestCase
{
    public function testHandle()
    {
        $record = $this->getRecord(ehough_epilog_Logger::WARNING, 'test', array('data' => new stdClass, 'foo' => 34));

        $expected = array(
            'message' => 'test',
            'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
            'level' => ehough_epilog_Logger::WARNING,
            'level_name' => 'WARNING',
            'channel' => 'test',
            'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
            'extra' => array(),
        );

        $handler = new ehough_epilog_handler_CouchDBHandler();

        try {
            $handler->handle($record);
        } catch (RuntimeException $e) {
            $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984');
        }
    }
}


text:
<?php

/*
 * Functional tests for the forgot password screen
 */
class ForgotPasswordFunctionalTest extends TestCase
{
    /**
     * Checks that viewing the forgot password screen is not possible if logged in
     */
    public function testRedirectAndErrorIfLoggedIn()
    {
        // Check we get a redirect and error here
        $this
            ->loginTestUser()
            ->visitForgotPasswordPage()
            ->seePageIs(route('public.welcome'))
            ->seeErrorMessage(trans('public.words.forgotten.signOutFirst'));
    }

    /**
     * Checks that the user is given an easy, explicit route back to the login page
     */
    public function testRememberedPasswordAfterAllLinkExists()
    {
        $this
            ->visitForgotPasswordPage()
            ->click(trans('public.words.forgotten.rememberedAfterAll'))
            ->seePageIs(route('public.login'));
    }

    /**
     * Checks that the submission of an empty email address results in an error
     */
    public function testSubmitEmptyEmail()
    {
        $this
            ->submitEmail('')
            ->seeErrorMessage(trans('public.words.forgotten.emailRequired'));
    }

    /**
     * Test that the submission of an invalid email results in an error
     *
     * Valid means "contains exactly one @ symbol, and at least one dot in the domain part"
     */
    public function testInvalidEmail()
    {
        // No alias part
        $this->submitInvalidEmail('@example.com');

        // No domain
        $this->submitInvalidEmail('test@');

        // No valid TLD
        $this->submitInvalidEmail('test@example');

        // Too many at symbols
        $this->submitInvalidEmail('test@@example.com');

        // No at symbol
        $this->submitInvalidEmail('test+example.com');
    }

    /**
     * Test that the submission of a valid email results in a success message
     *
     * Note there is no distinction between addresses that exist and those that do not.
     * In test mode, no actual email should be sent.
     *
     * @todo Is there a Laravel feature to check that an email has been sent? Yes, http://mailcatcher.me/
     */
    public function testValidEmail()
    {
        $this
            ->submitEmail('test@example.com')
            ->seeSuccessMessage(trans('public.words.forgotten.reminderRequestReceived'));
    }

    /**
     * Submits the specified email address in the forgotten password page
     *
     * @param string $email
     * @return ForgotPasswordFunctionalTest
     */
    protected function submitEmail($email)
    {
        return $this->visitForgotPasswordPage()
            ->type($email, 'email')
            ->pressSubmit();
    }

    /**
     * Submits the specified email address and checks for an invalid error
     *
     * @param string $email
     * @return ForgotPasswordFunctionalTest
     */
    protected function submitInvalidEmail($email)
    {
        return $this
            ->submitEmail($email)
            ->seeErrorMessage(trans('public.words.forgotten.emailNotValid'));
    }

    /**
     * Visits the password reset page in a nice self-contained method
     *
     * @return ForgotPasswordFunctionalTest
     */
    protected function visitForgotPasswordPage()
    {
        return $this->visit(route('public.forgotPassword'));
    }

    /**
     * Submits the password reset form
     *
     * @return ForgotPasswordFunctionalTest
     */
    protected function pressSubmit()
    {
        return $this->press(trans('public.buttons.sendPassword'));
    }
}


text:
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Wpcc::Application.initialize!


text:
<?php declare(strict_types=1);

namespace App\Controller;

use App\Entity\User;
use App\Form\RegistrationFormType;
use App\Security\EmailVerifier;
use App\Security\BruteForceLoginFormAuthenticator;
use App\Entity\UserRepository;
use App\Security\UserChecker;
use Beelab\Recaptcha2Bundle\Recaptcha\RecaptchaException;
use Beelab\Recaptcha2Bundle\Recaptcha\RecaptchaVerifier;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface;
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;

class RegistrationController extends Controller
{
    public function __construct(private EmailVerifier $emailVerifier)
    {
    }

    #[Route(path: '/register/', name: 'register')]
    public function register(Request $request, UserPasswordHasherInterface $passwordHasher, string $mailFromEmail, string $mailFromName, RecaptchaVerifier $recaptchaVerifier): Response
    {
        if ($this->getUser()) {
            return $this->redirectToRoute('home');
        }

        $user = new User();
        $form = $this->createForm(RegistrationFormType::class, $user);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            try {
                $recaptchaVerifier->verify();
            } catch (RecaptchaException $e) {
                $this->addFlash('error', 'Invalid ReCaptcha. Please try again.');

                return $this->redirectToRoute('register');
            }

            // encode the plain password
            $user->setPassword(
                $passwordHasher->hashPassword(
                    $user,
                    $form->get('plainPassword')->getData()
                )
            );

            $user->initializeApiToken();

            $this->getEM()->persist($user);
            $this->getEM()->flush();

            // generate a signed url and email it to the user
            $this->emailVerifier->sendEmailConfirmation(
                'register_confirm_email',
                $user,
                (new TemplatedEmail())
                    ->from(new Address($mailFromEmail, $mailFromName))
                    ->to($user->getEmail())
                    ->subject('Please confirm your email')
                    ->htmlTemplate('registration/confirmation_email.html.twig')
                    ->textTemplate('registration/confirmation_email.txt.twig')
            );
            $this->addFlash('success', 'Your account has been created. Please check your email inbox to confirm the account.');

            return $this->redirectToRoute('home');
        }

        return $this->render('registration/register.html.twig', [
            'registrationForm' => $form->createView(),
        ]);
    }

    #[Route(path: '/register/verify', name: 'register_confirm_email')]
    public function confirmEmail(Request $request, UserRepository $userRepository, UserChecker $userChecker, UserAuthenticatorInterface $userAuthenticator, BruteForceLoginFormAuthenticator $authenticator): Response
    {
        $id = $request->get('id');

        if (null === $id) {
            return $this->redirectToRoute('register');
        }

        $user = $userRepository->find($id);

        if (null === $user) {
            return $this->redirectToRoute('register');
        }

        // validate email confirmation link, sets User::isVerified=true and persists
        try {
            $this->emailVerifier->handleEmailConfirmation($request, $user);
        } catch (VerifyEmailExceptionInterface $exception) {
            $this->addFlash('verify_email_error', $exception->getReason());

            return $this->redirectToRoute('register');
        }

        $this->addFlash('success', 'Your email address has been verified. You are now logged in.');

        try {
            $userChecker->checkPreAuth($user);
        } catch (AuthenticationException $e) {
            // skip authenticating if any pre-auth check does not pass
        }

        if ($response = $userAuthenticator->authenticateUser($user, $authenticator, $request)) {
            return $response;
        }

        return $this->redirectToRoute('home');
    }
}


text:
KidoZen SDK for Xamarin
========================

The KidoZen SDK for Xamarin provides libraries and code samples for
developers to build connected applications using KidoZen. This guide walks
through the steps for setting up the SDK and running the tests.

For more information [check this link](http://docs.kidozen.com/?p=3091)

##    Get Set Up

To get Your Credentials Register in [kidozen.com](http://kidozen.com).

##    Get the Xamarin SDK

Minimum requirements for using the KidoZen SDK for Xamarin are:

- Xamarin Studio 5.4
- Android SDK Version 17 or above

##    Whats new?
Passive authentication support.
For more information [check this link](http://docs.kidozen.com/?p=3087)

##    About the Unit Tests

The Unit Tests projects require your Marketplace's URL, Application's
name, User, Password, etc directly into the code. This approach will get you
running quickly, but we do not recommend it in a production application: a
malicious user could use decompiling techniques to steal your KidoZen
security credentials.

All unit tests demostrate how to access KidoZen from an application using
the following services:

- Configuration
- EMail
- File
- Initialization
- Logging
- Marketplace
- Pubsub
- Queue
- SMS
- Storage

##    To prepare the Unit Tests
##
- In the solution, open KidoZen.Core.Tests project and open the file
Constants.cs provide the values for all defined constant.
	- MarketplaceUrl: URL of the tenant's marketplece.
	- AppName: Name of the application that the tests will use
	- Provider: Name of the User Source to be used
	- User: User name that belongs to the User Source
	- Password: User's password
	- Emai: address that will be used in tests

- Build the project

- Run the the tests

##    How to Include the KidoZen SDK for Windows within an existing
##Application
##
To use KidoZen with an existing application, you have to add all the
SDK's assemblies as references for the application project. You can find the
assemblies at the ´bin´ folder.

##    Getting started with the code
##
One instance of the KZApplication object has the instances of each of the
services that you can find in the Kidozen platform (Storage, Queue, etc.)

SDK API is await/async based on all its interfaces, so it will never
block the UI.

Initialize the Application: During initialization the SDK pulls the
application configuration from KidoZen servers.

	var app = new KZApplication("https://marketplace's URL","application name");
	await app.Initialize();

Authenticate: you must provide the user name, its password and the user
source. The SDK hides all the calls needed to authenticate the user against
the selected user source and to create a security tokens to execute all the
services call. The SDK's has an internal cache to store these tokens. Each
time the token is near get expired, teh SDk will renew it on the background.

	var user = await app.Authenticate("userName", "userPassword","userSource");

Once the user is authenticated you can start using all the services:

	var tasks = app.Storage["tasks"];
	var queryResult = await tasks.Query<Task>("{}"); ...

	var queue = app.Queue["pendingDocuments"];
	var document = await queue.Dequeue<Document>(); ...

#    License
#
Copyright (c) 2013 KidoZen, inc.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
<?php

class Sloth_Carteira_ItauCarteira175 extends Sloth_Banco_Itau
{

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

        $this->indice = 175;
        $this->descricao = 'Cobrança Simples';
        $this->permite_retorno = true;
        $this->permite_remessa = false;
        $this->template_boleto = 'Sloth_Boleto_Itau';

        $this->arquivos = array(
            'retorno' => 'Sloth_Retorno_CNAB400',
            'remessa' => '',
        );
    }

    public function processarRetorno($caminho_arquivo, $evento)
    {
        if ($this->permite_retorno && array_key_exists('retorno', $this->arquivos))
        {
            $retorno = new $this->arquivos['retorno']($caminho_arquivo, $evento);
            $retorno->processar();

            return true;
        }

        return false;
    }

    public function gerarBoleto($dadosBoleto)
    {
        $boleto = new $this->template_boleto;
        if (!empty($dadosBoleto))
        {
            $dadosBoleto['carteira'] = $this->indice;
            $dadosBoleto['banco_codigo'] = $this->banco_codigo;
            $dadosBoleto['numero_moeda'] = $this->numero_moeda;
        }
        $retorno = $boleto->configurarBoleto($dadosBoleto);

        if (empty($retorno))
        {
            ob_start();
            $boleto->renderizar($this->template_path, $this->template_name);
            return ob_get_clean();
        }

        return $retorno;
    }

}


text:
package com.solium.pcd.exception;

public class CalculationException extends Exception {

    private static final long serialVersionUID = 1L;

    public CalculationException(String str) {
        super(str);
    }
}


text:
@interface TestReliableSocket : NSObject

+(void) performUnitTests;

@end


text:
A tool to extract key-value pairs by comparing (diffing) a template with an input string.

[![Build Status](https://travis-ci.org/flowxo/diffex.svg?branch=master)](https://travis-ci.org/flowxo/diffex)
[![npm version](https://badge.fury.io/js/diffex.svg)](http://badge.fury.io/js/diffex)
[![Dependency Status](https://david-dm.org/flowxo/diffex.svg)](https://david-dm.org/flowxo/diffex)
[![devDependency Status](https://david-dm.org/flowxo/diffex/dev-status.svg)](https://david-dm.org/flowxo/diffex#info=devDependencies)

## Installation

```
npm install flowxo/diffex
```

## Usage

`diffex` is initialised with a _template_, which is used as a base for the diffing.

A template is a simple string with `{{placeholder}}` values. These placeholders will be replaced with data when the template is applied to an input string.

You should define your template variables inside `{{` and `}}` curly braces. _Don't include any spaces inside the curlys, as this will prevent the extractor from working correctly._

For example, these template variables are ok:

```
{{name}}
{{first_name}}
{{last-name}}
```

whereas these are invalid:

```
{{ name }}
{{first name}}
{{ last name }}
```

Create the diffex object like so:

``` js
var do = diffex(template);
```

Once you have the diffex object, there are two methods available: `placeholders()` and `parse(input)`.

### `.placeholders()`

Parses the template and outputs all found placeholders.

Example:

``` js
var diffex = require('diffex');
var template = '{{customer}} owes £{{amount}}.';

diffex(template).placeholders();
// -> ['customer', 'amount']
```

### `.parse(input)`

Compares the _template_ with an _input_, extracting the differences and outputting as key-value pairs.

``` js
var diffex = require('diffex');
var template = '{{customer}} owes £{{amount}}.';
var input = 'Bob owes £19.'

diffex(template).parse(input);
// -> { customer: 'Bob', amount: '19' }
```

## Credit

The core diff algorithm was implemented by Neil Fraser, originally found [here](https://code.google.com/p/google-diff-match-patch/). The library is reproduced here under the Apache 2.0 license.

## License

Apache 2.0


text:
cask "xctu" do
  version "40003027_AE"
  sha256 "549aa41bca87035df7251765404a6600c0696a260a09d6d35e8e11b783d5fa0a"

  url "https://ftp1.digi.com/support/utilities/#{version}.zip"
  name "XCTU"
  desc "Configuration Platform for XBee/RF Solutions"
  homepage "https://www.digi.com/products/embedded-systems/digi-xbee-tools/xctu"

  livecheck do
    url "https://www.digi.com/support/includes/utilities.aspx?pid=3352"
    regex(/(\d+[._-]\w+)\.zip/i)
  end

  installer script: {
    executable: "#{staged_path}/xctu_installer.app/Contents/MacOS/installbuilder.sh",
    args:       ["--mode", "unattended"],
  }

  uninstall trash: "/Applications/XCTU.app"

  zap trash: [
    "~/Library/Caches/XCTU",
    "~/Library/Preferences/XCTU.plist",
    "~/Library/Saved Application State/XCTU.savedState",
  ]
end


text:
/
- (void)glkView:(GLKView*)view drawInRect:(CGRect)rect;
@end

// --------------------------------------------------------------------------------

GLKIT_EXPORT_CLASS
@interface GLKView : UIView

@property (assign) id<GLKViewDelegate> delegate;
@property (retain) EAGLContext* context;

@property (readonly) GLuint drawableWidth;
@property (readonly) GLuint drawableHeight;

@property GLKViewDrawableColorFormat drawableColorFormat;
@property GLKViewDrawableDepthFormat drawableDepthFormat;
@property GLKViewDrawableStencilFormat drawableStencilFormat;

@property BOOL enableSetNeedsDisplay;

// ----------------------------------------

- (id)initWithFrame:(CGRect)rect;
- (id)initWithCoder:(NSCoder*)coder;

- (void)layoutSubviews;

@end


text:
import javax.swing.JTextField;

/* AUTORES: JULIAN EDUARDO AVILA, DIANA LUCIA AVILA
 * CODIGOS: 1053506 - 1356358
 * FECHA: ABRIL 27 DE 2014
 * DESCRIPCION: SUDOKU
 * */

	class CustomJTextField extends JTextField
	{
		private int row;
		private int column;
		private int numero;

		public CustomJTextField(int row,int column)
		{
			super();
			this.row = row;
			this.column = column;
		}

		public int getRow()
		{
			return this.row;
		}

		public int getColumn()
		{
			return this.column;
		}

		public void setNumero(int numero)
		{
			this.numero = numero;
		}

		public int getNumero()
		{
			return this.numero;
		}
	}


text:
module SignedXml
  class SignedInfo
    include Transformable

    attr_reader :start, :signature_method

    def initialize(here)
      @start = here

      canonicalization_method = here.at_xpath('//ds:CanonicalizationMethod/@Algorithm', ds: XMLDSIG_NS).value.strip

      transforms << C14NTransform.new(canonicalization_method)

      @signature_method = here.at_xpath('//ds:SignatureMethod/@Algorithm', ds: XMLDSIG_NS).value.strip
    end
  end
end


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Class: Erubis::Main</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

          Class
          Erubis::Main

            In:

                erubis/main.rb

            Parent:

                Object

main class of command

ex.

  Main.main(ARGV)

Methods

      execute
      main
      new

Public Class methods

          main(argv=ARGV)

[Source]

# File erubis/main.rb, line 40
    def self.main(argv=ARGV)
      status = 0
      begin
        Main.new.execute(ARGV)
      rescue CommandOptionError => ex
        $stderr.puts ex.message
        status = 1
      end
      exit(status)
    end

          new()

[Source]

# File erubis/main.rb, line 51
    def initialize
      @single_options = "hvxztTSbeBXNUC"
      @arg_options    = "pcrfKIlaE" #C
      @option_names   = {
        ?h => :help,
        ?v => :version,
        ?x => :source,
        ?z => :syntax,
        ?T => :unexpand,
        ?t => :untabify,      # obsolete
        ?S => :intern,
        ?b => :bodyonly,
        ?B => :binding,
        ?p => :pattern,
        ?c => :context,
        #?C => :class,
        ?e => :escape,
        ?r => :requires,
        ?f => :datafiles,
        ?K => :kanji,
        ?I => :includes,
        ?l => :lang,
        ?a => :action,
        ?E => :enhancers,
        ?X => :notext,
        ?N => :linenum,
        ?U => :unique,
        ?C => :compact,
      }
      assert unless @single_options.length + @arg_options.length == @option_names.length
      (@single_options + @arg_options).each_byte do |ch|
        assert unless @option_names.key?(ch)
      end
    end

Public Instance methods

          execute(argv=ARGV)

[Source]

# File erubis/main.rb, line 87
    def execute(argv=ARGV)
      ## parse command-line options
      options, properties = parse_argv(argv, @single_options, @arg_options)
      filenames = argv
      options[?h] = true if properties[:help]
      opts = Object.new
      arr = @option_names.collect { |ch, name| "def #{name}; @#{name}; end\n" }
      opts.instance_eval arr.join
      options.each do |ch, val|
        name = @option_names[ch]
        opts.instance_variable_set("@#{name}", val)
      end

      ## help, version, enhancer list
      if opts.help || opts.version
        puts version()         if opts.version
        puts usage()           if opts.help
        puts show_properties() if opts.help
        puts show_enhancers()  if opts.help
        return
      end

      ## include path
      opts.includes.split(/,/).each do |path|
        $: << path
      end if opts.includes

      ## require library
      opts.requires.split(/,/).each do |library|
        require library
      end if opts.requires

      ## action
      action = opts.action
      action ||= 'syntax'  if opts.syntax
      action ||= 'convert' if opts.source || opts.notext

      ## lang
      lang = opts.lang || 'ruby'
      action ||= 'convert' if opts.lang

      ## class name of Eruby
      #classname = opts.class
      classname = nil
      klass = get_classobj(classname, lang, properties[:pi])

      ## kanji code
      $KCODE = opts.kanji if opts.kanji

      ## read context values from yaml file
      datafiles = opts.datafiles
      context = load_datafiles(datafiles, opts)

      ## parse context data
      if opts.context
        context = parse_context_data(opts.context, opts)
      end

      ## properties for engine
      properties[:escape]   = true         if opts.escape && !properties.key?(:escape)
      properties[:pattern]  = opts.pattern if opts.pattern
      #properties[:trim]     = false        if opts.notrim
      properties[:preamble] = properties[:postamble] = false if opts.bodyonly
      properties[:pi]       = nil          if properties[:pi] == true

      ## create engine and extend enhancers
      engine = klass.new(nil, properties)
      enhancers = get_enhancers(opts.enhancers)
      #enhancers.push(Erubis::EscapeEnhancer) if opts.escape
      enhancers.each do |enhancer|
        engine.extend(enhancer)
        engine.bipattern = properties[:bipattern] if enhancer == Erubis::BiPatternEnhancer
      end

      ## no-text
      engine.extend(Erubis::NoTextEnhancer) if opts.notext

      ## convert and execute
      val = nil
      msg = "Syntax OK\n"
      if filenames && !filenames.empty?
        filenames.each do |filename|
          test(?f, filename)  or raise CommandOptionError.new("#{filename}: file not found.")
          engine.filename = filename
          engine.convert!(File.read(filename))
          val = do_action(action, engine, context, filename, opts)
          msg = nil if val
        end
      else
        engine.filename = filename = '(stdin)'
        engine.convert!($stdin.read())
        val = do_action(action, engine, context, filename, opts)
        msg = nil if val
      end
      print msg if action == 'syntax' && msg

    end

[Validate]


text:
//
//  ========================================================================
//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
//  ------------------------------------------------------------------------
//  All rights reserved. This program and the accompanying materials
//  are made available under the terms of the Eclipse Public License v1.0
//  and Apache License v2.0 which accompanies this distribution.
//
//      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//

package org.eclipse.jetty.websocket.common.events;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.InvalidWebSocketException;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;

/**
 * Create EventDriver implementations.
 */
public class EventDriverFactory
{
    private static final Logger LOG = Log.getLogger(EventDriverFactory.class);
    private final WebSocketPolicy policy;
    private final List<EventDriverImpl> implementations;

    public EventDriverFactory(WebSocketPolicy policy)
    {
        this.policy = policy;
        this.implementations = new ArrayList<>();

        addImplementation(new JettyListenerImpl());
        addImplementation(new JettyAnnotatedImpl());
    }

    public void addImplementation(EventDriverImpl impl)
    {
        if (implementations.contains(impl))
        {
            LOG.warn("Ignoring attempt to add duplicate EventDriverImpl: " + impl);
            return;
        }

        implementations.add(impl);
    }

    public void clearImplementations()
    {
        this.implementations.clear();
    }

    protected String getClassName(Object websocket)
    {
        return websocket.getClass().getName();
    }

    public List<EventDriverImpl> getImplementations()
    {
        return implementations;
    }

    public boolean removeImplementation(EventDriverImpl impl)
    {
        return this.implementations.remove(impl);
    }

    @Override
    public String toString()
    {
        StringBuilder msg = new StringBuilder();
        msg.append(this.getClass().getSimpleName());
        msg.append("[implementations=[");
        boolean delim = false;
        for (EventDriverImpl impl : implementations)
        {
            if (delim)
            {
                msg.append(',');
            }
            msg.append(impl.toString());
            delim = true;
        }
        msg.append("]");
        return msg.toString();
    }

    /**
     * Wrap the given WebSocket object instance in a suitable EventDriver
     *
     * @param websocket
     *            the websocket instance to wrap. Must either implement {@link WebSocketListener} or be annotated with {@link WebSocket &#064WebSocket}
     * @return appropriate EventDriver for this websocket instance.
     */
    public EventDriver wrap(Object websocket)
    {
        if (websocket == null)
        {
            throw new InvalidWebSocketException("null websocket object");
        }

        for (EventDriverImpl impl : implementations)
        {
            if (impl.supports(websocket))
            {
                try
                {
                    return impl.create(websocket,policy.clonePolicy());
                }
                catch (Throwable e)
                {
                    throw new InvalidWebSocketException("Unable to create websocket",e);
                }
            }
        }

        // Create a clear error message for the developer
        StringBuilder err = new StringBuilder();
        err.append(getClassName(websocket));
        err.append(" is not a valid WebSocket object.");
        err.append("  Object must obey one of the following rules: ");

        int len = implementations.size();
        for (int i = 0; i < len; i++)
        {
            EventDriverImpl impl = implementations.get(i);
            if (i > 0)
            {
                err.append(" or ");
            }
            err.append("\n(").append(i + 1).append(") ");
            err.append(impl.describeRule());
        }

        throw new InvalidWebSocketException(err.toString());
    }
}