text:
#define LOG_TAG "AudioPolicyManagerSPRD"
#define LOG_NDEBUG 0
#include <utils/Log.h>
#include "AudioPolicyManagerSPRD.h"
#include <media/mediarecorder.h>

namespace android_audio_legacy {

using namespace android;

// ----------------------------------------------------------------------------
// AudioPolicyManagerSPRD
// ----------------------------------------------------------------------------

// ---  class factory

extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface)
{
    ALOGI("SPRD policy manager created.");
    return new AudioPolicyManagerSPRD(clientInterface);
}

extern "C" void destroyAudioPolicyManager(AudioPolicyInterface *interface)
{
    delete interface;
}

// Nothing currently different between the Base implementation.

AudioPolicyManagerSPRD::AudioPolicyManagerSPRD(AudioPolicyClientInterface *clientInterface)
    : AudioPolicyManagerBase(clientInterface),is_voip_set(false)
{
    //loadVolumeProfilesInternal();
}

AudioPolicyManagerSPRD::~AudioPolicyManagerSPRD()
{
    //freeVolumeProfiles();
}

status_t AudioPolicyManagerSPRD::startOutput(audio_io_handle_t output,
                                             AudioSystem::stream_type stream,
                                             int session)
{
    ALOGD("startOutput() output %d, stream %d, session %d", output, stream, session);
    ssize_t index = mOutputs.indexOfKey(output);
    if (index < 0) {
        ALOGW("startOutput() unknow output %d", output);
        return BAD_VALUE;
    }

    AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);

    // increment usage count for this stream on the requested output:
    // NOTE that the usage count is the same for duplicated output and hardware output which is
    // necessary for a correct control of hardware output routing by startOutput() and stopOutput()
    outputDesc->changeRefCount(stream, 1);
	ALOGD("startOutput() is_voip_set %d,stream %d,",is_voip_set,stream);
	if((!is_voip_set)&&(stream == AudioSystem::VOICE_CALL)) {
		for (size_t i = 0; i < mOutputs.size(); i++) {
		    AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i);
			ALOGD("startOutput() outputDesc->mRefCount[AudioSystem::VOICE_CALL] %d",outputDesc->mRefCount[AudioSystem::VOICE_CALL]);
			if(outputDesc->mRefCount[AudioSystem::VOICE_CALL] == 1) {
                AudioParameter param;
                param.add(String8("sprd_voip_start"), String8("true"));
				mpClientInterface->setParameters(0, param.toString());
				is_voip_set = true;
			}
		}
	}

    if (outputDesc->mRefCount[stream] == 1) {
        audio_devices_t newDevice = getNewDevice(output, false /*fromCache*/);
        routing_strategy strategy = getStrategy(stream);
        bool shouldWait = (strategy == STRATEGY_SONIFICATION) ||
                            (strategy == STRATEGY_SONIFICATION_RESPECTFUL);
        uint32_t waitMs = 0;
        bool force = false;
        for (size_t i = 0; i < mOutputs.size(); i++) {
            AudioOutputDescriptor *desc = mOutputs.valueAt(i);
            if (desc != outputDesc) {
                // force a device change if any other output is managed by the same hw
                // module and has a current device selection that differs from selected device.
                // In this case, the audio HAL must receive the new device selection so that it can
                // change the device currently selected by the other active output.
                if (outputDesc->sharesHwModuleWith(desc) &&
                    desc->device() != newDevice) {
                    force = true;
                }
                // wait for audio on other active outputs to be presented when starting
                // a notification so that audio focus effect can propagate.
                uint32_t latency = desc->latency();
                if (shouldWait && desc->isActive(latency * 2) && (waitMs < latency)) {
                    waitMs = latency;
                }
            }
        }
        uint32_t muteWaitMs = setOutputDevice(output, newDevice, force);

        // handle special case for sonification while in call
        if (isInCall()) {
            handleIncallSonification(stream, true, false);
        }

        // apply volume rules for current stream and device if necessary
        // filter devices according to output selected
        if(!outputDesc->isDuplicated())
        newDevice = (audio_devices_t)(newDevice & outputDesc->mProfile->mSupportedDevices);

        ALOGW("startOutput() select newDevice %d", newDevice);

        checkAndSetVolume(stream,
                          mStreams[stream].getVolumeIndex(newDevice),
                          output,
                          newDevice);

        // update the outputs if starting an output with a stream that can affect notification
        // routing
        handleNotificationRoutingForStream(stream);
        if (waitMs > muteWaitMs) {
            usleep((waitMs - muteWaitMs) * 2 * 1000);
        }
    }
    return NO_ERROR;
}

status_t AudioPolicyManagerSPRD::stopOutput(audio_io_handle_t output,
                                            AudioSystem::stream_type stream,
                                            int session)
{
    ALOGD("stopOutput() output %d, stream %d, session %d", output, stream, session);
    ssize_t index = mOutputs.indexOfKey(output);
    if (index < 0) {
        ALOGW("stopOutput() unknow output %d", output);
        return BAD_VALUE;
    }

    AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);

    // handle special case for sonification while in call
    if (isInCall()) {
        handleIncallSonification(stream, false, false);
    }

	ALOGD("stopOutput() is_voip_set %d,stream %d,output size %d",is_voip_set,stream,mOutputs.size());
		if(is_voip_set &&(stream == AudioSystem::VOICE_CALL)) {
			for (size_t i = 0; i < mOutputs.size(); i++) {
				AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i);
				ALOGD("stopOutput() outputDesc->mRefCount[AudioSystem::VOICE_CALL] %d",outputDesc->mRefCount[AudioSystem::VOICE_CALL]);
				if(outputDesc->mRefCount[AudioSystem::VOICE_CALL] == 1) {
					AudioParameter param;
					param.add(String8("sprd_voip_start"), String8("false"));
					mpClientInterface->setParameters(0, param.toString());
					is_voip_set = false;
				}
			}
		}

    if (outputDesc->mRefCount[stream] > 0) {
        // decrement usage count of this stream on the output
        outputDesc->changeRefCount(stream, -1);
        // store time at which the stream was stopped - see isStreamActive()
        if (outputDesc->mRefCount[stream] == 0) {
            outputDesc->mStopTime[stream] = systemTime();
            audio_devices_t newDevice = getNewDevice(output, false /*fromCache*/);
            // delay the device switch by twice the latency because stopOutput() is executed when
            // the track stop() command is received and at that time the audio track buffer can
            // still contain data that needs to be drained. The latency only covers the audio HAL
            // and kernel buffers. Also the latency does not always include additional delay in the
            // audio path (audio DSP, CODEC ...)
            setOutputDevice(output, newDevice, false, outputDesc->mLatency*2);

            // force restoring the device selection on other active outputs if it differs from the
            // one being selected for this output
            for (size_t i = 0; i < mOutputs.size(); i++) {
                audio_io_handle_t curOutput = mOutputs.keyAt(i);
                AudioOutputDescriptor *desc = mOutputs.valueAt(i);
                if (curOutput != output &&
                        desc->isActive() &&
                        outputDesc->sharesHwModuleWith(desc) &&
                        (newDevice != desc->device())) {
                    setOutputDevice(curOutput,
                                    getNewDevice(curOutput, false /*fromCache*/),
                                    true,
                                    outputDesc->mLatency*2);
                }
            }
            // update the outputs if stopping one with a stream that can affect notification routing
            handleNotificationRoutingForStream(stream);
        }
        return NO_ERROR;
    } else {
        ALOGW("stopOutput() refcount is already 0 for output %d", output);
        return INVALID_OPERATION;
    }
}

