text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

    <meta name="author" content="Edouard Murat"/>
    <meta name="subject" content="Comment gérer vos pensées?"/>
    <meta name="description" content="Les pensées sont très utiles quand il s'agit de résoudre des problèmes, mais bien que l'on aime en dépendre dans notre vie quotidienne...on ne doit pas en abuser. Sans une bonne gestion de nos pensées, elles peuvent nous causer de gros problèmes et devenir incontrôlables. Voici quelques conseils pour mieux utiliser vos pensées sans qu'elles prennent le contrôle sur votre vie."/>
    <meta name="keywords" content="gérer pensées"/>
    <meta name="language" content="French"/>
    <meta name="copyright" content="HeadPause"/>
    <meta name="designer" content="Edouard Murat"/>
    <meta name="publisher" content="HeadPause"/>
    <meta name="distribution" content="Global"/>
    <meta name="zipcode" content="H1W3P3"/>
    <meta name="city" content="Montreal"/>
    <meta name="country" content="Canada"/>
    <meta property="og:image" content="https://www.headpause.com/img/news/18.jpg" />

    <title>Comment gérer vos pensées? - HeadPause</title>

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>

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

        HeadPause - Pleine Conscience Urbaine
        <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">

        </button>

              À Propos

              Services

              Coach

              Témoignages

              Contact

              EN

Comment gérer vos pensées?

"Rien au monde ne peut vous déranger autant que votre propre esprit, je vous le dis. En fait, d'autres semblent vous déranger, mais ce n'est pas les autres, c'est votre propre esprit." - Sri Sri Ravi Shankar

Les pensées sont très utiles quand il s'agit de résoudre des problèmes, mais bien que l'on aime en dépendre dans notre vie quotidienne...on ne doit pas en abuser. Sans une bonne gestion de nos pensées, elles peuvent nous causer de gros problèmes et devenir incontrôlables. Voici quelques conseils pour mieux utiliser vos pensées sans qu'elles prennent le contrôle sur votre vie.

Vous n'êtes pas vos pensées

Tout d'abord, vous n'êtes pas seulement vos pensées. Elles ne vous définissent pas en tant qu'être humain mais ne sont qu'une partie de vous-même. Les pensées n'arrivent que dans le cerveau et la vérité est que...vous êtes tellement plus qu'elles. Vous avez des sentiments, des sensations, tout un corps à déplacer. Vraiment, il y a beaucoup plus à apprécier dans tout votre être, quelles que soient vos pensées.

Même si vous comprenez que vous êtes beaucoup plus que vos pensées, vous pourriez souvent vous associer à elle, oubliant un instant que vos pensées ne sont pas la réalité qui est en face de vous...mais seulement une expérience que vous pouvez observer à l'intérieur de vous-même.

Perdre de vue le fait que les pensées existent seulement dans notre tête peut arriver très facilement et c'est parce que...les pensées sont polyvalentes, rapides, et peuvent prendre une forme réaliste.

Les pensées peuvent être problématiques

Les pensées peuvent prendre de nombreuses formes et être suffisamment réalistes pour qu'on les confonde avec la réalité. Quand on se perd dans nos pensées, on fait  juste cela...être coincé dans des pensées fictives sans le savoir. La rêverie n'est pas un gros problème, on le fait tous de temps en temps, mais c'est la non-différenciation avec la réalité qui peut devenir problématique.

Si vous avez une pensée positive, tout va bien...cette pensée peut vous donner plus d'énergie, de motivation et de bonheur...mais que faire si c'est négatif? Les pensées négatives peuvent mener à beaucoup d'émotions difficiles telles que la dépression, la colère, la tristesse, la jalousie...et vous inciter à agir de manière à vous causer encore plus de problèmes.

C'est précisément pourquoi vous devez les regarder et prendre le temps de comprendre comment elles fonctionnent. Vraiment, vos pensées peuvent contrôler beaucoup d'aspects de votre vie si vous ne leurs montrez pas assez d'intérêt.

Faire de vos pensées des amies

Vos pensées sont à l'intérieur de vous, et si vous réagissez mal à elles ou si vous ne prenez pas le temps d'écouter ce qu'elles ont à dire...elles continueront de nuire à votre vie. Quand vous avez un ami qui est en colère contre vous, si vous n'écoutez pas patiemment ce qu'il a à dire...il continuera d'être en colère. Les pensées fonctionnent de la même manière. Ce n'est pas en les évitant et en vous distrayant que vous les ferez partir parce que...elles n'ont nulle part où aller et sont là pour rester jusqu'à ce que vous les ayez vraiment écoutés...jusqu'à ce que vous ayez vraiment appris à les laisser être comme elles sont. Après tout, vous ne resteriez pas fâché contre votre bras s'il ne bougeait pas comme vous le vouliez, parce que c'est une partie de vous-même et qu'il vous est très utile.

Pour faire de vos pensées des amis, le meilleur moyen est vraiment juste de les observer sans jugement jusqu'à ce qu'elles se transforment en vos meilleurs amis.

Observez vos pensées sans jugement

Quand j'essaie de forcer un ami à faire quelque chose, cela lui donne généralement encore moins envie de le faire...et les pensées sont comme ça aussi. Si vous essayez de forcer vos pensées à changer, vous rendez le changement plus difficile pour elles. C'est en les laissant être et en acceptant la façon dont elles sont actuellement qu'elles vont changer avec le temps.

Il faut beaucoup de patience et de soin pour changer une pensée négative en une positive, alors donnez-vous du temps...mais sachez que c'est très faisable et ne vous requière pas de faire grand-chose.

Tout commence par une observation curieuse plutôt qu'un jugement habituel. Dans votre vie quotidienne, si vous avez tendance à juger les comportements et le mode de vie des autres, vous ferez certainement la même chose avec vos pensées, et si vous avez tendance à juger...c'est comme ça, acceptons-le.

Parfois, il peut être déroutant de comprendre ce qu'est vraiment une observation sans jugement. Voici un exemple:

Pensée avec jugement A: "Mes pieds me font mal et j'aime pas ça"

Quand vous voyez cette pensée, vous l'observez et vous êtes conscient de son existence. Si vous vous arrêtez là et observez, très bien...mais si vous jugez cette pensée parce que vous ne l'aimez pas, la pensée suivante pourrez apparaître:

A -> Pensée avec jugement B: "Je ne devrais pas avoir ce jugement"

Voilà juste un autre jugement. Cela peut durer encore longtemps...cette perspective de jugement, mais avec la pratique, vous serez moins réactif dans vos pensées et vous permettrez à vos pensées d'aller et venir à leur guise...et elles changeront plus positivement de cette façon.

Maintenant, on pratique

Comme on l'a dit, les pensées commenceront à changer et seront moins incontrôlables lorsqu'on apprend à les observer sans jugement. L'observation des pensées est une compétence qui peut être pratiquée et améliorée avec le temps, peu importe votre aptitude maintenant...et c'est une excellente nouvelle. Chacun des exercices suivants ne se concentre pas sur les pensées elles-mêmes, mais seulement sur le renforcement des compétences requises pour que vous puissiez observer avec discernement toutes les pensées que vous pourriez avoir. Ces exercices renforcent votre concentration, patience et calme. Voici d'excellents moyens de mieux gérer vos pensées.

Meditation de concentration focalisée

Ce type de méditation est très simple en théorie et assez difficile à maîtriser dans la pratique. Il suffit de se concentrer sur un objet (sonore, visuel, tactile, olfactif, gustatif, mental) et de garder cet objet en tête. Chaque fois que votre esprit s'égare pour observer d'autres objets, vous le remarquez et ensuite revenez doucement à regarder le même objet...comme je l'ai dit, extrêmement simple en théorie. Voici 2 façons de pratiquer la méditation de concentration

Sonore

Pour ce type de méditation, concentrez-vous sur les sons ambiants sans juger s'ils sont bons ou mauvais:

Asseyez-vous confortablement avec votre dos droit

Mettez une minuterie de 10 minutes sur votre téléphone ou montre

Fermez les yeux et détendez vos muscles

Écoutez les sons environnants sans vous concentrer sur l'un d'entre eux en particulier. Chaque fois qu'un nouveau son arrive, laissez-le venir et partir.

Visuel

Pour ce type de méditation, concentrez-vous sur l'aspect visuel d'un objet en face de vous...une flamme de bougie:

Allumez une bougie à 1-2 mètres en face de vous

Restez dans l'obscurité afin qu'il soit plus facile de vous concentrer sur la lumière de la bougie

Asseyez-vous confortablement avec votre dos droit

Mettez une minuterie de 10 minutes sur votre téléphone ou montre

Regardez la flamme et essayez de suivre ses mouvements subtils. Chaque fois que vous perdez le focus, revenez doucement à l'observation de cette flamme

Vous pourriez sentir un peu de mal aux yeux mal au début, mais avec le temps, vous trouverez cet exercice tranquille pour vos yeux.

Méditation sur la respiration

C'est le type de méditation le plus simple et facile, que je recommande le plus. Voici comment la pratiquer:

Trouvez un endroit tranquille où vous ne serez pas interrompu

Asseyez-vous confortablement avec votre dos droit

Mettez une minuterie de 10 minutes sur votre téléphone ou montre

Fermez les yeux et détendez vos muscles

Regardez votre respiration. Essayez de la suivre complètement et d'être conscient de chaque inspiration et expiration.

Quand votre esprit s'égare, c'est tout à fait normal, revenez simplement à l'observation de votre respiration.

Nos services

À headpause, nous organisons des activités qui vous aide à être plus conscient de vos pensées, les laissés venir et partir à leur guise, et donc de mieux les gérer sans les laisser prendre autant de contrôle sur votre vie. Nous avons un groupe de méditation gratuit chaque semaine pour pratiquer la méditation et développer les compétences dont vous avez besoins pour gérer vos pensées et un atelier de pleine conscience pour vous permettre de mieux comprendre vos pensées, les connaître et apprendre d'autres exercices amenant une plus grande paix d'esprit.

1 Mars 2018

Plus De Nouvelles

L'importance de l'amitié

De la haine à l'amour

Le plus grand virus: L'Anxiété?

