text:
<?php
// $Id: panels-pane.tpl.php,v 1.3 2010/10/11 22:56:02 sdboyer Exp $
/**
 * @file panels-pane.tpl.php
 * Main panel pane template
 *
 * Variables available:
 * - $pane->type: the content type inside this pane
 * - $pane->subtype: The subtype, if applicable. If a view it will be the
 *   view name; if a node it will be the nid, etc.
 * - $title: The title of the content
 * - $content: The actual content
 * - $links: Any links associated with the content
 * - $more: An optional 'more' link (destination only)
 * - $admin_links: Administrative links associated with the content
 * - $feeds: Any feed icons or associated with the content
 * - $display: The complete panels display object containing all kinds of
 *   data including the contexts and all of the other panes being displayed.
 */
?>
<div class="<?php print $classes; ?>" <?php print $id; ?>>
  <?php if ($admin_links): ?>
    <?php print $admin_links; ?>
  <?php endif; ?>

  <?php if ($title): ?>

<?php print $title; ?>

  <?php endif; ?>

  <?php if ($feeds): ?>

      <?php print $feeds; ?>

  <?php endif; ?>

    <?php print render($content); ?>

  <?php if ($links): ?>

      <?php print $links; ?>

  <?php endif; ?>

  <?php if ($more): ?>

      <?php print $more; ?>

  <?php endif; ?>


text:
<?php

declare(strict_types=1);

namespace Greenter\Validator\Entity;

class CpeError
{
    /**
     * @var string|null
     */
    private $code;
    /**
     * @var string|null
     */
    private $message;
    /**
     * @var string|null
     */
    private $level;
    /**
     * @var string|null
     */
    private $nodePath;
    /**
     * @var string|null
     */
    private $nodeValue;

    /**
     * @return string|null
     */
    public function getCode(): ?string
    {
        return $this->code;
    }

