text:
Basic Input Box, default width is `100%`.

:::demo
```html
<at-input v-model="inputValue" placeholder="Please input"></at-input>
<at-input v-model="inputValue" placeholder="Disabled" disabled></at-input>
<at-input v-model="password" type="password" placeholder="Password"></at-input>
```
:::

## With Status

Add the property `status`, which represents the input box with different meanings. It does not affect the button logic. Provide four status by default: `success`,`error`,`warning`,`info`

:::demo
```html
<at-input v-model="inputValue2" placeholder="success" status="success" icon="check-circle"></at-input>
<at-input v-model="inputValue2" placeholder="error" status="error" icon="x-circle"></at-input>
<at-input v-model="inputValue2" placeholder="warning" status="warning" icon="alert-circle"></at-input>
<at-input v-model="inputValue2" placeholder="info" status="info" icon="info"></at-input>
```
:::

## Wich Icon

To display the tooltip icon after the input box, add `icon` property to Input. Its value is the class name of Icon. Please refer to the section of `Brand/Icon` for details.

:::demo
```html
<at-input v-model="inputValue3" placeholder="Please input url" icon="link"></at-input>
```
:::

## Pre / Post Label

Set `slot="prepend"` or `slot="append"` to customize the input box.

:::demo
```html
<at-input v-model="inputValue4" placeholder="Please input">
  <template slot="prepend">
    <span>Https://</span>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input" size="small">
  <template slot="append">
    <span>@aotu.io</span>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input">
  <template slot="prepend">
    <i class="icon icon-link"></i>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input" prepend-button>
  <template slot="prepend">
    <span>Search</span>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input" append-button>
  <template slot="append">
    <span>Search</span>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input" prepend-button>
  <template slot="prepend">
    <i class="icon icon-search"></i>
  </template>
</at-input>
<at-input v-model="inputValue4" placeholder="Please input" append-button>
  <template slot="append">
    <i class="icon icon-search"></i>
  </template>
</at-input>
```
:::

## Size

There are three sizes of an Input box: `large`,`normal`,`small`.

:::demo
```html
<at-input v-model="inputValue" size="large" placeholder="Large Size"></at-input>
<at-input v-model="inputValue" placeholder="Normal Size"></at-input>
<at-input v-model="inputValue" size="small" placeholder="Small Size"></at-input>
```
:::

## Input Props

| Property      | Description          | Type      | Accepted values                           | Default  |
|---------- |-------------- |---------- |--------------------------------  |-------- |
| type | input type | String | `text`, `passowrd`, `textarea` | - |
| name | same as `name` in native input | String | - | - |
| value | binding value | String / Number | - | - |
| placeholder | placeholder of input | String | - | - |
| disabled | whether input is disabled | Boolean | - | false |
| readonly | same as native input | Boolean | - | false |
| maxlength | maximum input text length | Number | - | - |
| minlength | minimum input text length | Number | - | - |
| max | same as native input | Number | - | - |
| min | same as native input | Number | - | - |
| autofocus | same as native input | Boolean | - | false |
| size | size of input, works when type is not 'textarea' | String | `small`, `normal`, `large` | normal |
| status | status of input | String | `success`, `error`, `warning`, `info` | - |
| prependButton | whether has prepend button or not | Boolean | - | false |
| appendButton | whether has append button or not | Boolean | - | false |

## Input slot

| Name | Description          |
|------ |------------ |
| prepend | Preposed content, only works in text type |
| append | Append content, only works in text type |

## Input Events

| Event Name | Description          | Return Value  |
|---------- |-------------- |---------- |
| focus | Emitted when focus | event |
| blur | Emitted when blur | event |

<script>
export default {
  data() {
    return {
      inputValue: '',
      inputValue2: '',
      inputValue3: '',
      inputValue4: '',
      password: ''
    }
  }
}
</script>

<style lang="scss" scoped>
.at-input {
  width: 200px;

  & + .at-input {
    margin-top: 15px;
  }
}
</style>


text:
package org.sagebionetworks.bridge.udd.synapse;

import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;

import org.sagebionetworks.client.SynapseClient;
import org.sagebionetworks.client.exceptions.SynapseResultNotReadyException;
import org.sagebionetworks.repo.model.table.DownloadFromTableResult;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import org.sagebionetworks.bridge.config.Config;
import org.sagebionetworks.bridge.udd.exceptions.AsyncTimeoutException;

@SuppressWarnings("unchecked")
public class SynapseHelperQueryTest {
    private static final String DUMMY_QUERY = "SELECT * FROM BAR";
    private static final String TEST_ASYNC_JOB_TOKEN = "test-async-job-token";
    private static final String TEST_RESULT_FILE_HANDLE_ID = "test-csv-file-handle";
    private static final String TEST_SYNAPSE_TABLE_ID = "test-table-id";

    private SynapseClient mockClient;
    private SynapseHelper helper;

    @BeforeMethod
    public void setup() throws Exception {
        // set configs - zero poll interval and 2 tries
        Config config = mock(Config.class);
        when(config.getInt(SynapseHelper.CONFIG_KEY_POLL_INTERVAL_MILLIS)).thenReturn(0);
        when(config.getInt(SynapseHelper.CONFIG_KEY_POLL_MAX_TRIES)).thenReturn(2);

        // mock Synapse client
        mockClient = mock(SynapseClient.class);
        when(mockClient.downloadCsvFromTableAsyncStart(DUMMY_QUERY, /*writeHeader*/true,
                /*includeRowIdAndRowVersion*/false, /*csvDescriptor*/null, TEST_SYNAPSE_TABLE_ID))
                .thenReturn(TEST_ASYNC_JOB_TOKEN);

        // set up Synapse helper
        helper = new SynapseHelper();
        helper.setConfig(config);
        helper.setSynapseClient(mockClient);
    }

    @Test
    public void query() throws Exception {
        // set up get call
        DownloadFromTableResult result = new DownloadFromTableResult();
        result.setResultsFileHandleId(TEST_RESULT_FILE_HANDLE_ID);
        when(mockClient.downloadCsvFromTableAsyncGet(TEST_ASYNC_JOB_TOKEN, TEST_SYNAPSE_TABLE_ID)).thenReturn(result);

        // execute and validate
        String retval = helper.generateFileHandleFromTableQuery(DUMMY_QUERY, TEST_SYNAPSE_TABLE_ID);
        assertEquals(retval, TEST_RESULT_FILE_HANDLE_ID);

        verify(mockClient, times(1)).downloadCsvFromTableAsyncGet(anyString(), anyString());
    }

    @Test
    public void pollTwice() throws Exception {
        // set up get call
        DownloadFromTableResult result = new DownloadFromTableResult();
        result.setResultsFileHandleId(TEST_RESULT_FILE_HANDLE_ID);
        when(mockClient.downloadCsvFromTableAsyncGet(TEST_ASYNC_JOB_TOKEN, TEST_SYNAPSE_TABLE_ID))
                .thenThrow(SynapseResultNotReadyException.class).thenReturn(result);

        // execute and validate
        String retval = helper.generateFileHandleFromTableQuery(DUMMY_QUERY, TEST_SYNAPSE_TABLE_ID);
        assertEquals(retval, TEST_RESULT_FILE_HANDLE_ID);

        verify(mockClient, times(2)).downloadCsvFromTableAsyncGet(anyString(), anyString());
    }

    @Test
    public void timeout() throws Exception {
        // set up get call
        when(mockClient.downloadCsvFromTableAsyncGet(TEST_ASYNC_JOB_TOKEN, TEST_SYNAPSE_TABLE_ID))
                .thenThrow(SynapseResultNotReadyException.class);

        // execute and validate
        Exception thrownEx = null;
        try {
            helper.generateFileHandleFromTableQuery(DUMMY_QUERY, TEST_SYNAPSE_TABLE_ID);
            fail("expected exception");
        } catch (AsyncTimeoutException ex) {
            thrownEx = ex;
        }
        assertNotNull(thrownEx);

        verify(mockClient, times(2)).downloadCsvFromTableAsyncGet(anyString(), anyString());
    }

    @Test
    public void error() throws Exception {
        // set up get call
        when(mockClient.downloadCsvFromTableAsyncGet(TEST_ASYNC_JOB_TOKEN, TEST_SYNAPSE_TABLE_ID))
                .thenThrow(TestSynapseException.class);

        // execute and validate
        Exception thrownEx = null;
        try {
            helper.generateFileHandleFromTableQuery(DUMMY_QUERY, TEST_SYNAPSE_TABLE_ID);
            fail("expected exception");
        } catch (TestSynapseException ex) {
            thrownEx = ex;
        }
        assertNotNull(thrownEx);

        // Because of retries, we call this 5 times.
        verify(mockClient, times(5)).downloadCsvFromTableAsyncGet(anyString(), anyString());
    }
}

redpajama_set_name: RedPajamaGithub


text:
package it.stefanocappa.daggerexample.vehicle.sprungmass.engine;

import android.util.Log;

import javax.inject.Inject;

import it.stefanocappa.daggerexample.vehicle.sprungmass.Electric;
import it.stefanocappa.daggerexample.vehicle.sprungmass.tank.Tank;

/**
 * Created by Ks89 on 17/03/16.
 */
public class ElectricEngine extends Motor {
    private static final String TAG = ElectricEngine.class.getSimpleName();

    @Inject
    public ElectricEngine(@Electric Tank tank) {
        this.tank = tank;
    }

    @Override
    public int accelerate(int value) {
        if (tank.getCurrentLevel() >= value) {
            Log.d(TAG, "Engine accelerating to " + value + " with fuel: " + tank.getCurrentLevel());
            this.rpm = value;
            tank.setCurrentLevel(tank.getCurrentLevel() - value);
            Log.d(TAG, "Engine consumed " + value + " of fuel to be able to accelerate");
            return this.rpm;
        } else {
            Log.e(TAG, "Not enough fuel. Current is: " + tank.getCurrentLevel() + ", requested is " + value);
            return -1;
        }
    }

    @Override
    public void brake() {
        Log.d(TAG, "Braking...");
        this.rpm = 0;
    }
}


text:
<?php
namespace UnsrcSimpleAuth\Form;

use Zend\InputFilter\InputFilter;
use Zend\InputFilter\Input;

class LoginFilter extends InputFilter
{
	public function prepareFilters()
	{
		$who = new Input('who');
		$who->getFilterChain()
			->attachByName('StripTags');
		$what = new Input('what');
		$who->getFilterChain()
            ->attachByName('StripTags');
        $this->add($who)
             ->add($what);
	}
}


text:
/* ========================================
 * drive.c
 * Monica Lu and Victor Ying
 *
 * High-level movement program.
 * ========================================
 */

#include <project.h>

#include "drive.h"
#include "speed.h"
#include "steer.h"

/*
 * drive_init:
 * Begins driving the car.
 */
void drive_init(void) {
    steer_init();
    speed_init();

    steer_pid_start();
    speed_forward();
    speed_pid_start("0.5");
}