void AudioPolicyManagerSPRD::releaseOutput(audio_io_handle_t output)
{
    ALOGD("releaseOutput() %d", output);
    ssize_t index = mOutputs.indexOfKey(output);
    if (index < 0) {
        ALOGW("releaseOutput() releasing unknown output %d", output);
        return;
    }

	if(is_voip_set) {
	    AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
		if(outputDesc->mRefCount[AudioSystem::VOICE_CALL] == 0) {
			AudioParameter param;
			param.add(String8("sprd_voip_start"), String8("false"));
			mpClientInterface->setParameters(0, param.toString());
			is_voip_set = false;
		}
	}

#ifdef AUDIO_POLICY_TEST
    int testIndex = testOutputIndex(output);
    if (testIndex != 0) {
        AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
        if (outputDesc->isActive()) {
            mpClientInterface->closeOutput(output);
            delete mOutputs.valueAt(index);
            mOutputs.removeItem(output);
            mTestOutputs[testIndex] = 0;
        }
        return;
    }
#endif //AUDIO_POLICY_TEST

    AudioOutputDescriptor *desc = mOutputs.valueAt(index);
    if (desc->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT) {
        if (desc->mDirectOpenCount <= 0) {
            ALOGW("releaseOutput() invalid open count %d for output %d",
                                                              desc->mDirectOpenCount, output);
            return;
        }
        if (--desc->mDirectOpenCount == 0) {
            closeOutput(output);
            // If effects where present on the output, audioflinger moved them to the primary
            // output by default: move them back to the appropriate output.
            audio_io_handle_t dstOutput = getOutputForEffect();
            if (dstOutput != mPrimaryOutput) {
                mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, mPrimaryOutput, dstOutput);
            }
        }
    }
}

void AudioPolicyManagerSPRD::handleNotificationRoutingForStream(AudioSystem::stream_type stream) {
    switch(stream) {
    case AudioSystem::MUSIC:
        checkOutputForStrategy(STRATEGY_SONIFICATION_RESPECTFUL);
        updateDevicesAndOutputs();
        break;
    default:
        break;
    }
}

}; // namespace android_audio_legacy

redpajama_set_name: RedPajamaGithub


text:
import curses

class Menu():

    """ Simple curses Menu class. Creates a Simple menu which can be navigated
    using w (up), s (down), q (back) and e (select). Arguments are:
        - name (str): menu name (title)
        - options: list of tuples containing the item names their command
        - barData (str): data to be put in the information barData
        - selected=0 (int): initially selected item
        - settings: dict containing custom settings.
            settings keys can be:
                'bullet': (str) bullet shown in front of each option
                'selectedBullet': (str) bullet for selected option
                'infoPos': ('top' or 'bottom') location of info bar
                'keymap': list of keys in the form [up, down, select, back]"""

    def __init__(self, name, options, barData='', selected=0, settings=False):

        # Curses settings
        self.screen = curses.initscr()
        self.screen.border(0)
        curses.curs_set(0)
        curses.start_color()
        curses.noecho()
        curses.use_default_colors()
        self.screensize = self.screen.getmaxyx()

        # Get arguments
        self.barData = barData
        self.size = len(options)
        self.selected = selected % self.size
        self.name = name[0:self.screensize[1]-20]

        # Initialise lists
        self.optionNames = []
        self.optionCmds = []
        self.optionDict = {}

        # Order options in both dict and lists
        for option in options:
            # Truncate long names
            if len(option[0]) > self.screensize[1]:
                oName = option[1][0:self.screensize[1]-20] + '...'
            else:
                oName = option[0]
            self.optionNames.append(oName)
            self.optionCmds.append(option[1])
            self.optionDict[oName] = option[1]

        #  Default settings
        self.settings = {}
        self.settings['bullet'] = ''
        self.settings['selectedBullet'] = ''
        self.settings['infoPos'] = 'top'
        self.settings['keys'] = ['w', 's', 'e', 'q']  # Up down select quit

        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)

        # Copy settings from settings argument
        if settings:
            self.settings.update(settings)

    def scroll(self):
        """ Makes the menu 'scrollable' if the number of items is larger than
        the height of the screen. Shows max 5 options above the selected option.
        """
        options = self.optionNames
        maxItems = self.screensize[0] - 5
        if self.size > maxItems:  # More options than fit on screen
            firstItem = max(0, self.selected - 5)
            lastItem = min(maxItems+firstItem, self.size)
            options = self.optionNames[firstItem:lastItem]
        return options

    def cdraw(self):
        """ Draws the menu using curses. """

        shownOptions = self.scroll()

        self.screen.clear()
        self.screen.border(0)

        # Draw the title centered and at line 0 (with spaces for readability)
        title = ' ' + self.name + ' '
        self.screen.addstr(0, (self.screensize[1]-len(title))/2, title)

        x = (self.screensize[0] - len(shownOptions)) / 2  # Vertical centering
        y = (self.screensize[1] - max([len(a) for a in self.optionNames]))/2
        # Items are horizontally left-aligned with the longest item centered.

        for name in shownOptions:  # Draw each item
            if name == self.optionNames[self.selected]:  # Highlight selected
                self.screen.addstr(
                    x, y,
                    self.settings['selectedBullet'] + name,
                    curses.color_pair(1))
            else:
                self.screen.addstr(x, y, self.settings['bullet'] + name)
            x = x + 1

        # Truncate the info bar if too long
        barData = self.barData[0:self.screensize[1]]

        # Infor bar can be positioned 'top' or 'bottom'
        if self.settings['infoPos'] == 'bottom':
            barXPos = self.screensize[0]-1
        else:
            barXPos = 1

        # Center horizontally
        barYPos = (self.screensize[1]-len(self.barData))/2
        self.screen.addstr(barXPos, barYPos, barData, curses.color_pair(1))

        self.screen.refresh()

    def back(self):  # Go back one menu
        return 'back'

    def down(self):  # 1 item down
        self.selected = (self.selected + 1) % self.size
        self.cdraw()
        return self.optionNames[self.selected]

    def up(self):  # 1 item up
        self.selected = (self.selected - 1) % self.size
        self.cdraw()
        return self.optionCmds[self.selected]

    def select(self):  # Return the currently selected item
        return self.optionCmds[self.selected]

    def show(self):
        """ Show the menu until an item is selected or the back button is
        pressed. Returns the item's command or 'back', respectively."""

        self.cdraw()  # Draw the menu
        self.finished = False
        keymap = [ord(x) for x in self.settings['keys']]
        while not self.finished:  # Loop until select/back
            key = self.screen.getch()
            if key == keymap[3]:  # default q: Back button
                self.finished = True
                selectedItem = 'back'
            elif key == keymap[0]:  # default w: Up
                self.up()
            elif key == keymap[1]:  # default s: Down
                self.down()
            elif key == keymap[2]:  # default e: Select
                self.finished = True
                selectedItem = self.select()
        self.screen.clear()
        self.screen.refresh()
        return selectedItem