<meta itemprop="url" content="https://www.headpause.com/news/how-to-manage-your-thoughts-fr.html">

<meta itemprop="name" content="Edouard Murat">

    <!- FontAwesome core CSS-->
    <link href="/vendor/font-awesome/css/fontawesome-all.min.css" rel="stylesheet">

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


text:
<?php
/**
 * ErrorResponseTest
 *
 * PHP version 5
 *
 * @category Class
 * @package  InPlayer
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * InPlayer APIs
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 1.0.0
 *
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Please update the test case below to test the model.
 */

namespace InPlayer;

/**
 * ErrorResponseTest Class Doc Comment
 *
 * @category    Class */
// * @description ErrorResponse
/**
 * @package     InPlayer
 * @author      Swagger Codegen team
 * @link        https://github.com/swagger-api/swagger-codegen
 */
class ErrorResponseTest extends \PHPUnit_Framework_TestCase
{

    /**
     * Setup before running any test case
     */
    public static function setUpBeforeClass()
    {
    }

    /**
     * Setup before running each test case
     */
    public function setUp()
    {
    }

    /**
     * Clean up after running each test case
     */
    public function tearDown()
    {
    }

    /**
     * Clean up after running all test cases
     */
    public static function tearDownAfterClass()
    {
    }

    /**
     * Test "ErrorResponse"
     */
    public function testErrorResponse()
    {
    }

    /**
     * Test attribute "code"
     */
    public function testPropertyCode()
    {
    }

    /**
     * Test attribute "message"
     */
    public function testPropertyMessage()
    {
    }

    /**
     * Test attribute "errors"
     */
    public function testPropertyErrors()
    {
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Adler32.cs - Computes Adler32 data checksum of a data stream
// Copyright (C) 2001 Mike Krueger
//
// This file was translated from java, it was part of the GNU Classpath
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library.  Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.
//
// As a special exception, the copyright holders of this library give you
// permission to link this library with independent modules to produce an
// executable, regardless of the license terms of these independent
// modules, and to copy and distribute the resulting executable under
// terms of your choice, provided that you also meet, for each linked
// independent module, the terms and conditions of the license of that
// module.  An independent module is a module which is not derived from
// or based on this library.  If you modify this library, you may extend
// this exception to your version of the library, but you are not
// obligated to do so.  If you do not wish to do so, delete this
// exception statement from your version.

using System;

namespace ICSharpCode.SharpZipLib.Checksums
{

	/// <summary>
	/// Computes Adler32 checksum for a stream of data. An Adler32
	/// checksum is not as reliable as a CRC32 checksum, but a lot faster to
	/// compute.
	///
	/// The specification for Adler32 may be found in RFC 1950.
	/// ZLIB Compressed Data Format Specification version 3.3)
	///
	///
	/// From that document:
	///
	///      "ADLER32 (Adler-32 checksum)
	///       This contains a checksum value of the uncompressed data
	///       (excluding any dictionary data) computed according to Adler-32
	///       algorithm. This algorithm is a 32-bit extension and improvement
	///       of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073
	///       standard.
	///
	///       Adler-32 is composed of two sums accumulated per byte: s1 is
	///       the sum of all bytes, s2 is the sum of all s1 values. Both sums
	///       are done modulo 65521. s1 is initialized to 1, s2 to zero.  The
	///       Adler-32 checksum is stored as s2*65536 + s1 in most-
	///       significant-byte first (network) order."
	///
	///  "8.2. The Adler-32 algorithm
	///
	///    The Adler-32 algorithm is much faster than the CRC32 algorithm yet
	///    still provides an extremely low probability of undetected errors.
	///
	///    The modulo on unsigned long accumulators can be delayed for 5552
	///    bytes, so the modulo operation time is negligible.  If the bytes
	///    are a, b, c, the second sum is 3a + 2b + c + 3, and so is position
	///    and order sensitive, unlike the first sum, which is just a
	///    checksum.  That 65521 is prime is important to avoid a possible
	///    large class of two-byte errors that leave the check unchanged.
	///    (The Fletcher checksum uses 255, which is not prime and which also
	///    makes the Fletcher check insensitive to single byte changes 0 -
	///    255.)
	///
	///    The sum s1 is initialized to 1 instead of zero to make the length
	///    of the sequence part of s2, so that the length does not have to be
	///    checked separately. (Any sequence of zeroes has a Fletcher
	///    checksum of zero.)"
	/// </summary>
	/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream"/>
	/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream"/>
	public sealed class Adler32 : IChecksum
	{
		/// <summary>
		/// largest prime smaller than 65536
		/// </summary>
		const uint BASE = 65521;

		/// <summary>
		/// Returns the Adler32 data checksum computed so far.
		/// </summary>
		public long Value {
			get {
				return checksum;
			}
		}

		/// <summary>
		/// Creates a new instance of the Adler32 class.
		/// The checksum starts off with a value of 1.
		/// </summary>
		public Adler32()
		{
			Reset();
		}

		/// <summary>
		/// Resets the Adler32 checksum to the initial value.
		/// </summary>
		public void Reset()
		{
			checksum = 1;
		}

		/// <summary>
		/// Updates the checksum with a byte value.
		/// </summary>
		/// <param name="value">
		/// The data value to add. The high byte of the int is ignored.
		/// </param>
		public void Update(int value)
		{
			// We could make a length 1 byte array and call update again, but I
			// would rather not have that overhead
			uint s1 = checksum & 0xFFFF;
			uint s2 = checksum >> 16;

			s1 = (s1 + ((uint)value & 0xFF)) % BASE;
			s2 = (s1 + s2) % BASE;

			checksum = (s2 << 16) + s1;
		}

		/// <summary>
		/// Updates the checksum with an array of bytes.
		/// </summary>
		/// <param name="buffer">
		/// The source of the data to update with.
		/// </param>
		public void Update(byte[] buffer)
		{
			if ( buffer == null ) {
				throw new ArgumentNullException("buffer");
			}

			Update(buffer, 0, buffer.Length);
		}

		/// <summary>
		/// Updates the checksum with the bytes taken from the array.
		/// </summary>
		/// <param name="buffer">
		/// an array of bytes
		/// </param>
		/// <param name="offset">
		/// the start of the data used for this update
		/// </param>
		/// <param name="count">
		/// the number of bytes to use for this update
		/// </param>
		public void Update(byte[] buffer, int offset, int count)
		{
			if (buffer == null) {
				throw new ArgumentNullException("buffer");
			}

			if (offset < 0) {
#if NETCF_1_0
				throw new ArgumentOutOfRangeException("offset");
#else
				throw new ArgumentOutOfRangeException("offset", "cannot be negative");
#endif
			}

			if ( count < 0 )
			{
#if NETCF_1_0
				throw new ArgumentOutOfRangeException("count");
#else
				throw new ArgumentOutOfRangeException("count", "cannot be negative");
#endif
			}

			if (offset >= buffer.Length)
			{
#if NETCF_1_0
				throw new ArgumentOutOfRangeException("offset");
#else
				throw new ArgumentOutOfRangeException("offset", "not a valid index into buffer");
#endif
			}

			if (offset + count > buffer.Length)
			{
#if NETCF_1_0
				throw new ArgumentOutOfRangeException("count");
#else
				throw new ArgumentOutOfRangeException("count", "exceeds buffer size");
#endif
			}

			//(By Per Bothner)
			uint s1 = checksum & 0xFFFF;
			uint s2 = checksum >> 16;

			while (count > 0) {
				// We can defer the modulo operation:
				// s1 maximally grows from 65521 to 65521 + 255 * 3800
				// s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31
				int n = 3800;
				if (n > count) {
					n = count;
				}
				count -= n;
				while (--n >= 0) {
					s1 = s1 + (uint)(buffer[offset++] & 0xff);
					s2 = s2 + s1;
				}
				s1 %= BASE;
				s2 %= BASE;
			}

			checksum = (s2 << 16) | s1;
		}

		#region Instance Fields
		uint checksum;
		#endregion
	}
}


text:
/***********************************************************************
    created:    Fri Jul 8 2005
    author:     Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
 *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
 *
 *   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 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.
 ***************************************************************************/
#include "CEGUI/WindowRendererSets/Core/TabButton.h"
#include "CEGUI/falagard/WidgetLookManager.h"
#include "CEGUI/falagard/WidgetLookFeel.h"
#include "CEGUI/widgets/TabButton.h"
#include "CEGUI/widgets/TabControl.h"

namespace CEGUI
{
const String FalagardTabButton::TypeName("Core/TabButton");

//----------------------------------------------------------------------------//
FalagardTabButton::FalagardTabButton(const String& type) :
    WindowRenderer(type, "TabButton")
{
}

//----------------------------------------------------------------------------//
void FalagardTabButton::createRenderGeometry()
{
    TabButton* w = static_cast<TabButton*>(d_window);
    TabControl* tc = w->getParent() ? dynamic_cast<TabControl*>(w->getParent()->getParent()) : nullptr;
    String prefix((tc && tc->getTabPanePosition() == TabControl::TabPanePosition::Bottom) ? "Bottom" : "Top");

    String state;
    if (w->isEffectiveDisabled())
        state = "Disabled";
    else if (w->isSelected())
        state = "Selected";
    else if (w->isPushed())
        state = "Pushed";
    else if (w->isHovering())
        state = "Hover";
    else if (w->isFocused())
        state = "Focused";
    else
        state = "Normal";

    const WidgetLookFeel& wlf = getLookNFeel();
    if (!wlf.isStateImageryPresent(prefix + state))
    {
        state = "Normal";
        if (!wlf.isStateImageryPresent(prefix + state))
            prefix = "";
    }

    wlf.getStateImagery(prefix + state).render(*w);
}

//----------------------------------------------------------------------------//
Sizef FalagardTabButton::getContentSize() const
{
    if (!d_window->getGUIContextPtr())
        return Sizef(0.f, 0.f);

    TabControl* tc = d_window->getParent() ? dynamic_cast<TabControl*>(d_window->getParent()->getParent()) : nullptr;
    if (!tc)
        return Sizef(0.f, 0.f);

    const WidgetLookFeel& lnf = getLookNFeel();

    String state((tc->getTabPanePosition() == TabControl::TabPanePosition::Bottom) ? "Bottom" : "Top");
    state += "Normal";
    if (!lnf.isStateImageryPresent(state))
        state = "Normal";

    // Find a text component responsible for a text
    //!!!FIXME: duplicated code, see FalagardTooltip::getTextComponentExtents!
    const auto& layerSpecs = lnf.getStateImagery(state).getLayerSpecifications();
    for (auto& layerSpec : layerSpecs)
    {
        const auto& sectionSpecs = layerSpec.getSectionSpecifications();
        for (auto& sectionSpec : sectionSpecs)
        {
            const auto& texts = lnf.getImagerySection(sectionSpec.getSectionName()).getTextComponents();
            if (!texts.empty())
                return texts.front().getTextExtent(*d_window);
        }
    }

    return Sizef(0.f, 0.f);
}

}


text:
/** @file
 * @brief Modem receiver header file.
 *
 * A modem receiver driver allowing application to handle all
 * aspects of received protocol data.
 */

/*
 * Copyright (c) 2018 Foundries.io
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef ZEPHYR_INCLUDE_DRIVERS_MODEM_MODEM_RECEIVER_H_
#define ZEPHYR_INCLUDE_DRIVERS_MODEM_MODEM_RECEIVER_H_

#include <kernel.h>
#include <sys/ring_buffer.h>

#ifdef __cplusplus
extern "C" {
#endif

struct mdm_receiver_context {
	const struct device *uart_dev;

	/* rx data */
	struct ring_buf rx_rb;
	struct k_sem rx_sem;

	/* modem data */
	char *data_manufacturer;
	char *data_model;
	char *data_revision;
#if defined(CONFIG_MODEM_SIM_NUMBERS)
	char *data_imei;
	char *data_imsi;
#endif
	char *data_iccid;
	int   data_rssi;
};

/**
 * @brief  Gets receiver context by id.
 *
 * @param  id: receiver context id.
 *
 * @retval Receiver context or NULL.
 */
struct mdm_receiver_context *mdm_receiver_context_from_id(int id);

/**
 * @brief  Get received data.
 *
 * @param  *ctx: receiver context.
 * @param  *buf: buffer to copy the received data to.
 * @param  size: buffer size.
 * @param  *bytes_read: amount of received bytes
 *
 * @retval 0 if ok, < 0 if error.
 */
int mdm_receiver_recv(struct mdm_receiver_context *ctx,
		      uint8_t *buf, size_t size, size_t *bytes_read);

/**
 * @brief  Sends the data over specified receiver context.
 *
 * @param  *ctx: receiver context.
 * @param  *buf: buffer with the data to send.
 * @param  size: the amount of data to send.
 *
 * @retval 0 if ok, < 0 if error.
 */
int mdm_receiver_send(struct mdm_receiver_context *ctx,
		      const uint8_t *buf, size_t size);

/**
 * @brief  Registers receiver context.
 *
 * @note   Acquires receivers device, and prepares the context to be used.
 *
 * @param  *ctx: receiver context to register.
 * @param  *uart_dev_name: communication device for the receiver context.
 * @param  *buf: rx buffer to use for received data.
 * @param  size: rx buffer size.
 *
 * @retval 0 if ok, < 0 if error.
 */
int mdm_receiver_register(struct mdm_receiver_context *ctx,
			  const char *uart_dev_name,
			  uint8_t *buf, size_t size);

int mdm_receiver_sleep(struct mdm_receiver_context *ctx);

int mdm_receiver_wake(struct mdm_receiver_context *ctx);

#ifdef __cplusplus
}
#endif