/*
 * magnet_callback:
 * Called on every hall sensor tick with a running total distance traveled.
 */
void magnet_callback(void) {
    // Do about half a lap
    if (distance_traveled >= 50.0)
        speed_brake();

    /*
    // Do two laps and maximum speed
    if (distance_traveled < 1.0)
        ;
    else if ((distance_traveled > 3.0 && distance_traveled < 20.0) ||
             (distance_traveled > 100.0 && distance_traveled < 118.0))
        speed_set(9.0);
    else if (distance_traveled < 194.0)
        speed_set(5.7);
    else
        speed_brake(); */
}

//[] END OF FILE


text:
Здравствуйте, {{ username }}!
Ваш приглашают на проект {{ HTTP_HOST }}.

Войти можно по ссылке http://{{ HTTP_HOST }}{{ config('meerkat/user.url.public_login') }} используя
- логин: {{ email }}
- пароль: {{ password }}


text:
class FieldValueFieldValueable < ActiveRecord::Base
  belongs_to :field_value
  belongs_to :field_valueable, polymorphic: true
end


text:
#include "_scriptapi.h"

namespace Script
{
    namespace Comment
    {
        struct CommentInfo
        {
            char mod[MAX_MODULE_SIZE];
            duint rva;
            char text[MAX_LABEL_SIZE];
            bool manual;
        };

        SCRIPT_EXPORT bool Set(duint addr, const char* text, bool manual = false);
        SCRIPT_EXPORT bool Set(const CommentInfo* info);
        SCRIPT_EXPORT bool Get(duint addr, char* text); //text[MAX_COMMENT_SIZE]
        SCRIPT_EXPORT bool GetInfo(duint addr, CommentInfo* info);
        SCRIPT_EXPORT bool Delete(duint addr);
        SCRIPT_EXPORT void DeleteRange(duint start, duint end);
        SCRIPT_EXPORT void Clear();
        SCRIPT_EXPORT bool GetList(ListOf(CommentInfo) list); //caller has the responsibility to free the list
    }; //Comment
}; //Script

#endif //_SCRIPTAPI_COMMENT_H


text:
package com.hyh.common.fragment;

import android.app.Activity;
import android.app.Application;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.hyh.common.lifecycle.ActivityLifecycleHelper;
import com.hyh.common.visible.IVisibleHandler;
import com.hyh.common.visible.ItemVisibleStrategy;
import com.hyh.common.visible.ViewVisibleDetector;

import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.List;

public abstract class CommonBaseFragment extends Fragment {

    private Context mContext;

    private boolean mIsLoadedData = false;

    private boolean mCompelledLoading;

    protected boolean mIsSelected;

    protected View mContentView;

    private boolean isNeedLoadData;

    private Context mThemeContext;

    private ActivityLifecycleListener mLifecycleListener;

    private int mDefaultThemeResId;

    private boolean mIsRegisterActivityLifecycleCallbacks;

    public void setCompelledLoading() {
        mCompelledLoading = true;
    }