if __name__ == '__main__':
    sampleSettings = {'keys': ('1', '2', '3', '4'), 'bullet': '>'}
    sampleOptions = [('Option 1', 5),
                     ('Option 2', 'opt2'),
                     ('Something else', 'opt3')]
    sampleBar = '1: up, 2: down, 3: select, 4: back'
    sampleMenu = Menu('Example menu', sampleOptions, sampleBar,
                      0, sampleSettings)
    print sampleMenu.show()


text:
require 'chefspec'

class ChefSpec::ChefRunner
  def append(recipe)
    runner = Chef::Runner.new(recipe.run_context)
    runner.converge
    self
  end
end

module ChefSpec::Matchers
  RSpec::Matchers.define :enable_nginx_site do |site|
    match do |chef_run|
      chef_run.resources.any? do |resource|
        resource.resource_name == :execute and
            resource.name =~ /.*nxensite.*#{site}/
      end
    end
  end

  RSpec::Matchers.define :disable_nginx_site do |site|
    match do |chef_run|
      chef_run.resources.any? do |resource|
        resource.resource_name == :execute and
          resource.name =~ /.*nxdissite.*#{site}/
      end
    end
  end
end

def fake_recipe(run, &block)
  recipe = Chef::Recipe.new("nginx_spec", "default", run.run_context)
  recipe.instance_eval(&block)
end

describe 'nginx::default' do
  before do
    # stub out ohai
    Chef::Config[:config_file] = '/dev/null'
  end
  let(:runner) do
    ChefSpec::ChefRunner.new(
      :platform => 'debian',
      :version  => '7.0'
    )
  end
  let(:chef_run) do
    runner.converge 'nginx::default'
  end

  it "loads the ohai plugin" do
    expect(chef_run).to include_recipe 'nginx::ohai_plugin'
  end

  it "builds from source when specified" do
    runner.node.set['nginx']['install_method'] = 'source'
    expect(chef_run).to include_recipe 'nginx::source'
  end

  context "configured to install by package" do
    context "in a redhat-based platform" do
      let(:redhat) do
        ChefSpec::ChefRunner.new(
          :platform => 'redhat',
          :version  => '6.3'
        )
      end
      let(:redhat_run) do
        redhat.converge 'nginx::default'
      end
      it "includes the yum::epel recipe if the source is epel" do
        redhat.node.set['nginx']['repo_source'] = 'epel'
        expect(redhat_run).to include_recipe 'yum::epel'
      end

      it "includes the nginx::repo recipe if the source is not epel" do
        redhat.node.set['nginx']['repo_source'] = 'nginx'
        expect(redhat_run).to include_recipe 'nginx::repo'
      end
    end

    it "installs the package" do
      package_name = chef_run.node['nginx']['package_name']
      expect(chef_run).to install_package package_name
    end

    it "enables the service" do
      expect(chef_run).to enable_service 'nginx'
    end

    it "executes common nginx configuration" do
      expect(chef_run).to include_recipe 'nginx::commons'
    end
  end

  it "starts the service" do
    expect(chef_run).to start_service 'nginx'
  end

  context "#nginx_site (definition)" do
    context "#enable => true (default)" do
      let(:run) do
        recipe = fake_recipe(chef_run) do
          nginx_site "foo"
        end
        chef_run.append(recipe)
      end

      it { expect(run).to execute_command "/usr/sbin/nxensite foo" }

      it do
        expect(run.execute("nxensite foo"))
            .to notify("service[nginx]", "reload")
      end
    end

    context "#enable => false" do
      let(:run) do
        recipe = fake_recipe(chef_run) do
          nginx_site "foo" do
            enable false
          end
        end
        chef_run.append(recipe)
      end

      it { expect(run).to execute_command "/usr/sbin/nxdissite foo" }

      it do
        expect(run.execute("nxdissite foo"))
            .to notify("service[nginx]", "reload")
      end
    end
  end

  context "spec helpers" do
    def run(enabled=true)
      recipe = fake_recipe(chef_run) do
        nginx_site "foo" do
          enable enabled
        end
      end
      chef_run.append(recipe)
    end

    it "#enable_nginx_site is provided" do
      expect(run).to enable_nginx_site "foo"
    end

    it "#disable_nginx_site is provided" do
      expect(run false).to disable_nginx_site "foo"
    end
  end
end