#endif /* ZEPHYR_INCLUDE_DRIVERS_MODEM_MODEM_RECEIVER_H_ */


text:
import type { ICoordinates } from "../../../Core/Interfaces/ICoordinates";
export interface IAttract {
    enable: boolean;
    rotateX: number;
    rotateY: number;
    rotate: ICoordinates;
}


text:
package ch.boye.httpclientandroidlib;

import ch.boye.httpclientandroidlib.params.HttpParams;

/**
 * HTTP messages consist of requests from client to server and responses
 * from server to client.
 *

 *     HTTP-message   = Request | Response     ; HTTP/1.1 messages
 *

 *

 * HTTP messages use the generic message format of RFC 822 for
 * transferring entities (the payload of the message). Both types
 * of message consist of a start-line, zero or more header fields
 * (also known as "headers"), an empty line (i.e., a line with nothing
 * preceding the CRLF) indicating the end of the header fields,
 * and possibly a message-body.
 *

 *

 *      generic-message = start-line
 *                        *(message-header CRLF)
 *                        CRLF
 *                        [ message-body ]
 *      start-line      = Request-Line | Status-Line
 *

 *
 * @since 4.0
 */
public interface HttpMessage {

    /**
     * Returns the protocol version this message is compatible with.
     */
    ProtocolVersion getProtocolVersion();

    /**
     * Checks if a certain header is present in this message. Header values are
     * ignored.
     *
     * @param name the header name to check for.
     * @return true if at least one header with this name is present.
     */
    boolean containsHeader(String name);

    /**
     * Returns all the headers with a specified name of this message. Header values
     * are ignored. Headers are orderd in the sequence they will be sent over a
     * connection.
     *
     * @param name the name of the headers to return.
     * @return the headers whose name property equals name.
     */
    Header[] getHeaders(String name);

    /**
     * Returns the first header with a specified name of this message. Header
     * values are ignored. If there is more than one matching header in the
     * message the first element of {@link #getHeaders(String)} is returned.
     * If there is no matching header in the message null is
     * returned.
     *
     * @param name the name of the header to return.
     * @return the first header whose name property equals name
     *   or null if no such header could be found.
     */
    Header getFirstHeader(String name);

    /**
     * Returns the last header with a specified name of this message. Header values
     * are ignored. If there is more than one matching header in the message the
     * last element of {@link #getHeaders(String)} is returned. If there is no
     * matching header in the message null is returned.
     *
     * @param name the name of the header to return.
     * @return the last header whose name property equals name.
     *   or null if no such header could be found.
     */
    Header getLastHeader(String name);

    /**
     * Returns all the headers of this message. Headers are orderd in the sequence
     * they will be sent over a connection.
     *
     * @return all the headers of this message
     */
    Header[] getAllHeaders();

    /**
     * Adds a header to this message. The header will be appended to the end of
     * the list.
     *
     * @param header the header to append.
     */
    void addHeader(Header header);

    /**
     * Adds a header to this message. The header will be appended to the end of
     * the list.
     *
     * @param name the name of the header.
     * @param value the value of the header.
     */
    void addHeader(String name, String value);

    /**
     * Overwrites the first header with the same name. The new header will be appended to
     * the end of the list, if no header with the given name can be found.
     *
     * @param header the header to set.
     */
    void setHeader(Header header);

    /**
     * Overwrites the first header with the same name. The new header will be appended to
     * the end of the list, if no header with the given name can be found.
     *
     * @param name the name of the header.
     * @param value the value of the header.
     */
    void setHeader(String name, String value);

    /**
     * Overwrites all the headers in the message.
     *
     * @param headers the array of headers to set.
     */
    void setHeaders(Header[] headers);

    /**
     * Removes a header from this message.
     *
     * @param header the header to remove.
     */
    void removeHeader(Header header);

    /**
     * Removes all headers with a certain name from this message.
     *
     * @param name The name of the headers to remove.
     */
    void removeHeaders(String name);

    /**
     * Returns an iterator of all the headers.
     *
     * @return Iterator that returns Header objects in the sequence they are
     *         sent over a connection.
     */
    HeaderIterator headerIterator();

    /**
     * Returns an iterator of the headers with a given name.
     *
     * @param name      the name of the headers over which to iterate, or
     *                  null for all headers
     *
     * @return Iterator that returns Header objects with the argument name
     *         in the sequence they are sent over a connection.
     */
    HeaderIterator headerIterator(String name);

    /**
     * Returns the parameters effective for this message as set by
     * {@link #setParams(HttpParams)}.
     */
    HttpParams getParams();

    /**
     * Provides parameters to be used for the processing of this message.
     * @param params the parameters
     */
    void setParams(HttpParams params);

}


text:
namespace rt
{

class Light
{
private:
    Color m_ambient;
    Color m_diffuse;
    Color m_specular;
    double m_intensity = 0;
    Vector m_position;

public:
    Light()
    {
    }

    Light(const Color& ambient, const Color& diffuse, const Color& specular, double intensity, const Vector& position) :
        m_ambient(Color(ambient)),
        m_diffuse(Color(diffuse)),
        m_specular(Color(specular)),
        m_intensity(intensity),
        m_position(Vector(position))
    {

    }

    const double getIntensity() const { return m_intensity; }
    const Color& getAmbient() const { return m_ambient; }
    const Color& getDiffuse() const { return m_diffuse; }
    const Color& getSpecular() const { return m_specular; }
    const Vector& getPosition() const { return m_position; }
};

class Material
{
private:
    Color m_ambient;
    Color m_diffuse;
    Color m_specular;
    double m_shininess;
    double m_opacity;
    double m_reflectivity;

public:
    Material()
    {
    }

    Material(Color& ambient, Color& diffuse, Color& specular, double shininess, double opacity, double reflectivity)
    {
        m_ambient = Color(ambient);
        m_diffuse = Color(diffuse);
        m_specular = Color(specular);

        m_shininess = shininess;
        m_opacity = opacity;
        m_reflectivity = reflectivity;
    }

    Material(const Material& mat)
    {
        m_ambient = Color(mat.m_ambient);
        m_diffuse = Color(mat.m_diffuse);
        m_specular = Color(mat.m_specular);

        m_shininess = mat.m_shininess;
        m_opacity = mat.m_opacity;
        m_reflectivity = mat.m_reflectivity;
    }

    const Color& getAmbient() const { return m_ambient; }
    const Color& getDiffuse() const { return m_diffuse; }
    const Color& getSpecular() const { return m_specular; }
    const double getShininess() const { return m_shininess; }
    const double getOpacity() const { return m_opacity; }
    const double getReflectivity() const { return m_reflectivity; }
};
}

#endif


text:
import defaultConfig from './webpack.config.default';
import webpack from 'webpack';