    public void setDefaultThemeResId(int themeResId) {
        this.mDefaultThemeResId = themeResId;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.mContext = context;
        if (!mIsRegisterActivityLifecycleCallbacks && isFollowActivityLifecycle()) {
            Activity activity = getActivity();
            if (activity == null) {
                if (context instanceof Activity) {
                    activity = (Activity) context;
                }
            }
            mLifecycleListener = new ActivityLifecycleListener(activity, this);
            ActivityLifecycleHelper.getInstance().listenerAllActivity(mLifecycleListener);
            mIsRegisterActivityLifecycleCallbacks = true;
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        int themeResId = getThemeResId();
        if (themeResId == 0) {
            if (inflater != null) {
                mThemeContext = inflater.getContext();
            } else {
                Context context = getContext();
                mThemeContext = context;
                inflater = LayoutInflater.from(context);
            }
        } else {
            mThemeContext = new ContextThemeWrapper(getContext().getApplicationContext(), themeResId);
            inflater = LayoutInflater.from(mThemeContext);
        }
        if (isNeedReCreateView()) {
            mContentView = getContentView(inflater, container);
            initView(mContentView);
            if (mCompelledLoading || !lazyLoadData() || (isNeedLoadData && mIsSelected)) {
                mIsLoadedData = true;
                isNeedLoadData = false;
                initData();
            }
        } else {
            if (mContentView != null) {
                return mContentView;
            }
            mContentView = getContentView(inflater, container);
            initView(mContentView);
            if (mCompelledLoading || !lazyLoadData() || (isNeedLoadData && mIsSelected)) {
                mIsLoadedData = true;
                isNeedLoadData = false;
                initData();
            }
        }
        return mContentView;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        if (lazyLoadData()) {
            ViewVisibleDetector.setVisibleHandler(view, new VisibleHandler());
        }
    }

    @Override
    public Context getContext() {
        Context context = super.getContext();
        if (context != null) return context;
        return mContext;
    }

    protected Context getThemeContext() {
        return mThemeContext;
    }

    protected int getThemeResId() {
        return mDefaultThemeResId;
    }

    protected abstract View getContentView(LayoutInflater inflater, ViewGroup container);

    protected abstract void initView(View contentView);

    protected abstract void initData();

    protected boolean lazyLoadData() {
        return false;
    }

    protected boolean isNeedReCreateView() {
        return false;
    }

    protected boolean isFollowActivityLifecycle() {
        return false;
    }

    protected boolean isActivityFinish() {
        Activity activity = getActivity();
        return activity == null || activity.isFinishing();
    }

    protected void finishActivity() {
        Activity activity = getActivity();
        if (activity != null && !activity.isFinishing()) {
            activity.finish();
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    protected void onActivityStarted() {
    }

    protected void onActivityResumed() {
    }

    protected void onActivityPaused() {
    }

    protected void onActivityStopped() {
    }

    protected void onActivityDestroyed() {
        ActivityLifecycleListener lifecycleListener = mLifecycleListener;
        if (lifecycleListener != null) {
            ActivityLifecycleHelper.getInstance().unListenerAllActivity(lifecycleListener);
        }
        mLifecycleListener = null;
        mIsRegisterActivityLifecycleCallbacks = false;
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        ActivityLifecycleListener lifecycleListener = mLifecycleListener;
        if (lifecycleListener != null) {
            ActivityLifecycleHelper.getInstance().unListenerAllActivity(lifecycleListener);
        }
    }

    private class VisibleHandler implements IVisibleHandler {

        private final List<ItemVisibleStrategy> mVisibleStrategies = Collections.singletonList(
                new ItemVisibleStrategy(
                        ItemVisibleStrategy.VISIBLE_TYPE_HORIZONTAL,
                        1.0f,
                        100)
        );

        @Override
        public List<ItemVisibleStrategy> getItemVisibleStrategies() {
            return mVisibleStrategies;
        }

        @Override
        public void onViewInvisible(View view, ItemVisibleStrategy strategy) {

        }

        @Override
        public void onViewVisible(View view, ItemVisibleStrategy strategy) {
            if (!mIsLoadedData) {
                if (mContentView != null) {
                    mIsLoadedData = true;
                    isNeedLoadData = false;
                    initData();
                } else {
                    isNeedLoadData = true;
                }
            }
        }
    }

    private static class ActivityLifecycleListener implements Application.ActivityLifecycleCallbacks {

        private final WeakReference<Activity> mActivityReference;

        private final WeakReference<CommonBaseFragment> mFragmentReference;

        ActivityLifecycleListener(Activity activity, CommonBaseFragment fragment) {
            mActivityReference = new WeakReference<>(activity);
            mFragmentReference = new WeakReference<>(fragment);
        }

        @Override
        public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
        }

        @Override
        public void onActivityStarted(Activity activity) {
            if (getActivity() == activity) {
                CommonBaseFragment fragment = mFragmentReference.get();
                if (fragment != null) {
                    fragment.onActivityStarted();
                } else {
                    ActivityLifecycleHelper.getInstance().unListenerAllActivity(this);
                }
            }
        }

        @Override
        public void onActivityResumed(Activity activity) {
            if (getActivity() == activity) {
                CommonBaseFragment fragment = mFragmentReference.get();
                if (fragment != null) {
                    fragment.onActivityResumed();
                } else {
                    ActivityLifecycleHelper.getInstance().unListenerAllActivity(this);
                }
            }
        }

        @Override
        public void onActivityPaused(Activity activity) {
            if (getActivity() == activity) {
                CommonBaseFragment fragment = mFragmentReference.get();
                if (fragment != null) {
                    fragment.onActivityPaused();
                } else {
                    ActivityLifecycleHelper.getInstance().unListenerAllActivity(this);
                }
            }
        }

        @Override
        public void onActivityStopped(Activity activity) {
            if (getActivity() == activity) {
                CommonBaseFragment fragment = mFragmentReference.get();
                if (fragment != null) {
                    fragment.onActivityStopped();
                } else {
                    ActivityLifecycleHelper.getInstance().unListenerAllActivity(this);
                }
            }
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle outState) {

        }

        @Override
        public void onActivityDestroyed(Activity activity) {
            if (getActivity() == activity) {
                CommonBaseFragment fragment = mFragmentReference.get();
                if (fragment != null) {
                    fragment.onActivityDestroyed();
                } else {
                    ActivityLifecycleHelper.getInstance().unListenerAllActivity(this);
                }
            }
        }

        private Activity getActivity() {
            Activity activity = mActivityReference.get();
            if (activity == null) {
                CommonBaseFragment commonBaseFragment = mFragmentReference.get();
                if (commonBaseFragment != null) {
                    activity = commonBaseFragment.getActivity();
                }
            }
            return activity;
        }
    }
}


text:
package org.wd.doc.event.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.wd.doc.event.dto.Spec;
import java.io.IOException;
import java.util.Map;

@RestController
public class EventDocController {

    @Value("classpath:abc-events-blueprint.yaml")
    private Resource yamlFile;

    private final ObjectMapper objectMapper;

    public EventDocController() {
        this.objectMapper = new ObjectMapper(new YAMLFactory());
    }

    @RequestMapping(value = "/parser", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
    @ResponseBody
    public Map<String, Object> parse() throws IOException {

        Map<String, Object> mapped = objectMapper.readValue(yamlFile.getFile(), Map.class);

        return mapped;
    }

    public Spec getSpecFromMap(Map<String, Object> mapped) {
        Spec spec = new Spec();
        spec.setTitle((String) ((Map<String, Object>) mapped.get("info")).get("title"));
        spec.setVersion((String) ((Map<String, Object>) mapped.get("info")).get("version"));
        return spec;
    }

}


text:
/* $Id: UIGlobalSettingsDisplay.cpp $ */
/** @file
 * VBox Qt GUI - UIGlobalSettingsDisplay class implementation.
 */

/*
 * Copyright (C) 2012-2013 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifdef VBOX_WITH_PRECOMPILED_HEADERS
# include <precomp.h>
#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */

/* GUI includes: */
# include "UIGlobalSettingsDisplay.h"
# include "UIExtraDataManager.h"

#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */

/* Display page constructor: */
UIGlobalSettingsDisplay::UIGlobalSettingsDisplay()
{
    /* Apply UI decorations: */
    Ui::UIGlobalSettingsDisplay::setupUi(this);

    /* Setup widgets: */
    int iMinWidth = 640;
    int iMinHeight = 480;
    int iMaxSize = 16 * _1K;
    m_pResolutionWidthSpin->setMinimum(iMinWidth);
    m_pResolutionHeightSpin->setMinimum(iMinHeight);
    m_pResolutionWidthSpin->setMaximum(iMaxSize);
    m_pResolutionHeightSpin->setMaximum(iMaxSize);

    /* Setup connections: */
    connect(m_pMaxResolutionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(sltMaxResolutionComboActivated()));

    /* Apply language settings: */
    retranslateUi();
}

/* Load data to cache from corresponding external object(s),
 * this task COULD be performed in other than GUI thread: */
void UIGlobalSettingsDisplay::loadToCacheFrom(QVariant &data)
{
    /* Fetch data to properties & settings: */
    UISettingsPageGlobal::fetchData(data);

    /* Load to cache: */
    m_cache.m_strMaxGuestResolution = m_settings.maxGuestRes();
    m_cache.m_fActivateHoveredMachineWindow = gEDataManager->activateHoveredMachineWindow();

    /* Upload properties & settings to data: */
    UISettingsPageGlobal::uploadData(data);
}

/* Load data to corresponding widgets from cache,
 * this task SHOULD be performed in GUI thread only: */
void UIGlobalSettingsDisplay::getFromCache()
{
    /* Fetch from cache: */
    if ((m_cache.m_strMaxGuestResolution.isEmpty()) ||
        (m_cache.m_strMaxGuestResolution == "auto"))
    {
        /* Switch combo-box item: */
        m_pMaxResolutionCombo->setCurrentIndex(m_pMaxResolutionCombo->findData("auto"));
    }
    else if (m_cache.m_strMaxGuestResolution == "any")
    {
        /* Switch combo-box item: */
        m_pMaxResolutionCombo->setCurrentIndex(m_pMaxResolutionCombo->findData("any"));
    }
    else
    {
        /* Switch combo-box item: */
        m_pMaxResolutionCombo->setCurrentIndex(m_pMaxResolutionCombo->findData("fixed"));
        /* Trying to parse text into 2 sections by ',' symbol: */
        int iWidth  = m_cache.m_strMaxGuestResolution.section(',', 0, 0).toInt();
        int iHeight = m_cache.m_strMaxGuestResolution.section(',', 1, 1).toInt();
        /* And set values if they are present: */
        m_pResolutionWidthSpin->setValue(iWidth);
        m_pResolutionHeightSpin->setValue(iHeight);
    }
    /* Set state for corresponding check-box: */
    m_pCheckBoxActivateOnMouseHover->setChecked(m_cache.m_fActivateHoveredMachineWindow);
}

/* Save data from corresponding widgets to cache,
 * this task SHOULD be performed in GUI thread only: */
void UIGlobalSettingsDisplay::putToCache()
{
    /* Upload to cache: */
    if (m_pMaxResolutionCombo->itemData(m_pMaxResolutionCombo->currentIndex()).toString() == "auto")
    {
        /* If resolution current combo item is "auto" => resolution set to "auto": */
        m_cache.m_strMaxGuestResolution = QString();
    }
    else if (m_pMaxResolutionCombo->itemData(m_pMaxResolutionCombo->currentIndex()).toString() == "any" ||
             m_pResolutionWidthSpin->value() == 0 || m_pResolutionHeightSpin->value() == 0)
    {
        /* Else if resolution current combo item is "any"
         * or any of the resolution field attributes is zero => resolution set to "any": */
        m_cache.m_strMaxGuestResolution = "any";
    }
    else if (m_pResolutionWidthSpin->value() != 0 && m_pResolutionHeightSpin->value() != 0)
    {
        /* Else if both field attributes are non-zeroes => resolution set to "fixed": */
        m_cache.m_strMaxGuestResolution = QString("%1,%2").arg(m_pResolutionWidthSpin->value()).arg(m_pResolutionHeightSpin->value());
    }
    /* Acquire state from corresponding check-box: */
    m_cache.m_fActivateHoveredMachineWindow = m_pCheckBoxActivateOnMouseHover->isChecked();
}

/* Save data from cache to corresponding external object(s),
 * this task COULD be performed in other than GUI thread: */
void UIGlobalSettingsDisplay::saveFromCacheTo(QVariant &data)
{
    /* Fetch data to properties & settings: */
    UISettingsPageGlobal::fetchData(data);

    /* Save from cache: */
    m_settings.setMaxGuestRes(m_cache.m_strMaxGuestResolution);
    gEDataManager->setActivateHoveredMachineWindow(m_cache.m_fActivateHoveredMachineWindow);

    /* Upload properties & settings to data: */
    UISettingsPageGlobal::uploadData(data);
}

void UIGlobalSettingsDisplay::setOrderAfter(QWidget*)
{
}

void UIGlobalSettingsDisplay::retranslateUi()
{
    /* Translate uic generated strings: */
    Ui::UIGlobalSettingsDisplay::retranslateUi(this);

    /* Populate combo-box: */
    populate();
}

void UIGlobalSettingsDisplay::sltMaxResolutionComboActivated()
{
    /* Get current resolution-combo tool-tip data: */
    QString strCurrentComboItemTip = m_pMaxResolutionCombo->itemData(m_pMaxResolutionCombo->currentIndex(), Qt::ToolTipRole).toString();
    m_pMaxResolutionCombo->setWhatsThis(strCurrentComboItemTip);

    /* Get current resolution-combo item data: */
    QString strCurrentComboItemData = m_pMaxResolutionCombo->itemData(m_pMaxResolutionCombo->currentIndex()).toString();
    /* Is our combo in state for 'fixed' resolution? */
    bool fCurrentResolutionStateFixed = strCurrentComboItemData == "fixed";
    /* Should be combo-level widgets enabled? */
    bool fComboLevelWidgetsEnabled = fCurrentResolutionStateFixed;
    /* Enable/disable combo-level widgets: */
    m_pResolutionWidthLabel->setEnabled(fComboLevelWidgetsEnabled);
    m_pResolutionWidthSpin->setEnabled(fComboLevelWidgetsEnabled);
    m_pResolutionHeightLabel->setEnabled(fComboLevelWidgetsEnabled);
    m_pResolutionHeightSpin->setEnabled(fComboLevelWidgetsEnabled);
}

void UIGlobalSettingsDisplay::populate()
{
    /* Remember current position: */
    int iCurrentPosition = m_pMaxResolutionCombo->currentIndex();
    if (iCurrentPosition == -1)
        iCurrentPosition = 0;

    /* Clear combo-box: */
    m_pMaxResolutionCombo->clear();

    /* Create corresponding items: */
    m_pMaxResolutionCombo->addItem(tr("Automatic", "Maximum Guest Screen Size"), "auto");
    m_pMaxResolutionCombo->setItemData(m_pMaxResolutionCombo->count() - 1,
                                       tr("Suggest a reasonable maximum screen size to the guest. "
                                          "The guest will only see this suggestion when guest additions are installed."),
                                       Qt::ToolTipRole);
    m_pMaxResolutionCombo->addItem(tr("None", "Maximum Guest Screen Size"), "any");
    m_pMaxResolutionCombo->setItemData(m_pMaxResolutionCombo->count() - 1,
                                       tr("Do not attempt to limit the size of the guest screen."),
                                       Qt::ToolTipRole);
    m_pMaxResolutionCombo->addItem(tr("Hint", "Maximum Guest Screen Size"), "fixed");
    m_pMaxResolutionCombo->setItemData(m_pMaxResolutionCombo->count() - 1,
                                       tr("Suggest a maximum screen size to the guest. "
                                          "The guest will only see this suggestion when guest additions are installed."),
                                       Qt::ToolTipRole);

    /* Choose previous position: */
    m_pMaxResolutionCombo->setCurrentIndex(iCurrentPosition);
    sltMaxResolutionComboActivated();
}


text:
* HTTPS
* Express: GET/PUT/POST/DELETE --> DB
* UI

* Refactor
* Auth


text:
<?php

namespace Backpack\CRUD\PanelTraits;

trait Columns
{
    // ------------
    // COLUMNS
    // ------------

    /**
     * Add a bunch of column names and their details to the CRUD object.
     *
     * @param [array or multi-dimensional array]
     */
    public function setColumns($columns)
    {
        // clear any columns already set
        $this->columns = [];

        // if array, add a column for each of the items
        if (is_array($columns) && count($columns)) {
            foreach ($columns as $key => $column) {
                // if label and other details have been defined in the array
                if (is_array($columns[0])) {
                    $this->addColumn($column);
                } else {
                    $this->addColumn([
                                    'name'  => $column,
                                    'label' => ucfirst($column),
                                    'type'  => 'text',
                                ]);
                }
            }
        }

        if (is_string($columns)) {
            $this->addColumn([
                                'name'  => $columns,
                                'label' => ucfirst($columns),
                                'type'  => 'text',
                                ]);
        }

        // This was the old setColumns() function, and it did not work:
        // $this->columns = array_filter(array_map([$this, 'addDefaultTypeToColumn'], $columns));
    }

    /**
     * Add a column at the end of to the CRUD object's "columns" array.
     *
     * @param [string or array]
     */
    public function addColumn($column)
    {
        // if a string was passed, not an array, change it to an array
        if (! is_array($column)) {
            $column = ['name' => $column];
        }

        // make sure the column has a type
        $column_with_details = $this->addDefaultTypeToColumn($column);

        // make sure the column has a label
        $column_with_details = $this->addDefaultLabel($column);

        return array_filter($this->columns[] = $column_with_details);
    }

    /**
     * Add multiple columns at the end of the CRUD object's "columns" array.
     *
     * @param [array of columns]
     */
    public function addColumns($columns)
    {
        if (count($columns)) {
            foreach ($columns as $key => $column) {
                $this->addColumn($column);
            }
        }
    }

    /**
     * Add the default column type to the given Column, inferring the type from the database column type.
     *
     * @param [column array]
     */
    public function addDefaultTypeToColumn($column)
    {
        if (array_key_exists('name', (array) $column)) {
            $default_type = $this->getFieldTypeFromDbColumnType($column['name']);

            return array_merge(['type' => $default_type], $column);
        }

        return false;
    }

    /**
     * If a field or column array is missing the "label" attribute, an ugly error would be show.
     * So we add the field Name as a label - it's better than nothing.
     *
     * @param [field or column]
     */
    public function addDefaultLabel($array)
    {
        if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
            $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array);

            return $array;
        }

        return $array;
    }

    /**
     * Remove multiple columns from the CRUD object using their names.
     *
     * @param  [column array]
     */
    public function removeColumns($columns)
    {
        $this->columns = $this->remove('columns', $columns);
    }

    /**
     * Remove a column from the CRUD object using its name.
     *
     * @param  [column array]
     */
    public function removeColumn($column)
    {
        return $this->removeColumns([$column]);
    }

    /**
     * @param string $entity
     */
    public function remove($entity, $fields)
    {
        return array_values(array_filter($this->{$entity}, function ($field) use ($fields) {
            return ! in_array($field['name'], (array) $fields);
        }));
    }

    /**
     * Change attributes for multiple columns.
     *
     * @param [columns arrays]
     * @param [attributes and values array]
     */
    public function setColumnsDetails($columns, $attributes)
    {
        $this->sync('columns', $columns, $attributes);
    }

    /**
     * Change attributes for a certain column.
     *
     * @param [string] Column name.
     * @param [attributes and values array]
     */
    public function setColumnDetails($column, $attributes)
    {
        $this->setColumnsDetails([$column], $attributes);
    }

    /**
     * Order the columns in a certain way.
     *
     * @param [string] Column name.
     * @param [attributes and values array]
     */
    public function setColumnOrder($columns)
    {
        // TODO
    }

    // ALIAS of setColumnOrder($columns)
    public function setColumnsOrder($columns)
    {
        $this->setColumnOrder($columns);
    }

    // ------------
    // TONE FUNCTIONS - UNDOCUMENTED, UNTESTED, SOME MAY BE USED
    // ------------
    // TODO: check them

    public function getColumns()
    {
        return $this->sort('columns');
    }

    public function orderColumns($order)
    {
        $this->setSort('columns', (array) $order);
    }
}


text:
package fxml_main;

import gamedata.action.ConcreteAction;
import java.util.function.Consumer;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import authoring.data.ActionData;
import authoring.data.PlayerData;

/**
 * @author annamiyajima
 *
 */
public class ActionController extends GridComponentAbstCtrl<ConcreteAction> {
	private ActionData myActionData;
	private String myGridShape;