text:
<!doctype html>

		<meta charset="utf-8">

		<title>Market Risk Measurement and Management | Chapter 16 | Techniques for Valuing MBS</title>

		<meta name="description" content="Financial Risk Manager Part 2 Study Materials">
		<meta name="author" content="MacLane Wilkison">

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<link rel="stylesheet" href="css/reveal.min.css">
		<link rel="stylesheet" href="css/theme/default.css" id="theme">

		<link rel="stylesheet" href="lib/css/zenburn.css">

Chapter 16

Techniques for Valuing MBS

						Created for Alchemists Academy by MacLane Wilkison

Static Cash Flow Yield Analysis

Must assume a certain prepayment rate

Bond equivalent yield (BEY) = 2[(1+im/12)6-1]

Nominal spread - the difference between the cash flow yield and the Treasury yield

Z-Spread

A measure of the spread that an investor would realize over the Treasury spot rate curve if the mortgage security were held to maturity

Monte Carlo Simulation

Definition: A simulation generating a set of cash flows based on simulated future mortgage rates

Steps:

Simulate short-term interest rate and refinancing rate paths

Project the cash flow on each interest rate path

Determine the PV of the cash flows on each interest rate path

Compute the theoretical value of the mortgage security

Option-Adjusted Spread (OAS)

Definition: The spread (K) that, when added to all the spot rates of all interest rate paths, makes the average PV of the paths equal to the observed market price

Accounts for the option of borrowers to prepay

Option cost = Zero-volatility OAS - OAS

						The zero-volatility OAS is calculated in the same was as the OAS but only the base-case interest rate path is considered.

Total Return Analysis

Enables investors to evaluate returns over different horizons and interest rate scenarios

Total return = Total horizon proceeds/Total cost) - 1

If there are interim cash flows, these should be accounted for as well

THE END

AlchemistsAcademy.com


text:
// This code was generated by a tool: ViewModelTemplates\EntitySelectorViewModelTemplate.tt
namespace Admin.LegalEntityModule.ViewModels
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;

    using Common;
    using Common.Events;
    using Common.Extensions;
    using Common.UI.ViewModels;

    using EnergyTrading;
    using EnergyTrading.Contracts.Search;
    using EnergyTrading.Mdm.Client.Services;
    using EnergyTrading.MDM.Contracts.Sample;
    using EnergyTrading.Search;

    using Microsoft.Practices.Prism.Events;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.Prism.ViewModel;

    public class LegalEntitySelectorViewModel : NotificationObject
    {
        private readonly IMdmService entityService;

        private readonly IEventAggregator eventAggregator;

        private readonly IRegionManager regionManager;

        private DateTime asOf;

        private string entitySearchText;

        private ObservableCollection<SelectorViewModel> legalentitys;

        private SelectorViewModel selectedLegalEntity;

        public LegalEntitySelectorViewModel(
            IEventAggregator eventAggregator,
            IMdmService entityService,
            IRegionManager regionManager)
        {
            this.eventAggregator = eventAggregator;
            this.entityService = entityService;
            this.regionManager = regionManager;
            this.AsOf = SystemTime.UtcNow().Date;
        }

        public DateTime AsOf
        {
            get
            {
                return this.asOf;
            }

            set
            {
                this.asOf = value;
                this.RaisePropertyChanged(() => this.AsOf);
            }
        }

        public string EntitySearchText
        {
            get
            {
                return this.entitySearchText;
            }

            set
            {
                this.entitySearchText = value;
                this.RaisePropertyChanged(() => this.EntitySearchText);
            }
        }

        public ObservableCollection<SelectorViewModel> LegalEntitys
        {
            get
            {
                return this.legalentitys;
            }

            set
            {
                this.legalentitys = value;
                this.RaisePropertyChanged(() => this.LegalEntitys);
            }
        }

        public SelectorViewModel SelectedLegalEntity
        {
            get
            {
                return this.selectedLegalEntity;
            }

            set
            {
                this.selectedLegalEntity = value;
                this.RaisePropertyChanged(() => this.SelectedLegalEntity);
            }
        }

        public void CancelSelection()
        {
            this.eventAggregator.Publish(new EntitySelectedEvent(string.Empty, 0, string.Empty));
        }

        public void SearchForEntity()
        {
            Search search = SearchBuilder.CreateSearch();
            search.AsOf = this.AsOf;
            search.AddSearchCriteria(SearchCombinator.And)
                .AddCriteria("Name", SearchCondition.Contains, this.EntitySearchText);

            search.SearchOptions.OrderBy = "Name";
            this.entityService.ExecuteAsyncSearch<LegalEntity>(
                search,
                response =>
                    {
                        IList<LegalEntity> searchResults = response;
                        this.LegalEntitys =
                            new ObservableCollection<SelectorViewModel>(
                                searchResults.Select(x => new SelectorViewModel(x.MdmId().Value, x.Details.Name))
                                    .OrderBy(y => y.Name));
                    },
                this.eventAggregator);
        }

        public void SelectLegalEntity()
        {
            var entitySelectionViewContext =
                (EntitySelectionViewContext)this.regionManager.Regions[RegionNames.EntitySelectorRegion].Context;
            this.eventAggregator.Publish(
                new EntitySelectedEvent(
                    entitySelectionViewContext.SelectedPropertyName,
                    this.SelectedLegalEntity.Id,
                    this.SelectedLegalEntity.Name));
        }
    }
}


text:
from msrest.serialization import Model

class ConnectionResetSharedKey(Model):
    """ConnectionResetSharedKey.

    :param key_length: The virtual network connection reset shared key length
    :type key_length: long
    """

    _attribute_map = {
        'key_length': {'key': 'keyLength', 'type': 'long'},
    }

    def __init__(self, **kwargs):
        super(ConnectionResetSharedKey, self).__init__(**kwargs)
        self.key_length = kwargs.get('key_length', None)


text:
#pragma once
#include "../Base/List.h"
#include "../Base/StringRef.h"
#include "PathName.h"

#if defined(LN_OS_FAMILY_UNIX)
#include <dirent.h>
#endif

LN_NAMESPACE_BEGIN
namespace detail { template<typename TChar> class GenericFileFinderImplBase; }

/**
	@brief
*/
class DirectoryUtils
{
public:

	#pragma push_macro("GetCurrentDirectory")
	#undef GetCurrentDirectory
	/**
		@brief		カレントディレクトリのパスを取得します。
		@param[in]	outPath	: パス文字列を格納するバッファ (LN_MAX_PATH 文字数分のサイズが必要)
		@return		パスの文字数 (\0 は除く)
	*/
	template<typename TChar>
	static size_t GetCurrentDirectory(TChar* outPath);

	template<typename TChar>
	static size_t LN_AFX_FUNCNAME(GetCurrentDirectory)(TChar* outPath);
	#pragma pop_macro("GetCurrentDirectory")

	/**
		@brief		ディレクトリ内に含まれる全てのファイルのパスを取得します。
		@param[in]	dirPath	: 検索するディレクトリ
		@param[in]	pattern	: 検索文字列 (ワイルドカード指定可能)
	*/
	static List<String> GetFiles(const TCHAR* dirPath, const TCHAR* pattern);

};

/**
	@brief
*/
template<typename TChar>
class GenericFileFinder
{
public:
	GenericFileFinder(const GenericStringRef<TChar>& dirPath);
	~GenericFileFinder();
	bool IsWorking() const;
	const GenericPathName<TChar>& GetCurrent() const;
	bool Next();

private:
	detail::GenericFileFinderImplBase<TChar>*	m_impl;
};

namespace detail {

template<typename TChar>
class GenericFileFinderImplBase
{
public:
	virtual ~GenericFileFinderImplBase()
	{}

	bool IsWorking() const
	{
		return !m_combinedPath.IsEmpty();
	}

	const GenericPathName<TChar>& GetCurrent() const
	{
		return m_combinedPath;
	}

	virtual bool Next() = 0;

protected:
	GenericFileFinderImplBase(const GenericStringRef<TChar>& dirPath)
		: m_dirPath(dirPath)
	{}

	void SetCurrentFileName(const char* fileName)
	{
		if (fileName != nullptr)
			m_combinedPath.AssignUnderBasePath(m_dirPath, fileName);
		else
			m_combinedPath.Clear();
	}
	void SetCurrentFileName(const wchar_t* fileName)
	{
		if (fileName != nullptr)
			m_combinedPath.AssignUnderBasePath(m_dirPath, fileName);
		else
			m_combinedPath.Clear();
	}

protected:
	GenericPathName<TChar>	m_dirPath;
	GenericPathName<TChar>	m_combinedPath;
};

} // namespace detail

LN_NAMESPACE_END


text:
require_relative '../spec_helper'

describe 'Account' do

  describe 'get_ledger' do
    let(:ledger) do
      VCR.use_cassette('ledger', match_requests_on: [:method, :anonymized_uri]) do
        Paytunia.get_ledger
      end
    end

    it 'must return the ledger' do
      ledger.should be_an_instance_of Array
      ledger.last.balance.should be_an_instance_of BigDecimal
    end
  end

  describe 'get_operation' do
    let(:account_operation) do
      VCR.use_cassette('account_operation', match_requests_on: [:method, :anonymized_uri]) do
        Paytunia.get_operation('c503b258-2ad8-49a5-a8c6-b3ecad05ba70')
      end
    end

    it 'must be an instance of AccountOperation' do
      account_operation.should be_an_instance_of Paytunia::Api::AccountOperation
    end
  end
end


text:
exports.sleep = sleep;
function sleep() {
  sleeper(5000, function() {
    console.log('DONE');
    // throw new Error('Oh noes!');
  });
}

function sleeper(time, callback) {
  var stop = new Date().getTime();
  while(new Date().getTime() < stop + time) {
    ;
  }
  process.send({test: 'value'});
  callback();
}

sleep();

// Communication with the parent via the parent/child .send()
process.on('message', function(m) {
  console.log('CHILD received a message...');
  console.log(m);
});


text:
package org.drools.ide.common.client.modeldriven.dt52;

import org.drools.guvnor.shared.api.PortableObject;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;

/**
 * Holder for cell value and other attributes. This is serialised by GWT RPC and
 * therefore does not contain a single property of type Serializable (that would
 * have been ideal). Instead the concrete data types are included separately.
 */