export default function config(speedupLocalDevelopment, optimize = false) {
    const config = defaultConfig(speedupLocalDevelopment, optimize);

    config.entry = './src/{{ bundle.namespace|replace({'\\':'/'}) }}/Resources/ui/js/app.js';
    config.output = {
        filename: './web/frontend/js/bundle.js'
    };
{% if demosite %}
    config.module.rules = config.module.rules.concat([
        {
            test: /\/cargobay\/.+\.scroll-to-top\.js/,
            use: 'exports-loader?cargobay.scrollToTop'
        },
        {
            test: /\/cargobay\/.+\.sidebar-toggle\.js/,
            use: 'exports-loader?cargobay.sidebarToggle'
        },
        {
            test: /\/cargobay\/.+\.toggle\.js/,
            use: 'exports-loader?cargobay.toggle'
        }
    ]);
    config.plugins.push(
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery'
        }));
{% endif %}

    return config;
};


text:
        {{ .Params.id }}

                {{ .Title }}

        Tags:
        {{ range .Params.tags }}
            {{ . }}
        {{ end }}

            {{ .Content }}

        Top | Reference


text:
======
lstrip
======

Description
----------
Returns a copy of the string with leading characters removed.

Syntax
------
**str**. *lstrip([chars])*

*chars*
    Optional. String specifying the set of characters to be removed.
    If omitted or None, the chars argument defaults to removing whitespace.
    The *chars* argument is not a prefix; rather, all combinations of its values are stripped.

Return Value
------------
**str**

Time Complexity
---------------
#TODO

Example
-------
>>> '   spacious   '.lstrip()
'spacious   '
>>> "AABAA".lstrip("A")
'BAA'
>>> "ABBA".lstrip("AB") # both AB and BA are stripped
''
>>> "ABCABBA".rstrip("AB")
'ABC'
>>> "ABCABBA".lstrip("AB")
'CABBA'

See Also
--------
`strip()`_ and `rstrip()`_

.. _lstrip(): ../str/lstrip.html
.. _rstrip(): ../str/rstrip.html
.. _strip(): ../str/strip.html


text:
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import"
  href="/perf_insights/timeline_based_measurement/rendering_frame.html">

<link rel="import" href="/tracing/base/range.html">
<link rel="import" href="/tracing/base/statistics.html">
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
<link rel="import" href="/tracing/model/model.html">

<script>
'use strict';

tr.b.unittest.testSuite(function() {

  var ThreadSlice = tr.model.ThreadSlice;
  var RenderingFrame = pi.tbm.RenderingFrame;
  var SEND_BEGIN_FRAME_EVENT = tr.e.cc.constants.SEND_BEGIN_FRAME_EVENT;
  var BEGIN_MAIN_FRAME_EVENT = tr.e.cc.constants.BEGIN_MAIN_FRAME_EVENT;
  var Range = tr.b.Range;

  function RenderingFrameTestData() {
    this.beginFrameId_ = 0;
    this.events_ = [];
    this.rendererProcess_ = (new tr.Model()).getOrCreateProcess(1);
    this.mainThread_ = this.rendererProcess_.getOrCreateThread(11);
    this.compositorThread_ = this.rendererProcess_.getOrCreateThread(12);
  }

  RenderingFrameTestData.prototype = {
    get events() {
      return this.events_;
    },

    get rendererProcess() {
      return this.rendererProcess_;
    },

    get compositorThread() {
      return this.compositorThread_;
    },

    addSendEvent: function(opt_ts, opt_duration) {
      if (opt_ts === undefined)
        opt_ts = 0;
      if (opt_duration === undefined)
        opt_duration = 1;
      this.beginFrameId_ += 1;
      var event = this.createEvent_(
          SEND_BEGIN_FRAME_EVENT, opt_ts, opt_duration);
      this.compositorThread_.sliceGroup.pushSlice(event);
    },

    addBeginMainFrameEvent: function(opt_ts, opt_duration) {
      if (opt_ts === undefined)
        opt_ts = 0;
      if (opt_duration === undefined)
        opt_duration = 1;
      var event = this.createEvent_(
          BEGIN_MAIN_FRAME_EVENT, opt_ts, opt_duration);
      this.mainThread_.sliceGroup.pushSlice(event);
    },

    updateBounds: function() {
      this.rendererProcess_.updateBounds();
    },

    createEvent_: function(eventTitle, ts, duration) {
      var event = new ThreadSlice('cc,benchmark', eventTitle, 0, ts, {
        'begin_frame_id': this.beginFrameId_
      }, duration);
      this.events_.push(event);
      return event;
    }
  };

  function generateTimelineRange(opt_start, opt_end) {
    if (opt_start === undefined)
      opt_start = 0;
    if (opt_end === undefined)
      opt_end = 100;
    var timelineRange = new tr.b.Range();
    timelineRange.min = opt_start;
    timelineRange.max = opt_end;
    return timelineRange;
  }

  test('renderingFrameConstruction', function() {
    var r = new RenderingFrameTestData();
    r.addSendEvent(10);
    r.addBeginMainFrameEvent(20);
    r.updateBounds();
    var frames = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, Range.fromExplicitRange(0, 30));
    assert.equal(1, frames.length);
    assert.equal(10, frames[0].queueDuration);
  });

  test('renderingFrame_missingSendBeginFrameEvents', function() {
    var r = new RenderingFrameTestData();
    r.addBeginMainFrameEvent(10);
    r.updateBounds();
    var frames = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, Range.fromExplicitRange(0, 30));
    assert.equal(0, frames.length);
  });

  test('renderingFrame_duplicateSendBeginFrameEvents', function() {
    var r = new RenderingFrameTestData();
    r.addSendEvent(10);
    r.addBeginMainFrameEvent(20);
    var begin_frame_id = r.events[0].args['begin_frame_id'];
    r.compositorThread.sliceGroup.pushSlice(new ThreadSlice(
        'cc,benchmark', SEND_BEGIN_FRAME_EVENT, 0, 30,
        {'begin_frame_id': begin_frame_id}, 0));
    r.updateBounds();
    var frames = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, Range.fromExplicitRange(0, 30));
    assert.equal(0, frames.length);
  });

  test('renderingFrame_missingBeginMainFrameEvents', function() {
    var r = new RenderingFrameTestData();
    r.addSendEvent(10);
    r.updateBounds();
    var frames = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, Range.fromExplicitRange(0, 30));
    assert.equal(0, frames.length);
  });

  test('renderingFrame_duplicateBeginMainFrameEvents', function() {
    var r = new RenderingFrameTestData();
    r.addSendEvent(10);
    r.addBeginMainFrameEvent(20);
    r.addBeginMainFrameEvent(30);
    r.addBeginMainFrameEvent(40);
    r.updateBounds();

    var frames = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, Range.fromExplicitRange(0, 30));
    assert.equal(1, frames.length);
    assert.equal(30, frames[0].queueDuration);
  });

  test('renderingFrame_frameEventMissingBeginFrameId', function() {
    var model = new tr.Model();
    var process = model.getOrCreateProcess(1);
    var main_thread = process.getOrCreateThread(11);
    var model_range = {};

    // Create an event without the begin_frame_id argument
    var event = new ThreadSlice(
        'cc,benchmark', BEGIN_MAIN_FRAME_EVENT, 0, 0.0);
    main_thread.sliceGroup.pushSlice(event);
    process.updateBounds();
    try {
      RenderingFrame.getFrameEventsInsideRange(process, model_range);
      assert.isFalse(true, 'Exception should have been thrown');
    } catch (err) {
      assert.equal(true, true);
    }
  });

 /**
  *  Test a basic sequenece, with expected frame queueing delays A and B.
  *
  *              |----A----|    |--B--|
  *  Main:         [1]     [1]        [2]
  *
  *  Compositor: [1]            [2]
  **/
  test('renderingFrame_getFrameEventsInsideRange', function() {
    var r = new RenderingFrameTestData();
    r.addSendEvent(10);
    r.addBeginMainFrameEvent(20);
    r.addBeginMainFrameEvent(30);
    r.addSendEvent(40);
    r.addBeginMainFrameEvent(50);
    r.updateBounds();

    var timelineRange = generateTimelineRange();
    var frameEvents = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, timelineRange);

    assert.equal(2, frameEvents.length);
    assert.equal(20, frameEvents[0].queueDuration);
    assert.equal(10, frameEvents[1].queueDuration);
  });

 /**
  * Test a sequenece missing an initial SendBeginFrame.
  *
  * Only one frame should be returned, with expected frame queueing delay A.
  *                     |--A--|
  *    Main:  [0]  [0]        [2]
  *
  * Compositor:            [2]
  **/
  test('renderingFrame_frameEventsMissingDataNotIncluded', function() {
    var r = new RenderingFrameTestData();
    r.addBeginMainFrameEvent(20);
    r.addBeginMainFrameEvent(30);
    r.addSendEvent(40);
    r.addBeginMainFrameEvent(50);
    r.updateBounds();

    var timelineRange = generateTimelineRange();
    var frameEvents = RenderingFrame.getFrameEventsInsideRange(
        r.rendererProcess, timelineRange);

    assert.equal(1, frameEvents.length);
    assert.equal(10, frameEvents[0].queueDuration);
  });

});
</script>