	protected ActionController (VBox vbox, ScrollPane propertiesSPane,
			GUIGridReference gridRef, ActionData actionData, String gridShape) {
		super(vbox, propertiesSPane, gridRef);
		myActionData = actionData;
		myGridShape = gridShape;
	}

	@Override
	protected void initGlobalNewBtn (Button newBtn) {
		newBtn.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle (ActionEvent click) {
				Consumer<ConcreteAction> okLambda = (ConcreteAction action) -> {
					myActionData.add(action);
					addEntry(action);
				};
				myPropertiesSPane.setContent(new ActionEditor(okLambda, myGridShape));
			}
		});
	}

	@Override
	protected void initGlobalEditBtn (Button editBtn) {
		editBtn.setVisible(false);
		// do nothing
	}

	@Override
	protected void initGlobalDelBtn (Button delBtn) {
		delBtn.setVisible(false);
		// do nothing
	}

	@Override
	protected void initEntryEditBtn (ConcreteAction entry, Button editBtn) {
		editBtn.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle (ActionEvent click) {
				Consumer<ConcreteAction> okLambda = (ConcreteAction action) -> {
					HBox entryBox = makeCompleteEntryBox(action);
					HBox entryHolderBox = myEntryMap.get(entry);
					entryHolderBox.getChildren().clear();
					entryHolderBox.getChildren().add(entryBox);
					myEntryMap.put(action, entryHolderBox);
					myActionData.replace(entry, action);
				};
				myPropertiesSPane.setContent(new ActionEditor(okLambda, entry, myGridShape));
			}

		});
	}

	@Override
	protected HBox makeEntryBox (ConcreteAction entry) {
		HBox hb = new HBox();
		Label name = new Label(entry.getName());
		name.setTranslateY(7.5);
		hb.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle (MouseEvent e) {
				myPropertiesSPane.setContent(new ActionViewer(entry));
			}

		});
		hb.getChildren().addAll(name);
		return hb;
	}

	@Override
	protected void initEntryDelBtn (ConcreteAction entry, Button delBtn) {
		delBtn.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle (ActionEvent event) {
				myActionData.remove(entry);
				myVBox.getChildren().remove(myEntryMap.get(entry));
			}
		});
	}
}