public class DTCellValue52
    implements
        PortableObject {

    private static final long serialVersionUID = -3547167997433925031L;

    //Type safe value of cell
    private Boolean           valueBoolean;
    private Date              valueDate;
    private Number            valueNumeric;
    private String            valueString      = "";
    private DTDataTypes52     dataType         = DTDataTypes52.STRING;

    //Does this cell represent "all other values" to those explicitly defined for the column
    private boolean           isOtherwise;

    public DTCellValue52() {
    }

    public DTCellValue52(final DTCellValue52 sourceCell) {
        if ( sourceCell == null ) {
            return;
        }
        switch ( sourceCell.getDataType() ) {
            case BOOLEAN :
                setBooleanValue( sourceCell.getBooleanValue() );
                this.dataType = DTDataTypes52.BOOLEAN;
                break;
            case DATE :
                setDateValue( sourceCell.getDateValue() );
                this.dataType = DTDataTypes52.DATE;
                break;
            case NUMERIC :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC;
                break;
            case NUMERIC_BIGDECIMAL :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_BIGDECIMAL;
                break;
            case NUMERIC_BIGINTEGER :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_BIGINTEGER;
                break;
            case NUMERIC_BYTE :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_BYTE;
                break;
            case NUMERIC_DOUBLE :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_DOUBLE;
                break;
            case NUMERIC_FLOAT :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_FLOAT;
                break;
            case NUMERIC_INTEGER :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_INTEGER;
                break;
            case NUMERIC_LONG :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_LONG;
                break;
            case NUMERIC_SHORT :
                setNumericValue( sourceCell.getNumericValue() );
                this.dataType = DTDataTypes52.NUMERIC_SHORT;
                break;
            default :
                setStringValue( sourceCell.getStringValue() );
                this.dataType = DTDataTypes52.STRING;
        }
    }

    public DTCellValue52(final DTDataTypes52 type,
                         final boolean emptyValue) {
        switch ( type ) {
            case BOOLEAN :
                if ( !emptyValue ) {
                    setBooleanValue( false );
                }
                this.dataType = DTDataTypes52.BOOLEAN;
                break;
            case DATE :
                if ( !emptyValue ) {
                    setDateValue( new Date() );
                }
                this.dataType = DTDataTypes52.DATE;
                break;
            case NUMERIC :
                if ( !emptyValue ) {
                    setNumericValue( new BigDecimal( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC;
                break;
            case NUMERIC_BIGDECIMAL :
                if ( !emptyValue ) {
                    setNumericValue( new BigDecimal( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC_BIGDECIMAL;
                break;
            case NUMERIC_BIGINTEGER :
                if ( !emptyValue ) {
                    setNumericValue( new BigInteger( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC_BIGINTEGER;
                break;
            case NUMERIC_BYTE :
                if ( !emptyValue ) {
                    setNumericValue( new Byte( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC_BYTE;
                break;
            case NUMERIC_DOUBLE :
                if ( !emptyValue ) {
                    setNumericValue( 0.0d );
                }
                this.dataType = DTDataTypes52.NUMERIC_DOUBLE;
                break;
            case NUMERIC_FLOAT :
                if ( !emptyValue ) {
                    setNumericValue( 0.0f );
                }
                this.dataType = DTDataTypes52.NUMERIC_FLOAT;
                break;
            case NUMERIC_INTEGER :
                if ( !emptyValue ) {
                    setNumericValue( new Integer( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC_INTEGER;
                break;
            case NUMERIC_LONG :
                if ( !emptyValue ) {
                    setNumericValue( 0l );
                }
                this.dataType = DTDataTypes52.NUMERIC_LONG;
                break;
            case NUMERIC_SHORT :
                if ( !emptyValue ) {
                    setNumericValue( new Short( "0" ) );
                }
                this.dataType = DTDataTypes52.NUMERIC_SHORT;
                break;
            default :
                if ( !emptyValue ) {
                    setStringValue( "" );
                }
                this.dataType = DTDataTypes52.STRING;
        }
    }

    public DTCellValue52(final Object value) {
        if ( value instanceof String ) {
            setStringValue( (String) value );
            this.dataType = DTDataTypes52.STRING;
            return;
        }
        if ( value instanceof Boolean ) {
            setBooleanValue( (Boolean) value );
            this.dataType = DTDataTypes52.BOOLEAN;
            return;
        }
        if ( value instanceof Date ) {
            setDateValue( (Date) value );
            this.dataType = DTDataTypes52.DATE;
            return;
        }
        if ( value instanceof BigDecimal ) {
            setNumericValue( (BigDecimal) value );
            this.dataType = DTDataTypes52.NUMERIC_BIGDECIMAL;
            return;
        }
        if ( value instanceof BigInteger ) {
            setNumericValue( (BigInteger) value );
            this.dataType = DTDataTypes52.NUMERIC_BIGINTEGER;
            return;
        }
        if ( value instanceof Byte ) {
            setNumericValue( (Byte) value );
            this.dataType = DTDataTypes52.NUMERIC_BYTE;
            return;
        }
        if ( value instanceof Double ) {
            setNumericValue( (Double) value );
            this.dataType = DTDataTypes52.NUMERIC_DOUBLE;
            return;
        }
        if ( value instanceof Float ) {
            setNumericValue( (Float) value );
            this.dataType = DTDataTypes52.NUMERIC_FLOAT;
            return;
        }
        if ( value instanceof Integer ) {
            setNumericValue( (Integer) value );
            this.dataType = DTDataTypes52.NUMERIC_INTEGER;
            return;
        }
        if ( value instanceof Long ) {
            setNumericValue( (Long) value );
            this.dataType = DTDataTypes52.NUMERIC_LONG;
            return;
        }
        if ( value instanceof Short ) {
            setNumericValue( (Short) value );
            this.dataType = DTDataTypes52.NUMERIC_SHORT;
            return;
        }
        setStringValue( null );
    }

    public DTCellValue52(final BigDecimal value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_BIGDECIMAL;
    }

    public DTCellValue52(final BigInteger value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_BIGINTEGER;
    }

    public DTCellValue52(final Byte value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_BYTE;
    }

    public DTCellValue52(final Double value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_DOUBLE;
    }

    public DTCellValue52(final Float value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_FLOAT;
    }

    public DTCellValue52(final Integer value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_INTEGER;
    }

    public DTCellValue52(final Long value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_LONG;
    }

    public DTCellValue52(final Short value) {
        setNumericValue( value );
        this.dataType = DTDataTypes52.NUMERIC_SHORT;
    }

    public DTCellValue52(final Boolean value) {
        setBooleanValue( value );
        this.dataType = DTDataTypes52.BOOLEAN;
    }

    public DTCellValue52(final Date value) {
        setDateValue( value );
        this.dataType = DTDataTypes52.DATE;
    }

    public DTCellValue52(final String value) {
        setStringValue( value );
        this.dataType = DTDataTypes52.STRING;
    }

    public DTDataTypes52 getDataType() {
        return this.dataType;
    }

    public Boolean getBooleanValue() {
        return valueBoolean;
    }

    public Date getDateValue() {
        return valueDate;
    }

    public Number getNumericValue() {
        return valueNumeric;
    }

    public String getStringValue() {
        return valueString;
    }

    public boolean isOtherwise() {
        return isOtherwise;
    }

    public void setBooleanValue(final Boolean value) {
        clearValues();
        this.valueBoolean = value;
        this.dataType = DTDataTypes52.BOOLEAN;
    }

    public void setDateValue(final Date value) {
        clearValues();
        this.valueDate = value;
        this.dataType = DTDataTypes52.DATE;
    }

    public void setNumericValue(final Number value) {
        clearValues();
        this.valueNumeric = value;
    }

    public void setNumericValue(final BigDecimal value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_BIGDECIMAL;
    }

    public void setNumericValue(final BigInteger value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_BIGINTEGER;
    }

    public void setNumericValue(final Byte value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_BYTE;
    }

    public void setNumericValue(final Double value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_DOUBLE;
    }

    public void setNumericValue(final Float value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_FLOAT;
    }

    public void setNumericValue(final Integer value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_INTEGER;
    }

    public void setNumericValue(final Long value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_LONG;
    }

    public void setNumericValue(final Short value) {
        clearValues();
        this.valueNumeric = value;
        this.dataType = DTDataTypes52.NUMERIC_SHORT;
    }

    public void setOtherwise(final boolean isOtherwise) {
        this.isOtherwise = isOtherwise;
    }

    public void setStringValue(final String value) {
        clearValues();
        this.valueString = value;
        this.dataType = DTDataTypes52.STRING;
    }

    public void clearValues() {
        this.valueBoolean = null;
        this.valueDate = null;
        this.valueNumeric = null;
        this.valueString = null;
        this.isOtherwise = false;
    }

    public boolean hasValue() {
        return valueBoolean != null
               || valueDate != null
               || valueNumeric != null
               || valueString != null
               || isOtherwise;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash = hash + 31 * (valueBoolean == null ? 0 : valueBoolean.hashCode());
        hash = hash + 31 * (valueDate == null ? 0 : valueDate.hashCode());
        hash = hash + 31 * (valueNumeric == null ? 0 : valueNumeric.hashCode());
        hash = hash + 31 * dataType.hashCode();
        return hash;
    }

    @Override
    //A clone of this class is used while editing a column. Overriding this method
    //allows us to easily compare the clone and the original to check if a change
    //has been made
    public boolean equals(Object obj) {
        if ( !(obj instanceof DTCellValue52) ) {
            return false;
        }
        DTCellValue52 that = (DTCellValue52) obj;
        if ( valueBoolean != null ? !valueBoolean.equals( that.valueBoolean ) : that.valueBoolean != null ) return false;
        if ( valueDate != null ? !valueDate.equals( that.valueDate ) : that.valueDate != null ) return false;
        if ( valueNumeric != null ? !valueNumeric.equals( that.valueNumeric ) : that.valueNumeric != null ) return false;
        if ( valueString != null ? !valueString.equals( that.valueString ) : that.valueString != null ) return false;
        if ( !dataType.equals( that.dataType ) ) return false;
        return true;
    }

}


text:
local Bullet = require("Bullet")
local gameConfig = require("gameConfig")
local CircleBullet = {}

CircleBullet.new = function(options)
    local bullet = Bullet.new(options)
    local circle = display.newCircle(0, 0, (options and options.radius) or gameConfig.contentWidth*0.03 )
    bullet.name = "circlebullet"
    bullet:insert(circle)
    bullet:enablePhysics()
    return bullet
end

return CircleBullet


text:
import sbt._
import Keys._

object BuildSettings {

  // Basic settings for our app
  lazy val basicSettings = Seq[Setting[_]](
    organization  := "SnowPlow Analytics Ltd",
    version       := "0.0.4",
    description   := "The Scalding WordCountJob example as a standalone SBT project, ready for Amazon EMR",
    scalaVersion  := "2.10.3", // -> 2.10.0 when Scalding is ready
    scalacOptions := Seq("-deprecation", "-encoding", "utf8"),
    resolvers     ++= Dependencies.resolutionRepos
  )

  lazy val buildSettings = basicSettings ++ seq( sbtavro.SbtAvro.avroSettings : _*)
}


text:
using namespace std;

int SumByValue(int);
int SumByReference(int &);
int SumByReference2(const int &);
int SumByPointer(int *);

int main()
{
	system("color 70");
	setlocale(0, "");
	SetConsoleTitle("008.Reference");

	int value = 99;
	int &ref = value;

	cout << "value = " << value << endl;
	cout << "ref = " << ref << endl << endl;

	cout << "Change value:" << endl;
	value++;												//изминение значения переменной сказываетс¤ и на значении ссылки
	cout << "value = " << value << endl;
	cout << "ref = " << ref << endl << endl;

	cout << "Change ref:" << endl;
	ref++;													//при изминении ссылки изменяется и значение переменной
	cout << "value = " << value << endl;
	cout << "ref = " << ref << endl << endl;

	cout << "Function:" << endl;
	int func = 10;
	cout << "value = " << func << endl;
	//передавая переменную в функцию она не изменяетс¤!
	cout << "SumByValue(func) = " << SumByValue(func) << endl;
	cout << "value = " << func << endl;
	//передавая ссылку на переменную в функцию, все изминение отобразятся
	//на переменной вне функции
	cout << "SumByReference(func) = " << SumByReference(func) << endl;
	cout << "value = " << func << endl;
	//если нужно передать ссылку но изменять переменную нельзя
	//нужно определить функию вида SumByReference2(const int &ref)
	cout << "SumByReference2(func) = " << SumByReference2(func) << endl;
	cout << "value = " << func << endl;
	//передавая указатель на переменную в функцию
	//также как и ссылкой все изминение отобразятся
	cout << "SumByPointer(&func) = " << SumByPointer(&func) << endl;
	cout << "value = " << func << endl;

	system("pause");
    return 0;
}

int SumByValue(int value)
{
	value += value;
	return value;
}
int SumByReference(int &ref)
{
	ref += ref;
	return ref;
}
int SumByReference2(const int &ref)
{
	//ref += ref;
	return ref + ref;
}
int SumByPointer(int *prt)
{
	*prt += *prt;
	return *prt;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright (C) Tony Green, Litepal Framework Open Source Project

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="10dp" >

    <Button
        android:id="@+id/save_sample_btn"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/save_sample" />

    <Button
        android:id="@+id/update_sample_btn"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/update_sample" />

    <Button
        android:id="@+id/delete_sample_btn"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/delete_sample" />

    <Button
        android:id="@+id/query_sample_btn"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/query_sample" />

</LinearLayout>


text:
var editing = false;

$(function() {
  editing = $("#edit-user-data").data("editingPage");
});

$('#cancel-edit-button').click(function(){
    return confirm('Are you sure you want to cancel? You will lose any unsaved work');
});

$("#create-user-form").on('submit', function() {
    var name = $("#name").val();
    var username = $("#username").val();
    var password = $("#password").val();
    var confirm = $("#confirmPassword").val();

    if (!isValidName(name)) {
        alert("Please enter a valid name");
        return false;
    }

    if (!isValidUsername(username)) {
        alert("Please enter a valid username");
        return false;
    }

    if (!editing || password !== "") {
        if (!isValidPassword(password)) {
            alert("Please enter a valid password");
            return false;
        }

        if (password != confirm) {
            alert("Please ensure your passwords match")
            return false;
        }
    }
    return true;
});

$("#name").blur(function() {
    var name = $("#name").val();
    if (isValidName(name)) {
        $("#name").removeClass("is-invalid");
    }
    else {
        $("#name").addClass("is-invalid");
    }
});

$("#username").on('change keyup paste',function(){
    $(this).val($(this).val().toLowerCase());
})

$("#username").blur(function() {
    var username = $("#username").val();
    if (isValidUsername(username)) {
        $("#username").removeClass("is-invalid");
    }
    else {
        $("#username").addClass("is-invalid");
    }
});

$("#password").blur(function() {
    var password = $("#password").val();
    if (editing && !password) {
        return;
    }
    if (isValidPassword(password)) {
        $("#password").removeClass("is-invalid");
        $("#password-feedback").hide();
    }
    else {
        $("#password").addClass("is-invalid");
        $("#password-feedback").show();
    }
});

$("#confirmPassword").blur(function() {
    var password = $("#password").val();
    var confirm = $("#confirmPassword").val();
    if (editing && !password && !confirm) {
        return;
    }
    if (password == confirm) {
        $("#confirmPassword").removeClass("is-invalid");
    }
    else {
        $("#confirmPassword").addClass("is-invalid");
    }
});

function isValidName(name) {
    if (name) {
        if (name.length > 64) {
            return false;
        }
        if (/^[a-zA-Z \-.,']+$/.test(name)) {
            return true;
        }
        return false;
    }
    return false;
}

function isValidUsername(username) {
    if (username) {
        if (username.length > 64) {
            return false;
        }
        if (/^[a-z0-9\-.]+$/.test(username.toLowerCase())) {
            return true;
        }
        return false;
    }
    return false;
}

function isValidPassword(password) {
    if (editing && !password) {
        return true;
    }

    if (!password) {
        return false;
    }

    if (password.length < 8) {
        return false;
    }

    var anUpperCase = /[A-Z]/;
    var aLowerCase = /[a-z]/;
    var aNumber = /[0-9]/;
    var aSpecial = /[!|@|#|$|%|^|&|*|(|)|-|_|']/;

    var complexity = 0;
    for(var i=0; i<password.length; i++){
        if(anUpperCase.test(password[i]))
            complexity++;
        else if(aLowerCase.test(password[i]))
            complexity++;
        else if(aNumber.test(password[i]))
            complexity++;
        else if(aSpecial.test(password[i]))
            complexity++;
    }

    if (complexity < 3) {
        return false;
    }
    else {
        return true;
    }
}


text:
template<typename _Object>
class CStateMonsterCustomAction : public CState<_Object> {
	typedef CState<_Object> inherited;

	SStateDataAction	data;

public:
						CStateMonsterCustomAction	(_Object *obj);
	virtual				~CStateMonsterCustomAction	();

	virtual	void		execute						();
	virtual bool		check_completion			();
};

#include "state_custom_action_inline.h"


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UnitTestGenerator;
#pragma warning disable RECS0026 // Possible unassigned object created by 'new'
#pragma warning disable RECS0001 // Class is declared partial but has only one part
        namespace FooBarLibrary.Tests
        {
            [TestClass]
            public partial class FooTests_Reuse
            {
                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Concat_StringString_StrANullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Concat(null, Value.Create<string>());
                }

                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Concat_StringString_StrBNullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Concat(Value.Create<string>(), null);
                }

                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Concat_StringStringString_StrANullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Concat(null, Value.Create<string>(), Value.Create<string>());
                }

                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Concat_StringStringString_StrBNullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Concat(Value.Create<string>(), null, Value.Create<string>());
                }

                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Concat_StringStringString_StrCNullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Concat(Value.Create<string>(), Value.Create<string>(), null);
                }

                [TestMethod]
                [TestCategory("UnitTestGenerator.ArgumentCheck")]
                [ExpectedException(typeof(System.ArgumentNullException))]
                public void Lowercase_ValueNullValueGiven_ShouldThrowArgumentNullException()
                {
                    fooInstance.Lowercase(null);
                }

            }
        }
#pragma warning restore RECS0026 // Possible unassigned object created by 'new'
#pragma warning restore RECS0001 // Class is declared partial but has only one part


text:
var cameraLoc;

// From: https://en.wikipedia.org/wiki/Aircraft_principal_axes
var cameraPitch = 0;
var cameraRoll = 0;
var cameraYaw = 0;
var generatedTerrain;
var terrain;
var cellSize;

function setup(){
  createCanvas(windowWidth, windowHeight, WEBGL);

  terrain = new Terrain();
  cameraLoc = createVector(0, 0, 0);
  cameraPitch = PI / 3;

  cellSize = map(width, 300, 3000, 20, 100);
  stroke(50, 200, 50);
  // draw();
  // noLoop();
  // frameRate(0.005);
  // frameRate(5);
}

function draw(){
  background(45);

  let baseColor = color(30, 90, 30);
  let maxColor = color(230, 240, 230);

  let renderDepth = 95;
  let renderWidth = 3 * (width / cellSize);
  // console.log("Render Width: "+ renderWidth);

  generatedTerrain = [];

  // Build Terrain
  for (var y = 0; y < renderDepth; y++){
    generatedTerrain.push([]);
    for (var x = 0; x < renderWidth; x++){
      let xScaled = ((x - renderWidth/2) * cellSize) + cameraLoc.x;
      let yScaled = (y * cellSize) + cameraLoc.y;
      let heightAtLoc = terrain.elevationAt(xScaled, yScaled);
      generatedTerrain[y][x] = heightAtLoc;
    }
  }

  // translate(width/2, height/2);
  // translate(cameraLoc.x, cameraLoc.y, cameraLoc.z);
  rotateX(cameraPitch);

  // x => left-right
  // y => forward-back
  // z => up-down
  translate(0, -1200, 0);

  // Render mesh for Terrain
  noFill();
  for (var y = 0; y < renderDepth-1; y++){
    beginShape(TRIANGLE_STRIP);
    for (var x = 0; x < renderWidth; x++){
      let xScaled = ((x - renderWidth/2)* cellSize) + cameraLoc.x;
      let yScaled = (y * cellSize) + 0;

      let nextScaledY = yScaled + cellSize;
      vertex(xScaled, yScaled, generatedTerrain[y][x]);
      vertex(xScaled, nextScaledY, generatedTerrain[y+1][x]);
    }
    endShape();
  }
  cameraLoc.y -= cellSize;
}

class Terrain {
  constructor(){
    this.noiseScale = 0.005;
  }

  elevationAt(x, z){
    return 100 * noise(x * this.noiseScale, z * this.noiseScale);
  }
}