text:
class ConvertIconsToBootstrap < ActiveRecord::Migration[6.1]
  CMS_CONTENT_COLUMNS = {
    pages: 'content',
    cms_partials: 'content',
    cms_layouts: 'content'
  }

  ICON_MAP = {
    'address-card': 'card-heading',
    'arrow-circle-left': 'arrow-left-circle-fill',
    'arrow-circle-right': 'arrow-right-circle-fill',
    'asterisk': 'asterisk',
    'bars': 'list',
    'building': 'building',
    'calendar': 'calendar3',
    'calendar-o': 'calendar',
    'calendar-check-o': 'calendar2-check',
    'calendar-plus-o': 'calendar-plus',
    'caret-down': 'caret-down-fill',
    'caret-right': 'caret-right-fill',
    'cc-stripe': 'credit-card',
    'check': 'check',
    'check-square-o': 'check-square',
    'chevron-left': 'chevron-left',
    'chevron-right': 'chevron-right',
    'circle': 'circle-fill',
    'circle-o': 'circle',
    'circle-thin': 'circle',
    'clock-o': 'clock',
    'close': 'x',
    'code': 'code-slash',
    'cog': 'gear-fill',
    'cogs': 'gear-wide-connected',
    'columns': 'layout-split',
    'comments': 'chat-fill',
    'ellipsis-h': 'three-dots',
    'envelope': 'envelope-fill',
    'envelope-o': 'envelope',
    'exclamation-circle': 'exclamation-circle-fill',
    'exclamation-triangle': 'exclamation-triangle-fill',
    'external-link': 'box-arrow-up-right',
    'eye-slash': 'eye-slash',
    'file-audio-o': 'file-earmark-music',
    'file-excel-o': 'file-earmark-excel',
    'file-image-o': 'file-earmark-image',
    'file-o': 'file-earmark',
    'file-pdf-o': 'file-earmark-pdf',
    'file-powerpoint-o': 'file-earmark-ppt',
    'file-text': 'file-earmark-text-fill',
    'file-text-o': 'file-earmark-text',
    'file-video-o': 'file-earmark-play',
    'file-word-o': 'file-earmark-word',
    'file-zip-o': 'file-earmark-zip',
    'files-o': 'files',
    'folder': 'folder',
    'gavel': 'megaphone-fill',
    'gear': 'gear-fill',
    'gift': 'gift-fill',
    'group': 'people-fill',
    'google': 'google',
    'hourglass-half': 'hourglass-split',
    'lightbulb-o': 'lightbulb',
    'list': 'list-ul',
    'lock': 'lock-fill',
    'map': 'map-fill',
    'map-o': 'map',
    'map-marker': 'geo-alt-fill',
    'paperclip': 'paperclip',
    'paragraph': 'paragraph',
    'pause-circle': 'pause-circle-fill',
    'pencil': 'pencil-fill',
    'pencil-square-o': 'pencil-square',
    'plus': 'plus',
    'question-circle': 'question-circle-fill',
    'refresh': 'arrow-clockwise',
    'rocket': 'flag-fill', # we use this to represent "conventions", it's pretty arbitrary
    'star': 'star-fill',
    'star-o': 'star',
    'search': 'search',
    'shopping-bag': 'bag-fill',
    'shopping-cart': 'cart-fill',
    'sign-in': 'box-arrow-in-right',
    'sign-out': 'box-arrow-right',
    'square-o': 'square',
    'suitcase': 'briefcase-fill',
    'table': 'table',
    'tag': 'tag-fill',
    'tags': 'tags-fill',
    'ticket': 'person-badge-fill',
    'times': 'x',
    'times-rectangle': 'x-square-fill',
    'toggle-off': 'toggle-off',
    'toggle-on': 'toggle-on',
    'trash': 'trash-fill',
    'trash-o': 'trash',
    'university': 'bank2',
    'users': 'people-fill',
    'user-circle': 'person-circle',
    'user-circle-o': 'person-circle',
    'user-secret': 'lock-fill',
    'warning': 'exclamation-triangle-fill',
    'wrench': 'wrench'
  }

  def up
    replacements = ICON_MAP.map do |fa_icon, bi_icon|
      ["fa fa-#{fa_icon}", "bi-#{bi_icon}"]
    end

    CMS_CONTENT_COLUMNS.each do |table_name, column_name|
      execute <<~SQL
        UPDATE #{quote_table_name(table_name)}
        SET #{quote_column_name(column_name)} = #{generate_nested_regexp_replace(quote_column_name(column_name), replacements)};
      SQL
    end

    execute <<~SQL
      UPDATE form_items
      SET properties = properties || jsonb_build_object('caption', #{generate_nested_regexp_replace("properties->>'caption'", replacements)});
    SQL
  end

  def down
    replacements = ICON_MAP.map do |fa_icon, bi_icon|
      ["bi-#{bi_icon}", "fa fa-#{fa_icon}"]
    end

    CMS_CONTENT_COLUMNS.each do |table_name, column_name|
      execute <<~SQL
        UPDATE #{quote_table_name(table_name)}
        SET #{quote_column_name(column_name)} = #{generate_nested_regexp_replace(quote_column_name(column_name), replacements)};
      SQL
    end

    execute <<~SQL
      UPDATE form_items
      SET properties = properties || jsonb_build_object('caption', #{generate_nested_regexp_replace("properties->>'caption'", replacements)});
    SQL
  end

  private

  def generate_nested_regexp_replace(column_name, replacements)
    replacements.inject(column_name) do |sql, (pattern, replacement)|
      <<~SQL
        regexp_replace(#{sql}, #{quote(pattern)}, #{quote(replacement)}, 'g')
      SQL
    end
  end
end


text:
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

$string['adminlogin'] = 'Turnitinə administrator kimi daxil ol';
$string['compareinstitution'] = 'Bu təşkilat çərçivəsində təqdim olunmuş sənədlərlə faylların müqayisə edilməsi';
$string['pluginname'] = 'Turnitin plagiat plagin';
$string['status'] = 'Status';


text:
/**
 *
 * library to allow open youtube-video with high-quality and and auto-start
 *
 * @package Afterpay_Afterpay
 * @author VEN Development Team <info@ven.com>
 * @requires jQuery, fancybox
 */
;
(function ($) {

    // TODO: move variables and function, that are defined below, into $.fn.afterpayYoutube function
    "use strict";
    var player;

    //Load player api asynchronously.
    var tag = document.createElement('script');
    tag.src = "//www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

    var setBestQuality = function (event) {
        var availableQualityLevels = player.getAvailableQualityLevels();

        if (availableQualityLevels.length) {
            player.setPlaybackQuality(availableQualityLevels[0]);
        }
    };

    // Fires whenever a player has finished loading
    function onPlayerReady(event) {
        setBestQuality(event);
        //Hacked to disable autostart on iPad
        if (/(iPhone|iPod|iPad|BlackBerry|Android)/g.test(navigator.userAgent) === false) {
            player.playVideo();
        }
    }

    // Fires when the player's state changes.
    function onPlayerStateChange(event) {
        // Go to the next video after the current one is finished playing
        if (event.data == YT.PlayerState.BUFFERING) {
            setBestQuality(event);
        }
        if (event.data == YT.PlayerState.PLAYING) {
            setBestQuality(event);
        }
        if (event.data === 0) {
            $.fancybox.close();
        }
    }

    $.fn.afterpayYoutube = function () {

        this.on('click', function (e) {
            e.preventDefault();
            // TODO: define it before current event
            var $this = $(this),
                url = '//www.youtube.com/embed/' + $this.data('id') + '?enablejsapi=1';

            $.fancybox({
                'padding': 25,
                'width': 680,
                'height': 400,
                'href': url,
                'type': 'iframe',
                'overlayOpacity': 0.8,
                'overlayColor': '#fff',
                afterLoad: function () {

                    // TODO: check that $('.fancybox-iframe').attr('id') exists to create player object
                    // Find the iframe ID
                    var id = $('.fancybox-iframe').attr('id');

                    // Create video player object and add event listeners
                    player = new YT.Player(id, {
                        events: {
                            'onReady': onPlayerReady,
                            'onStateChange': onPlayerStateChange
                        }
                    });
                }
            });
        });
    };
})(jQuery);


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

#ifndef NET_IP6_IP6_HPP
#define NET_IP6_IP6_HPP

#include "addr.hpp"
#include "header.hpp"
#include "packet_ip6.hpp"
#include "addr_list.hpp"

#include <common>
#include <net/netfilter.hpp>
#include <net/conntrack.hpp>

namespace net
{

  class Inet;

  /** IP6 layer */
  class IP6
  {
  public:
    enum class Drop_reason
    { None, Bad_source, Bad_destination, Wrong_version,
        Unknown_proto };

    enum class Direction
    { Upstream, Downstream };

    using Stack = class Inet;
    using addr = ip6::Addr;
    using header = ip6::Header;
    using IP_packet = PacketIP6;
    using IP_packet_ptr = std::unique_ptr<IP_packet>;
    using IP_packet_factory = delegate<IP_packet_ptr(Protocol)>;
    using downstream_ndp = delegate<void(Packet_ptr, IP6::addr, MAC::Addr)>;
    using drop_handler = delegate<void(IP_packet_ptr, Direction, Drop_reason)>;
    using Forward_delg  = delegate<void(IP_packet_ptr, Stack& source, Conntrack::Entry_ptr)>;
    using PMTU = uint16_t;
    using netmask = uint8_t;

    static const addr ADDR_ANY;
    static const addr ADDR_LOOPBACK;

    /** Initialize. Sets a dummy linklayer out. */
    explicit IP6(Stack&) noexcept;

    //
    // Delegate setters
    //

    /** Set ICMP protocol handler (upstream)*/
    void set_icmp_handler(upstream s)
    { icmp_handler_ = s; }

    /** Set UDP protocol handler (upstream)*/
    void set_udp_handler(upstream s)
    { udp_handler_ = s; }

    /** Set TCP protocol handler (upstream) */
    void set_tcp_handler(upstream s)
    { tcp_handler_ = s; }

    /** Set packet dropped handler */
    void set_drop_handler(drop_handler s)
    { drop_handler_ = s; }

    /** Set handler for packets not addressed to this interface (upstream) */
    void set_packet_forwarding(Forward_delg fwd)
    { forward_packet_ = fwd; }

    /** Set linklayer out (downstream) via ndp */
    void set_linklayer_out(downstream_ndp s)
    { ndp_out_ = s; }

    /** Upstream: Input from link layer */
    void receive(Packet_ptr, const bool link_bcast);

    //
    // Delegate getters
    //

    upstream icmp_handler()
    { return icmp_handler_; }

    upstream udp_handler()
    { return udp_handler_; }

    upstream tcp_handler()
    { return tcp_handler_; }

    Forward_delg forward_delg()
    { return forward_packet_; }

    /**
     *  Downstream: Receive data from above and transmit
     *
     *  @note: The following *must be set* in the packet:
     *
     *   * Destination IP
     *   * Protocol
     *
     *  Source IP *can* be set - if it's not, IP6 will set it
     */
    void transmit(Packet_ptr);
    void ship(Packet_ptr, addr next_hop = IP6::ADDR_ANY, Conntrack::Entry_ptr ct = nullptr);

    const ip6::Addr local_ip() const;

    ip6::Addr_list& addr_list()
    { return addr_list_; }

    const ip6::Addr_list& addr_list() const
    { return addr_list_; }

    bool is_valid_source(const ip6::Addr& addr) const
    { return addr_list_.has(addr); }

    /**
     * @brief      Determines if the packet is for me (this host).
     *
     * @param[in]  dst   The destination
     *
     * @return     True if for me, False otherwise.
     */
    bool is_for_me(ip6::Addr dst) const;
    Protocol ipv6_ext_header_receive(net::PacketIP6& packet);

    ///
    /// PACKET FILTERING
    ///

    /**
     * Packet filtering hooks for firewall, NAT, connection tracking etc.
     **/

    /** Packets pass through prerouting chain before routing decision */
    Filter_chain<IP6>& prerouting_chain()
    { return prerouting_chain_; }

    /** Packets pass through postrouting chain after routing decision */
    Filter_chain<IP6>& postrouting_chain()
    { return postrouting_chain_; }

    /** Packets pass through input chain before hitting protocol handlers */
    Filter_chain<IP6>& input_chain()
    { return input_chain_; }

    /** Packets pass through output chain after exiting protocol handlers */
    Filter_chain<IP6>& output_chain()
    { return output_chain_; }

    /**
     * Stats getters
     **/
    uint64_t get_packets_rx()
    { return packets_rx_; }

    uint64_t get_packets_tx()
    { return packets_tx_; }

    uint64_t get_packets_dropped()
    { return packets_dropped_; }

    /**  Drop incoming packets invalid according to RFC */
    IP_packet_ptr drop_invalid_in(IP_packet_ptr packet);

    /**  Drop outgoing packets invalid according to RFC */
    IP_packet_ptr drop_invalid_out(IP_packet_ptr packet);

  private:
    Stack& stack_;

    ip6::Addr_list addr_list_;

    /** Stats */
    uint64_t& packets_rx_;
    uint64_t& packets_tx_;
    uint32_t& packets_dropped_;

    /** Upstream delegates */
    upstream icmp_handler_ = nullptr;
    upstream udp_handler_  = nullptr;
    upstream tcp_handler_  = nullptr;

    /** Downstream delegates */
    downstream_ndp ndp_out_ = nullptr;

    /** Packet forwarding  */
    Forward_delg forward_packet_;

    // Filter chains
    Filter_chain<IP6> prerouting_chain_{"Prerouting", {}};
    Filter_chain<IP6> postrouting_chain_{"Postrouting", {}};
    Filter_chain<IP6> input_chain_{"Input", {}};
    Filter_chain<IP6> output_chain_{"Output", {}};

    /** All dropped packets go here */
    drop_handler drop_handler_;

    /** Drop a packet, calling drop handler if set */
    IP_packet_ptr drop(IP_packet_ptr ptr, Direction direction, Drop_reason reason);

  }; //< class IP6

} //< namespace net

#endif


text:
var promise = require('./promise')

module.exports = function delay(ms, d){
  var p = promise()
    , t = setTimeout(function(){ p.resolve(d) }, ms)
  p.abort = function(){ clearTimeout(t) }
  return p
}


text:
require "abstract_unit"
require "active_support/inflector/transliterate"

class TransliterateTest < ActiveSupport::TestCase
  def test_transliterate_should_not_change_ascii_chars
    (0..127).each do |byte|
      char = [byte].pack("U")
      assert_equal char, ActiveSupport::Inflector.transliterate(char)
    end
  end

  def test_transliterate_should_approximate_ascii
    # create string with range of Unicode's western characters with
    # diacritics, excluding the division and multiplication signs which for
    # some reason or other are floating in the middle of all the letters.
    string = (0xC0..0x17E).to_a.reject { |c| [0xD7, 0xF7].include?(c) }.pack("U*")
    string.each_char do |char|
      assert_match %r{^[a-zA-Z']*$}, ActiveSupport::Inflector.transliterate(char)
    end
  end

  def test_transliterate_should_work_with_custom_i18n_rules_and_uncomposed_utf8
    char = [117, 776].pack("U*") # "ü" as ASCII "u" plus COMBINING DIAERESIS
    I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
    default_locale, I18n.locale = I18n.locale, :de
    assert_equal "ue", ActiveSupport::Inflector.transliterate(char)
  ensure
    I18n.locale = default_locale
  end

  def test_transliterate_respects_the_locale_argument
    char = [117, 776].pack("U*") # "ü" as ASCII "u" plus COMBINING DIAERESIS
    I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
    assert_equal "ue", ActiveSupport::Inflector.transliterate(char, locale: :de)
  end

  def test_transliterate_should_allow_a_custom_replacement_char
    assert_equal "a*b", ActiveSupport::Inflector.transliterate("a索b", "*")
  end

  def test_transliterate_handles_empty_string
    assert_equal "", ActiveSupport::Inflector.transliterate("")
  end

  def test_transliterate_handles_nil
    exception = assert_raises ArgumentError do
      ActiveSupport::Inflector.transliterate(nil)
    end
    assert_equal "Can only transliterate strings. Received NilClass", exception.message
  end

  def test_transliterate_handles_unknown_object
    exception = assert_raises ArgumentError do
      ActiveSupport::Inflector.transliterate(Object.new)
    end
    assert_equal "Can only transliterate strings. Received Object", exception.message
  end
end


text:
package com.esafirm.imagepicker.features.common;

import com.esafirm.imagepicker.model.FileSystemData;
import com.esafirm.imagepicker.model.Folder;
import com.esafirm.imagepicker.model.Image;

import java.util.List;

public interface ImageLoaderListener {
    void onImageLoaded(List<Image> images, List<Folder> folders, FileSystemData mFileSystemData);
    void onFailed(Throwable throwable);
}


text:
from .base import *

import json

from django.core.exceptions import ImproperlyConfigured

secrets_path = BASE_DIR.child('config').child('settings', 'secrets.json')

with open(secrets_path) as f:
    secrets = json.loads(f.read())

def get_secret(setting, secrets=secrets):
    try:
        return secrets[setting]
    except KeyError:
        error_msg = "Set the {} environment variable".format(setting)
        raise ImproperlyConfigured(error_msg)

SECRET_KEY = get_secret('SECRET_KEY')

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'portland_python_local',
        'USER': 'portland_python',
        'PASSWORD': 'snakes_and_beer',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

EMAIL_HOST = 'localhost'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': ''
    }
}

MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)

INSTALLED_APPS += ('debug_toolbar',)

INTERNAL_IPS = ('127.0.0.1',)

DEBUG_TOOLBAR_CONFIG = {
    'DISABLE_PANELS': [
        'debug_toolbar.panels.redirects.RedirectsPanel',
    ],
    'SHOW_TEMPLATE_CONTEXT': True,
}

INSTALLED_APPS += ('django_extensions', )

SHELL_PLUS = "ipython"


text:
namespace Slash.AI.BehaviorTrees.Editor
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    using Slash.AI.BehaviorTrees.Attributes;
    using Slash.AI.BehaviorTrees.Implementations;
    using Slash.AI.BehaviorTrees.Interfaces;
    using Slash.Collections.Utils;

    /// <summary>
    ///   Contains information about a decider which should be communicated to the level editor.
    /// </summary>
    [Serializable]
    public class TaskDescription
    {
        #region Public Properties

        /// <summary>
        ///   Class name of the task.
        /// </summary>
        public string ClassName { get; set; }

        /// <summary>
        ///   Task description.
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        ///   Indicates if the task is a decorator and thus can have a child task.
        /// </summary>
        public bool IsDecorator { get; set; }

        /// <summary>
        ///   Name of the task.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///   List of descriptions of the parameters of the task.
        /// </summary>
        public List<TaskParameterDescription> ParameterDescriptions { get; set; }

        /// <summary>
        ///   Full qualified type of the task.
        /// </summary>
        public string TypeName { get; set; }

        #endregion

        #region Properties

        /// <summary>
        ///   Task type. Returns null if the type can't be loaded because it's not available in the current loaded assemblies.
        /// </summary>
        protected Type Type
        {
            get
            {
                return Type.GetType(this.TypeName);
            }
        }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        ///   Generates a task description for the specified task type.
        /// </summary>
        /// <typeparam name="T"> Task type. </typeparam>
        /// <returns> Task description. </returns>
        public static TaskDescription Generate<T>() where T : ITask
        {
            return Generate(typeof(T));
        }

        /// <summary>
        ///   Generates a task description for the specified task type.
        /// </summary>
        /// <param name="taskType"> Task type. </param>
        /// <returns> Task description. </returns>
        public static TaskDescription Generate(Type taskType)
        {
            // Check for task attribute.
            TaskAttribute[] taskAttributes =
                taskType.GetCustomAttributes(typeof(TaskAttribute), true) as TaskAttribute[];
            if (taskAttributes == null || taskAttributes.Length == 0)
            {
                throw new ArgumentException(
                    "Type {0} doesn't have a task attribute which specifies the class as a behavior tree task.",
                    taskType.Name);
            }

            TaskAttribute taskAttribute = taskAttributes[0];

            TaskDescription description = new TaskDescription
                {
                    Name = taskAttribute.Name,
                    Description = taskAttribute.Description,
                    IsDecorator = taskAttribute.IsDecorator,
                    ClassName = taskType.Name,
                    TypeName = taskType.AssemblyQualifiedName,
                    ParameterDescriptions = new List<TaskParameterDescription>()
                };

            MemberInfo[] parameterMembers = taskType.GetMembers();
            foreach (MemberInfo parameterMember in parameterMembers)
            {
                TaskParameterDescription parameterDescription = TaskParameterDescription.Generate(parameterMember);
                if (parameterDescription == null)
                {
                    continue;
                }

                description.ParameterDescriptions.Add(parameterDescription);
            }

            return description;
        }

        /// <summary>
        ///   Creates a task instance from this description. If the task type can't be found, a ReferenceTask instance is created
        ///   which capsules this task description.
        /// </summary>
        /// <returns> Task instance. </returns>
        public ITask CreateInstance()
        {
            // Find task type.
            Type taskType = this.Type ?? typeof(ReferenceTask);

            // Create instance.
            ITask task = (ITask)Activator.CreateInstance(taskType);
            task.Name = this.Name;

            return task;
        }

        public bool Equals(TaskDescription other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            return Equals(other.Name, this.Name)
                   && CollectionUtils.SequenceEqual(other.ParameterDescriptions, this.ParameterDescriptions)
                   && Equals(other.IsDecorator, this.IsDecorator) && Equals(other.TypeName, this.TypeName)
                   && Equals(other.ClassName, this.ClassName);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != typeof(TaskDescription))
            {
                return false;
            }

            return this.Equals((TaskDescription)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = this.Name != null ? this.Name.GetHashCode() : 0;
                result = (result * 397)
                         ^ (this.ParameterDescriptions != null ? this.ParameterDescriptions.GetHashCode() : 0);
                result = (result * 397) ^ this.IsDecorator.GetHashCode();
                result = (result * 397) ^ (this.TypeName != null ? this.TypeName.GetHashCode() : 0);
                result = (result * 397) ^ (this.ClassName != null ? this.ClassName.GetHashCode() : 0);
                return result;
            }
        }

        #endregion
    }
}