text:
# Form implementation generated from reading ui file 'ui/MainWindow.ui'
#
# Created: Sat May 24 23:02:45 2014
#      by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(763, 711)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.splitter_2 = QtGui.QSplitter(self.centralwidget)
        self.splitter_2.setOrientation(QtCore.Qt.Vertical)
        self.splitter_2.setObjectName(_fromUtf8("splitter_2"))
        self.splitter_1 = QtGui.QSplitter(self.splitter_2)
        self.splitter_1.setOrientation(QtCore.Qt.Horizontal)
        self.splitter_1.setObjectName(_fromUtf8("splitter_1"))
        self.graphicsView = QtGui.QGraphicsView(self.splitter_1)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.layoutWidget = QtGui.QWidget(self.splitter_1)
        self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.pushButtonLoad = QtGui.QPushButton(self.layoutWidget)
        self.pushButtonLoad.setObjectName(_fromUtf8("pushButtonLoad"))
        self.verticalLayout.addWidget(self.pushButtonLoad)
        self.comboBoxLang = QtGui.QComboBox(self.layoutWidget)
        self.comboBoxLang.setObjectName(_fromUtf8("comboBoxLang"))
        self.verticalLayout.addWidget(self.comboBoxLang)
        self.comboBoxPSM = QtGui.QComboBox(self.layoutWidget)
        self.comboBoxPSM.setObjectName(_fromUtf8("comboBoxPSM"))
        self.verticalLayout.addWidget(self.comboBoxPSM)
        self.comboBoxRIL = QtGui.QComboBox(self.layoutWidget)
        self.comboBoxRIL.setObjectName(_fromUtf8("comboBoxRIL"))
        self.verticalLayout.addWidget(self.comboBoxRIL)
        self.pushButtonShow = QtGui.QPushButton(self.layoutWidget)
        self.pushButtonShow.setObjectName(_fromUtf8("pushButtonShow"))
        self.verticalLayout.addWidget(self.pushButtonShow)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.pushButtonRestart = QtGui.QPushButton(self.layoutWidget)
        self.pushButtonRestart.setObjectName(_fromUtf8("pushButtonRestart"))
        self.verticalLayout.addWidget(self.pushButtonRestart)
        self.pushButtonQuit = QtGui.QPushButton(self.layoutWidget)
        self.pushButtonQuit.setObjectName(_fromUtf8("pushButtonQuit"))
        self.verticalLayout.addWidget(self.pushButtonQuit)
        self.textEdit = QtGui.QTextEdit(self.splitter_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.textEdit.sizePolicy().hasHeightForWidth())
        self.textEdit.setSizePolicy(sizePolicy)
        self.textEdit.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.gridLayout.addWidget(self.splitter_2, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 763, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.toolBarZoom = QtGui.QToolBar(MainWindow)
        self.toolBarZoom.setObjectName(_fromUtf8("toolBarZoom"))
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarZoom)
        self.actionZoomFit = QtGui.QAction(MainWindow)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/zoom_fit.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoomFit.setIcon(icon)
        self.actionZoomFit.setObjectName(_fromUtf8("actionZoomFit"))
        self.actionZoomTo1 = QtGui.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/zoom_1 to_1.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoomTo1.setIcon(icon1)
        self.actionZoomTo1.setObjectName(_fromUtf8("actionZoomTo1"))
        self.actionZoomIn = QtGui.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/zoom_in.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoomIn.setIcon(icon2)
        self.actionZoomIn.setObjectName(_fromUtf8("actionZoomIn"))
        self.actionZoomOut = QtGui.QAction(MainWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/zoom_out.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionZoomOut.setIcon(icon3)
        self.actionZoomOut.setObjectName(_fromUtf8("actionZoomOut"))
        self.toolBarZoom.addAction(self.actionZoomFit)
        self.toolBarZoom.addAction(self.actionZoomTo1)
        self.toolBarZoom.addAction(self.actionZoomIn)
        self.toolBarZoom.addAction(self.actionZoomOut)

        self.retranslateUi(MainWindow)
        QtCore.QObject.connect(self.pushButtonQuit, QtCore.SIGNAL(_fromUtf8("pressed()")), MainWindow.close)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.pushButtonLoad.setText(_translate("MainWindow", "Load Image", None))
        self.pushButtonShow.setText(_translate("MainWindow", "Analyze", None))
        self.pushButtonRestart.setText(_translate("MainWindow", "Restart program", None))
        self.pushButtonQuit.setText(_translate("MainWindow", "Quit", None))
        self.toolBarZoom.setWindowTitle(_translate("MainWindow", "zoomBar", None))
        self.actionZoomFit.setText(_translate("MainWindow", "Fit image to window", None))
        self.actionZoomFit.setToolTip(_translate("MainWindow", "Fit Image to scene", None))
        self.actionZoomTo1.setText(_translate("MainWindow", "1:1", None))
        self.actionZoomTo1.setToolTip(_translate("MainWindow", "Show image without zoom", None))
        self.actionZoomIn.setText(_translate("MainWindow", "Zoom In", None))
        self.actionZoomOut.setText(_translate("MainWindow", "Zoom Out", None))

import resources_rc


text:
from itertools import chain
from cqlsl.utils import sorted_kwargs
from .base import BaseStatement, WhereClauseMixin

__all__ = ['update']

class UpdateStatement(BaseStatement, WhereClauseMixin):
    def __init__(self, *args, **kwargs):
        BaseStatement.__init__(self, *args, **kwargs)
        WhereClauseMixin.__init__(self)
        self._set_values = {}

    def set(self, **values):
        self._set_values = sorted_kwargs(**values)
        return self

    @property
    def query(self):
        if not self._where_conditions:
            raise Exception('WHERE is mandatory for UPDATE statement.')

        return 'UPDATE {table} SET {set_clause} WHERE {where_clause}'.format(
            table=self.table_name,
            set_clause=self._get_set_clause(),
            where_clause=self._get_where_clause(),
        )

    @property
    def context(self):
        return self._get_set_context() + self._get_where_context()

    def _get_set_clause(self):
        set_items = []
        for field, modifier, value in self._unpack_set_items():
            if modifier in ('add', 'append'):
                set_items.append('{field} = {field} + %s'.format(field=field))
            elif modifier == 'remove':
                set_items.append('{field} = {field} - %s'.format(field=field))
            elif modifier == 'prepend':
                set_items.append('{field} = %s + {field}'.format(field=field))
            elif modifier.startswith('insert__'):
                index = int(modifier.replace('insert__', ''))
                set_items.append('{field}[{index}] = %s'.format(field=field, index=index))
            elif modifier == 'update' and isinstance(value, dict):
                set_items += ['{field}[%s] = %s'.format(field=field)] * len(value.items())
            else:
                set_items.append('{field} = %s'.format(field=field))

        return ', '.join(set_items)

    def _get_set_context(self):
        context = []
        for field, modifier, value in self._unpack_set_items():
            if modifier == 'update' and isinstance(value, dict):
                context += list(chain(*value.items()))
            else:
                context.append(value)

        return tuple(context)

    def _unpack_set_items(self):
        for field, value in self._set_values.items():
            try:
                field, modifier = field.split('__', 1)
            except ValueError:
                modifier = ''

            yield field, modifier, value

update = UpdateStatement


text:
```
$ make
gcc -g -Wall -O3    demo.c   -o demo
$ ./demo
iterate_null_terminated_string: qwerty
result: qwerty
iterate_char_array: qwerty
result: qwerty
```

## Credits and References
* [Incrementing pointers for *char in a while loop](https://stackoverflow.com/questions/17101592/incrementing-pointers-for-char-in-a-while-loop)
* [How to Initialize char array from a string](https://stackoverflow.com/questions/963911/how-to-initialize-char-array-from-a-string)


text:
import { Unit } from '@geometryzen/multivectors';
import { mustBeNonNullObject } from '../checks/mustBeNonNullObject';
import { mustBeNumber } from '../checks/mustBeNumber';
import { DiffEqSolver } from '../core/DiffEqSolver';
import { Simulation } from '../core/Simulation';
import { AdvanceStrategy } from '../runner/AdvanceStrategy';

/**
 * @hidden
 */
export class DefaultAdvanceStrategy implements AdvanceStrategy {
    /**
     *
     */
    constructor(private readonly simulation: Simulation, private readonly solver: DiffEqSolver) {
        mustBeNonNullObject('simulation', simulation);
        mustBeNonNullObject('solver', solver);
    }

    /**
     * 1. Update the state vector from bodies.
     * 2. The solver integrates the derivatives from the simulation.
     * 3. Compute system variables such as energies, linear momentum, and angular momentum.
     */
    advance(stepSize: number, uomStep?: Unit): void {
        mustBeNumber("stepSize", stepSize);
        this.simulation.prolog(stepSize, uomStep);
        this.solver.step(stepSize, uomStep);
        this.simulation.epilog(stepSize, uomStep);
    }
}


text:
title: "{{ replace .TranslationBaseName "-" " " | humanize }}"
date: {{ .Date }}
layout: none
type: faq
weight: 0
---


text:
namespace GPUCA_NAMESPACE
{
namespace gpu
{
struct GPUTPCClusterRejection {
  template <bool C, class T = void, class S = void>
  static constexpr inline bool GetProtectionStatus(int attach, bool& physics, bool& protect, T* counts = nullptr, S* mev200 = nullptr)
  {
    (void)counts; // Avoid incorrect -Wunused-but-set-parameter warning
    (void)mev200;
    if (attach == 0) {
      return false;
    } else if ((attach & gputpcgmmergertypes::attachGoodLeg) == 0) {
      if constexpr (C) {
        counts->nLoopers++;
      }
      return true;
    } else if (attach & gputpcgmmergertypes::attachHighIncl) {
      if constexpr (C) {
        counts->nHighIncl++;
      }
      return true;
    } else if (attach & gputpcgmmergertypes::attachTube) {
      protect = true;
      if constexpr (C) {
        if (*mev200) {
          counts->nTube200++;
        } else {
          counts->nTube++;
        }
      }
      return false;
    } else if ((attach & gputpcgmmergertypes::attachGood) == 0) {
      protect = true;
      if constexpr (C) {
        counts->nRejected++;
      }
      return false;
    } else {
      physics = true;
      return false;
    }
  }

  static constexpr inline bool GetIsRejected(int attach)
  {
    bool physics = false, protect = false;
    return GetProtectionStatus<false>(attach, physics, protect);
  }
};
} // namespace gpu
} // namespace GPUCA_NAMESPACE

#endif


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**title** | **string** | Название вопроса |
**no** | **int** | Порядковый номер |
**is_required** | **bool** | Вопрос обязательный |
**has_comment** | **bool** | Отображать комментарий |
**comment** | **string** | Текст комментария |
**has_unable_answer** | **bool** | Вариант \"затрудняюсь ответить\" |
**branchrules** | [**\AnketologClient\Model\SurveyBranchrule[]**](SurveyBranchrule.md) |  |
**visiblerules** | [**\AnketologClient\Model\SurveyVisiblerule[]**](SurveyVisiblerule.md) |  |
**has_nothing_answer** | **bool** | Вариант \"ничего из вышеперечисленного\" |
**has_other_answer** | **bool** | Вариант \"другое\" |
**is_limited** | **bool** | Ограничение кол-ва выбранных вариантов |
**limit** | [**\AnketologClient\Model\SurveyOptionLimit**](SurveyOptionLimit.md) |  |
**options** | [**\AnketologClient\Model\SurveyOption[]**](SurveyOption.md) |  |
**options_sort** | **string** | Сортировка  * `default` - по умолчанию * `alphabet` - в алфавитном порядке * `random` - в случайном порядке |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
python tests/serialization/cifar10_conv.py -b cpu -s cifar10_run1.prm --serialize 1 -e 4 -r 1 --determin -H 2 -eval 1
python tests/serialization/cifar10_conv.py -b cpu -s cifar10_run2.prm --serialize 1 -e 4 -r 1 --determin -eval 1 \
            --model_file cifar10_run1_2.prm

python tests/serialization/compare_models.py cifar10_run1_3.prm cifar10_run2.prm
exit $?


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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/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=".new_song"
            android:label="@string/title_activity_new_song"
            android:parentActivityName=".MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.uol.xiaoyang.intelligenthouse.MainActivity" />
        </activity>
        <activity
            android:name=".NewSong"
            android:label="@string/title_activity_new_song"
            android:parentActivityName=".MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.uol.xiaoyang.intelligenthouse.MainActivity" />
        </activity>
        <activity
            android:name=".AudioCapture"
            android:label="@string/title_activity_audio_capture"
            android:parentActivityName=".MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.uol.xiaoyang.intelligenthouse.MainActivity" />
        </activity>
    </application>

</manifest>


text:
import { EventInterface } from 'microevent.ts';

import StellaConfig from '../../../machine/stella/Config';
import CartridgeInfo from '../../../machine/stella/cartridge/CartridgeInfo';
import EmulationContextInterface from './EmulationContextInterface';

interface EmulationServiceInterface {
    init(): Promise<void>;

    start(
        buffer: { [i: number]: number; length: number },
        config: EmulationServiceInterface.Config,
        cartridgeType?: CartridgeInfo.CartridgeType
    ): Promise<EmulationServiceInterface.State>;

    stop(): Promise<EmulationServiceInterface.State>;

    pause(): Promise<EmulationServiceInterface.State>;

    resume(): Promise<EmulationServiceInterface.State>;

    reset(): Promise<EmulationServiceInterface.State>;

    setRateLimit(enforce: boolean): Promise<void>;

    getRateLimit(): boolean;

    getState(): EmulationServiceInterface.State;

    getLastError(): Error;

    getEmulationContext(): EmulationContextInterface;

    getFrequency(): number;

    stateChanged: EventInterface<EmulationServiceInterface.State>;

    frequencyUpdate: EventInterface<number>;
}

namespace EmulationServiceInterface {
    export enum State {
        stopped = 'stopped',
        running = 'running',
        paused = 'paused',
        error = 'error'
    }

    export interface Config extends StellaConfig {
        asyncIO?: boolean;
    }
}

export { EmulationServiceInterface as default };


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>DefaultBoxJSONResponseParser</title>
<meta name="date" content="2014-01-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.box.restclientv2.responseparsers

Class DefaultBoxJSONResponseParser

java.lang.Object

com.box.restclientv2.responseparsers.DefaultBoxJSONResponseParser

All Implemented Interfaces:

IBoxResponseParser

Direct Known Subclasses:

BoxObjectResponseParser, ErrorResponseParser

public class DefaultBoxJSONResponseParser
extends java.lang.Object
implements IBoxResponseParser

This class is a wrapper class in order for Jackson JSON processor to parse response JSON into the wrapped objects.

Constructor Summary

Constructors

Constructor and Description

DefaultBoxJSONResponseParser(java.lang.Class objectClass,
                            IBoxJSONParser parser)

Constructor.

Method Summary

Methods

Modifier and Type
Method and Description

java.lang.Class
getObjectClass()

Class of the wrapped object.

IBoxJSONParser
getParser()

java.lang.Object
parse(IBoxResponse response)

By default, this only parses the JSON part into object.

protected java.lang.Object
parseInputStream(java.io.InputStream in)

Parse input stream.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DefaultBoxJSONResponseParser

public DefaultBoxJSONResponseParser(java.lang.Class objectClass,
                            IBoxJSONParser parser)

Constructor.

Parameters:

objectClass - class of the wrapped object. Response from API will be parsed into this object, caller needs to make sure this class has fields with same
            names as the JSON part of API response. If class contains more fields than the JSON, those fields will be left null. If the class contains
            less fields than the JSON, the parsing will error out.

objectMapper - ObjectMapper to be used when parsing.

Method Detail

getParser

public IBoxJSONParser getParser()

getObjectClass

public java.lang.Class getObjectClass()

Class of the wrapped object.

Returns:

class of the wrapped object.

parse

public java.lang.Object parse(IBoxResponse response)
                       throws BoxRestException

By default, this only parses the JSON part into object. In case caller needs more information(i.e. information from headers) into this object, caller can
 extend this class and implement the extraParses(HttpResponse httpResponse) method

Specified by:

parse in interface IBoxResponseParser

Parameters:

response - API response.

Returns:

Throws:

BoxRestException

parseInputStream

protected java.lang.Object parseInputStream(java.io.InputStream in)
                                     throws BoxRestException,
                                            BoxJSONException

Parse input stream.

Parameters:

in - input stream.

Throws:

BoxRestException

BoxJSONException

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
module.exports = require("./base");
require("./visitor");
require("./printer");

require("./ast");
require("./compiler");


text:
    <md-list flex>
        <md-list-item layout ng-click="null" class="md-subhead bz-thead">

{{ 'LOCALE.LABEL.USER.GROUP.GRID.GROUP_NAME' | translate }}

{{ 'LOCALE.LABEL.USER.GROUP.GRID.GROUP_SHORT_NAME' | translate }}

{{ 'LOCALE.LABEL.USER.GROUP.GRID.HAS_GROUP' | translate }}

        </md-list-item>
        <md-divider></md-divider>

{{group.groupName | nodeText}}

{{group.groupShortName | nodeText}}

                <md-checkbox ng-model="group.hasGroup"
                             ng-click="updateUserGroupRelation(group)" aria-label="{{ 'LOCALE.LABEL.USER.GROUP.GRID.HAS_GROUP' | translate }}">
                </md-checkbox>

        <md-divider ng-repeat-end></md-divider>
    </md-list>
    <bz-pagination total-count="totalCount" on-page="getUserBusinessGroupRelation(position)" current-page="currentPage"></bz-pagination>


text:
layout: organization
category: local

title: Tzu Chi Foundation
impact_area: Human Rights
keywords:
location_services:
location_offices:
website: www.tzuchi.org

description:
mission: |
  Tzu Chi Foundation strives to bring forth a world without suffering and obtainign through love, compassion, selfless giving, and working towards a disaster-free world.

cash_grants:
grants:
service_opp:
services:

learn:
cont_relationship:

salutation:
first_name:
last_name:
title_contact_person:

city: Queens
state: NY
address: |
  137-77 Northern Blvd
  Queens NY 11354
lat: 40.76416
lng: -73.828644
phone: 718-888-0866
ext:
fax: 718-460-2068
email:
preferred_contact:
contact_person_intro:
---


text:
package org.apache.cassandra.cql3.statements;

import java.util.Set;

import org.apache.cassandra.auth.IResource;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.RoleName;
import org.apache.cassandra.exceptions.RequestExecutionException;
import org.apache.cassandra.exceptions.RequestValidationException;
import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.transport.messages.ResultMessage;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

public class RevokePermissionsStatement extends PermissionsManagementStatement
{
    public RevokePermissionsStatement(Set<Permission> permissions, IResource resource, RoleName grantee)
    {
        super(permissions, resource, grantee);
    }

    public ResultMessage execute(ClientState state) throws RequestValidationException, RequestExecutionException
    {
        DatabaseDescriptor.getAuthorizer().revoke(state.getUser(), permissions, resource, grantee);
        return null;
    }

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


text:
namespace PartsUnlimited.Security
{
    public interface ILoginProviderCredentials
    {
        string Key { get; }
        string Secret { get; }
        bool Use { get; }
    }
}


text:
package com.example.nwilde.myfirstapp;

        import android.annotation.TargetApi;
        import android.content.Context;
        import android.content.SharedPreferences;
        import android.content.res.TypedArray;
        import android.graphics.Color;
        import android.graphics.drawable.Drawable;
        import android.graphics.drawable.GradientDrawable;
        import android.graphics.drawable.LayerDrawable;
        import android.graphics.drawable.ShapeDrawable;
        import android.graphics.drawable.shapes.OvalShape;
        import android.preference.PreferenceManager;
        import android.util.AttributeSet;
        import android.util.Log;
        import android.view.LayoutInflater;
        import android.view.View;
        import android.view.ViewGroup;
        import android.widget.ImageView;
        import android.widget.TextView;

        import com.example.nwilde.myfirstapp.settingsactivity.SettingsFragment;
        import com.example.nwilde.myfirstapp.utils.DrawableUtils;

        import static android.content.Context.LAYOUT_INFLATER_SERVICE;
        import static android.os.Build.VERSION_CODES.LOLLIPOP;
        import static android.text.TextUtils.isEmpty;
        import static android.view.View.GONE;
        import static android.view.View.VISIBLE;
        import static com.example.nwilde.myfirstapp.Typefaces.getRobotoRegular;

public class PrimaryColorPreference extends android.preference.Preference {
    private static final String TAG = "ColorPreference";
    TextView titleView;
    TextView summaryView;

    public ImageView imageView;
    public View imageFrame;

    private int iconResId;
    private Drawable icon;
    private SharedPreferences mSharedPreferences;

    public PrimaryColorPreference(Context context) {
        super(context);
        init(context, null, 0, 0);
    }

    public PrimaryColorPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs, 0, 0);
    }

    public PrimaryColorPreference(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs, defStyleAttr, 0);
    }

    @TargetApi(LOLLIPOP)
    public PrimaryColorPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init(context, attrs, defStyleAttr, defStyleRes);
    }

    private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        TypedArray typedArray =
                context.obtainStyledAttributes(attrs, new int[] { android.R.attr.background },
                        defStyleAttr, defStyleRes);
        iconResId = typedArray.getResourceId(0, 0);
        typedArray.recycle();
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    }

    @Override
    protected View onCreateView(ViewGroup parent) {
        super.onCreateView(parent);
        LayoutInflater layoutInflater =
                (LayoutInflater) getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = layoutInflater.inflate(R.layout.preference_color_chooser, parent, false);

        ViewGroup widgetFrame = (ViewGroup) layout.findViewById(R.id.widget_frame);
        int widgetLayoutResId = getWidgetLayoutResource();
        if (widgetLayoutResId != 0) {
            layoutInflater.inflate(widgetLayoutResId, widgetFrame);
        }
        widgetFrame.setVisibility(widgetLayoutResId != 0 ? VISIBLE : GONE);

        return layout;
    }

    @Override
    protected void onBindView(View view) {
        super.onBindView(view);

        CharSequence title = getTitle();
        titleView = (TextView) view.findViewById(R.id.title);
        titleView.setText(title);
        titleView.setVisibility(!isEmpty(title) ? VISIBLE : GONE);
        titleView.setTypeface(getRobotoRegular(getContext()));

        CharSequence summary = getSummary();
        summaryView = (TextView) view.findViewById(R.id.summary);
        summaryView.setText(summary);
        summaryView.setVisibility(!isEmpty(summary) ? VISIBLE : GONE);
        summaryView.setTypeface(getRobotoRegular(getContext()));

//        getContext().getTheme();
        if (icon == null && iconResId > 0) {
            //TODO: add theme to deprecated getDrawable
//            icon = getContext().getResources().getDrawable(iconResId, getContext().getTheme());
            icon = getContext().getResources().getDrawable(iconResId);
        }
        imageView = (ImageView) view.findViewById(R.id.icon);

        imageView.setBackground(icon);
        int color = DrawableUtils.getColor(
                getContext(), mSharedPreferences.getInt(
                    SettingsFragment.KEY_PREFS_PRIMARY_COLOR, 0
                )
        );
        DrawableUtils.setColor(imageView, color);
        imageView.setVisibility(icon != null ? VISIBLE : GONE);

        imageFrame = view.findViewById(R.id.icon_frame);
        imageFrame.setVisibility(icon != null ? VISIBLE : GONE);
    }

    public void setColor(int color){
        // http://stackoverflow.com/a/16637696/1061279
        if (imageView != null) {
            LayerDrawable bgDrawable = (LayerDrawable) imageView.getBackground();
            if (bgDrawable != null) {
                final GradientDrawable shape = (GradientDrawable) bgDrawable
                        .findDrawableByLayerId(R.id.shape_id);
                if (shape != null) {
                    shape.setColor(color);
                }
            }
        }
    }

    @Override
    public void setIcon(int iconResId) {
        super.setIcon(iconResId);
        this.iconResId = iconResId;
    }

    @Override
    public void setIcon(Drawable icon) {
        super.setIcon(icon);
        this.icon = icon;
    }
}