    /**
     * @param string|null $code
     * @return CpeError
     */
    public function setCode(?string $code): CpeError
    {
        $this->code = $code;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getMessage(): ?string
    {
        return $this->message;
    }

    /**
     * @param string|null $message
     * @return CpeError
     */
    public function setMessage(?string $message): CpeError
    {
        $this->message = $message;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getLevel(): ?string
    {
        return $this->level;
    }

    /**
     * @param string|null $level
     * @return CpeError
     */
    public function setLevel(?string $level): CpeError
    {
        $this->level = $level;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getNodePath(): ?string
    {
        return $this->nodePath;
    }

    /**
     * @param string|null $nodePath
     * @return CpeError
     */
    public function setNodePath(?string $nodePath): CpeError
    {
        $this->nodePath = $nodePath;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getNodeValue(): ?string
    {
        return $this->nodeValue;
    }

    /**
     * @param string|null $nodeValue
     * @return CpeError
     */
    public function setNodeValue(?string $nodeValue): CpeError
    {
        $this->nodeValue = $nodeValue;
        return $this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="false" android:state_enabled="true" android:state_active="false" android:drawable="@drawable/ic_lockscreen_browser_normal" />
    <item android:state_focused="false" android:state_enabled="true" android:state_active="true" android:drawable="@drawable/ic_lockscreen_browser_activated" />
    <item android:state_focused="true" android:state_enabled="true" android:state_active="false" android:drawable="@drawable/ic_lockscreen_browser_activated" />
</selector>


text:
'use strict';

requireCommon('test/synthetic_gestures.js');
require('/tests/performance/performance_helper.js');
require('apps/communications/dialer/test/integration/app.js');

suite(window.mozTestInfo.appPath + '>', function() {
  var device;
  var app;

  MarionetteHelper.start(function(client) {
    app = new DialerIntegration(client);
    device = app.device;
  });

  setup(function() {
    yield IntegrationHelper.unlock(device);
  });

  test('Dialer/callLog rendering time >', function() {

    this.timeout(500000);
    yield device.setScriptTimeout(50000);

    var lastEvent = 'call-log-ready';

    var performanceHelper = new PerformanceHelper({
      app: app,
      lastEvent: lastEvent
    });

    yield performanceHelper.repeatWithDelay(function(app, next) {
      var waitForBody = true;
      yield app.launch(waitForBody);

      var recentsButton = yield app.element('optionRecents');

      yield recentsButton.singleTap();

      var runResults = yield performanceHelper.observe(next);
      performanceHelper.reportRunDurations(runResults);

      yield app.close();
    });

    performanceHelper.finish();
  });
});


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.zero.debloper.kaddu" >

    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".ProfileRecyclerViewActivity" />
        <activity android:name=".VoiceCommandHelpActivity" />
        <activity android:name=".AboutActivity" />
    </application>

</manifest>


text:
/** global: Craft */
/** global: Garnish */
/**
 * Category Select input
 */
Craft.CategorySelectInput = Craft.BaseElementSelectInput.extend(
    {
        setSettings: function() {
            this.base.apply(this, arguments);
            this.settings.sortable = false;
        },

        getModalSettings: function() {
            var settings = this.base();
            settings.hideOnSelect = false;
            return settings;
        },

        getElements: function() {
            return this.$elementsContainer.find('.element');
        },

        onModalSelect: function(elements) {
            // Disable the modal
            this.modal.disable();
            this.modal.disableCancelBtn();
            this.modal.disableSelectBtn();
            this.modal.showFooterSpinner();

            // Get the new category HTML
            var selectedCategoryIds = this.getSelectedElementIds();

            for (var i = 0; i < elements.length; i++) {
                selectedCategoryIds.push(elements[i].id);
            }

            var data = {
                categoryIds: selectedCategoryIds,
                siteId: elements[0].siteId,
                id: this.settings.id,
                name: this.settings.name,
                branchLimit: this.settings.branchLimit,
                selectionLabel: this.settings.selectionLabel
            };

            Craft.postActionRequest('elements/get-categories-input-html', data, $.proxy(function(response, textStatus) {
                this.modal.enable();
                this.modal.enableCancelBtn();
                this.modal.enableSelectBtn();
                this.modal.hideFooterSpinner();

                if (textStatus === 'success') {
                    var $newInput = $(response.html),
                        $newElementsContainer = $newInput.children('.elements');

                    this.$elementsContainer.replaceWith($newElementsContainer);
                    this.$elementsContainer = $newElementsContainer;
                    this.resetElements();

                    var filteredElements = [];

                    for (var i = 0; i < elements.length; i++) {
                        var element = elements[i],
                            $element = this.getElementById(element.id);

                        if ($element) {
                            this.animateElementIntoPlace(element.$element, $element);
                            filteredElements.push(element);
                        }
                    }

                    this.updateDisabledElementsInModal();
                    this.modal.hide();
                    this.onSelectElements(filteredElements);
                }
            }, this));
        },

        removeElement: function($element) {
            // Find any descendants this category might have
            var $allCategories = $element.add($element.parent().siblings('ul').find('.element'));

            // Remove our record of them all at once
            this.removeElements($allCategories);

            // Animate them away one at a time
            for (var i = 0; i < $allCategories.length; i++) {
                this._animateCategoryAway($allCategories, i);
            }
        },

        _animateCategoryAway: function($allCategories, i) {
            var callback;

            // Is this the last one?
            if (i === $allCategories.length - 1) {
                callback = $.proxy(function() {
                    var $li = $allCategories.first().parent().parent(),
                        $ul = $li.parent();

                    if ($ul[0] === this.$elementsContainer[0] || $li.siblings().length) {
                        $li.remove();
                    }
                    else {
                        $ul.remove();
                    }
                }, this);
            }

            var func = $.proxy(function() {
                this.animateElementAway($allCategories.eq(i), callback);
            }, this);

            if (i === 0) {
                func();
            }
            else {
                setTimeout(func, 100 * i);
            }
        }
    });


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Fohanno
* Fulup
* Gwenn-Ael
-->
<resources>
  <string name="crash_dialog_title">Commons zo chomet boud</string>
  <string name="crash_dialog_text">Hopala ! Un dra bennak a-dreuz zo bet !</string>
  <string name="crash_dialog_comment_prompt">Lavarit din ar pezh e oac\'h oc\'h ober, ha kasit dimp ar pezh e oac\'h oc\'h ober dre bostel da c\'houde. Sikour a ray ac\'hanomp da reizhañ an dra-se !</string>
  <string name="crash_dialog_ok_toast">Trugarez deoc\'h</string>
</resources>


text:
<?php

namespace AmpProject\Optimizer\Configuration;

use AmpProject\Optimizer\Exception\InvalidConfigurationValue;
use AmpProject\RuntimeVersion;

/**
 * Configuration for the AmpRuntimeCss transformer.
 *
 * @property bool    $canary  Whether to use the canary version or not. Defaults to false.
 * @property string  $styles  Runtime styles to use.
 * @property string  $version Version string to use. Defaults to an empty string.
 *
 * @package ampproject/amp-toolbox
 */
final class AmpRuntimeCssConfiguration extends BaseTransformerConfiguration
{
    /**
     * Configuration key that holds the flag for the canary version of the runtime style.
     *
     * @var string
     */
    const CANARY = RuntimeVersion::OPTION_CANARY;

    /**
     * Configuration key that holds the actual runtime CSS styles to use.
     *
     * If the styles are not provided, the latest runtime styles are fetched from cdn.ampproject.org.
     *
     * @var string
     */
    const STYLES = 'styles';

    /**
     * Configuration key that holds the version number to use.
     *
     * If the version is not provided, the latest runtime version is fetched from cdn.ampproject.org.
     *
     * @var string
     */
    const VERSION = 'version';

    /**
     * Get the associative array of allowed keys and their respective default values.
     *
     * The array index is the key and the array value is the key's default value.
     *
     * @return array Associative array of allowed keys and their respective default values.
     */
    protected function getAllowedKeys()
    {
        return [
            self::CANARY  => false,
            self::STYLES  => '',
            self::VERSION => '',
        ];
    }

    /**
     * Validate an individual configuration entry.
     *
     * @param string $key   Key of the configuration entry to validate.
     * @param mixed  $value Value of the configuration entry to validate.
     * @return mixed Validated value.
     */
    protected function validate($key, $value)
    {
        switch ($key) {
            case self::CANARY:
                if (! is_bool($value)) {
                    throw InvalidConfigurationValue::forInvalidSubValueType(
                        self::class,
                        self::CANARY,
                        'boolean',
                        is_object($value) ? get_class($value) : gettype($value)
                    );
                }
                break;

            case self::STYLES:
                if (! is_string($value)) {
                    throw InvalidConfigurationValue::forInvalidSubValueType(
                        self::class,
                        self::STYLES,
                        'string',
                        is_object($value) ? get_class($value) : gettype($value)
                    );
                }
                $value = trim($value);
                break;

            case self::VERSION:
                if (! is_string($value)) {
                    throw InvalidConfigurationValue::forInvalidSubValueType(
                        self::class,
                        self::VERSION,
                        'string',
                        is_object($value) ? get_class($value) : gettype($value)
                    );
                }
                $value = trim($value);
                break;
        }

        return $value;
    }
}


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>SesameSDK Reference</title>
		<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.2 (build 963)" />

SesameSDK

				Atama

SesameSDK Reference

					Next

SesameSDK Reference

Welcome to the Sesame SDK Reference guide. Here you can find full API documentation for the iOS and OSX SDK.

A high level overview of this SDK can be found at: Overview

A sample project can be found on GitHub alongside the SDK download and installation instructions: Sesame SDK Github

Class References

ATASesame

ATASesameManager

Constant References

ATABroadcastPower

ATAConnectionState

ATASignalStrength

Block References

ATAChallengeCallback

ATAConnectionStateCallback

ATASesameScanningCallback

ATASignalStrengthCallback

					Next

© 2014 Atama. All rights reserved. (Last updated: 2014-12-15)

						Generated by appledoc 2.2 (build 963).


text:
<!DOCTYPE html>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>GoHart</title>
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="css/styles.min.css">
		<link rel="stylesheet" href="css/styles2.css">

			<?php include ("views/main-nav.php"); ?>

HART

EMPLOYMENT

CAREERS

								Public transportation services are becoming one of the fastest growing industries in our nation. If you take pride in a job well done, enjoy being of service to others or desire to work in a technological field -- a career with the Hillsborough Area Regional Transit Authority (HART) may be just what you are looking for.

OPPORTUNITIES

								We have all types of employment opportunities awaiting people just like you. Bus operators are regularly recruited as HART continues to grow.

											VIEW CURRENT

											OPEN JOB POSITIONS

											LOGIN OR CREATE AN ACCOUNT

											APPLY HERE

EMPLOYEE BENEFITS

Health Insurance

Life Insurance

Long-Term Disability Insurance

Florida State Retirement Program

Deferred Compensation Plan (457 Plan)

Vacation and Paid Sick Leave

Credit Union Membership (no fees)

Tuition Reimbursement

Paid Training Programs

Free HART Bus Transportation (for Employee) and low cost annual spouse and child passes

Uniform Allowance

Other Supplemental Options as Offered by Outside Providers (i.e.; Short Term Disability Insurance, AFLAC, etc.)

HART is a drug free, safe work environment and an Equal Opportunity Employer

								Hillsborough Area Regional Transit

								4305 E 21st Avenue

								Tampa, FL 33605

									WANT TO FIND OUT MORE? VISIT
									BUSINESS

		<?php include ("views/scripts-load.php"); ?>


text:
#include "mitkRenderWindowBase.h"
#include "mitkDisplayPositionEvent.h"
#include "mitkVtkLayerController.h"
#include "mitkRenderingManager.h"
#include "vtkRenderer.h"

mitk::RenderWindowBase::RenderWindowBase( )
{
}

/*
* "Member functions, including virtual functions (10.3), can be called during construction or destruction (12.6.2). When a
* virtual function is called directly or indirectly from a constructor (including from the mem-initializer for a data member) or from
* a destructor, and the object to which the call applies is the object under construction or destruction, the function called is
* the one defined in the constructor or destructor�s own class or in one of its bases, but not a function overriding it in a class
* derived from the constructor or destructor�s class, or overriding it in one of the other base classes of the most derived object[..]"

* or short: within constructors and destructors classes are not polymorph.
*/
void mitk::RenderWindowBase::Initialize( mitk::RenderingManager* renderingManager, const char* name )
{
  if ( renderingManager == NULL )
  {
    renderingManager = mitk::RenderingManager::GetInstance();
  }

  if(m_Renderer.IsNull())
  {
      m_Renderer = mitk::VtkPropRenderer::New( name , GetVtkRenderWindow(), renderingManager );
  }

  m_Renderer->InitRenderer(this->GetVtkRenderWindow());

  mitk::BaseRenderer::AddInstance(GetVtkRenderWindow(),m_Renderer);

  renderingManager->AddRenderWindow(GetVtkRenderWindow());

  m_RenderProp = vtkMitkRenderProp::New();
  m_RenderProp->SetPropRenderer(m_Renderer);
  m_Renderer->GetVtkRenderer()->AddViewProp(m_RenderProp);

  if((this->GetVtkRenderWindow()->GetSize()[0] > 10)
      && (this->GetVtkRenderWindow()->GetSize()[1] > 10))
    m_Renderer->InitSize(this->GetVtkRenderWindow()->GetSize()[0], this->GetVtkRenderWindow()->GetSize()[1]);

  m_InResize = false;
}

bool mitk::RenderWindowBase::HandleEvent(InteractionEvent* interactionEvent)
{
  return m_Renderer->GetDispatcher()->ProcessEvent(interactionEvent);
}

void mitk::RenderWindowBase::Destroy()
{
  m_Renderer->GetRenderingManager()->RemoveRenderWindow(GetVtkRenderWindow());
  mitk::BaseRenderer::RemoveInstance(GetVtkRenderWindow());
  m_Renderer->GetVtkRenderer()->RemoveViewProp(m_RenderProp);
  m_RenderProp->Delete();
}

mitk::RenderWindowBase::~RenderWindowBase()
{

}

void mitk::RenderWindowBase::mousePressMitkEvent(mitk::MouseEvent *me)
{
  if (m_Renderer.IsNotNull())
    m_Renderer->MousePressEvent(me);
}

void mitk::RenderWindowBase::mouseReleaseMitkEvent(mitk::MouseEvent *me)
{
  if(m_Renderer.IsNotNull())
    m_Renderer->MouseReleaseEvent(me);
}

void mitk::RenderWindowBase::mouseMoveMitkEvent(mitk::MouseEvent *me)
{
  if (m_Renderer.IsNotNull())
     m_Renderer->MouseMoveEvent(me);
}

void mitk::RenderWindowBase::wheelMitkEvent(mitk::WheelEvent *we)
{
  if(m_Renderer.IsNotNull())
  {
    m_Renderer->WheelEvent(we);
  }
}

void mitk::RenderWindowBase::keyPressMitkEvent(mitk::KeyEvent* mke)
{
  if (m_Renderer.IsNotNull())
    m_Renderer->KeyPressEvent(mke);
}

void mitk::RenderWindowBase::resizeMitkEvent(int width, int height)
{
  if(m_InResize) //@FIXME CRITICAL probably related to VtkSizeBug
    return;
  m_InResize = true;

  if(m_Renderer.IsNotNull())
  {
    m_Renderer->Resize(width, height);
  }

  m_InResize = false;
}

mitk::SliceNavigationController * mitk::RenderWindowBase::GetSliceNavigationController()
{
  return mitk::BaseRenderer::GetInstance(this->GetVtkRenderWindow())->GetSliceNavigationController();
}

mitk::CameraRotationController * mitk::RenderWindowBase::GetCameraRotationController()
{
  return mitk::BaseRenderer::GetInstance(this->GetVtkRenderWindow())->GetCameraRotationController();
}

mitk::BaseController * mitk::RenderWindowBase::GetController()
{
  mitk::BaseRenderer * renderer = mitk::BaseRenderer::GetInstance(GetVtkRenderWindow());
  switch ( renderer->GetMapperID() )
  {
    case mitk::BaseRenderer::Standard2D:
      return GetSliceNavigationController();

    case mitk::BaseRenderer::Standard3D:
      return GetCameraRotationController();

    default:
      return GetSliceNavigationController();
  }
}

mitk::VtkPropRenderer* mitk::RenderWindowBase::GetRenderer()
{
  return m_Renderer;
}


text:
import os

_curr_dir = os.path.dirname(__file__)

APP_NAME = 'Ketchuporo'

class Files(object):
    BELL_SOUND = os.path.join(_curr_dir, 'lib', 'audio', 'bell.wav')
    KV = os.path.join(_curr_dir, 'ketchuporo.kv')
    SETTINGS = os.path.join(_curr_dir, 'settings.json')
    SETTINGS_DEFAULT = os.path.join(_curr_dir, 'settings_default.json')


text:
<?php

namespace Mautic\CoreBundle\Helper;

use Mautic\CoreBundle\Exception as MauticException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Mautic\CoreBundle\Templating\Helper\ThemeHelper as TemplatingThemeHelper;

class ThemeHelper
{
    /**
     * @var PathsHelper
     */
    private $pathsHelper;

    /**
     * @var array|mixed
     */
    private $themes = array();

    /**
     * @var array
     */
    private $themesInfo = array();

    /**
     * @var array
     */
    private $steps = array();

    /**
     * @var string
     */
    private $defaultTheme;

    /**
     * @var TemplatingThemeHelper[]
     */
    private $themeHelpers = array();

    /**
     * ThemeHelper constructor.
     *
     * @param PathsHelper $pathsHelper
     */
    public function __construct(PathsHelper $pathsHelper, TemplatingHelper $templatingHelper)
    {
        $this->pathsHelper = $pathsHelper;
        $this->templatingHelper = $templatingHelper;
    }

    /**
     * @param string $defaultTheme
     */
    public function setDefaultTheme($defaultTheme)
    {
        $this->defaultTheme = $defaultTheme;
    }

    /**
     * @param string $themeName
     *
     * @return ThemeHelper
     */
    public function createThemeHelper($themeName)
    {
        if ($themeName === 'current') {
            $themeName = $this->defaultTheme;
        }

        $themeHelper = new TemplatingThemeHelper($this->pathsHelper, $themeName);

        return $themeHelper;
    }

    /**
     * @param $newName
     *
     * @return string
     */
    private function getDirectoryName($newName)
    {
        return InputHelper::alphanum($newName, true);
    }

    /**
     * @param $theme
     * @param $newName
     *
     * @throws MauticException\FileExistsException
     * @throws MauticException\FileNotFoundException
     */
    public function copy($theme, $newName)
    {
        $root      = $this->pathsHelper->getSystemPath('themes_root') . '/';
        $themes    = $this->getInstalledThemes();

        //check to make sure the theme exists
        if (!isset($themes[$theme])) {
            throw new MauticException\FileNotFoundException($theme . ' not found!');
        }

        $dirName = $this->getDirectoryName($newName);

        $fs = new Filesystem();

        if ($fs->exists($root . $dirName)) {
            throw new MauticException\FileExistsException("$dirName already exists");
        }

        $fs->mirror($root . $theme, $root . $dirName);

        $this->updateConfig($root . $dirName, $newName);
    }

    /**
     * @param $theme
     * @param $newName
     *
     * @throws MauticException\FileNotFoundException
     * @throws MauticException\FileExistsException
     */
    public function rename($theme, $newName)
    {
        $root      = $this->pathsHelper->getSystemPath('themes_root') . '/';
        $themes    = $this->getInstalledThemes();

        //check to make sure the theme exists
        if (!isset($themes[$theme])) {
            throw new MauticException\FileNotFoundException($theme . ' not found!');
        }

        $dirName = $this->getDirectoryName($newName);

        $fs = new Filesystem();

        if ($fs->exists($root . $dirName)) {
            throw new MauticException\FileExistsException("$dirName already exists");
        }

        $fs->rename($root . $theme, $root . $dirName);

        $this->updateConfig($root . $theme, $dirName);
    }

    /**
     * @param $theme
     *
     * @throws MauticException\FileNotFoundException
     */
    public function delete($theme)
    {
        $root      = $this->pathsHelper->getSystemPath('themes_root') . '/';
        $themes    = $this->getInstalledThemes();

        //check to make sure the theme exists
        if (!isset($themes[$theme])) {
            throw new MauticException\FileNotFoundException($theme . ' not found!');
        }

        $fs = new Filesystem();
        $fs->remove($root . $theme);
    }

    /**
     * Updates the theme configuration and converts
     * it to json if still using php array
     *
     * @param $themePath
     * @param $newName
     */
    private function updateConfig($themePath, $newName)
    {
        if (file_exists($themePath . '/config.json')) {
            $config = json_decode(file_get_contents($themePath . '/config.json'), true);
        }

        $config['name'] = $newName;

        file_put_contents($themePath . '/config.json', json_encode($config));
    }

    /**
     * Fetches the optional settings from the defined steps.
     *
     * @return array
     */
    public function getOptionalSettings()
    {
        $minors = array();

        foreach ($this->steps as $step) {
            foreach ($step->checkOptionalSettings() as $minor) {
                $minors[] = $minor;
            }
        }

        return $minors;
    }

    /**
     * @param string $template
     *
     * @return string The logical name for the template
     */
    public function checkForTwigTemplate($template)
    {
        $parser = $this->templatingHelper->getTemplateNameParser();
        $templating = $this->templatingHelper->getTemplating();

        $template = $parser->parse($template);

        $twigTemplate = clone $template;
        $twigTemplate->set('engine', 'twig');

        if ($templating->exists($twigTemplate)) {
            return $twigTemplate->getLogicalName();
        }

        return $template->getLogicalName();
    }

    /**
     * @param string $specificFeature
     * @param boolean $extended returns extended information about the themes
     *
     * @return mixed
     */
    public function getInstalledThemes($specificFeature = 'all', $extended = false)
    {
        if (empty($this->themes[$specificFeature])) {
            $dir = $this->pathsHelper->getSystemPath('themes', true);
            $addTheme = false;

            $finder = new Finder();
            $finder->directories()->depth('0')->ignoreDotFiles(true)->in($dir);

            $this->themes[$specificFeature] = array();
            $this->themesInfo[$specificFeature] = array();
            foreach ($finder as $theme) {
                if (file_exists($theme->getRealPath().'/config.json')) {
                    $config = json_decode(file_get_contents($theme->getRealPath() . '/config.json'), true);
                } else {
                    continue;
                }

                if ($specificFeature != 'all') {
                    if (isset($config['features']) && in_array($specificFeature, $config['features'])) {
                        $addTheme = true;
                    }
                } else {
                    $addTheme = true;
                }

                if ($addTheme) {
                    $this->themes[$specificFeature][$theme->getBasename()] = $config['name'];
                    $this->themesInfo[$specificFeature][$theme->getBasename()] = array();
                    $this->themesInfo[$specificFeature][$theme->getBasename()]['name'] = $config['name'];
                    $this->themesInfo[$specificFeature][$theme->getBasename()]['key'] = $theme->getBasename();
                    $this->themesInfo[$specificFeature][$theme->getBasename()]['dir'] = $theme->getRealPath();
                    $this->themesInfo[$specificFeature][$theme->getBasename()]['config'] = $config;
                }
            }
        }

        if ($extended) {
            return $this->themesInfo[$specificFeature];
        } else {
            return $this->themes[$specificFeature];
        }
    }

    /**
     * @param string $theme
     * @param bool $throwException
     *
     * @return TemplatingThemeHelper
     *
     * @throws MauticException\FileNotFoundException
     * @throws MauticException\BadConfigurationException
     */
    public function getTheme($theme = 'current', $throwException = false)
    {
        if (empty($this->themeHelpers[$theme])) {
            try {
                $this->themeHelpers[$theme] = $this->createThemeHelper($theme);
            } catch (MauticException\FileNotFoundException $e) {
                if (! $throwException) {
                    // theme wasn't found so just use the first available
                    $themes = $this->getInstalledThemes();

                    foreach ($themes as $installedTheme => $name) {
                        try {
                            if (isset($this->themeHelpers[$installedTheme])) {
                                // theme found so return it
                                return $this->themeHelpers[$installedTheme];
                            } else {
                                $this->themeHelpers[$installedTheme] = $this->createThemeHelper($installedTheme);
                                // found so use this theme
                                $theme = $installedTheme;
                                $found = true;
                                break;
                            }
                        } catch (MauticException\FileNotFoundException $e) {
                            continue;
                        }
                    }
                }

                if (empty($found)) {
                    // if we get to this point then no template was found so throw an exception regardless
                    throw $e;
                }
            }
        }

        return $this->themeHelpers[$theme];
    }
}


text:
package org.kasource.web.websocket.client.parameter;

import org.kasource.commons.reflection.parameter.binder.AnnotationParameterBinder;
import org.kasource.web.websocket.annotations.SessionAttribute;
import org.kasource.web.websocket.client.HandshakeRequestData;

public class ClientSessionAttributeBinder implements AnnotationParameterBinder<SessionAttribute>{

    private HandshakeRequestData handshakeRequestData;

    public ClientSessionAttributeBinder(HandshakeRequestData handshakeRequestData) {
        this.handshakeRequestData = handshakeRequestData;
    }

    @Override
    public Object bindValue(SessionAttribute annotation) {
        return handshakeRequestData.getHttpSession().getAttribute(annotation.value());
    }

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

}


text:
' ===================================================================== '
' NumericUpDownEx - v.1.6                                               '
' ===================================================================== '
' Author:   Claudio Nicora                                              '
' WebSite:  http://coolsoft.altervista.org/numericupdownex              '
' CodeProject: http://www.codeproject.com/KB/edit/NumericUpDownEx.aspx  '
' License:  CodeProject Open License                                    '
'           http://www.codeproject.com/info/cpol10.aspx                 '
' Feel free to contribute here: http://coolsoft.altervista.org          '
' ===================================================================== '

Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms

<DesignerCategory("code")>
Public Class NumericUpDownEx

    Inherits NumericUpDown

    ' reference to the underlying TextBox control
    Private _textbox As TextBox

    ' reference to the underlying UpDownButtons control
    Private _upDownButtons As Control

    '''
    ''' object creator
    '''
    Public Sub New()
        MyBase.New()
        ' get a reference to the underlying UpDownButtons field
        ' Underlying private type is System.Windows.Forms.UpDownBase+UpDownButtons
        _upDownButtons = MyBase.Controls(0)
        If _upDownButtons Is Nothing OrElse _upDownButtons.GetType().FullName <> "System.Windows.Forms.UpDownBase+UpDownButtons" Then
            Throw New ArgumentNullException(Me.GetType.FullName & ": Can't get a reference to internal UpDown buttons field.")
        End If
        ' Get a reference to the underlying TextBox field.
        ' Underlying private type is System.Windows.Forms.UpDownBase+UpDownButtons
        _textbox = TryCast(MyBase.Controls(1), TextBox)
        If _textbox Is Nothing OrElse _textbox.GetType().FullName <> "System.Windows.Forms.UpDownBase+UpDownEdit" Then
            Throw New ArgumentNullException(Me.GetType.FullName & ": Can't get a reference to internal TextBox field.")
        End If
        ' add handlers (MouseEnter and MouseLeave events of NumericUpDown
        ' are not working properly)
        AddHandler _textbox.MouseEnter, AddressOf _mouseEnterLeave
        AddHandler _textbox.MouseLeave, AddressOf _mouseEnterLeave
        AddHandler _upDownButtons.MouseEnter, AddressOf _mouseEnterLeave
        AddHandler _upDownButtons.MouseLeave, AddressOf _mouseEnterLeave
        AddHandler MyBase.MouseEnter, AddressOf _mouseEnterLeave
        AddHandler MyBase.MouseLeave, AddressOf _mouseEnterLeave
    End Sub

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        If _upDownButtons.Visible = False Then
            e.Graphics.Clear(Me.BackColor)
        End If
        MyBase.OnPaint(e)
    End Sub

    '''
    ''' WndProc override to kill WN_MOUSEWHEEL message
    '''
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Const WM_MOUSEWHEEL As Integer = &H20A

        If m.Msg = WM_MOUSEWHEEL Then
            Select Case InterceptMouseWheel
                Case InterceptMouseWheelMode.Always
                    ' standard message
                    MyBase.WndProc(m)
                Case InterceptMouseWheelMode.WhenMouseOver
                    If _mouseOver Then
                        ' standard message
                        MyBase.WndProc(m)
                    End If
                Case InterceptMouseWheelMode.Never
                    ' kill the message
                    Exit Sub
            End Select
        Else
            MyBase.WndProc(m)
        End If

    End Sub

#Region " New properties "

    <DefaultValue(False)>
    <Category("Behavior")>
    <Description("Automatically select control text when it receives focus.")>
    Public Property AutoSelect() As Boolean

    <Browsable(False)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property SelectionStart() As Integer
        Get
            Return _textbox.SelectionStart
        End Get
        Set(ByVal value As Integer)
            _textbox.SelectionStart = value
        End Set
    End Property

    <Browsable(False)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property SelectionLength() As Integer
        Get
            Return _textbox.SelectionLength
        End Get
        Set(ByVal value As Integer)
            _textbox.SelectionLength = value
        End Set
    End Property

    <Browsable(False)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property SelectedText() As String
        Get
            Return _textbox.SelectedText
        End Get
        Set(ByVal value As String)
            _textbox.SelectedText = value
        End Set
    End Property

    <Category("Behavior")>
    <DefaultValue(GetType(InterceptMouseWheelMode), "Always")>
    <Description("Enables MouseWheel only under certain conditions.")>
    Public Property InterceptMouseWheel() As InterceptMouseWheelMode = InterceptMouseWheelMode.Always

    Public Enum InterceptMouseWheelMode
        ''' MouseWheel always works (defauld behavior)
        Always
        ''' MouseWheel works only when mouse is over the (focused) control
        WhenMouseOver
        ''' MouseWheel never works
        Never
    End Enum

    <Category("Behavior")>
    <DefaultValue(GetType(ShowUpDownButtonsMode), "Always")>
    <Description("Set UpDownButtons visibility mode.")>
    Public Property ShowUpDownButtons() As ShowUpDownButtonsMode
        Get
            Return _showUpDownButtons
        End Get
        Set(ByVal value As ShowUpDownButtonsMode)
            _showUpDownButtons = value
            ' update UpDownButtons visibility
            UpdateUpDownButtonsVisibility()
        End Set
    End Property
    Private _showUpDownButtons As ShowUpDownButtonsMode = ShowUpDownButtonsMode.Always

    Public Enum ShowUpDownButtonsMode
        ''' UpDownButtons are always visible (defauld behavior)
        Always
        ''' UpDownButtons are visible only when mouse is over the control
        WhenMouseOver
        ''' UpDownButtons are visible only when control has the focus
        WhenFocus
        ''' UpDownButtons are visible when control has focus or mouse is over the control
        WhenFocusOrMouseOver
        ''' UpDownButtons are never visible
        Never
    End Enum

    '''
    ''' If set, incrementing value will cause it to restart from Minimum
    ''' when Maximum is reached (and viceversa).
    '''
    <DefaultValue(False)>
    <Category("Behavior")>
    <Description("If set, incrementing value will cause it to restart from Minimum when Maximum is reached (and viceversa).")>
    Public Property WrapValue() As Boolean

#End Region

#Region " Text selection "

    '''
    ''' Select all the text on focus enter
    '''
    Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
        _haveFocus = True
        If AutoSelect Then
            _textbox.SelectAll()
        End If
        ' Update UpDownButtons visibility
        If _showUpDownButtons = ShowUpDownButtonsMode.WhenFocus _
                OrElse _showUpDownButtons = ShowUpDownButtonsMode.WhenFocusOrMouseOver Then
            UpdateUpDownButtonsVisibility()
        End If
        MyBase.OnGotFocus(e)
    End Sub

    '''
    ''' Indicate that we have lost the focus
    '''
    Protected Overrides Sub OnLostFocus(e As EventArgs)
        _haveFocus = False
        ' Update UpDownButtons visibility
        If _showUpDownButtons = ShowUpDownButtonsMode.WhenFocus _
                OrElse _showUpDownButtons = ShowUpDownButtonsMode.WhenFocusOrMouseOver Then
            UpdateUpDownButtonsVisibility()
        End If
        MyBase.OnLostFocus(e)
    End Sub

    '''
    ''' MouseUp will kill the SelectAll made on GotFocus.
    ''' Will restore it, but only if user have not made a partial text selection.
    '''
    Protected Overrides Sub OnMouseUp(ByVal mevent As System.Windows.Forms.MouseEventArgs)
        If AutoSelect AndAlso _textbox.SelectionLength = 0 Then
            _textbox.SelectAll()
        End If
        MyBase.OnMouseUp(mevent)
    End Sub

#End Region

#Region " Additional events "

    ' these events will be raised correctly, when mouse enters on the textbox
    Shadows Event MouseEnter As EventHandler(Of EventArgs)
    Shadows Event MouseLeave As EventHandler(Of EventArgs)

    ' Events raised BEFORE value decrement/increment
    Public Event BeforeValueDecrement As CancelEventHandler
    Public Event BeforeValueIncrement As CancelEventHandler

    ' flag to track mouse position
    Private _mouseOver As Boolean = False

    ' flag to track focus
    Private _haveFocus As Boolean = False

    ' this handler is called at each mouse Enter/Leave movement
    Private Sub _mouseEnterLeave(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim cr As Drawing.Rectangle = RectangleToScreen(ClientRectangle)
        Dim mp As Drawing.Point = MousePosition

        ' actual state
        Dim isOver As Boolean = cr.Contains(mp)

        ' test if status changed
        If _mouseOver Xor isOver Then
            ' update state
            _mouseOver = isOver
            If _mouseOver Then
                RaiseEvent MouseEnter(Me, EventArgs.Empty)
            Else
                RaiseEvent MouseLeave(Me, EventArgs.Empty)
            End If
        End If

        ' update UpDownButtons visibility
        If _showUpDownButtons <> ShowUpDownButtonsMode.Always Then
            UpdateUpDownButtonsVisibility()
        End If

    End Sub

#End Region

#Region " Value increment/decrement management "

    ' raises the two new events
    Public Overrides Sub DownButton()
        If MyBase.ReadOnly Then Exit Sub
        Dim e As New CancelEventArgs
        RaiseEvent BeforeValueDecrement(Me, e)
        If e.Cancel Then Exit Sub
        ' decrement with wrap
        If WrapValue AndAlso Value - Increment < Minimum Then
            Value = Maximum
        Else
            MyBase.DownButton()
        End If
    End Sub
    Public Overrides Sub UpButton()
        If MyBase.ReadOnly Then Exit Sub
        Dim e As New CancelEventArgs
        RaiseEvent BeforeValueIncrement(Me, e)
        If e.Cancel Then Exit Sub
        ' increment with wrap
        If WrapValue AndAlso Value + Increment > Maximum Then
            Value = Minimum
        Else
            MyBase.UpButton()
        End If
    End Sub

#End Region

#Region " UpDownButtons visibility management "

    '''
    ''' Show or hide the UpDownButtons, according to ShowUpDownButtons property value
    '''
    Sub UpdateUpDownButtonsVisibility()

        ' test new state
        Dim newVisible As Boolean = False
        Select Case _showUpDownButtons
            Case ShowUpDownButtonsMode.WhenMouseOver
                newVisible = _mouseOver
            Case ShowUpDownButtonsMode.WhenFocus
                newVisible = _haveFocus
            Case ShowUpDownButtonsMode.WhenFocusOrMouseOver
                newVisible = _haveFocus OrElse _mouseOver
            Case ShowUpDownButtonsMode.Never
                newVisible = False
            Case Else
                newVisible = True
        End Select

        ' assign only if needed
        If _upDownButtons.Visible <> newVisible Then
            If newVisible Then
                _textbox.Width = Me.ClientRectangle.Width - _upDownButtons.Width
            Else
                _textbox.Width = Me.ClientRectangle.Width
            End If
            _upDownButtons.Visible = newVisible
            OnTextBoxResize(_textbox, EventArgs.Empty)
            Me.Invalidate()
        End If

    End Sub

    '''
    ''' Custom textbox size management
    '''
    Protected Overrides Sub OnTextBoxResize(ByVal source As Object, ByVal e As System.EventArgs)
        If _textbox Is Nothing Then Exit Sub
        If _showUpDownButtons = ShowUpDownButtonsMode.Always Then
            ' standard management
            MyBase.OnTextBoxResize(source, e)
        Else
            ' custom management

            ' change position if RTL
            Dim fixPos As Boolean = Me.RightToLeft = Windows.Forms.RightToLeft.Yes _
                                Xor Me.UpDownAlign = LeftRightAlignment.Left

            If _mouseOver Then
                _textbox.Width = Me.ClientSize.Width - _textbox.Left - _upDownButtons.Width - 2
                If fixPos Then _textbox.Location = New Point(16, _textbox.Location.Y)
            Else
                If fixPos Then _textbox.Location = New Point(2, _textbox.Location.Y)
                _textbox.Width = Me.ClientSize.Width - _textbox.Left - 2
            End If

        End If

    End Sub

#End Region

End Class


text:
/**
 *
 */
package com.cheer.petstore.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "tbl_master")
public class Master
{
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private int id;

    @Column
    private String username;

    @Column
    private String password;

    public Master()
    {
        super();
    }

    public Master(int id, String username, String password)
    {
        super();
        this.id = id;
        this.username = username;
        this.password = password;
    }

    public int getId()
    {
        return id;
    }

    public void setId(int id)
    {
        this.id = id;
    }

    public String getUsername()
    {
        return username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public Master(String username, String password)
    {
        super();
        this.username = username;
        this.password = password;
    }

    @Override
    public String toString()
    {
        return ToStringBuilder.reflectionToString(this);
    }
}


text:
/**
 * Provides the formatting API used by Form classes.
 */
package play.data.format;


text:
\section{\STYRITFULL}

\subsection{Befogenheter}
\STYRIT{} handhar i överensstämmelse med sektionens stadga, reglemente och
styrdokument samt av sektionsmötet fattade beslut den verkställande
ledningen av sektionens verksamhet.

\subsection{Sammansättning}
\STYRIT{} består av
\begin{itemize}
	\item ordförande
	\item vice ordförande
	\item kassör
	\item sekreterare
	\item studerandearbetsmiljöombud (SAMO)
	\item 0-3 ledamöter.
\end{itemize}

\subsection{Rättigheter}
\STYRIT{} har full insyn i sektionens alla organ och äger rätt att deltaga i deras
möten med yttranderätt.

\subsection{Åligganden}

\subsubsection{Det åligger \STYRIT}

\begin{att}
	\item Verka för sammanhållningen mellan sektionsmedlemmarna och verka för deras gemensamma intressen.
	\item Leda sektionens arbete.
	\item Övervaka genomförandet av sektionsmötets beslut och se till att de verkställs.
	\item Lämna förslag, till sektionens valberedning, på representanter till nästkommande \STYRIT.
	\item Utse representanter till kårens utskott
	\item Ansvara för att sektionens kommunikationsplatform administreras.
	\item Ansvara för att sektionens mail och digitala verktyg administreras.
	\item Ansvara för att nya kommittémedlemmar läggs in i sektionens medlemssystem.
	\item Ansvara att förtroendeinvalda får utbildning om GDPR och ansvarsfull datahantering, samt se till att förtroendevalda får hjälp i frågor som rör GDPR.
\end{att}

\subsubsection{Det åligger \STYRIT{}s ordförande}
\begin{att}
	\item Leda \STYRIT{}s verksamhet.
	\item Föra sektionens talan då annat ej stadgats eller beslutats.
	\item Teckna sektionens firma.
\end{att}

\subsubsection{Det åligger \STYRIT{}s vice ordförande}
\begin{att}
	\item Överta ordförandens åligganden i ordförandes frånvaro.
	\item Kalla till möte med alla ordföranden i sektionens organ varje läsperiod.
\end{att}

\subsubsection{Det åligger \STYRIT{}s kassör}
\begin{att}
	\item Fortlöpande kontrollera sektionens räkenskaper och bokföring.
	\item Teckna sektionens firma.
	\item Upprätta budgetförslag till de i stadgan berörda sektionsmötena.
	\item Till varje sektionsmöte kunna redogöra för sektionens ekonomiska ställning.
	\item Informera nya revisorer och kassörer i kommittéer och studienämnd om sektionens bokförings- och redovisningssystem.
\end{att}

\subsubsection{Det åligger \STYRIT{}s sekreterare}
\begin{att}
	\item Föra protokoll vid styrelsemöte.
	\item Tillse att protokoll från såväl styrelsemöte som sektionsmöte anslås i enlighet med stadga.
	\item Tillse att material som inkommer till sektionen anslås eller på annat sätt förmedlas dem det berör.
	\item Handha \STYRIT{}s handlingar.
\end{att}

\subsection{Mandatperiod}
Invalda till \STYRIT{} betraktas som en del av \STYRIT{} och sektionen från tillträdet, 1:a juli, till avträdet, 1:a juli ett år efter tillträdet.

Det yttersta ansvaret för \STYRIT{}s verksamhet och ekonomi övergår till de nyinvalda den 1:a juli.


text:
const injectToGame = require('../utils/addToFirebase')
const { levelThumb } = require('../utils/createImage')
const functions = require('firebase-functions')
const { upload } = require('../utils/storage')
const fs = require('node-fs-extra')

const removeTempFiles = path => fs.removeSync(path)

const paths = ['games', 'drafts']

paths.forEach(baseRef => {
  exports[baseRef] = createGameImage(baseRef)
})

function createGameImage (baseRef) {
  return functions.database
    .ref(`/${baseRef}/{gameRef}/targetPainted`)
    .onWrite(evt => {
      return new Promise((resolve, reject) => {
        const { gameRef } = evt.params
        const targetPainted = evt.data.val()
        evt.data.ref.parent
          .child('imageVersion')
          .transaction(v => v + 1)
          .then(({ snapshot }) => snapshot.val())
          .then(imageVersion => {
            evt.data.ref.parent
              .once('value')
              .then(snap => snap.val())
              .then(
                ({ levelSize, type = 'write', imageUrl, palette }) =>
                  type === 'write'
                    ? levelThumb(
                      gameRef,
                      levelSize[0],
                      targetPainted,
                      undefined,
                      palette
                    )
                    : Promise.resolve(imageUrl)
              )
              .then(res => upload(res, gameRef))
              .then(res =>
                injectToGame(
                  `/${baseRef}/${gameRef}/imageUrl`,
                  `${res}&v=${imageVersion}`
                )
              )
              .then(res =>
                injectToGame(
                  `/${baseRef}/${gameRef}/meta/imageUrl`,
                  `${res}&v=${imageVersion}`
                )
              )
              .then(success)
              .catch(failed)
          })

        function failed (e) {
          console.warn(e)
          removeTempFiles(`/tmp/${gameRef}.png`)
          console.log('cleaned up')
          resolve()
        }

        function success () {
          removeTempFiles(`/tmp/${gameRef}.png`)
          console.log('cleaned up')
          reject()
        }
      })
    })
}


text:
from django.test import SimpleTestCase

from wagtail.test.utils.form_data import querydict_from_html

class TestQueryDictFromHTML(SimpleTestCase):
    html = """
    <form id="personal-details">
        <input type="hidden" name="csrfmiddlewaretoken" value="Z783HTL5Bc2J54WhAtEeR3eefM1FBkq0EbTfNnYnepFGuJSOfvosFvwjeKYtMwFr">
        <input type="hidden" name="no_value_input">
        <input type="hidden" value="no name input">

                    Full name
                    <input type="text" name="name" value="Jane Doe" class="mt-1 block w-full" placeholder="">

                    Email address
                    <input type="email" name="email" class="mt-1 block w-full" value="jane@example.com" placeholder="name@example.com">

    </form>
    <form id="event-details">

                    When is your event?
                    <input type="date" name="date" class="mt-1 block w-full" value="2023-01-01">

                    What type of event is it?
                    <select name="event_type" class="block w-full mt-1">
                        <option value="corporate">Corporate event</option>
                        <option value="wedding">Wedding</option>
                        <option value="birthday">Birthday</option>
                        <option value="other" selected>Other</option>
                    </select>

                    What age groups is it suitable for?
                    <select name="ages" class="block w-full mt-1" multiple>
                        <option>Infants</option>
                        <option>Children</option>
                        <option>Teenagers</option>
                        <option selected>18-30</option>
                        <option selected>30-50</option>
                        <option>50-70</option>
                        <option>70+</option>
                    </select>

    </form>
    <form id="market-research">

                <fieldset class="block">
                    <legend>How many pets do you have?</legend>

                                <input type="radio" name="pets" value="0" />
                                None

                                <input type="radio" name="pets" value="1" />
                                One

                                <input type="radio" name="pets" value="2" checked />
                                Two

                                <input type="radio" name="pets" value="3+" />
                                Three or more

                </fieldset>
                <fieldset class="block">
                    <legend>Which two colours do you like best?</legend>

                                <input type="checkbox" name="colours" value="cyan">
                                Cyan

                                <input type="checkbox" name="colours" value="magenta" checked />
                                Magenta

                                <input type="checkbox" name="colours" value="yellow" />
                                Yellow

                                <input type="checkbox" name="colours" value="black" checked />
                                Black

                                <input type="checkbox" name="colours" value="white" />
                                White

                </fieldset>

                    Tell us what you love
                    <textarea name="love" class="mt-1 block w-full" rows="3">Comic books</textarea>

    </form>
    """

    personal_details = [
        ("no_value_input", [""]),
        ("name", ["Jane Doe"]),
        ("email", ["jane@example.com"]),
    ]

    event_details = [
        ("date", ["2023-01-01"]),
        ("event_type", ["other"]),
        ("ages", ["18-30", "30-50"]),
    ]

    market_research = [
        ("pets", ["2"]),
        ("colours", ["magenta", "black"]),
        ("love", ["Comic books"]),
    ]

    def test_html_only(self):
        # data should be extracted from the 'first' form by default
        result = querydict_from_html(self.html)
        self.assertEqual(list(result.lists()), self.personal_details)

    def test_include_csrf(self):
        result = querydict_from_html(self.html, exclude_csrf=False)
        expected_result = [
            (
                "csrfmiddlewaretoken",
                ["Z783HTL5Bc2J54WhAtEeR3eefM1FBkq0EbTfNnYnepFGuJSOfvosFvwjeKYtMwFr"],
            )
        ] + self.personal_details
        self.assertEqual(list(result.lists()), expected_result)

    def test_form_index(self):
        for index, expected_data in (
            (0, self.personal_details),
            ("2", self.market_research),
            (1, self.event_details),
        ):
            result = querydict_from_html(self.html, form_index=index)
            self.assertEqual(list(result.lists()), expected_data)

    def test_form_id(self):
        for id, expected_data in (
            ("event-details", self.event_details),
            ("personal-details", self.personal_details),
            ("market-research", self.market_research),
        ):
            result = querydict_from_html(self.html, form_id=id)
            self.assertEqual(list(result.lists()), expected_data)

    def test_invalid_form_id(self):
        with self.assertRaises(ValueError):
            querydict_from_html(self.html, form_id="invalid-id")

    def test_invalid_index(self):
        with self.assertRaises(ValueError):
            querydict_from_html(self.html, form_index=5)


text:
<?php
/**
 * AttwFramework
 *
 * @author Gabriel Jacinto <gamjj74@hotmail.com>
 * @license MIT License
 * @link http://attwframework.github.io
*/

namespace Attw\Db\Sql\MySQL\Clause;

use Attw\Db\Sql\AbstractClause;
use \InvalidArgumentException;

class Offset extends AbstractClause
{
    private $offset;

    public function __construct($offset)
    {
        if (!is_int($offset)) {
            throw new InvalidArgumentException('Offset must be integer');
        }

        $this->offset = $offset;
    }

    protected function constructSql()
    {
        $this->sql = sprintf('OFFSET %s', $this->offset);
    }
}


text:
id: functions-debugging
title: How to debug Pulsar Functions
sidebar_label: "Debugging"
original_id: functions-debugging
---

You can use the following methods to debug Pulsar Functions:

* [Use unit test](functions-debugging.md#use-unit-test)
* [Debug with localrun mode](functions-debugging.md#debug-with-localrun-mode)
* [Use log topic](functions-debugging.md#use-log-topic)
* [Use Functions CLI](functions-debugging.md#use-functions-cli)

## Use unit test

A Pulsar Function at its core is just a function with inputs and outputs, thus testing a Pulsar Function can be done in a similar way as testing any function.

For example, if a user has the following Pulsar Function:

```java

import java.util.function.Function;

public class JavaNativeExclamationFunction implements Function<String, String> {
   @Override
   public String apply(String input) {
       return String.format("%s!", input);
   }
}

```

The user can write a simple unit test to test this Pulsar function:

```java

@Test
public void testJavaNativeExclamationFunction() {
   JavaNativeExclamationFunction exclamation = new JavaNativeExclamationFunction();
   String output = exclamation.apply("foo");
   Assert.assertEquals(output, "foo!");
}

```

Consequently, if a user has a Pulsar Function that implements the ```org.apache.pulsar.functions.api.Function``` interface:

```java

import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;

public class ExclamationFunction implements Function<String, String> {
   @Override
   public String process(String input, Context context) {
       return String.format("%s!", input);
   }
}

```

The user can write a unit test for this function as well. Remember to mock out the ```Context``` parameter.

For example:

```java

@Test
public void testExclamationFunction() {
   ExclamationFunction exclamation = new ExclamationFunction();
   String output = exclamation.process("foo", mock(Context.class));
   Assert.assertEquals(output, "foo!");
}

```

## Debug with localrun mode

:::note

Currently, debugging with localrun mode only supports Pulsar Functions written in Java. Users need Pulsar version 2.4.0 or later to do the following. Even though localrun is available in versions earlier than Pulsar 2.4.0, it does not have the functionality to be executed programmatically and run Functions as threads.

:::

To test in a more realistic fashion, a Pulsar Function can be run via localrun mode which will launch an instance of the Function on your local machine as a thread.

In this mode, the Pulsar Function can consume and produce actual data to a Pulsar cluster and mirrors how the function will actually run in a Pulsar cluster.

Users can launch his or her function in the following manner:

```java

FunctionConfig functionConfig = new FunctionConfig();
functionConfig.setName(functionName);
functionConfig.setInputs(Collections.singleton(sourceTopic));
functionConfig.setClassName(ExclamationFunction.class.getName());
functionConfig.setRuntime(FunctionConfig.Runtime.JAVA);
functionConfig.setOutput(sinkTopic);

LocalRunner localRunner = LocalRunner.builder().functionConfig(functionConfig).build();
localRunner.start(true);

```

This allows users to easily debug functions using an IDE. Users can set breakpoints and manually step through a function to debug with real data.

The following code snippet is a more complete example on how to programmatically launch a function in localrun mode.

```java

public class ExclamationFunction implements Function<String, String> {

   @Override
   public String process(String s, Context context) throws Exception {
       return s + "!";
   }

public static void main(String[] args) throws Exception {
    FunctionConfig functionConfig = new FunctionConfig();
    functionConfig.setName("exclamation");
    functionConfig.setInputs(Collections.singleton("input"));
    functionConfig.setClassName(ExclamationFunction.class.getName());
    functionConfig.setRuntime(FunctionConfig.Runtime.JAVA);
    functionConfig.setOutput("output");

    LocalRunner localRunner = LocalRunner.builder().functionConfig(functionConfig).build();
    localRunner.start(false);
}

```

To use localrun like above programmatically please addd the following dependency:

```xml

<dependency>
   <groupId>org.apache.pulsar</groupId>
   <artifactId>pulsar-functions-local-runner</artifactId>
   <version>${pulsar.version}</version>
</dependency>

```

For complete code samples, see [here](https://github.com/jerrypeng/pulsar-functions-demos/tree/master/debugging).

In the future, debugging with localrun mode for Pulsar Functions written in other languages will be supported.

## Use log topic

Pulsar Functions allow you to output the log information defined in functions to a specified log topic. Consumers can be configured to consume messages from a specified log topic to check the log information.

![Pulsar Functions core programming model](/assets/pulsar-functions-overview.png)

**Example**

```text

import org.apache.pulsar.functions.api.Context;
import org.apache.pulsar.functions.api.Function;
import org.slf4j.Logger;

public class LoggingFunction implements Function<String, Void> {
    @Override
    public void apply(String input, Context context) {
        Logger LOG = context.getLogger();
        String messageId = new String(context.getMessageId());

        if (input.contains("danger")) {
            LOG.warn("A warning was received in message {}", messageId);
        } else {
            LOG.info("Message {} received\nContent: {}", messageId, input);
        }

        return null;
    }
}

```

As shown in the example above, you can get the logger via `context.getLogger()` and assign the logger to the `LOG` variable of `slf4j`, so you can define your desired log information in a function using the `LOG` variable. You also need to specify the topic to which the log information is produced.

**Example**

```

$ bin/pulsar-admin functions create \
  --log-topic persistent://public/default/logging-function-logs \
  # Other function configs

```

## Use Functions CLI

The [Pulsar Functions CLI](reference-pulsar-admin.md#functions) helps you in debugging Pulsar Functions with the following subcommands:

* `get`
* `status`
* `stats`
* `list`
* `trigger`

:::tip

For complete commands of **Pulsar Functions CLI**, see [here](reference-pulsar-admin.md#functions)。

:::

### `get`

Get information about a Pulsar Function.

**Usage**

```text

$ pulsar-admin functions get options

```

**Options**

|Flag|Description
|---|---
|`--fqfn`|The Fully Qualified Function Name (FQFN) of a Pulsar Function
|`--name`|The name of a Pulsar Function
|`--namespace`|The namespace of a Pulsar Function
|`--tenant`|The tenant of a Pulsar Function

:::tip

`--fqfn` consists of `--name`, `--namespace` and `--tenant`, that is, you can specify only `--fqfn` or specify `--name`, `--namespace` and `--tenant` instead.

:::

**Example**

You can specify `--fqfn` to get information about a Pulsar Function.

```text

$ ./bin/pulsar-admin functions get public/default/ExclamationFunctio6

```

Optionally, you can specify `--name`, `--namespace` and `--tenant` to get information about a Pulsar Function.

```text

$ ./bin/pulsar-admin functions get \
    --tenant public \
    --namespace default \
    --name ExclamationFunctio6

```

As shown below, the `get` command shows input, output, runtime, and other information about the _ExclamationFunctio6_ function.

```text

{
  "tenant": "public",
  "namespace": "default",
  "name": "ExclamationFunctio6",
  "className": "org.example.test.ExclamationFunction",
  "inputSpecs": {
    "persistent://public/default/my-topic-1": {
      "isRegexPattern": false
    }
  },
  "output": "persistent://public/default/test-1",
  "processingGuarantees": "ATLEAST_ONCE",
  "retainOrdering": false,
  "userConfig": {},
  "runtime": "JAVA",
  "autoAck": true,
  "parallelism": 1
}

```

### `status`

Check the current status of a Pulsar Function.

**Usage**

```text

$ pulsar-admin functions status options

```

**Options**

|Flag|Description
|---|---
|`--fqfn`|The Fully Qualified Function Name (FQFN) of a Pulsar Function
|`--instance-id`|The instance ID of a Pulsar Function
If the `--instance-id` is not specified, it will get the IDs of all instances

|`--name`|The name of a Pulsar Function
|`--namespace`|The namespace of a Pulsar Function
|`--tenant`|The tenant of a Pulsar Function

**Example**

```text

$ ./bin/pulsar-admin functions status \
    --tenant public \
    --namespace default \
    --name ExclamationFunctio6 \

```

As shown below, the `status` command shows the number of instances, the number of running instances, the instance running under the _ExclamationFunctio6_ function, the number of received messages, the number of successfully processed messages, the number of system exceptions, the average latency and so on.

```text

{
  "numInstances" : 1,
  "numRunning" : 1,
  "instances" : [ {
    "instanceId" : 0,
    "status" : {
      "running" : true,
      "error" : "",
      "numRestarts" : 0,
      "numReceived" : 1,
      "numSuccessfullyProcessed" : 1,
      "numUserExceptions" : 0,
      "latestUserExceptions" : [ ],
      "numSystemExceptions" : 0,
      "latestSystemExceptions" : [ ],
      "averageLatency" : 0.8385,
      "lastInvocationTime" : 1557734137987,
      "workerId" : "c-standalone-fw-23ccc88ef29b-8080"
    }
  } ]
}

```

### `stats`

Get the current stats of a Pulsar Function.

**Usage**

```text

$ pulsar-admin functions stats options

```

**Options**

|Flag|Description
|---|---
|`--fqfn`|The Fully Qualified Function Name (FQFN) of a Pulsar Function
|`--instance-id`|The instance ID of a Pulsar Function
If the `--instance-id` is not specified, it will get the IDs of all instances

|`--name`|The name of a Pulsar Function
|`--namespace`|The namespace of a Pulsar Function
|`--tenant`|The tenant of a Pulsar Function

**Example**

```text

$ ./bin/pulsar-admin functions stats \
    --tenant public \
    --namespace default \
    --name ExclamationFunctio6 \

```

The output is as below:

```text

{
  "receivedTotal" : 1,
  "processedSuccessfullyTotal" : 1,
  "systemExceptionsTotal" : 0,
  "userExceptionsTotal" : 0,
  "avgProcessLatency" : 0.8385,
  "1min" : {
    "receivedTotal" : 0,
    "processedSuccessfullyTotal" : 0,
    "systemExceptionsTotal" : 0,
    "userExceptionsTotal" : 0,
    "avgProcessLatency" : null
  },
  "lastInvocation" : 1557734137987,
  "instances" : [ {
    "instanceId" : 0,
    "metrics" : {
      "receivedTotal" : 1,
      "processedSuccessfullyTotal" : 1,
      "systemExceptionsTotal" : 0,
      "userExceptionsTotal" : 0,
      "avgProcessLatency" : 0.8385,
      "1min" : {
        "receivedTotal" : 0,
        "processedSuccessfullyTotal" : 0,
        "systemExceptionsTotal" : 0,
        "userExceptionsTotal" : 0,
        "avgProcessLatency" : null
      },
      "lastInvocation" : 1557734137987,
      "userMetrics" : { }
    }
  } ]
}

```

### `list`

List all Pulsar Functions running under a specific tenant and namespace.

**Usage**

```text

$ pulsar-admin functions list options

```

**Options**

|Flag|Description
|---|---
|`--namespace`|The namespace of a Pulsar Function
|`--tenant`|The tenant of a Pulsar Function

**Example**

```text

$ ./bin/pulsar-admin functions list \
    --tenant public \
    --namespace default

```

As shown below, the `list` command returns three functions running under the _public_ tenant and the _default_ namespace.

```text

ExclamationFunctio1
ExclamationFunctio2
ExclamationFunctio3

```

### `trigger`

Trigger a specified Pulsar Function with a supplied value. This command simulates the execution process of a Plusar Function and verifies it.

**Usage**

```text

$ pulsar-admin functions trigger options

```

**Options**

|Flag|Description
|---|---
|`--fqfn`|The Fully Qualified Function Name (FQFN) of a Pulsar Function
|`--name`|The name of a Pulsar Function
|`--namespace`|The namespace of a Pulsar Function
|`--tenant`|The tenant of a Pulsar Function
|`--topic`|The topic name that a Pulsar Function consumes from
|`--trigger-file`|The path to a file that contains the data to trigger a Pulsar Function
|`--trigger-value`|The value to trigger a Pulsar Function

**Example**

```text

$ ./bin/pulsar-admin functions trigger \
    --tenant public \
    --namespace default \
    --name ExclamationFunctio6 \
    --topic persistent://public/default/my-topic-1 \
    --trigger-value "hello pulsar functions"

```

As shown below, the `trigger` command returns the following result:

```text

This is my function!

```

:::note

You must specify the [entire topic name](getting-started-pulsar.md#topic-names) when using the `--topic` option. Otherwise, the following error is raised.

```text

Function in trigger function has unidentified topic
Reason: Function in trigger function has unidentified topic

```

:::


text:
import * as vscode from 'vscode';
import { TestNode } from '../testExplorer/testNode';

/**
 * Select specific range in the text editor
 * @param index VS Code range
 */
function updateSelection(index: vscode.Range | number) {
  const editor = vscode.window.activeTextEditor;
  if (editor) {
    if (index instanceof vscode.Range) {
      editor.selection = new vscode.Selection(index.start, index.end);
      editor.revealRange(index); // Show selection
    } else {
      const line = editor.document.lineAt(index);
      const startPos = new vscode.Position(
        line.lineNumber,
        line.firstNonWhitespaceCharacterIndex
      );
      editor.selection = new vscode.Selection(startPos, line.range.end);
      editor.revealRange(line.range); // Show selection
    }
  }
}

/**
 * Navigate to the test position
 * @param node test explorer node
 */
export function forceLwcTestNavigateToTest(node: TestNode) {
  if (node.location) {
    vscode.window.showTextDocument(node.location.uri);
  }
  const position: vscode.Range | number = node.location!.range;
  updateSelection(position);
}


text:
package org.springframework.boot.web.embedded.undertow;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.GracefulShutdownHandler;
import io.undertow.server.handlers.accesslog.AccessLogHandler;
import io.undertow.server.handlers.accesslog.DefaultAccessLogReceiver;
import org.xnio.OptionMap;
import org.xnio.Options;
import org.xnio.Xnio;
import org.xnio.XnioWorker;

import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
import org.springframework.boot.web.server.GracefulShutdown;
import org.springframework.boot.web.server.WebServer;
import org.springframework.http.server.reactive.UndertowHttpHandlerAdapter;
import org.springframework.util.Assert;

/**
 * {@link ReactiveWebServerFactory} that can be used to create {@link UndertowWebServer}s.
 *
 * @author Brian Clozel
 * @since 2.0.0
 */
public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerFactory
		implements ConfigurableUndertowWebServerFactory {

	private Set<UndertowBuilderCustomizer> builderCustomizers = new LinkedHashSet<>();

	private Integer bufferSize;

	private Integer ioThreads;

	private Integer workerThreads;

	private Boolean directBuffers;

	private File accessLogDirectory;

	private String accessLogPattern;

	private String accessLogPrefix;

	private String accessLogSuffix;

	private boolean accessLogEnabled = false;

	private boolean accessLogRotate = true;

	private boolean useForwardHeaders;

	/**
	 * Create a new {@link UndertowReactiveWebServerFactory} instance.
	 */
	public UndertowReactiveWebServerFactory() {
	}

	/**
	 * Create a new {@link UndertowReactiveWebServerFactory} that listens for requests
	 * using the specified port.
	 * @param port the port to listen on
	 */
	public UndertowReactiveWebServerFactory(int port) {
		super(port);
	}

	@Override
	public WebServer getWebServer(org.springframework.http.server.reactive.HttpHandler httpHandler) {
		Undertow.Builder builder = createBuilder(getPort());
		HttpHandler handler = new UndertowHttpHandlerAdapter(httpHandler);
		if (this.useForwardHeaders) {
			handler = Handlers.proxyPeerAddress(handler);
		}
		handler = UndertowCompressionConfigurer.configureCompression(getCompression(), handler);
		Closeable closeable = null;
		if (isAccessLogEnabled()) {
			AccessLogHandlerConfiguration accessLogHandlerConfiguration = configureAccessLogHandler(builder, handler);
			closeable = accessLogHandlerConfiguration.closeable;
			handler = accessLogHandlerConfiguration.accessLogHandler;
		}
		GracefulShutdown gracefulShutdown = null;
		GracefulShutdownHandler gracefulShutdownHandler = Handlers.gracefulShutdown(handler);
		Duration gracePeriod = getShutdown().getGracePeriod();
		if (gracePeriod != null) {
			gracefulShutdown = new UndertowGracefulShutdown(gracefulShutdownHandler, gracePeriod);
			handler = gracefulShutdownHandler;
		}
		else {
			gracefulShutdown = GracefulShutdown.IMMEDIATE;
		}
		builder.setHandler(handler);
		return new UndertowWebServer(builder, getPort() >= 0, closeable, gracefulShutdown);
	}

	private Undertow.Builder createBuilder(int port) {
		Undertow.Builder builder = Undertow.builder();
		if (this.bufferSize != null) {
			builder.setBufferSize(this.bufferSize);
		}
		if (this.ioThreads != null) {
			builder.setIoThreads(this.ioThreads);
		}
		if (this.workerThreads != null) {
			builder.setWorkerThreads(this.workerThreads);
		}
		if (this.directBuffers != null) {
			builder.setDirectBuffers(this.directBuffers);
		}
		if (getSsl() != null && getSsl().isEnabled()) {
			customizeSsl(builder);
		}
		else {
			builder.addHttpListener(port, getListenAddress());
		}
		for (UndertowBuilderCustomizer customizer : this.builderCustomizers) {
			customizer.customize(builder);
		}
		return builder;
	}

	private AccessLogHandlerConfiguration configureAccessLogHandler(Undertow.Builder builder, HttpHandler handler) {
		try {
			createAccessLogDirectoryIfNecessary();
			XnioWorker worker = createWorker();
			String prefix = (this.accessLogPrefix != null) ? this.accessLogPrefix : "access_log.";
			DefaultAccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver(worker, this.accessLogDirectory,
					prefix, this.accessLogSuffix, this.accessLogRotate);
			String formatString = ((this.accessLogPattern != null) ? this.accessLogPattern : "common");
			AccessLogHandler accessLogHandler = new AccessLogHandler(handler, accessLogReceiver, formatString,
					Undertow.class.getClassLoader());
			return new AccessLogHandlerConfiguration(accessLogHandler, () -> {
				try {
					accessLogReceiver.close();
					worker.shutdown();
					worker.awaitTermination(30, TimeUnit.SECONDS);
				}
				catch (IOException ex) {
					throw new IllegalStateException(ex);
				}
				catch (InterruptedException ex) {
					Thread.currentThread().interrupt();
				}
			});
		}
		catch (IOException ex) {
			throw new IllegalStateException("Failed to create AccessLogHandler", ex);
		}
	}

	private void createAccessLogDirectoryIfNecessary() {
		Assert.state(this.accessLogDirectory != null, "Access log directory is not set");
		if (!this.accessLogDirectory.isDirectory() && !this.accessLogDirectory.mkdirs()) {
			throw new IllegalStateException("Failed to create access log directory '" + this.accessLogDirectory + "'");
		}
	}

	private XnioWorker createWorker() throws IOException {
		Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
		return xnio.createWorker(OptionMap.builder().set(Options.THREAD_DAEMON, true).getMap());
	}

	private void customizeSsl(Undertow.Builder builder) {
		new SslBuilderCustomizer(getPort(), getAddress(), getSsl(), getSslStoreProvider()).customize(builder);
		if (getHttp2() != null) {
			builder.setServerOption(UndertowOptions.ENABLE_HTTP2, getHttp2().isEnabled());
		}
	}

	private String getListenAddress() {
		if (getAddress() == null) {
			return "0.0.0.0";
		}
		return getAddress().getHostAddress();
	}

	@Override
	public void setAccessLogDirectory(File accessLogDirectory) {
		this.accessLogDirectory = accessLogDirectory;
	}

	@Override
	public void setAccessLogPattern(String accessLogPattern) {
		this.accessLogPattern = accessLogPattern;
	}

	@Override
	public void setAccessLogPrefix(String accessLogPrefix) {
		this.accessLogPrefix = accessLogPrefix;
	}

	@Override
	public void setAccessLogSuffix(String accessLogSuffix) {
		this.accessLogSuffix = accessLogSuffix;
	}

	public boolean isAccessLogEnabled() {
		return this.accessLogEnabled;
	}

	@Override
	public void setAccessLogEnabled(boolean accessLogEnabled) {
		this.accessLogEnabled = accessLogEnabled;
	}

	@Override
	public void setAccessLogRotate(boolean accessLogRotate) {
		this.accessLogRotate = accessLogRotate;
	}

	protected final boolean isUseForwardHeaders() {
		return this.useForwardHeaders;
	}

	@Override
	public void setUseForwardHeaders(boolean useForwardHeaders) {
		this.useForwardHeaders = useForwardHeaders;
	}

	@Override
	public void setBufferSize(Integer bufferSize) {
		this.bufferSize = bufferSize;
	}

	@Override
	public void setIoThreads(Integer ioThreads) {
		this.ioThreads = ioThreads;
	}

	@Override
	public void setWorkerThreads(Integer workerThreads) {
		this.workerThreads = workerThreads;
	}

	@Override
	public void setUseDirectBuffers(Boolean directBuffers) {
		this.directBuffers = directBuffers;
	}

	/**
	 * Set {@link UndertowBuilderCustomizer}s that should be applied to the Undertow
	 * {@link io.undertow.Undertow.Builder Builder}. Calling this method will replace any
	 * existing customizers.
	 * @param customizers the customizers to set
	 */
	public void setBuilderCustomizers(Collection<? extends UndertowBuilderCustomizer> customizers) {
		Assert.notNull(customizers, "Customizers must not be null");
		this.builderCustomizers = new LinkedHashSet<>(customizers);
	}

	/**
	 * Returns a mutable collection of the {@link UndertowBuilderCustomizer}s that will be
	 * applied to the Undertow {@link io.undertow.Undertow.Builder Builder}.
	 * @return the customizers that will be applied
	 */
	public Collection<UndertowBuilderCustomizer> getBuilderCustomizers() {
		return this.builderCustomizers;
	}

	/**
	 * Add {@link UndertowBuilderCustomizer}s that should be used to customize the
	 * Undertow {@link io.undertow.Undertow.Builder Builder}.
	 * @param customizers the customizers to add
	 */
	@Override
	public void addBuilderCustomizers(UndertowBuilderCustomizer... customizers) {
		Assert.notNull(customizers, "Customizers must not be null");
		this.builderCustomizers.addAll(Arrays.asList(customizers));
	}

	private static final class AccessLogHandlerConfiguration {

		private final AccessLogHandler accessLogHandler;

		private final Closeable closeable;

		private AccessLogHandlerConfiguration(AccessLogHandler accessLogHandler, Closeable closeable) {
			this.accessLogHandler = accessLogHandler;
			this.closeable = closeable;
		}

	}

}


text:
package org.openqa.selenium.net;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class NetworkUtilsTest {
  @Test
  public void testGetPrivateLocalAddress() {
    NetworkUtils networkUtils =
        new NetworkUtils(StubNetworkInterfaceProvider.getUbuntu1010SingleNICAndWlan());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("127.0.0.3", s);
    assertEquals("chunky.local", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testPrivateLocalAddress() {
    NetworkUtils networkUtils =
        new NetworkUtils(StubNetworkInterfaceProvider.getWindowsXpWithIp4Only());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("localXhost", s);
    assertEquals("myip4.mydomain.com", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testRHELBox() {
    NetworkUtils networkUtils = new NetworkUtils(StubNetworkInterfaceProvider.getRHEL5Box());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("localhost.localdomain", s);
    assertEquals("woz-woz23", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testSolarisBox() {
    NetworkUtils networkUtils = new NetworkUtils(StubNetworkInterfaceProvider.getSolarisBox());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("localhost", s);
    assertEquals("woz-woz01-adm", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testUbuntu9X() {
    NetworkUtils networkUtils =
        new NetworkUtils(StubNetworkInterfaceProvider.getUbuntu09XSingleNIC());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("127.0.0.1", s);
    assertEquals("157.120.171.97", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testOsXSnowLeopard() {
    NetworkUtils networkUtils =
        new NetworkUtils(StubNetworkInterfaceProvider.getOsXWiredAndWireless());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("127.0.0.1", s);
    assertEquals("192.168.4.1", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testFreeBsd() {
    NetworkUtils networkUtils = new NetworkUtils(StubNetworkInterfaceProvider.getFreeBsd());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("localhost.apache.org", s);
    assertEquals("192.168.0.4", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testVistaBox() {
    NetworkUtils networkUtils = new NetworkUtils(StubNetworkInterfaceProvider.getVistaBox());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("127.0.0.1", s);
    assertEquals("woz134", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testWindows7Box() {
    NetworkUtils networkUtils = new NetworkUtils(StubNetworkInterfaceProvider.getWindows7Box());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("127.0.0.1", s);
    assertEquals("192.168.1.102", networkUtils.getNonLoopbackAddressOfThisMachine());
  }

  @Test
  public void testOpenSuseBoxIssue1181() {
    NetworkUtils networkUtils =
        new NetworkUtils(StubNetworkInterfaceProvider.getOpenSuseBoxFromIssue1181());
    String s = networkUtils.obtainLoopbackIp4Address();
    assertEquals("localhost.localdomain", s);
  }
}


text:
package com.ericsson.eiffel.remrem.generate.service;

import org.springframework.context.annotation.Configuration;

@Configuration public class FakeConfig {

}


text:
                  Bookmarks
                  410


text:
<?php

/*
 * dashboard for admin
 */
session_start();

if( !( isset( $_SESSION['Username'] ) && isset($_SESSION['Name']) && $_SESSION['Username'] === 'admin' ) )
{
	echo "To access this page you need to login as Admin. Please log in first.";
	die();
}

require_once "../LocalSettings.php";
require_once "Globals.php";

$html = <<<HTML

<title>Assign Post(s)</title>
<link rel="shortcut icon" href="/favicon.png" type="image/png">
<link rel="shortcut icon" type="image/png" href="../image/gogreen.jpg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<button onclick="document.location.href='../' "> HOME </button>

HTML;

echo $html;

$sqlConn = new mysqli( $eorgDBserver , $eorgDBuser , $eorgDBpasswd , $eorgDBname );

if( $sqlConn->connect_errno )
{
	echo "Error connecting database. Please check your database credentials and update.";
	die();
}

if(! isset($_POST['submit']))
{
	echo"Sorry, there is some problem";
	die();
}

$stmt = $sqlConn->prepare("SELECT $setKey FROM $settings");

if ( ! $stmt->execute() )
{
	echo"there is a problem with database
";
	die ();
}

$res = $stmt->get_result();

while ($row = mysqli_fetch_row($res))
{
	$newRow = preg_replace('/\s+/', '_', $row[0]);
	$newRow = str_replace('.', '$', $newRow);
	if( isset($_POST[$newRow]) )
	{
		echo $row[0]."
";

		$stmt2 = $sqlConn->prepare("UPDATE $settings SET $setValue = ? WHERE $setKey = \"$row[0]\"");
		$stmt2->bind_param ('s', $_POST[$newRow] );
		if ( ! $stmt2->execute() )
		{
			echo"there is a problem with database
";
			die ();
		}
		$stmt2->close();
	}
}

echo "
Settings saved successfully.

";

echo "";

?>


text:
<?php
	include_once("admin.config.inc.php");
	include("connect.php");
?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

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

			View user Statestics


text:
package de.tudresden.inf.lat.born.problog.connector;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringTokenizer;

import de.tudresden.inf.lat.born.core.common.ResourceUtil;
import de.tudresden.inf.lat.born.core.term.SubApp;

/**
 * An object of this class creates a Bayesian network using randomized values.
 *
 * @see BayesianNetworkCreatorCore
 *
 * @author Julian Mendez
 *
 */
public class BayesianNetworkCreatorSubApp implements SubApp {

	public static final String COMMAND = "link";
	public static final String HELP = "Parameters: <list of parents> <output file>"
			+ "\n\nExample of parameters: \"1,1,2,3,5,8\" network.pl"
			+ "\n\nThe example creates a Bayesian network with:" + "\n  1 independent variable (no parents),"
			+ "\n  1 variable with 1 parent," + "\n  2 variables with 2 parents," + "\n  3 variables with 3 parents,"
			+ "\n  5 variables with 4 parents," + "\n  and 8 variables with 5 parents.";

	public BayesianNetworkCreatorSubApp() {
	}

	boolean isValidInput(List<Integer> variables) {
		Objects.requireNonNull(variables);
		int accumVars = 0;
		boolean isValid = true;
		for (int parents = 0; isValid && (parents < variables.size()); parents++) {
			isValid = isValid && (parents <= accumVars);
			int current = variables.get(parents);
			accumVars += current;
		}
		return isValid;
	}

	List<Integer> parseIntegers(String listAsStr) {
		List<Integer> ret = new ArrayList<>();
		StringTokenizer stok = new StringTokenizer(listAsStr, ",");
		while (stok.hasMoreTokens()) {
			String value = stok.nextToken().trim();
			ret.add(Integer.parseInt(value));
		}
		return ret;
	}

	@Override
	public String getHelp() {
		return HELP;
	}

	@Override
	public boolean isValid(String[] args) {
		if (args.length == 2) {
			List<Integer> dependencies = parseIntegers(args[0]);
			return isValidInput(dependencies);
		} else {
			return false;
		}
	}

	@Override
	public String run(String[] args) {
		if (isValid(args)) {
			try {
				BayesianNetworkCreatorConfiguration conf = new BayesianNetworkCreatorConfigurationImpl();

				List<Integer> dependencies = parseIntegers(args[0]);
				conf.setDependencies(dependencies);

				OutputStream output = new FileOutputStream(ResourceUtil.ensurePath(args[1]));
				conf.setOutput(output);

				BayesianNetworkCreatorCore core = new BayesianNetworkCreatorCore();
				core.run(conf);

				output.close();

			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
			return "Done.";
		} else {
			return getHelp();
		}
	}

}


text:
from mimetypes import MimeTypes
import os
from os import path
import urllib

import unittest
from webtest import TestApp

from . import main

BASEPATH = path.abspath(path.dirname(__file__))
FIXTURES = path.join(BASEPATH, 'tests/fixtures')

AUTH_ENVIRON = {
    'HTTP_AUTHORIZATION': 'Basic YWRtaW46YWRtaW4='
}

class S3FileMockup(object):

    def __init__(self, filepath, block_size=1024):
        mime = MimeTypes()
        self.block_size = block_size
        url = urllib.pathname2url(filepath)
        self.content_type = mime.guess_type(url)[0]
        self.file = open(filepath)

    def __iter__(self):
        return self

    def next(self):
        val = self.file.read(self.block_size)
        if not val:
            raise StopIteration
        return val

    #  py3
    __next__ = next

    def close(self):
        self.file.close()

class S3BucketMockup:

    def __init__(self, bucket_name):
        self.bucket_name = bucket_name
        self.abspath = path.join(FIXTURES, bucket_name)

    def lookup(self, filename):
        if filename.startswith('/'):
            filename = filename[1:]

        file = path.join(self.abspath, filename)
        if path.isfile(file):
            return S3FileMockup(file)
        return None

class S3ConnectionMockup:

    def __init__(self, key, secret):
        self.key_id = key
        self.key_secret = secret

    def get_bucket(self, bucket_name, validate=True):
        return S3BucketMockup(bucket_name)

def unset_environment():
    for item in [
        'USER_admin',
        'AWS_BUCKET_NAME',
        'AWS_ACCESS_KEY_ID',
        'AWS_SECRET_ACCESS_KEY',
    ]:
        if item in os.environ:
            del os.environ[item]

class BaseAppTest(unittest.TestCase):

    def setUp(self):
        unset_environment()
        settings = {
            'user_admin': '8c6976e5b5410415bde908bd4dee15dfb16'
                          '7a9c873fc4bb8a81f6f2ab448a918',
            'aws_bucket_name': 'bucket_example',
            'aws_access_key_id': '123123',
            'aws_secret_access_key': '123123123',
            'S3Wrapper': S3ConnectionMockup,
        }

        app = main({}, **settings)
        self.testapp = TestApp(app)

    def tearDown(self):
        unset_environment()
        self.testapp.reset()


text:
package mujina.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

public class SharedController {

  protected final Logger LOG = LoggerFactory.getLogger(getClass());

  protected SharedConfiguration configuration;

  public SharedController(SharedConfiguration configuration) {
    this.configuration = configuration;
  }

  @PostMapping("/reset")
  public void reset() {
    LOG.info("Resetting to default configuration");
    configuration.reset();
  }

  @PutMapping("/entityid")
  public void setEntityID(@RequestBody String entityID) {
    LOG.info("Request to set entityID {}", entityID);
    configuration.setEntityId(entityID);
  }

  @PostMapping("/signing-credential")
  public void setSigningCredential(@RequestBody Credential credential) {
    LOG.info("Request to set signing credential {}", credential);
    configuration.injectCredential(credential.getCertificate(), credential.getKey());
  }

  @PutMapping("/needs-signing")
  public void setSigningNeeded(@RequestBody boolean needsSigning) {
    LOG.info("Request to set signing needed {}", needsSigning);
    configuration.setNeedsSigning(needsSigning);
  }

  @PutMapping("/signatureAlgorithm")
  public void setSignatureAlgorithm(@RequestBody String signatureAlgorithm) {
    LOG.info("Request to set signatureAlgorithm to {}", signatureAlgorithm);
    configuration.setSignatureAlgorithm(signatureAlgorithm);
  }

}


text:
package org.apache.cassandra.db.marshal;

import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.*;

import org.apache.cassandra.db.IColumn;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.utils.Pair;

public class SetType<T> extends CollectionType<Set<T>>
{
    // interning instances
    private static final Map<AbstractType<?>, SetType> instances = new HashMap<AbstractType<?>, SetType>();

    public final AbstractType<T> elements;

    public static SetType<?> getInstance(TypeParser parser) throws ConfigurationException, SyntaxException
    {
        List<AbstractType<?>> l = parser.getTypeParameters();
        if (l.size() != 1)
            throw new ConfigurationException("SetType takes exactly 1 type parameter");

        return getInstance(l.get(0));
    }

    public static synchronized <T> SetType<T> getInstance(AbstractType<T> elements)
    {
        SetType<T> t = instances.get(elements);
        if (t == null)
        {
            t = new SetType<T>(elements);
            instances.put(elements, t);
        }
        return t;
    }

    public SetType(AbstractType<T> elements)
    {
        super(Kind.SET);
        this.elements = elements;
    }

    public AbstractType<T> nameComparator()
    {
        return elements;
    }

    public AbstractType<?> valueComparator()
    {
        return EmptyType.instance;
    }

    public Set<T> compose(ByteBuffer bytes)
    {
        try
        {
            ByteBuffer input = bytes.duplicate();
            int n = input.getShort();
            Set<T> l = new LinkedHashSet<T>(n);
            for (int i = 0; i < n; i++)
            {
                int s = input.getShort();
                byte[] data = new byte[s];
                input.get(data);
                ByteBuffer databb = ByteBuffer.wrap(data);
                elements.validate(databb);
                l.add(elements.compose(databb));
            }
            return l;
        }
        catch (BufferUnderflowException e)
        {
            throw new MarshalException("Not enough bytes to read a set");
        }
    }

    /**
     * Layout is: {@code <n><s_1><b_1>...<s_n><b_n> }
     * where:
     *   n is the number of elements
     *   s_i is the number of bytes composing the ith element
     *   b_i is the s_i bytes composing the ith element
     */
    public ByteBuffer decompose(Set<T> value)
    {
        List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(value.size());
        int size = 0;
        for (T elt : value)
        {
            ByteBuffer bb = elements.decompose(elt);
            bbs.add(bb);
            size += 2 + bb.remaining();
        }
        return pack(bbs, value.size(), size);
    }

    protected void appendToStringBuilder(StringBuilder sb)
    {
        sb.append(getClass().getName()).append(TypeParser.stringifyTypeParameters(Collections.<AbstractType<?>>singletonList(elements)));
    }

    public ByteBuffer serialize(List<Pair<ByteBuffer, IColumn>> columns)
    {
        List<ByteBuffer> bbs = new ArrayList<ByteBuffer>(columns.size());
        int size = 0;
        for (Pair<ByteBuffer, IColumn> p : columns)
        {
            bbs.add(p.left);
            size += 2 + p.left.remaining();
        }
        return pack(bbs, columns.size(), size);
    }
}


text:
/**
 * Created by josemanuel on 22/11/16.
 */
module latte {

    export interface EaseFunction {
        (t: number): number;
    }

    /**
     *
     */
    export class Easing{

        //region Static
        // no easing, no acceleration
        static linear : EaseFunction = (t: number): number => { return t };
        // accelerating from zero velocity
        static easeInQuad : EaseFunction = (t: number): number => { return t*t };
        // decelerating to zero velocity
        static easeOutQuad : EaseFunction = (t: number): number => { return t*(2-t) };
        // acceleration until halfway, then deceleration
        static easeInOutQuad : EaseFunction = (t: number): number => { return t<.5 ? 2*t*t : -1+(4-2*t)*t };
        // accelerating from zero velocity
        static easeInCubic : EaseFunction = (t: number): number => { return t*t*t };
        // decelerating to zero velocity
        static easeOutCubic : EaseFunction = (t: number): number => { return (--t)*t*t+1 };
        // acceleration until halfway, then deceleration
        static easeInOutCubic : EaseFunction = (t: number): number => { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 };
        // accelerating from zero velocity
        static easeInQuart : EaseFunction = (t: number): number => { return t*t*t*t };
        // decelerating to zero velocity
        static easeOutQuart : EaseFunction = (t: number): number => { return 1-(--t)*t*t*t };
        // acceleration until halfway, then deceleration
        static easeInOutQuart : EaseFunction = (t: number): number => { return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t };
        // accelerating from zero velocity
        static easeInQuint : EaseFunction = (t: number): number => { return t*t*t*t*t };
        // decelerating to zero velocity
        static easeOutQuint : EaseFunction = (t: number): number => { return 1+(--t)*t*t*t*t };
        // acceleration until halfway, then deceleration
        static easeInOutQuint : EaseFunction = (t: number): number => { return t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t };
        //endregion

        //region Fields
        //endregion

        /**
         *
         */
        constructor() {
        }

        //region Private Methods
        //endregion

        //region Methods
        //endregion

        //region Events
        //endregion

        //region Properties
        //endregion

    }

}


text:
package mergo_test

import (
	"encoding/json"
	"testing"

	"github.com/imdario/mergo"
)

type settings struct {
	FirstSlice  []string `json:"FirstSlice"`
	SecondSlice []string `json:"SecondSlice"`
}

func TestIssue125MergeWithOverwrite(t *testing.T) {
	var (
		defaultSettings = settings{
			FirstSlice:  []string{},
			SecondSlice: []string{},
		}
		something settings
		data      = `{"FirstSlice":[], "SecondSlice": null}`
	)

	if err := json.Unmarshal([]byte(data), &something); err != nil {
		t.Errorf("Error while Unmarshalling maprequest: %s", err)
	}

	if err := mergo.Merge(&something, defaultSettings, mergo.WithOverrideEmptySlice); err != nil {
		t.Errorf("Error while merging: %s", err)
	}

	if something.FirstSlice == nil {
		t.Error("Invalid merging first slice")
	}

	if something.SecondSlice == nil {
		t.Error("Invalid merging second slice")
	}
}