text:
// -*- C++ -*-
// $Id: config-qnx-rtp-common.h 79134 2007-07-31 18:23:50Z johnnyw $
// several macros common to various qnx neutrino version.

#ifndef ACE_CONFIG_QNX_RTP_COMMON_H
#define ACE_CONFIG_QNX_RTP_COMMON_H
#include /**/ "ace/pre.h"

#define _POSIX_C_SOURCE 199506
#define _QNX_SOURCE

// These constants are in i386-nto/include/limits.h, but egcs
// picks up its own limits.h instead:
#define _POSIX_NAME_MAX     14      /*  Max bytes in a filename             */
#define _POSIX_PATH_MAX     256     /*  Num. bytes in pathname (excl. NULL) */

#if defined(__OPTIMIZE__)
# if defined(__X86__)
    // string.h can't be used by ACE with __OPTIMIZE__.
#   undef __OPTIMIZE__
#   include <string.h>
#   define __OPTIMIZE__
# endif /* __X86__ */
#endif /* __OPTIMIZE__ */

#include "ace/config-g++-common.h"

// The following defines the Neutrino compiler.
// gcc should know to call g++ as necessary
#ifdef __GNUC__
# define ACE_CC_NAME ACE_TEXT ("gcc")
#else
# define ACE_CC_NAME ACE_TEXT ("QNX-RTP compiler ??")
#endif