text:
using FluentAssertions;
using NUnit.Framework;

namespace Nest.Tests.Unit.QueryParsers.Queries
{
	[TestFixture]
	public class ConstantScoreQueryTests : ParseQueryTestsBase
	{
		[Test]
		public void ConstantScore_Query_Deserializes()
		{
			var q = this.SerializeThenDeserialize(
				f=>f.ConstantScore,
				f=>f.ConstantScore(cs=>cs
					.Boost(2.0)
					.Query(csq=>Query3)
					)
				);
			q.Boost.Should().Be(2.0);
			AssertIsTermQuery(q.Query, Query3);
		}

		[Test]
		public void ConstantScore_Filter_Deserializes()
		{
			var q = this.SerializeThenDeserialize(
				f=>f.ConstantScore,
				f=>f.ConstantScore(cs=>cs
					.Boost(2.0)
					.Filter(ff=>Filter1)
					)
				);
			q.Boost.Should().Be(2.0);
			AssertIsTermFilter(q.Filter, Filter1);
		}
	}
}


text: CT2017E01 Introduction to Docker by Mauricio Quezada.


text:
\section*{Acknowlegements}
\addcontentsline{toc}{section}{Acknowledgments}

Our customer Team Cymru and their representative Chas Tomlin.

The Celery community, in particular Ask Solem Hoel (@asksol)

Proof Reading: Ali Emamy, Matthew Power, Chrissie Metcalf


text:
package org.jolokia.jvmagent.security;

import java.io.IOException;
import java.io.Writer;

import javax.net.ssl.*;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import com.sun.net.httpserver.*;
import org.jolokia.test.util.EnvTestUtil;
import org.jolokia.util.AuthorizationHeaderParser;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;
import org.testng.annotations.*;

import static org.testng.Assert.*;

/**
 * @author roland
 * @since 27/05/15
 */
public class DelegatingAuthenticatorTest extends BaseAuthenticatorTest {

    private Server jettyServer;
    private String url;

    @DataProvider
    public static Object[][] headers() {
        return new Object[][]{{"Authorization"}, {AuthorizationHeaderParser.JOLOKIA_ALTERNATE_AUTHORIZATION_HEADER}};
    }

    @BeforeClass
    public void setup() throws Exception {
        int port = EnvTestUtil.getFreePort();
        jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        ServletHolder holder = new ServletHolder(createServlet());
        jettyContext.addServlet(holder, "/test/*");

        jettyServer.start();
        url = "http://localhost:" + port + "/test";
    }

    private Servlet createServlet() {
        return new HttpServlet() {
            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                String auth = req.getHeader("Authorization");
                if (auth == null || !auth.equals("Bearer blub")) {
                    resp.setStatus(401);
                } else {
                    resp.setContentType("text/json");
                    Writer writer = resp.getWriter();
                    if (req.getPathInfo() != null && req.getPathInfo().contains("invalid")) {
                        writer.append("{\"Invalid JSON\"");
                    } else {
                        writer.append("{\"metadata\":{\"name\":\"roland\"},\"array\":[\"eins\",\"zwei\"]}");
                    }
                }
            }
        };
    }

    @Test
    public void noAuth() {
        DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia",url,"json:metadata/name",false);

        Headers respHeader = new Headers();
        HttpExchange ex = createHttpExchange(respHeader);

        Authenticator.Result result = authenticator.authenticate(ex);
        assertNotNull(result);
        assertTrue(result instanceof Authenticator.Failure);
        assertEquals(((Authenticator.Failure) result).getResponseCode(), 401);
    }

    @Test(dataProvider = "headers")
    public void withAuth(String header) {
        SSLSocketFactory sFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
        HostnameVerifier hVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
        try {
            String[] data = {
                    "json:metadata/name", "roland",
                    "json:array/0", "eins",
                    "empty:", "",
                    null, ""
            };
            for (int i = 0; i < data.length; i += 2) {
                HttpPrincipal principal = executeAuthCheck(data[i], header);
                assertEquals(principal.getRealm(), "jolokia");
                assertEquals(principal.getUsername(), data[i+1]);
            }
        } finally {
            HttpsURLConnection.setDefaultSSLSocketFactory(sFactory);
            HttpsURLConnection.setDefaultHostnameVerifier(hVerifier);
        }
    }

    private HttpPrincipal executeAuthCheck(String pSpec, String header) {
        DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia", url, pSpec, true);

        Headers respHeader = new Headers();
        HttpExchange ex = createHttpExchange(respHeader, header, "Bearer blub");

        Authenticator.Result result = authenticator.authenticate(ex);
        assertNotNull(result);
        Authenticator.Success success = (Authenticator.Success) result;
        return success.getPrincipal();
    }

    @Test
    public void invalidProtocol() {
        DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia","ftp://ftp.redhat.com",null,false);

        Authenticator.Result result = authenticator.authenticate(createHttpExchange(new Headers()));
        Authenticator.Failure failure = (Authenticator.Failure) result;
        assertEquals(failure.getResponseCode(),401);
    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*blub.*")
    public void invalidExtractor() {
        new DelegatingAuthenticator("jolokia","http://www.redhat.com","blub:bla",false);
    }

    @Test
    public void ioException() {
        String wrongUrl = "http://0.0.0.2:80";
        DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia",wrongUrl,null,false);
        HttpExchange exchange = createHttpExchange(new Headers());
        Authenticator.Result result = authenticator.authenticate(exchange);
        Authenticator.Failure failure = (Authenticator.Failure) result;
        assertEquals(failure.getResponseCode(),503);
        String error = exchange.getResponseHeaders().getFirst("X-Error-Details");
        assertTrue(error.contains("http://0.0.0.2:80"));
    }

    @Test
    public void invalidPath() {
        String  data[] = new String[] { "json:never/find/me", "never",
                                        "json:metadata/name/yet/deeper", "deeper" };
        for (int i = 0; i < data.length; i +=2) {
            DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia", url, data[i], false);
            HttpExchange exchange = createHttpExchange(new Headers(), "Authorization", "Bearer blub");
            Authenticator.Result result = authenticator.authenticate(exchange);
            Authenticator.Failure failure = (Authenticator.Failure) result;
            assertEquals(failure.getResponseCode(), 400);
            String error = exchange.getResponseHeaders().getFirst("X-Error-Details");
            assertTrue(error.contains(data[i+1]));
        }
    }

    @Test
    public void invalidJson() {
        DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia", url + "/invalid","json:metadata/name", false);
        HttpExchange exchange = createHttpExchange(new Headers(), "Authorization", "Bearer blub");
        Authenticator.Result result = authenticator.authenticate(exchange);
        Authenticator.Failure failure = (Authenticator.Failure) result;
        assertEquals(failure.getResponseCode(), 422);
        String error = exchange.getResponseHeaders().getFirst("X-Error-Details");
        assertTrue(error.contains("Invalid JSON"));
    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*blub.*")
    public void malformedUrl() {
        new DelegatingAuthenticator("jolokia","blub//://bla",null,false);
    }

    @Test(dataProvider = "headers")
    public void emptySpec(String header){

        HttpPrincipal principal = executeAuthCheck("empty:", header);
        assertEquals(principal.getRealm(), "jolokia");
        assertEquals(principal.getUsername(), "");
    }

    @AfterClass
    public void tearDown() throws Exception {
        jettyServer.stop();
    }
}


text:
import { range } from 'lodash';
import { Note } from './note';

export interface KeyLayout {
  nRows: number;

  groupByRow: (notes: Note[]) => Note[][];
  getKeyColor: (index: number) => string;
}

export class Piano88 implements KeyLayout {
  nRows = 88;

  getKeyColor(keyIndex: number) {
    const key = keyIndex % 12;

    let white = true;
    if (key === 1 || key === 3 || key === 6 || key === 8 || key === 10) white = false;

    return white ? '#EEE' : '#444';
  }

  groupByRow(notes: Note[]) {
    const rows: Note[][] = range(0, this.nRows).map(() => []);
    for (const note of notes) {
      rows[note.value].push(note);
    }
    return rows;
  }
}


text:
package fr.acinq.eclair.db

import akka.actor.ActorSystem
import com.opentable.db.postgres.embedded.EmbeddedPostgres
import com.zaxxer.hikari.HikariConfig
import fr.acinq.eclair.db.Databases.{PostgresDatabases, SqliteDatabases}
import fr.acinq.eclair.db.migration._
import fr.acinq.eclair.db.pg.PgUtils.PgLock
import fr.acinq.eclair.db.pg._
import org.scalatest.Ignore
import org.scalatest.funsuite.AnyFunSuite
import org.sqlite.SQLiteConfig

import java.io.File
import java.sql.{Connection, DriverManager}
import java.util.UUID
import javax.sql.DataSource

/**
 * To run this test, create a `migration` directory in your project's `user.dir`
 * and copy your sqlite files to it (eclair.sqlite, network.sqlite, audit.sqlite).
 * Then remove the `Ignore` annotation and run the test.
 */
@Ignore
class DbMigrationSpec extends AnyFunSuite {

  import DbMigrationSpec._

  test("eclair migration test") {
    val sqlite = loadSqlite("migration\\eclair.sqlite")
    val postgresDatasource = EmbeddedPostgres.start().getPostgresDatabase

    new PgChannelsDb()(postgresDatasource, PgLock.NoLock)
    new PgPendingCommandsDb()(postgresDatasource, PgLock.NoLock)
    new PgPeersDb()(postgresDatasource, PgLock.NoLock)
    new PgPaymentsDb()(postgresDatasource, PgLock.NoLock)

    PgUtils.inTransaction { postgres =>
      MigrateChannelsDb.migrateAllTables(sqlite, postgres)
      MigratePendingCommandsDb.migrateAllTables(sqlite, postgres)
      MigratePeersDb.migrateAllTables(sqlite, postgres)
      MigratePaymentsDb.migrateAllTables(sqlite, postgres)
      assert(CompareChannelsDb.compareAllTables(sqlite, postgres))
      assert(ComparePendingCommandsDb.compareAllTables(sqlite, postgres))
      assert(ComparePeersDb.compareAllTables(sqlite, postgres))
      assert(ComparePaymentsDb.compareAllTables(sqlite, postgres))
    }(postgresDatasource)

    sqlite.close()
  }

  test("network migration test") {
    val sqlite = loadSqlite("migration\\network.sqlite")
    val postgresDatasource = EmbeddedPostgres.start().getPostgresDatabase

    new PgNetworkDb()(postgresDatasource)

    PgUtils.inTransaction { postgres =>
      MigrateNetworkDb.migrateAllTables(sqlite, postgres)
      assert(CompareNetworkDb.compareAllTables(sqlite, postgres))
    }(postgresDatasource)

    sqlite.close()
  }

  test("audit migration test") {
    val sqlite = loadSqlite("migration\\audit.sqlite")
    val postgresDatasource = EmbeddedPostgres.start().getPostgresDatabase

    new PgAuditDb()(postgresDatasource)

    PgUtils.inTransaction { postgres =>
      MigrateAuditDb.migrateAllTables(sqlite, postgres)
      assert(CompareAuditDb.compareAllTables(sqlite, postgres))
    }(postgresDatasource)

    sqlite.close()
  }

  test("full migration") {
    // we need to open in read/write because of the getVersion call
    val sqlite = SqliteDatabases(
      auditJdbc = loadSqlite("migration\\audit.sqlite", readOnly = false),
      eclairJdbc = loadSqlite("migration\\eclair.sqlite", readOnly = false),
      networkJdbc = loadSqlite("migration\\network.sqlite", readOnly = false),
      jdbcUrlFile_opt = None
    )
    val postgres = {
      val pg = EmbeddedPostgres.start()
      val datasource: DataSource = pg.getPostgresDatabase
      val hikariConfig = new HikariConfig
      hikariConfig.setDataSource(datasource)
      PostgresDatabases(
        hikariConfig = hikariConfig,
        instanceId = UUID.randomUUID(),
        lock = PgLock.NoLock,
        jdbcUrlFile_opt = None,
        readOnlyUser_opt = None,
        resetJsonColumns = false,
        safetyChecks_opt = None
      )(ActorSystem())
    }
    val dualDb = DualDatabases(sqlite, postgres)
    MigrateDb.migrateAll(dualDb)
    CompareDb.compareAll(dualDb)
  }

}

object DbMigrationSpec {
  def loadSqlite(path: String, readOnly: Boolean = true): Connection = {
    val sqliteConfig = new SQLiteConfig()
    sqliteConfig.setReadOnly(readOnly)
    val dbFile = new File(path)
    DriverManager.getConnection(s"jdbc:sqlite:$dbFile", sqliteConfig.toProperties)
  }
}


text:
package org.wildfly.swarm.jolokia;

/**
 * @author Bob McWhirter
 */
public interface JolokiaProperties {

    String CONTEXT = "thorntail.jolokia.context";
    String ACCESS_XML = "thorntail.jolokia.access.xml";
    String KEYCLOAK_ROLE = "thorntail.jolokia.keycloak.role";
}


text:
Aria.classDefinition({
    $classpath : "test.aria.widgets.container.dialog.movable.test3.MovableDialogTestCaseThree",
    $extends : "aria.jsunit.RobotTestCase",
    $dependencies : ["aria.utils.Json", "aria.utils.Dom"],
    $constructor : function () {
        this.$RobotTestCase.constructor.call(this);

        this.data = {
            firstDialog : {
                visible : true,
                xpos : 0,
                ypos : 0
            }
        };

        this.setTestEnv({
            template : "test.aria.widgets.container.dialog.movable.test3.MovableDialogTemplateThree",
            data : this.data
        });
    },
    $prototype : {
        runTemplateTest : function () {
            this.currXPos = this.data.firstDialog.xpos;
            this.currYPos = this.data.firstDialog.ypos;

            var handleGeometry = aria.utils.Dom.getGeometry(this._getHandle("firstDialog"));

            this.assertFalse(handleGeometry.x !== this.data.firstDialog.xpos, "Dialog Widget is Positioned wrongly before drag started");
            this.assertFalse(handleGeometry.y !== this.data.firstDialog.ypos, "Dialog Widget is Positioned wrongly before drag started");

            aria.core.Timer.addCallback({
                fn : this._dragDialog,
                scope : this,
                delay : 500
            });
        },

        _dragDialog : function () {
            var handleGeometry = aria.utils.Dom.getGeometry(this._getHandle("firstDialog"));
            var from = {
                x : handleGeometry.x + handleGeometry.width / 2,
                y : handleGeometry.y + handleGeometry.height / 2
            };
            var options = {
                duration : 2000,
                to : {
                    x : from.x + 150,
                    y : from.y + 150
                }
            };

            this.synEvent.execute([["drag", options, from]], {
                fn : this._afterDrag,
                scope : this
            });
        },

        _afterDrag : function () {
            // Simulate click on the refresh section button
            var btn = this.getWidgetInstance("refreshInnerSection").getDom();
            var self = this;
            this.synEvent.click(btn, {
                fn : function () {
                    aria.core.Timer.addCallback({
                        fn : self._afterClick,
                        scope : self
                    });
                },
                scope : this
            });
        },

        _afterClick : function () {
            var handleGeometry = aria.utils.Dom.getGeometry(this._getHandle("firstDialog"));
            this.assertFalse(handleGeometry.x !== this.data.firstDialog.xpos, "Dialog Widget is Positioned wrongly after Dragging");
            this.assertFalse(handleGeometry.y !== this.data.firstDialog.ypos, "Dialog Widget is Positioned wrongly after Dragging");

            this.end();
        },

        _getHandle : function (dialogId) {
            return this.getWidgetInstance(dialogId)._titleBarDomElt;
        }
    }
});


text:
/* ************************************************************************************* */
/* *    PhatWare WritePad SDK                                                          * */
/* *    Copyright (c) 2008-2014 PhatWare(r) Corp. All rights reserved.                 * */
/* ************************************************************************************* */

/* ************************************************************************************* *
 *
 * WritePad SDK Sample
 *
 * Unauthorized distribution of this code is prohibited. For more information
 * refer to the End User Software License Agreement provided with this
 * software.
 *
 * This source code is distributed and supported by PhatWare Corp.
 * http://www.phatware.com
 *
 * THIS SAMPLE CODE CAN BE USED  AS A REFERENCE AND, IN ITS BINARY FORM,
 * IN THE USER'S PROJECT WHICH IS INTEGRATED WITH THE WRITEPAD SDK.
 * ANY OTHER USE OF THIS CODE IS PROHIBITED.
 *
 * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
 * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
 * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PHATWARE CORP.
 * BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
 * INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, SAVINGS
 * OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR NOT PHATWARE CORP.
 * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
 * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * US Government Users Restricted Rights
 * Use, duplication, or disclosure by the Government is subject to
 * restrictions set forth in EULA and in FAR 52.227.19(c)(2) or subparagraph
 * (c)(1)(ii) of the Rights in Technical Data and Computer Software
 * clause at DFARS 252.227-7013 and/or in similar or successor
 * clauses in the FAR or the DOD or NASA FAR Supplement.
 * Unpublished-- rights reserved under the copyright laws of the
 * United States.  Contractor/manufacturer is PhatWare Corp.
 * 1314 S. Grand Blvd. Ste. 2-175 Spokane, WA 99202
 *
 * ************************************************************************************* */

#import "utils.h"
#import "RecognizerAPI.h"
#import "RecognizerWrapper.h"
#import "LanguageManager.h"
#import "OptionKeys.h"
#include <sys/types.h>
#include <sys/sysctl.h>

extern NSString *	g_appName;
extern NSData *		g_deviceToken;

#define radians( degrees ) ( (degrees) * M_PI / 180.0 )

@implementation utils

+ (CGFloat) distanceFrom:(CGPoint)from toPoint:(CGPoint)to
{
    CGFloat cx = from.x - to.x;
    CGFloat cy = from.y - to.y;
    return sqrt( cx * cx + cy * cy );
}

+ (UInt32) _uiColorToColorRef:(UIColor *)color
{
    if ( nil != color )
    {
        CGColorRef	 colorref = [color CGColor];
        const CGFloat * colorComponents = CGColorGetComponents(colorref);
        UInt32	 coloref = RGBA( CCTB(colorComponents[0]), CCTB(colorComponents[1]), CCTB(colorComponents[2]), CCTB(colorComponents[3]) );
        return coloref;
    }
    return RGBA( 0xFF, 0xFF, 0xFF, 0xFF );
}

+ (CGFloat) _uiColorAlpha:(UIColor *)color
{
    CGColorRef	 colorref = [color CGColor];
    const CGFloat * colorComponents = CGColorGetComponents(colorref);
    return colorComponents[3];
}

+ (UIColor *) _uiColorRefToColor:(UInt32)coloref
{
    if ( coloref == 0 )
    {
        UIColor * color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
        return color;
    }
    else
    {
        UIColor * color = [UIColor colorWithRed:GetRValue(coloref) green:GetGValue(coloref) blue:GetBValue(coloref) alpha:GetAValue(coloref)];
        return color;
    }
}

#define FMIN    0.5
#define FMAX    1.5

+ (CGFloat) calcWidth:(CGFloat)weight pressure:(int)pressure
{
    int p = pressure;
    if ( p <= 0 )
        p = DEFAULT_PRESSURE;
    else if ( p < MIN_PRESSURE )
        p = MIN_PRESSURE;
    else if ( p > MAX_PRESSURE )
        p = MAX_PRESSURE;
    if ( p == DEFAULT_PRESSURE )
        return weight;

    CGFloat f = (CGFloat)p/(CGFloat)DEFAULT_PRESSURE;
    if ( f < FMIN )
        f = FMIN;
    if ( f > FMAX )
        f = FMAX;
    return weight * f;
}

+ (NSString *)appNameAndVersionNumberDisplayString
{
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *appDisplayName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    // NSString *majorVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    NSString *minorVersion = [infoDictionary objectForKey:@"CFBundleVersion"];

    return [NSString stringWithFormat:@"%@ %@", appDisplayName, minorVersion];
}

+ (UIDeviceResolution)resolution
{
    UIDeviceResolution resolution = UIDeviceResolution_Unknown;
    UIScreen *mainScreen = [UIScreen mainScreen];
    CGFloat scale = ([mainScreen respondsToSelector:@selector(scale)] ? mainScreen.scale : 1.0f);
    CGFloat pixelHeight = (CGRectGetHeight(mainScreen.bounds) * scale);

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        if (scale == 2.0f)
        {
            if (pixelHeight == 960.0f)
                resolution = UIDeviceResolution_iPhoneRetina35;
            else if (pixelHeight == 1136.0f)
                resolution = UIDeviceResolution_iPhoneRetina4;

        }
        else if (scale == 1.0f && pixelHeight == 480.0f)
            resolution = UIDeviceResolution_iPhoneStandard;

    }
    else
    {
        if (scale == 2.0f && pixelHeight == 2048.0f)
        {
            resolution = UIDeviceResolution_iPadRetina;

        }
        else if (scale == 1.0f && pixelHeight == 1024.0f)
        {
            resolution = UIDeviceResolution_iPadStandard;
        }
    }

    return resolution;
}