// /usr/nto/include/float.h defines
//  FLT_MAX_EXP 127
//  DBL_MAX_EXP 1023
//  ace expects 128 & 1024 respectively
//  to set the following macros in ace/Basic_Types.h
//  These macros are:
#define ACE_SIZEOF_DOUBLE   8
#define ACE_SIZEOF_FLOAT    4

#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_QNX_RTP_COMMON_H */


text:
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.madvoc.interceptor;

import jodd.madvoc.ActionRequest;
import jodd.madvoc.ScopeType;
import jodd.madvoc.component.MadvocContextInjector;
import jodd.madvoc.component.ServletContextInjector;
import jodd.madvoc.injector.ActionPathMacroInjector;
import jodd.madvoc.injector.RequestScopeInjector;
import jodd.madvoc.injector.SessionScopeInjector;
import jodd.madvoc.component.MadvocConfig;
import jodd.madvoc.meta.In;
import jodd.servlet.ServletUtil;
import jodd.servlet.upload.MultipartRequestWrapper;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Configures actions and applies some servlet configuration prior action execution.
 * This interceptor does the following:
 *

 *
uses multi-part request if needed

 *
performs the injection (using either default or specified injector)

 *
invokes the action

 *
performs the outjection.

 *

 */
public class ServletConfigInterceptor extends BaseActionInterceptor {

	@In(scope = ScopeType.CONTEXT)
	protected MadvocConfig madvocConfig;

	@In(scope = ScopeType.CONTEXT)
	protected ServletContextInjector servletContextInjector;

	@In(scope = ScopeType.CONTEXT)
	protected MadvocContextInjector madvocContextInjector;

	protected RequestScopeInjector requestScopeInjector;
	protected SessionScopeInjector sessionScopeInjector;
	protected ActionPathMacroInjector actionPathMacroInjector;

	@Override
	public void init() {
		requestScopeInjector = new RequestScopeInjector(madvocConfig);
		sessionScopeInjector = new SessionScopeInjector();
		actionPathMacroInjector = new ActionPathMacroInjector();
	}

	/**
	 * {@inheritDoc}
	 */
	public Object intercept(ActionRequest actionRequest) throws Exception {
		HttpServletRequest servletRequest = actionRequest.getHttpServletRequest();

		// detect multipart request
		if (ServletUtil.isMultipartRequest(servletRequest)) {
			servletRequest = new MultipartRequestWrapper(servletRequest, madvocConfig.getFileUploadFactory(), madvocConfig.getEncoding());
			actionRequest.setHttpServletRequest(servletRequest);
		}

		// do it
		inject(actionRequest);
		Object result = actionRequest.invoke();
		outject(actionRequest);
		return result;
	}

	/**
	 * Performs injection.
	 */
	protected void inject(ActionRequest actionRequest) {
		Object target = actionRequest.getAction();
		HttpServletRequest servletRequest = actionRequest.getHttpServletRequest();
		HttpServletResponse servletResponse = actionRequest.getHttpServletResponse();

		madvocContextInjector.injectMadvocContext(target);

		// no need to inject madvoc params, as this can be slow
		// and its better to use some single data object instead
		//madvocContextInjector.injectMadvocParams(target);

		servletContextInjector.injectContext(target, servletRequest, servletResponse);

		sessionScopeInjector.inject(target, servletRequest);

		requestScopeInjector.prepare(servletRequest);
		requestScopeInjector.inject(target, servletRequest);

		actionPathMacroInjector.inject(target, actionRequest);
	}

	/**
	 * Performs outjection.
	 */
	protected void outject(ActionRequest actionRequest) {
		Object target = actionRequest.getAction();
		HttpServletRequest servletRequest = actionRequest.getHttpServletRequest();
		HttpServletResponse servletResponse = actionRequest.getHttpServletResponse();

		madvocContextInjector.outjectMadvocContext(target);
		servletContextInjector.outjectContext(target, servletRequest, servletResponse);

		sessionScopeInjector.outject(target, servletRequest);

		requestScopeInjector.outject(target, servletRequest);
	}

}


text:
"""
Main dispatcher for Talkback apps.
"""
import os
import yaml
from talkback.core import App, Intent, IntentNotFound, AppNotFound
import threading
import logging

log = logging.getLogger('talkback')

class ConfigError(Exception):
    """
    Indicates a configuration problem with Talkback.
    """

def get_app(app_name):
    """
    Gets the specified app.
    """
    try:
        return app_map[app_name]
    except KeyError:
        raise AppNotFound("Can't find %s" % app_name)

default_app = None

def get_default_app():
    """
    Gets whatever app has been specified as the default.
    """
    return app_map.get('__default__',None)

def get_intent(app_name,intent_name):
    """
    Gets the intent by name.
    """
    try:
        return app_map[app_name][intent_name]
    except KeyError:
        raise IntentNotFound()

def intent_for(app_name,text):
    """
    Gets the intent that matches the specified text.
    """
    try:
        return app_map[app_name].intent_for(text)
    except KeyError:
        raise IntentNotFound()

app_map = {}

def init(config_path=None):
    """
    Initializes the Dispatcher. Relies on the TALKBACK_CONFIG envar.
    """
    if not app_map:
        config_file_path = config_path or os.environ.get('TALKBACK_CONFIG',None)
        if not config_file_path:
            raise ConfigError('No config file set. Define TALKBACK_CONFIG environment variable.')

        try:
            # ingest the config file
            config_file = file(config_file_path,'r')
            data = yaml.safe_load(config_file)
            print 'config data',data

            for app_wrapper in data['Apps']:
                app_data = app_wrapper['App']
                app = App(app_data['Name'],app_data['Greeting'])
                for intent_wrapper in app_data['Intents']:
                    intent = Intent(intent_wrapper)
                    app[intent.name] = intent
                app_map[app.name] = app

            if 'Default' in data:
                app_map['__default__'] = app_map[data['Default']]

        except Exception as e:
            log.exception('Problem with Dispatcher init.')
            raise ConfigError(e)


text:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>iEmoji</name>
    <description>
        表情宝,一套有趣的表情app
    </description>
    <author email="hcy2367@163.com" href="https://github.com/hcy2367">
        chmyun
    </author>

	<!-- Core plugins -->
    <!-- Basic device information (Device API) -->
    <gap:plugin name="org.apache.cordova.device" />

    <!-- Accelerometer, Compass, and Geolocation: -->
    <gap:plugin name="org.apache.cordova.device-motion" />
    <gap:plugin name="org.apache.cordova.device-orientation" />
    <gap:plugin name="org.apache.cordova.geolocation" />

    <!-- Network Connection and Battery Events -->
    <gap:plugin name="org.apache.cordova.network-information" />
    <gap:plugin name="org.apache.cordova.battery-status" />

    <!-- Camera, Media playback and Capture -->
    <gap:plugin name="org.apache.cordova.camera" />
    <gap:plugin name="org.apache.cordova.media" />
    <gap:plugin name="org.apache.cordova.media-capture" />

    <!-- Debug console -->
    <gap:plugin name="org.apache.cordova.console" />

    <!-- Contacts -->
    <gap:plugin name="org.apache.cordova.contacts" />

    <!-- Notification via dialog box or vibration -->
    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.vibration" />

    <!-- Access files on device or network (File API) -->
    <gap:plugin name="org.apache.cordova.file" />
    <gap:plugin name="org.apache.cordova.file-transfer" />

    <!-- Globalization -->
    <gap:plugin name="org.apache.cordova.globalization" />

    <!-- Open new browser windows (InAppBrowser) -->
    <gap:plugin name="org.apache.cordova.inappbrowser" />

    <!-- Splashscreen -->
    <gap:plugin name="org.apache.cordova.splashscreen" />

    <gap:plugin name="org.apache.cordova.statusbar" />

    <!-- Third party plugins -->
    <!-- A list of available plugins are available at https://build.phonegap.com/plugins -->
    <!--
        <gap:plugin name="com.phonegap.plugins.barcodescanner" />
    -->

    <access origin="*" />