+ (BOOL) isRetina
{
    UIScreen *mainScreen = [UIScreen mainScreen];
    CGFloat scale = ([mainScreen respondsToSelector:@selector(scale)] ? mainScreen.scale : 1.0f);
    CGFloat pixelHeight = (CGRectGetHeight(mainScreen.bounds) * scale);

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        if (scale == 2.0f)
        {
            return YES;
        }
    }
    else
    {
        if (scale == 2.0f && pixelHeight == 2048.0f)
        {
            return YES;
        }
    }
    return NO;
}

+ (NSInteger) getMajorOSVersion
{
    NSArray *versionCompatibility = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
    if ( nil == versionCompatibility )
        return 0;
    return [[versionCompatibility objectAtIndex:0] intValue];
}

+ (NSString *) getFileType:(NSString *)filename
{
    NSString * type = nil;

    NSInteger  index = [filename rangeOfString:@"." options:(NSCaseInsensitiveSearch | NSBackwardsSearch)].location;
    if ( index != NSNotFound && index < [filename length] - 1 )
        type = [filename substringFromIndex:index];
    return type;
}

+ (NSString *)shortFileName:(NSString *)strFileName
{
	NSString * name;
	if ( [strFileName length] < 1 )
	{
		name = @"<filename>";
	}
	else
	{
		NSInteger  index = [strFileName rangeOfString:@"/" options:(NSCaseInsensitiveSearch | NSBackwardsSearch)].location;
		if ( index != NSNotFound && index < [strFileName length] - 1 )
			name = [strFileName substringFromIndex:(index+1)];
		else
			name = strFileName;
	}
	return name;
}

+ (Boolean) isPhone
{
    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
}

#pragma mark -- Image scaling

+ (UIImage *) colorImageWithName:(NSString *)name color:(UIColor *)col mode:(CGBlendMode)m
{
    UIImage * img = [UIImage imageNamed:name];
    if ( img == nil )
        return nil;

    return [utils colorImageWithImage:img color:col mode:m];
}

+ (UIImage *) colorImageWithImage:(UIImage *)img color:(UIColor *)col mode:(CGBlendMode)m
{
    /*
     if ( [utils isRetina] )
     {
     img = [UIImage imageNamed:[NSString stringWithFormat:@"%@@2x.png", [name substringToIndex:[name rangeOfString:@"."].location]]];
     }
     */
    // UIImage * img = [UIImage imageNamed:name];
    // img = [UIImage imageWithCGImage:img.CGImage scale:[img scale] orientation:UIImageOrientationRight];

    // begin a new image context, to draw our colored image onto
    UIGraphicsBeginImageContextWithOptions( img.size, NO, img.scale ); // [utils isRetina] ? 2 : 1 );
    // UIGraphicsBeginImageContext(img.size);

    // get a reference to that context we created
    CGContextRef context = UIGraphicsGetCurrentContext();
    if ( context == nil )
        return nil;

    // set the fill color
    [col setFill];

    CGContextSetShouldAntialias(context, YES );
    CGContextSetFlatness(context, 0.1);
    // translate/flip the graphics context (for transforming from CG* coords to UI* coords
    CGContextTranslateCTM(context, 0, img.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);

    // set the blend mode to color burn, and the original image
    CGContextSetBlendMode(context, m);
    // CGContextSetAlpha(context, 0.9 );
    CGRect rect = CGRectMake(0, 0, img.size.width, img.size.height);
    CGContextDrawImage(context, rect, img.CGImage);

    // set a mask that matches the shape of the image, then draw (color burn) a colored rectangle
    CGContextClipToMask(context, rect, img.CGImage);
    CGContextAddRect(context, rect);
    CGContextDrawPath(context,kCGPathFill);

    // generate a new UIImage from the graphics context we drew onto
    UIImage *coloredImg = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    //return the color-burned image
    return coloredImg;
}

static BOOL _use_local_settings = YES;

+ (NSURL *) sharedRecoDataURL
{
    if ( _use_local_settings )
        return nil;
    NSURL *containerURL = [[NSFileManager defaultManager]
                           containerURLForSecurityApplicationGroupIdentifier:@"group.com.phatware.writepadreco"];
    return containerURL;
}

+ (void) useLocalRecoDefaults:(BOOL)use
{
    _use_local_settings = use;
}

+ (NSUserDefaults *) recoGroupUserDefaults
{
    if ( _use_local_settings )
    {
        return [NSUserDefaults standardUserDefaults];
    }
    else
    {
        NSUserDefaults*	defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.phatware.writepadreco"];
#if __has_feature(objc_arc)
        return defaults;
#else
        return [defaults autorelease];
#endif
    }
}

@end