</widget>


text:
1) Installation
---------------

# Create folder app/sessions with 777 rights

On OSX install ElasticSearch with: `brew install elasticsearch`

```bash
# Install composer depedencies
curl -s http://getcomposer.org/installer | php
php composer.phar install

# Install nodeJS packages
npm install

# Install bower packages
bower install

# build assets
gulp build

# populate elastica indexes
php app/console fos:elastica:populate

# Load communes datas
php app/console doctrine:fixtures:load --append --fixtures src/ServiceCivique/Bundle/AddressingBundle/DataFixtures/ORM

# Import translations
php app/console lexik:translations:import

# Ruby dependencies (capistrano)
gem install bundler
```

2) Tests
--------

Before running test update database schema and clear cache

```bash
php app/console cache:clear --env=test
php app/console doctrine:schema:update --force --env=test
php app/console lexik:translations:import --force --env=test
```

Run tests:

```bash
bin/phpspec run
bin/behat
```

3) Cronjobs
--------

Check that cronjobs are set :

```bash
# Archive old missions (monthly)
0 0 1 * * php /home/www/new.service-civique.gouv.dev.scoua.de/current/app/console sc:archive:missions --env=prod
# Add new mailchimp subscribers (daily)
0 0 * * * php /home/www/new.service-civique.gouv.dev.scoua.de/current/app/console sc:update_mailchimp_subscribers --env=prod
```

4) Import CV
-------------

```bash
# Download all resumes (ZzzZzZZzzzz)
# example in preprod
scp -r -P 2222 lanetpprssh@89.31.147.217:/var/www/test.service-civique.gouv.fr/current/sites/default/files/webform/ /path/to/symfony/web/drupal-cv/

# Launch the command to rename and move resumes
php app/console sc:import:resumes

# Delete imported resumes
rm -rf /path/to/symfony/web/drupal-cv

```


text:
Originally published: 2015-03-05 15:59:29
Last updated: 2015-03-05 15:59:30
Author: alexander baker

The strategy here is not to iterate through the set of possible integer values and check for is_perfect_square()
      each time but to translate the upper and lower values to either complex or real space of square numbers.

        # O(n) complexity
        len([x for x in range(0, 100) if x!= 0 and float(math.sqrt(x)).is_integer()])

        so if a and b positive then we count the number of integer values between upper and lower sqrt() values
        if either a or b are negative then we need to use the complex number space for the sqrt() results. In this case
        we are still counting integer values either along the imaginary or real axis, the result is then a simple sum
        if both a and b are negative we need to make sure that when walking down the same imaginary axis we dont count
        the same inteters twice, in this case we can take the min(a,b) to get max distinct set of integer values.


text:
.class Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;
.super Ljava/lang/Object;
.source "AudioService.java"

# interfaces
.implements Landroid/os/IBinder$DeathRecipient;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/media/AudioService$VolumeStreamState;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "VolumeDeathHandler"
.end annotation

# instance fields
.field private mICallback:Landroid/os/IBinder;

.field private mMuteCount:I

.field final synthetic this$1:Landroid/media/AudioService$VolumeStreamState;

# direct methods
.method constructor <init>(Landroid/media/AudioService$VolumeStreamState;Landroid/os/IBinder;)V
    .locals 0
    .param p2, "cb"    # Landroid/os/IBinder;

    .prologue
    .line 3799
    iput-object p1, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 3800
    iput-object p2, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    .line 3801
    return-void
.end method

.method static synthetic access$2300(Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;)I
    .locals 1
    .param p0, "x0"    # Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;

    .prologue
    .line 3795
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    return v0
.end method

.method static synthetic access$2302(Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;I)I
    .locals 0
    .param p0, "x0"    # Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;
    .param p1, "x1"    # I

    .prologue
    .line 3795
    iput p1, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    return p1
.end method

.method static synthetic access$5000(Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;)Landroid/os/IBinder;
    .locals 1
    .param p0, "x0"    # Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;

    .prologue
    .line 3795
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    return-object v0
.end method

# virtual methods
.method public binderDied()V
    .locals 3

    .prologue
    .line 3865
    const-string v0, "AudioService"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Volume service client died for stream: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mStreamType:I
    invoke-static {v2}, Landroid/media/AudioService$VolumeStreamState;->access$4900(Landroid/media/AudioService$VolumeStreamState;)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 3866
    const-class v1, Landroid/media/AudioService$VolumeStreamState;

    monitor-enter v1

    .line 3867
    :try_start_0
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    if-eqz v0, :cond_0

    .line 3869
    const/4 v0, 0x1

    iput v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    .line 3870
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mute_syncVSS(Z)V

    .line 3872
    :cond_0
    monitor-exit v1

    .line 3873
    return-void

    .line 3872
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public mute_syncVSS(Z)V
    .locals 9
    .param p1, "state"    # Z

    .prologue
    const/4 v3, 0x0

    .line 3805
    const/4 v8, 0x0

    .line 3806
    .local v8, "updateVolume":Z
    if-eqz p1, :cond_5

    .line 3807
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    if-nez v0, :cond_4

    .line 3811
    :try_start_0
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    if-eqz v0, :cond_0

    .line 3812
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    const/4 v1, 0x0

    invoke-interface {v0, p0, v1}, Landroid/os/IBinder;->linkToDeath(Landroid/os/IBinder$DeathRecipient;I)V

    .line 3815
    :cond_0
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mDeathHandlers:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$2200(Landroid/media/AudioService$VolumeStreamState;)Ljava/util/ArrayList;

    move-result-object v1

    monitor-enter v1
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 3816
    :try_start_1
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mDeathHandlers:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$2200(Landroid/media/AudioService$VolumeStreamState;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 3817
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 3820
    :try_start_2
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # invokes: Landroid/media/AudioService$VolumeStreamState;->isMuted_syncVSS()Z
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$300(Landroid/media/AudioService$VolumeStreamState;)Z
    :try_end_2
    .catch Landroid/os/RemoteException; {:try_start_2 .. :try_end_2} :catch_0

    move-result v0

    if-nez v0, :cond_1

    .line 3821
    const/4 v8, 0x1

    .line 3831
    :cond_1
    :goto_0
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    .line 3854
    :cond_2
    :goto_1
    if-eqz v8, :cond_3

    .line 3855
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    iget-object v0, v0, Landroid/media/AudioService$VolumeStreamState;->this$0:Landroid/media/AudioService;

    # getter for: Landroid/media/AudioService;->mAudioHandler:Landroid/media/AudioService$AudioHandler;
    invoke-static {v0}, Landroid/media/AudioService;->access$000(Landroid/media/AudioService;)Landroid/media/AudioService$AudioHandler;

    move-result-object v0

    const/16 v1, 0xa

    const/4 v2, 0x2

    iget-object v5, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    move v4, v3

    move v6, v3

    # invokes: Landroid/media/AudioService;->sendMsg(Landroid/os/Handler;IIIILjava/lang/Object;I)V
    invoke-static/range {v0 .. v6}, Landroid/media/AudioService;->access$100(Landroid/os/Handler;IIIILjava/lang/Object;I)V

    .line 3862
    :cond_3
    :goto_2
    return-void

    .line 3817
    :catchall_0
    move-exception v0

    :try_start_3
    monitor-exit v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    :try_start_4
    throw v0
    :try_end_4
    .catch Landroid/os/RemoteException; {:try_start_4 .. :try_end_4} :catch_0

    .line 3823
    :catch_0
    move-exception v7

    .line 3825
    .local v7, "e":Landroid/os/RemoteException;
    invoke-virtual {p0}, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->binderDied()V

    goto :goto_2

    .line 3829
    .end local v7    # "e":Landroid/os/RemoteException;
    :cond_4
    const-string v0, "AudioService"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "stream: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mStreamType:I
    invoke-static {v2}, Landroid/media/AudioService$VolumeStreamState;->access$4900(Landroid/media/AudioService$VolumeStreamState;)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " was already muted by this client"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 3833
    :cond_5
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    if-nez v0, :cond_6

    .line 3834
    const-string v0, "AudioService"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "unexpected unmute for stream: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mStreamType:I
    invoke-static {v2}, Landroid/media/AudioService$VolumeStreamState;->access$4900(Landroid/media/AudioService$VolumeStreamState;)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 3836
    :cond_6
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    .line 3837
    iget v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mMuteCount:I

    if-nez v0, :cond_2

    .line 3839
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mDeathHandlers:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$2200(Landroid/media/AudioService$VolumeStreamState;)Ljava/util/ArrayList;

    move-result-object v1

    monitor-enter v1

    .line 3841
    :try_start_5
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # getter for: Landroid/media/AudioService$VolumeStreamState;->mDeathHandlers:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$2200(Landroid/media/AudioService$VolumeStreamState;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z

    .line 3842
    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    .line 3845
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    if-eqz v0, :cond_7

    .line 3846
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->mICallback:Landroid/os/IBinder;

    invoke-interface {v0, p0, v3}, Landroid/os/IBinder;->unlinkToDeath(Landroid/os/IBinder$DeathRecipient;I)Z

    .line 3848
    :cond_7
    iget-object v0, p0, Landroid/media/AudioService$VolumeStreamState$VolumeDeathHandler;->this$1:Landroid/media/AudioService$VolumeStreamState;

    # invokes: Landroid/media/AudioService$VolumeStreamState;->isMuted_syncVSS()Z
    invoke-static {v0}, Landroid/media/AudioService$VolumeStreamState;->access$300(Landroid/media/AudioService$VolumeStreamState;)Z

    move-result v0

    if-nez v0, :cond_2

    .line 3849
    const/4 v8, 0x1

    goto/16 :goto_1

    .line 3842
    :catchall_1
    move-exception v0

    :try_start_6
    monitor-exit v1
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_1

    throw v0
.end method


text:
static-builder
==============