text:
package com.amazonaws.services.customerprofiles.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.customerprofiles.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * ConflictResolutionMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ConflictResolutionMarshaller {

    private static final MarshallingInfo<String> CONFLICTRESOLVINGMODEL_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ConflictResolvingModel").build();
    private static final MarshallingInfo<String> SOURCENAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("SourceName").build();

    private static final ConflictResolutionMarshaller instance = new ConflictResolutionMarshaller();

    public static ConflictResolutionMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(ConflictResolution conflictResolution, ProtocolMarshaller protocolMarshaller) {

        if (conflictResolution == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(conflictResolution.getConflictResolvingModel(), CONFLICTRESOLVINGMODEL_BINDING);
            protocolMarshaller.marshall(conflictResolution.getSourceName(), SOURCENAME_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
This theme is based on the Intellij Darcula syntax theme.

**This is a work in progress, for the moment, only Javascript, LESS and JSON were supported.**

![A screenshot of darcula-syntax-14](https://raw.githubusercontent.com/ofrogon/atom-darcula-syntax-14/master/doc/preview/less.png)

redpajama_set_name: RedPajamaGithub


text:
export default Ember.Route.extend({
	model: function(){
		return this.store.findAll('measure');
	}
});


text:
import json,sys

### This plugin in python monitors the performance metrics of Lighttpd servers

### It uses the inbuilt Lighttpd monitoring options to get the monitoring data.
### Download and install the latest version of Site24x7 Linux Agent. The agent will execute the plugin and push the data to the Site24x7 server

### Author: Anita, Zoho Corp
### Language : Python
### Tested in Ubuntu

### Configure Lighttpd Server to enable monitoring for Site24x7
### Open Lighttpd confi file.  File location: /etc/lighttpd/lighttpd.conf
### Add "mod_status" to server.modules
### Add status urls if not present  ::: status.status-url="/server-status"
### Restart Lighttpd Server

# Change the Lighttpd stats URL accordingly here. Retain the "?auto" suffix.
URL = "http://localhost:80/server-status?auto"
USERNAME = None
PASSWORD = None

# if any impacting changes to this plugin kindly increment the plugin version here.
PLUGIN_VERSION = "1"

# Setting this to true will alert you when there is a communication problem while posting plugin data to server
HEARTBEAT = "true"

### Attribute Names
KEYS = {'Total Accesses':'accesses', # number of requests handled
        'Total kBytes':'traffic',# overall outgoing traffic
        'Uptime':'uptime', # server uptime
        'BusyServers':'busy_servers', # number of currently active connections
        'IdleServers':'idle_servers' # number of currently inactive connections
}

### Attribute Units
UNITS = {'traffic':'KB','uptime':'seconds'}

PYTHON_MAJOR_VERSION = sys.version_info[0]
if PYTHON_MAJOR_VERSION == 3:
    import urllib
    import urllib.request as urlconnection
    from urllib.error import URLError, HTTPError
    from http.client import InvalidURL
elif PYTHON_MAJOR_VERSION == 2:
    import urllib2 as urlconnection
    from urllib2 import HTTPError, URLError
    from httplib import InvalidURL

class Lighttp():
    def __init__(self):
        self.data = {}
        self._userName = USERNAME
        self._userPass = PASSWORD
        self.data['plugin_version'] = PLUGIN_VERSION
        self.data['heartbeat_required'] = HEARTBEAT

    def getData(self):
        try:
            if self._userName and self._userPass:
                password_mgr = urlconnection.HTTPPasswordMgrWithDefaultRealm()
                password_mgr.add_password(None, URL, self._userName, self._userPass)
                auth_handler = urlconnection.HTTPBasicAuthHandler(password_mgr)
                opener = urlconnection.build_opener(auth_handler)
                urlconnection.install_opener(opener)
            response = urlconnection.urlopen(URL, timeout=10)
            if response.getcode() == 200:
                byte_responseData = response.read()
                str_responseData = byte_responseData.decode('UTF-8')
                self.data = self.parseData(str_responseData)
                self.data['units'] = UNITS
            else:
                self.data['status'] = 0
                self.data['msg'] = 'Error_code' + str(response.getcode())
        except HTTPError as e:
            self.data['status'] = 0
            self.data['msg'] = 'Error_code : HTTP Error ' + str(e.code)
        except URLError as e:
            self.data['status'] = 0
            self.data['msg'] = 'Error_code : URL Error ' + str(e.reason)
        except InvalidURL as e:
            self.data['status'] = 0
            self.data['msg'] = 'Error_code : Invalid URL'
        except Exception as e:
            self.data['status'] = 0
            self.data['msg'] = 'Exception occured in collecting data : ' + str(e)

        return self.data

    ### Parse Lighttp Server Stats Data
    def parseData(self, output):
        try:
            line = output.split('\n')
            for _ in line:
                value = _.split(':')
                if str(value[0]) in KEYS.keys(): self.data[KEYS[value[0]]] = value[1]
        except Exception as e:
            self.data['msg'] = str(e)

        return self.data

if __name__ == '__main__':
    lighttp = Lighttp()
    result = lighttp.getData()
    print(json.dumps(result, indent=4, sort_keys=True))


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annals de Musée du Congo, Botanique Série 5 2(2): 94 (1907)

#### Original name
Uredo sonsensis Henn.

### Remarks
null


text:
import { Observable } from '../../internal/Observable';
import { delayWhen } from '../../internal/patching/operator/delayWhen';

Observable.prototype.delayWhen = delayWhen;

declare module '../../internal/Observable' {
  interface Observable<T> {
    delayWhen: typeof delayWhen;
  }
}


text:
CHANGES:

- jQuery knowledge gap - funcionality in jQuery is implemented as a set of plugins - (basically just function calls)
- Checklist - show list - don't talk about it
- options/defaults -> "merging the options from our caller with the defaults so we have a complete set of options"
- skip audience interaction - play devil's advocate
- switch to stills
- dragTracker "callbacks" - talk about derivation
- Closing: Recap -> reusable plugins follow the checklist (DIY or 3rd party) - ui widgets can be modularized even further by learning to notice UI patterns

TODO:
- Closing slides
- Practice!


text:
#include <stdio.h>
#include "open/types.h"
#include "port_malloc.h"
#include "port_modules.h"

native_module_t* port_find_module(native_module_t* modules, void* code_ptr)
{
    native_module_t* module;
    size_t s;

    for (module = modules; NULL != module; module = module->next)
    {
        for (s = 0; s < module->seg_count; s++)
        {
            char* base = module->segments[s].base;
            size_t size = module->segments[s].size;

            if ((char*)code_ptr >= base && (char*)code_ptr < base + size)
                return module;
        }
    }

    // no matching module
    return NULL;
}

void port_dump_modules(native_module_t* modules, FILE *out)
{
    native_module_t* module;
    size_t i;

    if (!modules)
    {
        fprintf(out, "unavailable, probably /proc is not mounted\n");
        return;
    }

    for (module = modules; module; module = module->next)
    {
        if (!module->filename)
            continue;

        fprintf(out, "%s:\n", module->filename);

        for (i = 0; i < module->seg_count; i++)
        {
            size_t base = (size_t)module->segments[i].base;

            fprintf(out, "\t0x%"W_PI_FMT":0x%"W_PI_FMT"\n",
                    base, base + module->segments[i].size);
        }
    }
}

void port_clear_modules(native_module_t** list_ptr)
{
    native_module_t* cur = *list_ptr;

    while (cur)
    {
        native_module_t* next = cur->next;

        if (cur->filename)
            STD_FREE(cur->filename);

        STD_FREE(cur);
        cur = next;
    }

    *list_ptr = NULL;
}


text:
/*
  HomeDHT.h - Library for reading the temperature and humidity.
  Created by , April 4, 2016.
  Released into the public domain.
*/

#if ARDUINO >= 100
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

#include "HomeSerial.h"

HomeSerial::HomeSerial(){}

boolean HomeSerial::getError(){
    return _error;
}

char *HomeSerial::getErrorMessage(){
    return _error_message;
}

char *HomeSerial::readSerial(){
    // reset error
    _error = false;
    memset(&_error_message, 0, sizeof(_error_message)); // clear it

    // declare variables
    int num_bytes = 0;
    char bytes[30]; // ^fr:10;to:10;ts:12;ac:10;$ plus \0

    // empty variables
    memset(&bytes, 0, sizeof(bytes)); // clear it
    //bytes[0] = '\0';

    num_bytes = Serial.readBytesUntil('\0', bytes, sizeof(bytes));

    Serial.println("Serail ..");

    _error = true;
    strncpy( _error_message, "Serial must start with ^ and end with $ !", sizeof(_error_message)-1 );

    int count = 0;
    memset(&_serial, 0, sizeof(_serial)); // clear it

    boolean start = false;
    for(int i = 0; i <= num_bytes; i++){
        if('^' == bytes[i]){
            start = true;
            count = 0;

        }else if(start && '$' == bytes[i]){
           start = false;
           _serial[count] = '\0';

           _error = false;
           memset(&_error_message, 0, sizeof(_error_message)); // clear it

       }else if(start){
            _serial[count] = bytes[i];
            count++;
        }
    }

    Serial.print("Serial: ");
    Serial.println(_serial);

    return _serial;
}

char *HomeSerial::getSerial(){
    return _serial;
}

boolean HomeSerial::sscanfSerial(){
    _from = 0;
    _to = 0;
    _task = 0;
    _action = 0;
    memset(&_message, 0, sizeof(_message)); // clear it

    sscanf((char *)_serial, "fr:%d;to:%d;ts:%d;ac:%d;msg:%s", &_from, &_to, &_task, &_action, &_message);

    if (0 == _from){
        _error = true;
        strncpy( _error_message, "Serial has no fr:, it must be like fr:%d;to:%d;ts:%d;ac:%d;msg:%s", sizeof(_error_message)-1 );
        return false;
    }

    if (0 == _to){
        _error = true;
        strncpy( _error_message, "Serial has no to:, it must be like fr:%d;to:%d;ts:%d;ac:%d;msg:%s", sizeof(_error_message)-1 );
        return false;
    }

    if (0 == _task){
        _error = true;
        strncpy( _error_message, "Serial has no ts:, it must be like fr:%d;to:%d;ts:%d;ac:%d;msg:%s", sizeof(_error_message)-1 );
        return false;
    }

    if (0 == _action){
        _error = true;
        strncpy( _error_message, "Serial has no ac:, it must be like fr:%d;to:%d;ts:%d;ac:%d;msg:%s", sizeof(_error_message)-1 );
        return false;
    }

    Serial.print("Serial sscanf: ");
    Serial.print("From: ");
    Serial.print(_from);
    Serial.print(" To: ");
    Serial.print(_to);
    Serial.print(" Task: ");
    Serial.print(_task);
    Serial.print(" Action: ");
    Serial.print(_action);
    Serial.print(" Message: ");
    Serial.println(_message);

    return true;
}

int HomeSerial::getFrom(){
    return _from;
}

int HomeSerial::getTo(){
    return _to;
}

int HomeSerial::getTask(){
    return _task;
}

int HomeSerial::getAction(){
    return _action;
}

char *HomeSerial::getMessage(){
    return _message;
}

boolean HomeSerial::writeSerial(char *serial){
    Serial.print('^');
    Serial.print(serial);
    Serial.println('$');

    _error = false;
    memset(&_error_message, 0, sizeof(_error_message)); // clear it

    return true;
}


text:
using CommandLine;

namespace JsonSchema
{
    internal class Options
    {
        [Option('o', "outputFile", Required = false, HelpText = "Set path of the output file.", Default = "../../../../Umbraco.Web.UI/umbraco/config/appsettings-schema.json")]
        public string OutputFile { get; set; }
    }
}


text:
package com.seamusdawkins.tablayout.activities;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.seamusdawkins.tablayout.fragments.SecondFragment;
import com.seamusdawkins.tablayout.R;
import com.seamusdawkins.tablayout.fragments.ThirdFragment;
import com.seamusdawkins.tablayout.fragments.FirstFragment;

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

public class IconTextActivity extends AppCompatActivity {

    private Toolbar toolbar;
    private TabLayout tabLayout;
    private ViewPager viewPager;
    private int[] tabIcons = {
            R.drawable.ic_android,
            R.drawable.ic_android,
            R.drawable.ic_android
    };

    public static void start(Context context){
        Intent i = new Intent(context, IconTextActivity.class);
        context.startActivity(i);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(R.string.action_icon_text_tabs);
        setSupportActionBar(toolbar);

        viewPager = (ViewPager) findViewById(R.id.viewpager);
        setupViewPager(viewPager);
        tabLayout = (TabLayout) findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(viewPager);
        setupTabIcons();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        switch(id) {
            case R.id.action_samples:
                SimpleActivity.start(this);
                overridePendingTransition(0, 0);
                finish();
                break;
            case R.id.action_icon_text:

                break;
            case R.id.action_only_icons:
                OnlyIconsActivity.start(this);
                overridePendingTransition(0, 0);
                finish();
                break;
            case R.id.action_github:
                String url = "https://github.com/cleidimarviana/tabs-material";
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
                startActivity(intent);
                break;
            default:
        }

        return super.onOptionsItemSelected(item);
    }

    private void setupViewPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFrag(new FirstFragment(), getResources().getString(R.string.str_first));
        adapter.addFrag(new SecondFragment(), getResources().getString(R.string.str_second));
        adapter.addFrag(new ThirdFragment(), getResources().getString(R.string.str_third));
        viewPager.setAdapter(adapter);
    }

    class ViewPagerAdapter extends FragmentPagerAdapter {
        private final List<Fragment> mFragmentList = new ArrayList<>();
        private final List<String> mFragmentTitleList = new ArrayList<>();

        public ViewPagerAdapter(FragmentManager manager) {
            super(manager);
        }

        @Override
        public Fragment getItem(int position) {
            return mFragmentList.get(position);
        }

        @Override
        public int getCount() {
            return mFragmentList.size();
        }

        public void addFrag(Fragment fragment, String title) {
            mFragmentList.add(fragment);
            mFragmentTitleList.add(title);
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mFragmentTitleList.get(position);
        }
    }
    private void setupTabIcons() {
        tabLayout.getTabAt(0).setIcon(tabIcons[0]);
        tabLayout.getTabAt(1).setIcon(tabIcons[1]);
        tabLayout.getTabAt(2).setIcon(tabIcons[2]);
    }
}


text:
<title>Ogre::EmbeddedZipArchiveFactory Class Reference - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="doxygen.css">
<link type="text/css" rel="stylesheet" href="tabs.css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Directories

Class List

Class Index

Class Hierarchy

Class Members

Ogre

EmbeddedZipArchiveFactory

Public Types |
Public Member Functions |
Static Public Member Functions |
Static Protected Attributes

Ogre::EmbeddedZipArchiveFactory Class Reference
Resources

Specialisation of ZipArchiveFactory for embedded Zip files.
 More...

#include <OgreZip.h>

Inheritance diagram for Ogre::EmbeddedZipArchiveFactory:

<map name="Ogre_1_1EmbeddedZipArchiveFactory_inherit__map" id="Ogre_1_1EmbeddedZipArchiveFactory_inherit__map">
<area shape="rect" id="node2" href="classOgre_1_1ZipArchiveFactory.html" title="Specialisation of ArchiveFactory for Zip files." alt="" coords="101,160,264,189"/><area shape="rect" id="node4" href="classOgre_1_1ArchiveFactory.html" title="Abstract factory class, archive codec plugins can register concrete subclasses of this..." alt="" coords="109,83,256,112"/><area shape="rect" id="node6" href="classOgre_1_1FactoryObj.html" title="Ogre::FactoryObj\< Archive \>" alt="" coords="5,5,195,35"/><area shape="rect" id="node8" href="classOgre_1_1AllocatedObject.html" title="Superclass for all objects that wish to use custom memory allocators when their new / delete operator..." alt="" coords="219,5,312,35"/></map>
[legend]

List of all members.

Public Types

typedef bool(* 	DecryptEmbeddedZipFileFunc )(size_t pos, void *buf, size_t len)

 	a function type to decrypt embedded zip file

Public Member Functions

 	EmbeddedZipArchiveFactory ()

virtual 	~EmbeddedZipArchiveFactory ()

const String & 	getType (void) const

Archive * 	createInstance (const String &name)

void 	destroyInstance (Archive *arch)

void * 	operator new (size_t sz, const char *file, int line, const char *func)

 	operator new, with debug line info

void * 	operator new (size_t sz)

void * 	operator new (size_t sz, void *ptr)

 	placement operator new

void * 	operator new[] (size_t sz, const char *file, int line, const char *func)

 	array operator new, with debug line info

void * 	operator new[] (size_t sz)

void 	operator delete (void *ptr)

void 	operator delete (void *ptr, void *)

void 	operator delete (void *ptr, const char *, int, const char *)

void 	operator delete[] (void *ptr)

void 	operator delete[] (void *ptr, const char *, int, const char *)

Static Public Member Functions

static void 	addEmbbeddedFile (const String &name, const uint8 *fileData, size_t fileSize, DecryptEmbeddedZipFileFunc decryptFunc)

 	Add an embedded file to the embedded file list.

static void 	removeEmbbeddedFile (const String &name)

 	Remove an embedded file to the embedded file list.

Static Protected Attributes

static zzip_plugin_io_handlers * 	mPluginIo

 	A static pointer to file io alternative implementation for the embedded files.

Detailed Description

Specialisation of ZipArchiveFactory for embedded Zip files.

Definition at line 126 of file OgreZip.h.

Member Typedef Documentation

          typedef bool(* Ogre::EmbeddedZipArchiveFactory::DecryptEmbeddedZipFileFunc)(size_t pos, void *buf, size_t len)

a function type to decrypt embedded zip file

Parameters:

pos	pos in file

buf	current buffer to decrypt

len	- length of buffer

Returns:

success

Definition at line 149 of file OgreZip.h.

Constructor & Destructor Documentation

          Ogre::EmbeddedZipArchiveFactory::EmbeddedZipArchiveFactory
          (
          	)

          virtual Ogre::EmbeddedZipArchiveFactory::~EmbeddedZipArchiveFactory
          (
          	)
           [virtual]

Member Function Documentation

          static void Ogre::EmbeddedZipArchiveFactory::addEmbbeddedFile
          (
          const String &
          name,

          const uint8 *
          fileData,

          size_t
          fileSize,

          DecryptEmbeddedZipFileFunc
          decryptFunc

          )
          	 [static]

Add an embedded file to the embedded file list.

          Archive* Ogre::EmbeddedZipArchiveFactory::createInstance
          (
          const String &
          name	)
           [virtual]

Creates a new object.

Parameters:

name	Name of the object to create

Returns:

An object created by the factory. The type of the object depends on the factory.

Reimplemented from Ogre::ZipArchiveFactory.

Definition at line 137 of file OgreZip.h.

References OGRE_NEW.

          void Ogre::ZipArchiveFactory::destroyInstance
          (
          Archive *
          arch	)
           [virtual, inherited]

Destroys an object which was created by this factory.

Parameters:

ptr	Pointer to the object to destroy

Implements Ogre::FactoryObj< Archive >.

Definition at line 122 of file OgreZip.h.

References OGRE_DELETE.

          const String& Ogre::EmbeddedZipArchiveFactory::getType
          (
          void
          	)
           const [virtual]

Returns the factory type.

Returns:

The factory type.

Reimplemented from Ogre::ZipArchiveFactory.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr	)
           [inherited]

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr,

          void *

          )
          	 [inherited]

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete
          (
          void *
          ptr,

          const char *
          ,

          int
          ,

          const char *

          )
          	 [inherited]

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete[]
          (
          void *
          ptr	)
           [inherited]

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void Ogre::AllocatedObject< Alloc >::operator delete[]
          (
          void *
          ptr,

          const char *
          ,

          int
          ,

          const char *

          )
          	 [inherited]

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz,

          const char *
          file,

          int
          line,

          const char *
          func

          )
          	 [inherited]

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz	)
           [inherited]

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new
          (
          size_t
          sz,

          void *
          ptr

          )
          	 [inherited]

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new[]
          (
          size_t
          sz,

          const char *
          file,

          int
          line,

          const char *
          func

          )
          	 [inherited]

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

          void* Ogre::AllocatedObject< Alloc >::operator new[]
          (
          size_t
          sz	)
           [inherited]

Definition at line 90 of file OgreMemoryAllocatedObject.h.

          static void Ogre::EmbeddedZipArchiveFactory::removeEmbbeddedFile
          (
          const String &
          name	)
           [static]

Remove an embedded file to the embedded file list.

Member Data Documentation

          zzip_plugin_io_handlers* Ogre::EmbeddedZipArchiveFactory::mPluginIo [static, protected]

A static pointer to file io alternative implementation for the embedded files.

Definition at line 130 of file OgreZip.h.

The documentation for this class was generated from the following file:

OgreZip.h

Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Last modified Sun Sep 2 2012 07:27:42


text:
module Vito
  module Commands
    class Install
      def initialize(command_line)
        @command_line = command_line
      end

      def perform
        Vito::DslFile.new(command_line).run
      end

      private

      attr_reader :command_line
    end
  end
end


text:
'use strict';

var request = require('supertest');
var koa = require('../..');

describe('ctx.onerror(err)', function(){
  it('should respond', function(done){
    var app = koa();

    app.use(function *(next){
      this.body = 'something else';

      this.throw(418, 'boom');
    })

    var server = app.listen();

    request(server)
    .get('/')
    .expect(418)
    .expect('Content-Type', 'text/plain; charset=utf-8')
    .expect('Content-Length', '4')
    .end(done);
  })

  it('should unset all headers', function(done){
    var app = koa();

    app.use(function *(next){
      this.set('Vary', 'Accept-Encoding');
      this.set('X-CSRF-Token', 'asdf');
      this.body = 'response';

      this.throw(418, 'boom');
    })

    var server = app.listen();

    request(server)
    .get('/')
    .expect(418)
    .expect('Content-Type', 'text/plain; charset=utf-8')
    .expect('Content-Length', '4')
    .end(function(err, res){
      if (err) return done(err);

      res.headers.should.not.have.property('vary');
      res.headers.should.not.have.property('x-csrf-token');

      done();
    })
  })

  it('should set headers specified in the error', function(done){
    var app = koa();

    app.use(function *(next){
      this.set('Vary', 'Accept-Encoding');
      this.set('X-CSRF-Token', 'asdf');
      this.body = 'response';

      throw Object.assign(new Error('boom'), {
        status: 418,
        expose: true,
        headers: {
          'X-New-Header': 'Value'
        }
      })
    })

    var server = app.listen();

    request(server)
    .get('/')
    .expect(418)
    .expect('Content-Type', 'text/plain; charset=utf-8')
    .expect('X-New-Header', 'Value')
    .end(function(err, res){
      if (err) return done(err);

      res.headers.should.not.have.property('vary');
      res.headers.should.not.have.property('x-csrf-token');

      done();
    })
  })

  describe('when invalid err.status', function(){
    describe('not number', function(){
      it('should respond 500', function(done){
        var app = koa();

        app.use(function *(next){
          this.body = 'something else';
          var err = new Error('some error');
          err.status = 'notnumber';
          throw err;
        })

        var server = app.listen();

        request(server)
        .get('/')
        .expect(500)
        .expect('Content-Type', 'text/plain; charset=utf-8')
        .expect('Internal Server Error', done);
      })
    })

    describe('not http status code', function(){
      it('should respond 500', function(done){
        var app = koa();

        app.use(function *(next){
          this.body = 'something else';
          var err = new Error('some error');
          err.status = 9999;
          throw err;
        })

        var server = app.listen();

        request(server)
        .get('/')
        .expect(500)
        .expect('Content-Type', 'text/plain; charset=utf-8')
        .expect('Internal Server Error', done);
      })
    })
  })

  describe('when non-error thrown', function(){
    it('should response non-error thrown message', function(done){
      var app = koa();

      app.use(function *(next){
        throw 'string error';
      })

      var server = app.listen();

      request(server)
      .get('/')
      .expect(500)
      .expect('Content-Type', 'text/plain; charset=utf-8')
      .expect('Internal Server Error', done);
    })
  })
})


text:
DROP DATABASE IF EXISTS jobs;
CREATE DATABASE jobs;


text:
namespace base {
class DictionaryValue;
class Value;
}  // namespace base

namespace chromeos {
namespace parent_access {

// Configuration used to generate and verify parent access code.
class AccessCodeConfig {
 public:
  // Returns AccessCodeConfig created from a |dictionary|, if the |dictionary|
  // contains valid config data.
  static base::Optional<AccessCodeConfig> FromDictionary(
      const base::DictionaryValue& value);

  // TODO(agawronska): Make constructor private.
  // To create valid AccessCodeConfig:
  // * |shared_secret| cannot be empty
  // * |code_validity| needs to be in between 30s and 3600s
  // * |clock_drift_tolerance| needs to be between 0 and 1800s
  // The above restrictions are applied to AccessCodeConfig policy that is the
  // main source of this configuration.
  AccessCodeConfig(const std::string& shared_secret,
                   base::TimeDelta code_validity,
                   base::TimeDelta clock_drift_tolerance);
  AccessCodeConfig(AccessCodeConfig&&);
  AccessCodeConfig& operator=(AccessCodeConfig&&);
  ~AccessCodeConfig();

  // Secret shared between child and parent devices.
  const std::string& shared_secret() const { return shared_secret_; }

  // Time that access code is valid for.
  base::TimeDelta code_validity() const { return code_validity_; }

  // The allowed difference between the clock on child and parent devices.
  base::TimeDelta clock_drift_tolerance() const {
    return clock_drift_tolerance_;
  }

  // Converts the AccessCodeConfig object to its dictionary equivalent.
  base::Value ToDictionary() const;

 private:
  std::string shared_secret_;
  base::TimeDelta code_validity_;
  base::TimeDelta clock_drift_tolerance_;

  DISALLOW_COPY_AND_ASSIGN(AccessCodeConfig);
};

// Parent access code that can be used to authorize various actions on child
// user's device.
// Typical lifetime of the code is 10 minutes and clock difference between
// generating and validating device is half of the code lifetime. Clock
// difference is accounted for during code validation.
class AccessCode {
 public:
  // To create valid AccessCode:
  // * |code| needs to be 6 characters long
  // * |valid_to| needs to be greater than |valid_from|
  AccessCode(const std::string& code,
             base::Time valid_from,
             base::Time valid_to);
  AccessCode(const AccessCode&);
  AccessCode& operator=(const AccessCode&);
  ~AccessCode();

  // Parent access code.
  const std::string& code() const { return code_; }

  // Code validity start time.
  base::Time valid_from() const { return valid_from_; }

  // Code expiration time.
  base::Time valid_to() const { return valid_to_; }

  bool operator==(const AccessCode&) const;
  bool operator!=(const AccessCode&) const;
  friend std::ostream& operator<<(std::ostream&, const AccessCode&);

 private:
  std::string code_;
  base::Time valid_from_;
  base::Time valid_to_;
};

// Generates and validates parent access codes.
// Does not support timestamp from before Unix Epoch.
class Authenticator {
 public:
  // Granularity of which generation and verification of access code are carried
  // out. Should not exceed code validity period.
  static constexpr base::TimeDelta kAccessCodeGranularity =
      base::TimeDelta::FromMinutes(1);

  explicit Authenticator(AccessCodeConfig config);
  ~Authenticator();

  // Generates parent access code from the given |timestamp|. Returns the code
  // if generation was successful. |timestamp| needs to be greater or equal Unix
  // Epoch.
  base::Optional<AccessCode> Generate(base::Time timestamp) const;

  // Returns AccessCode structure with validity information, if |code| is
  // valid for the given timestamp. |timestamp| needs to be greater or equal
  // Unix Epoch.
  base::Optional<AccessCode> Validate(const std::string& code,
                                      base::Time timestamp) const;

 private:
  // Returns AccessCode structure with validity information, if |code| is valid
  // for the range [|valid_from|, |valid_to|). |valid_to| needs to be greater or
  // equal to |valid_from|. |valid_from| needs to be greater or equal Unix
  // Epoch.
  base::Optional<AccessCode> ValidateInRange(const std::string& code,
                                             base::Time valid_from,
                                             base::Time valid_to) const;

  // Configuration used to generate and validate parent access code.
  const AccessCodeConfig config_;

  // Keyed-hash message authentication generator.
  crypto::HMAC hmac_{crypto::HMAC::SHA1};

  DISALLOW_COPY_AND_ASSIGN(Authenticator);
};

}  // namespace parent_access
}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_PARENT_ACCESS_CODE_AUTHENTICATOR_H_


text:
<menu xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".LecturesActivity">

    <item
        android:id="@+id/action_share"
        android:title="@string/action_share"
        android:orderInCategory="130"
        android:icon="@drawable/ic_share_white"
        app:showAsAction="ifRoom" />

    <item
        android:id="@+id/action_search"
        android:icon="@drawable/ic_search_white"
        android:title="@string/bible_search_title"
        app:actionViewClass="androidx.appcompat.widget.SearchView"
        app:showAsAction="collapseActionView|ifRoom" />

</menu>


text:
define([
// dojo
    'dojo/_base/declare',
// dijit
    'dijit/MenuItem',
// epi-addons
    'epi-forms/widget/SelectorMenuBase',
// resources
    'epi/i18n!epi/cms/nls/episerver.forms.editview'
],
function (
// dojo
    declare,
// dijit
    MenuItem,
// epi-addons
    SelectorMenuBase,
// resources
    resources
) {

    // module:
    //      epi-forms/widget/PlaceHolderSelectorMenu
    // summary:
    //      Token selector menu widget.
    // tags:
    //      public

    return declare([SelectorMenuBase], {

        headingText: resources.selectanitem,

        createMenuItem: function(/*Object*/item){
            // summary:
            //      Create an instance of 'dijit/MenuItem' from the given data object.
            // item: [Object]
            //      Data object that used to build a menu item widget.
            // returns: [Object]
            //      Returns an instance of 'dijit/MenuItem' class.
            // tags:
            //      public, extensions

            return new MenuItem({
                label: item.label,
                onClick: item.onItemSelected
            });
        }

    });

});


text:
var express = require('express');
var router = express.Router();
var passport = require('passport');
var jwt = require('jsonwebtoken');
var User = require('../models/users.js');
var options = {
    secret: 'jswd0fsoknebtokkdfj3298wjkdaslkfjan',
    timeout: 5000
};

//protect router
router.use(function (req, res, next)
{
    if (req.originalUrl == '/users/register' || req.originalUrl == '/users/login') return next();
    var token = req.body.token || req.query.token || req.headers['x-access-token'];
    if (token)
    {
        jwt.verify(token, options.secret, function (err, decoded)
        {
            if (err)
            {
                return res.json({ success: false, message: 'Failed to authenticate token.' });
            } else
            {
                req.decoded = decoded;
                next();
            }
        });

    } else
    {
        return res.status(403).send({
            success: false,
            message: 'No token provided.'
        });

    }
});

/* GET users listing. */
router.get('/', function (req, res) {
    res.send('respond with a resource');
});

router.get('/register', function (req, res)
{
    res.render('partial/register', { title: 'Join Us' });
});
router.post('/register', function (req, res)
{
    User.findOne( {$or: [
            { 'local.email': req.body.email },
            {'local.username': req.body.username}
        ]}, function (err, user)
    {
        if (err) return res.status(500).send(err);
        if (user) return res.status(500).send('The email or username already taken');
        else
        {

            var aUser = new User();

            aUser.local.name = req.body.name;
            aUser.local.email = req.body.email;
            aUser.local.username = req.body.username;
            aUser.local.password = aUser.generateHash(req.body.password);

            aUser.save(function (err)
            {
                if (err) throw err;
                return res.status(200).send('registered');
            });
        }

    });
});

router.get('/login', function (req, res)
{
    res.render('partial/login', { title: 'Login' });
});

router.post('/login', function (req, res){
    //authenticate user then sign it
    User.findOne({ 'local.username': req.body.username }, function (err, user)
    {
        if (err) return res.status(500).send(err);
        if (!user) return res.status(403).send('The username and password you entered did not match!');
        else
        {
            if (user.validPassword(req.body.password))
            {

                var token = jwt.sign({ id: user._id }, options.secret);
                return res.json({
                    success: true,
                    message: 'Welcome!',
                    token: token
                });
            }
            else
                return res.status(403).send('The username and password you entered did not match!');

        }
    });
});

router.post('/check', function (req, res)
{
    res.status(200).send('Ok');
});

router.post('/notify', function (req, res)
{
    var token = req.body.token || req.query.token || req.headers['x-access-token'];
    if (token)
    {
        jwt.verify(token, options.secret, function (err, decoded)
        {
            if (err)
            {
                return res.json({ success: false, message: 'Failed to authenticate token.' });
            } else
            {
                req.decoded = decoded;
                User.findOne({ '_id': decoded.id }, function (err, user)
                {
                    if (!err)
                    {
                        user.local.isOnline = 1;
                        user.save();

                    }

                    User.find({ 'local.isOnline': 1 }, function (err, users)
                    {
                        var resUsers = [];
                        for (var i = 0; i < users.length; i++)
                            resUsers.push({
                                'id': users[i]._id,
                                'name': users[i].local.name,
                                'username': users[i].local.username,
                                'email': users[i].local.email,
                                'isOnline': users[i].local.isOnline,
                            });
                        res.json({ 'onlines': resUsers, 'me': user });
                    }
                    );
                });
            }
        });

    }

});

module.exports = router;


text:
//------------------------------------------------------------------------------
// <copyright file="WindowsFont.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

#if WGCM_TEST_SUITE // Enable tracking when built for the test suites.
#define TRACK_HDC
#define GDI_FONT_CACHE_TRACK
#endif

#if WINFORMS_NAMESPACE
namespace System.Windows.Forms.Internal
#elif DRAWING_NAMESPACE
namespace System.Drawing.Internal
#else
namespace System.Experimental.Gdi
#endif
{
    using System;
    using System.Collections.Generic;
    using System.Internal;
    using System.Diagnostics;
    using System.Drawing;
    using System.Threading;
    using Microsoft.Win32;
    using System.Runtime.Versioning;

    /// <devdoc>
    ///     Keeps a cache of some graphics primitives.
    ///     Created to improve performance of TextRenderer.MeasureText methods that don't receive a WindowsGraphics.
    ///     This class mantains a cache of MRU WindowsFont objects in the process. (See VSWhidbey#301492).
    /// </devdoc>
#if WINFORMS_PUBLIC_GRAPHICS_LIBRARY
    public
#else
    internal
#endif
    class WindowsGraphicsCacheManager
    {
        // From MSDN: Do not specify initial values for fields marked with ThreadStaticAttribute, because such initialization occurs only once,
        // when the class constructor executes, and therefore affects only one thread.

        // WindowsGraphics object used for measuring text based on the screen DC.  TLS to avoid synchronization issues.
        [ThreadStatic]
        private static WindowsGraphics measurementGraphics;

        // Circular list implementing the WindowsFont per-process cache.
        private const int CacheSize = 10;
        [ThreadStatic]
        private static int currentIndex;
        [ThreadStatic]
        private static List<KeyValuePair<Font, WindowsFont>> windowsFontCache;

        /// <devdoc>
        ///     Static constructor since this is a utility class.
        /// </devdoc>
        static WindowsGraphicsCacheManager()
        {
            //

        }

        /// <devdoc>
        ///     Class is never instantiated, private constructor prevents the compiler from generating a default constructor.
        /// </devdoc>
        private WindowsGraphicsCacheManager()
        {
        }

        /// <devdoc>
        ///     Initializes the WindowsFontCache object.
        /// </devdoc>
        private static List<KeyValuePair<Font, WindowsFont>> WindowsFontCache
        {
            get
            {
                if (windowsFontCache == null)
                {
                    currentIndex = -1;
                    windowsFontCache = new List<KeyValuePair<Font, WindowsFont>>(CacheSize);
                }

                return windowsFontCache;
            }
        }

        /// <devdoc>
        ///     Get the cached screen (primary monitor) memory dc.
        ///     Users of this class should always use this property to get the WindowsGraphics and never cache it, it could be mistakenly
        ///     disposed and we would recreate it if needed.
        ///     Users should not dispose of the WindowsGraphics so it can be reused for the lifetime of the thread.
        /// </devdoc>
        public static WindowsGraphics MeasurementGraphics
        {
            [ResourceExposure(ResourceScope.Process)]
            [ResourceConsumption(ResourceScope.Process)]
            get
            {
                if (measurementGraphics == null || measurementGraphics.DeviceContext == null /*object disposed*/)
                {
                    Debug.Assert( measurementGraphics == null || measurementGraphics.DeviceContext != null, "TLS MeasurementGraphics was disposed somewhere, enable TRACK_HDC macro to determine who did it, recreating it for now ..." );
#if TRACK_HDC
                    //Debug.WriteLine( DbgUtil.StackTraceToStr(string.Format("Initializing MeasurementGraphics for thread: [0x{0:x8}]", Thread.CurrentThread.ManagedThreadId)));
                    Debug.WriteLine( DbgUtil.StackTraceToStr("Initializing MeasurementGraphics"));
#endif
                    measurementGraphics = WindowsGraphics.CreateMeasurementWindowsGraphics();
                }

                return measurementGraphics;
            }
        }
#if OPTIMIZED_MEASUREMENTDC
        // in some cases, we dont want to demand create MeasurementGraphics, as creating it has
        // re-entrant side effects.
        internal static WindowsGraphics GetCurrentMeasurementGraphics()
        {
            return measurementGraphics;
        }
#endif

        /// <devdoc>
        ///     Get the cached WindowsFont associated with the specified font if one exists, otherwise create one and
        ///     add it to the cache.
        /// </devdoc>
        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static WindowsFont GetWindowsFont(Font font)
        {
            return GetWindowsFont(font, WindowsFontQuality.Default);
        }

        [ResourceExposure(ResourceScope.Process)]
        [ResourceConsumption(ResourceScope.Process)]
        public static WindowsFont GetWindowsFont(Font font, WindowsFontQuality fontQuality)
        {
            if( font == null )
            {
                return null;
            }

            // First check if font is in the cache.

            int count = 0;
            int index = currentIndex;

            // Search by index of most recently added object.
            while( count < WindowsFontCache.Count )
            {
                if (WindowsFontCache[index].Key.Equals(font))  // don't do shallow comparison, we could miss cloned fonts.
                {
                    // We got a Font in the cache, let's see if we have a WindowsFont with the same quality as required by the caller.

                    // WARNING: It is not expected that the WindowsFont is disposed externally since it is created by this class.
                    Debug.Assert(WindowsFontCache[index].Value.Hfont != IntPtr.Zero, "Cached WindowsFont was disposed, enable GDI_FINALIZATION_WATCH to track who did it!");

                    WindowsFont wf = WindowsFontCache[index].Value;
                    if(wf.Quality == fontQuality)
                    {
                        return wf;
                    }
                }

                index--;
                count++;

                if( index < 0 )
                {
                    index = CacheSize - 1;
                }
            }

            // Font is not in the cache, let's add it.

            WindowsFont winFont = WindowsFont.FromFont(font, fontQuality);
            KeyValuePair<Font, WindowsFont> newEntry = new KeyValuePair<Font, WindowsFont>(font, winFont);

            currentIndex++;

            if (currentIndex == CacheSize)
            {
                currentIndex = 0;
            }

            if (WindowsFontCache.Count == CacheSize)  // No more room, update current index.
            {
                WindowsFont wfont = null;

                // Go through the existing fonts in the cache, and see if any
                // are not in use by a DC.  If one isn't, replace that.  If
                // all are in use, new up a new font and do not cache it.

                bool finished = false;
                int startIndex = currentIndex;
                int loopIndex = startIndex + 1;
                while (!finished) {
                    if (loopIndex >= CacheSize) {
                        loopIndex = 0;
                    }

                    if (loopIndex == startIndex) {
                        finished = true;
                    }

                    wfont = WindowsFontCache[loopIndex].Value;
                    if (!DeviceContexts.IsFontInUse(wfont)) {
                        currentIndex = loopIndex;
                        finished = true;
                        break;
                    }
                    else {
                        loopIndex++;
                        wfont = null;
                    }
                }

                if (wfont != null) {
                    WindowsFontCache[currentIndex] = newEntry;
                    winFont.OwnedByCacheManager = true;

#if GDI_FONT_CACHE_TRACK
                    Debug.WriteLine("Removing from cache: " + wfont);
                    Debug.WriteLine( "Adding to cache: " + winFont );
#endif

                    wfont.OwnedByCacheManager = false;
                    wfont.Dispose();
                }
                else {
                    // do not cache font - caller is ALWAYS responsible for
                    // disposing now.  If it is owned  by the CM, it will not
                    // disposed.

                    winFont.OwnedByCacheManager = false;

#if GDI_FONT_CACHE_TRACK
                    Debug.WriteLine("Creating uncached font: " + winFont);
#endif
                }
            }
            else
            {
                winFont.OwnedByCacheManager = true;
                WindowsFontCache.Add(newEntry);

#if GDI_FONT_CACHE_TRACK
                Debug.WriteLine( "Adding to cache: " + winFont );
#endif
            }
            return winFont;
        }

#if WINFORMS_PUBLIC_GRAPHICS_LIBRARY
        /// The following methods are not needed in production code since the cached objects are meant to be reused and should not be explicitly disposed,
        /// left here for testing purposes.

        /// <devdoc>
        /// </devdoc>
        public static void Reset()
        {
            ResetFontCache();
            ResetMeasurementGraphics();
        }

        /// <devdoc>
        ///     Dispose of all cached WindowsFont objects and reset the collection.
        /// </devdoc>
        public static void ResetFontCache()
        {
            if( WindowsFontCache.Count > 0 )
            {
                for(int index = 0; index < WindowsFontCache.Count; index++ )
                {
                    WindowsFontCache[index].Value.Dispose();
                }

                WindowsFontCache.Clear();
                currentIndex = -1;

#if GDI_FONT_CACHE_TRACK
                Debug.WriteLine( "Font cache reset.  Count: " + WindowsFontCache.Count );
#endif
            }
        }

        /// <devdoc>
        ///     Dispose of cached memory dc.
        /// </devdoc>
        public static void ResetMeasurementGraphics()
        {
            if( measurementGraphics != null )
            {
#if TRACK_HDC
                //Debug.WriteLine( DbgUtil.StackTraceToStr(string.Format("Disposing measurement DC and WG for thread: [0x{0:x8}]", Thread.CurrentThread.ManagedThreadId)));
                Debug.WriteLine( DbgUtil.StackTraceToStr("Disposing measurement DC and WG"));
#endif
                measurementGraphics.Dispose();
                measurementGraphics = null;
            }
        }
#endif
    }

}


text:
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/media/session/media_session_controllers_manager.h"

#include <set>

#include "base/command_line.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/media/session/media_session_controller.h"
#include "content/browser/media/session/media_session_impl.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "media/base/media_content_type.h"
#include "media/base/media_switches.h"
#include "services/media_session/public/cpp/features.h"
#include "services/media_session/public/cpp/test/mock_media_session.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediasession/media_session.mojom.h"

namespace content {

namespace {

std::set<media_session::mojom::MediaSessionAction> GetDefaultActions() {
  return {media_session::mojom::MediaSessionAction::kPlay,
          media_session::mojom::MediaSessionAction::kPause,
          media_session::mojom::MediaSessionAction::kStop,
          media_session::mojom::MediaSessionAction::kSeekTo,
          media_session::mojom::MediaSessionAction::kScrubTo};
}

std::set<media_session::mojom::MediaSessionAction>
AppendPictureInPictureActionsTo(
    std::set<media_session::mojom::MediaSessionAction> actions) {
  actions.insert(
      {media_session::mojom::MediaSessionAction::kEnterPictureInPicture,
       media_session::mojom::MediaSessionAction::kExitPictureInPicture});
  return actions;
}

}  // namespace

class MediaSessionControllersManagerTest
    : public RenderViewHostImplTestHarness,
      public ::testing::WithParamInterface<std::tuple<bool, bool>> {
 public:
  // Indices of the tuple parameters.
  static const int kIsInternalMediaSessionEnabled = 0;
  static const int kIsAudioFocusEnabled = 1;

  void SetUp() override {
    std::vector<base::test::FeatureRef> enabled_features;
    std::vector<base::test::FeatureRef> disabled_features;

    enabled_features.push_back(media::kGlobalMediaControlsPictureInPicture);

    // Based on the parameters, switch them on.
    if (IsInternalMediaSessionEnabled()) {
      enabled_features.push_back(media::kInternalMediaSession);
    } else {
      disabled_features.push_back(media::kInternalMediaSession);
    }

    if (IsAudioFocusEnabled()) {
      enabled_features.push_back(media_session::features::kMediaSessionService);
      enabled_features.push_back(
          media_session::features::kAudioFocusEnforcement);
    } else {
      disabled_features.push_back(
          media_session::features::kMediaSessionService);
      disabled_features.push_back(
          media_session::features::kAudioFocusEnforcement);
    }

    scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features);

    RenderViewHostImplTestHarness::SetUp();

    GlobalRenderFrameHostId frame_routing_id =
        contents()->GetPrimaryMainFrame()->GetGlobalId();
    media_player_id_ = MediaPlayerId(frame_routing_id, 1);
    media_player_id2_ = MediaPlayerId(frame_routing_id, 2);
    manager_ = std::make_unique<MediaSessionControllersManager>(contents());
  }

  MediaSessionImpl* media_session() {
    return MediaSessionImpl::Get(contents());
  }

  bool IsInternalMediaSessionEnabled() const {
    return std::get<kIsInternalMediaSessionEnabled>(GetParam());
  }

  bool IsAudioFocusEnabled() const {
    return std::get<kIsAudioFocusEnabled>(GetParam());
  }

  bool IsMediaSessionEnabled() const {
    return IsInternalMediaSessionEnabled() || IsAudioFocusEnabled();
  }

  void TearDown() override {
    manager_.reset();
    RenderViewHostImplTestHarness::TearDown();
  }

 protected:
  MediaPlayerId media_player_id_ = MediaPlayerId::CreateMediaPlayerIdForTests();
  MediaPlayerId media_player_id2_ =
      MediaPlayerId::CreateMediaPlayerIdForTests();
  std::unique_ptr<MediaSessionControllersManager> manager_;

 private:
  base::test::ScopedFeatureList scoped_feature_list_;
};

TEST_P(MediaSessionControllersManagerTest, ActivateDeactivateSession) {
  ASSERT_FALSE(media_session()->IsActive());

  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);
  manager_->OnMetadata(media_player_id2_, true, false,
                       media::MediaContentType::Transient);
  EXPECT_FALSE(media_session()->IsActive());

  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  EXPECT_EQ(media_session()->IsActive(), IsMediaSessionEnabled());

  // RequestPlay() for the same player has no effect.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  EXPECT_EQ(media_session()->IsActive(), IsMediaSessionEnabled());

  // RequestPlay() for another player should keep the session active until both
  // are stopped.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id2_));
  EXPECT_EQ(media_session()->IsActive(), IsMediaSessionEnabled());

  manager_->OnPause(media_player_id_, true);
  EXPECT_EQ(media_session()->IsActive(), IsMediaSessionEnabled());

  manager_->OnEnd(media_player_id2_);
  EXPECT_FALSE(media_session()->IsActive());
}

TEST_P(MediaSessionControllersManagerTest, RenderFrameDeletedRemovesHost) {
  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  ASSERT_EQ(media_session()->IsActive(), IsMediaSessionEnabled());

  manager_->RenderFrameDeleted(contents()->GetPrimaryMainFrame());
  EXPECT_FALSE(media_session()->IsActive());
}

TEST_P(MediaSessionControllersManagerTest, OnPauseSuspends) {
  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  ASSERT_FALSE(media_session()->IsSuspended());

  manager_->OnPause(media_player_id_, false);
  EXPECT_EQ(media_session()->IsSuspended(), IsMediaSessionEnabled());
}

TEST_P(MediaSessionControllersManagerTest, OnPauseIdNotFound) {
  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  ASSERT_FALSE(media_session()->IsSuspended());

  manager_->OnPause(media_player_id2_, false);
  EXPECT_FALSE(media_session()->IsSuspended());
}

TEST_P(MediaSessionControllersManagerTest, PositionState) {
  // If not enabled, no adds will occur, as RequestPlay returns early.
  if (!IsMediaSessionEnabled())
    return;

  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);

  {
    media_session::test::MockMediaSessionMojoObserver observer(
        *media_session());

    const media_session::MediaPosition expected_position(
        /*playback_rate=*/1.0, /*duration=*/base::TimeDelta(),
        /*position=*/base::TimeDelta(), /*end_of_media=*/false);

    manager_->OnMediaPositionStateChanged(media_player_id_, expected_position);

    EXPECT_TRUE(manager_->RequestPlay(media_player_id_));

    // Media session should be updated with the last received position for that
    // player.
    observer.WaitForExpectedPosition(expected_position);
  }

  {
    auto observer =
        std::make_unique<media_session::test::MockMediaSessionMojoObserver>(
            *media_session());

    media_session::MediaPosition expected_position(
        /*playback_rate=*/0.0, /*duration=*/base::Seconds(10),
        /*position=*/base::TimeDelta(), /*end_of_media=*/false);

    manager_->OnMediaPositionStateChanged(media_player_id_, expected_position);

    // Media session should be updated with the new position.
    observer->WaitForExpectedPosition(expected_position);

    // Replay the current player.
    manager_->OnPause(media_player_id_, true);
    observer =
        std::make_unique<media_session::test::MockMediaSessionMojoObserver>(
            *media_session());
    EXPECT_TRUE(manager_->RequestPlay(media_player_id_));

    // Media session should still see the last received position for that
    // player.
    observer->WaitForExpectedPosition(expected_position);
  }
}

TEST_P(MediaSessionControllersManagerTest, MultiplePlayersWithPositionState) {
  // If not enabled, no adds will occur, as RequestPlay returns early.
  if (!IsMediaSessionEnabled())
    return;

  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);
  manager_->OnMetadata(media_player_id2_, true, false,
                       media::MediaContentType::Transient);

  media_session::MediaPosition expected_position1(
      /*playback_rate=*/1.0, /*duration=*/base::TimeDelta(),
      /*position=*/base::TimeDelta(), /*end_of_media=*/false);
  media_session::MediaPosition expected_position2(
      /*playback_rate=*/0.0, /*duration=*/base::Seconds(10),
      /*position=*/base::TimeDelta(), /*end_of_media=*/false);

  media_session::test::MockMediaSessionMojoObserver observer(*media_session());

  manager_->OnMediaPositionStateChanged(media_player_id_, expected_position1);
  manager_->OnMediaPositionStateChanged(media_player_id2_, expected_position2);

  // If there is exactly one player, media session uses its position.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  observer.WaitForExpectedPosition(expected_position1);

  // If there is more than one player, media session doesn't know about
  // position.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id2_));
  observer.WaitForEmptyPosition();

  // Change the position of the second player.
  media_session::MediaPosition new_position(
      /*playback_rate=*/0.0, /*duration=*/base::Seconds(20),
      /*position=*/base::TimeDelta(), /*end_of_media=*/false);
  manager_->OnMediaPositionStateChanged(media_player_id2_, new_position);

  // Stop the first player.
  manager_->OnPause(media_player_id_, true);

  // There is exactly one player again (the second one). Media session should
  // use its updated position.
  observer.WaitForExpectedPosition(new_position);
}

TEST_P(MediaSessionControllersManagerTest, PictureInPictureAvailability) {
  if (!IsMediaSessionEnabled())
    return;

  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Transient);

  media_session::test::MockMediaSessionMojoObserver observer(*media_session());

  manager_->OnPictureInPictureAvailabilityChanged(media_player_id_, true);
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));

  observer.WaitForExpectedActions(AppendPictureInPictureActionsTo({}));

  manager_->OnPictureInPictureAvailabilityChanged(media_player_id_, false);

  observer.WaitForEmptyActions();
}

TEST_P(MediaSessionControllersManagerTest,
       PictureInPictureAvailabilityMultiplePlayers) {
  if (!IsMediaSessionEnabled())
    return;

  manager_->OnMetadata(media_player_id_, true, false,
                       media::MediaContentType::Persistent);
  manager_->OnMetadata(media_player_id2_, true, false,
                       media::MediaContentType::Persistent);

  media_session::test::MockMediaSessionMojoObserver observer(*media_session());

  manager_->OnPictureInPictureAvailabilityChanged(media_player_id_, true);
  manager_->OnPictureInPictureAvailabilityChanged(media_player_id2_, true);

  // If there is exactly one player, media session uses its Picture-In-Picture
  // availability.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id_));
  observer.WaitForExpectedActions(
      AppendPictureInPictureActionsTo(GetDefaultActions()));

  // If there is more than one player, media session doesn't know about
  // Picture-In-Picture availability.
  EXPECT_TRUE(manager_->RequestPlay(media_player_id2_));
  observer.WaitForExpectedActions(GetDefaultActions());

  // Change the Picture-In-Picture availability of the first player.
  manager_->OnPictureInPictureAvailabilityChanged(media_player_id_, false);

  // Stop the second player.
  manager_->OnPause(media_player_id2_, true);

  // There is exactly one player again (the second one). Media session should
  // use its updated Picture-In-Picture availability.
  observer.WaitForExpectedActions(GetDefaultActions());
}

// First bool is to indicate whether InternalMediaSession is enabled.
// Second bool is to indicate whether AudioFocus is enabled.
INSTANTIATE_TEST_SUITE_P(MediaSessionEnabledTestInstances,
                         MediaSessionControllersManagerTest,
                         ::testing::Combine(::testing::Bool(),
                                            ::testing::Bool()));
}  // namespace content


text:
<?php
/**
 * The template for displaying Comments.
 *
 * The area of the page that contains both current comments
 * and the comment form.
 *
 * @package WordPress
 * @subpackage Nishita
 */
?>

	<?php if ( post_password_required() ) : ?>

<?php _e( 'This post is password protected. Enter the password to view any comments.', 'nishita' ); ?>

	<?php
			/* Stop the rest of comments.php from being processed,
			 * but don't kill the script entirely -- we still have
			 * to fully load the template.
			 */
			return;
		endif;
	?>

	<?php // You can start editing here -- including this comment! ?>

	<?php if ( have_comments() ) : ?>

			<?php
				printf( _n( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'nishita' ),
					number_format_i18n( get_comments_number() ), '' . get_the_title() . '' );
			?>

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

<?php _e( 'Comment navigation', 'nishita' ); ?>

<?php previous_comments_link( __( '← Older Comments', 'nishita' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'nishita' ) ); ?>

		<?php endif; // check for comment navigation ?>

			<?php
				/* Loop through and list the comments. Tell wp_list_comments()
				 * to use nishita_comment() to format the comments.
				 * If you want to overload this in a child theme then you can
				 * define nishita_comment() and that will be used instead.
				 * See nishita_comment() in nishita/functions.php for more.
				 */
				wp_list_comments( array( 'callback' => 'nishita_comment' ) );
			?>

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

<?php _e( 'Comment navigation', 'nishita' ); ?>

<?php previous_comments_link( __( '← Older Comments', 'nishita' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'nishita' ) ); ?>

		<?php endif; // check for comment navigation ?>

	<?php
		/* If there are no comments and comments are closed, let's leave a little note, shall we?
		 * But we don't want the note on pages or post types that do not support comments.
		 */
		elseif ( ! comments_open() ) :
	?>

<?php _e( 'Comments are closed.', 'nishita' ); ?>

	<?php endif; ?>

	<?php comment_form(); ?>


text:
<?php

class Releasr_Repo_ExternalTest extends PHPUnit_Framework_Testcase
{
    public function testHasUnversionedExternalsReturnsFalseWhenThereAreNoExternals()
    {
        $external = new Releasr_Repo_External();
        $external->property = '';

        $result = $external->hasUnversionedExternals();

        $this->assertFalse($result);
    }

    public function testHasUnversionedExternalsReturnsFalseWhenAllExternalsAreVersioned()
    {
        $external = new Releasr_Repo_External();
        $external->property = 'Foo -r1242 http://foo
Bar -r 12424 http://bar';

        $result = $external->hasUnversionedExternals();

        $this->assertFalse($result);
    }

    public function testHasUnversionedExternalsReturnsTrueWhenAnExternalIsNotVersioned()
    {
        $external = new Releasr_Repo_External();
        $external->property = 'Foo http://foo
Bar -r 12424 http://bar';

        $result = $external->hasUnversionedExternals();

        $this->assertTrue($result);
    }
}


text:
package com.opengamma.strata.pricer.impl.credit.isda.e2e;

import java.util.Arrays;

import com.opengamma.analytics.math.MathException;
import com.opengamma.analytics.math.function.Function1D;
import com.opengamma.analytics.math.rootfinding.NewtonRaphsonSingleRootFinder;
import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.pricer.impl.credit.isda.CdsAnalytic;
import com.opengamma.strata.pricer.impl.credit.isda.DoublesScheduleGenerator;
import com.opengamma.strata.pricer.impl.credit.isda.IsdaCompliantCreditCurve;
import com.opengamma.strata.pricer.impl.credit.isda.IsdaCompliantYieldCurve;

/**
 *
 */
public class PortfolioSwapAdjustment {
  // this code has been moved from src/main/java to src/test/java

  private static final NewtonRaphsonSingleRootFinder ROOTFINDER = new NewtonRaphsonSingleRootFinder();

  private final CdsIndexCalculator _pricer;

  /**
   * Default constructor
   */
  public PortfolioSwapAdjustment() {
    _pricer = new CdsIndexCalculator();
  }

  /**
   * Adjust the hazard rates of the credit curves of the individual single names in a index
   * so that the index is priced exactly.  The hazard rates are adjusted on
   * a percentage rather than a absolute bases (e.g. all hazard rates are increased by 1%).
   *
   * @param indexPUF The clean price of the index for unit current notional
   *  (i.e. divide the actual clean price by the current notional)
   * @param indexCDS analytic description of a CDS traded at a certain time
   * @param indexCoupon The coupon of the index (as a fraction)
   * @param yieldCurve The yield curve
   * @param intrinsicData The credit curves of the individual single names making up the index
   * @return credit curve adjusted so they will exactly reprice the index.
   */
  public IntrinsicIndexDataBundle adjustCurves(
      double indexPUF,
      CdsAnalytic indexCDS,
      double indexCoupon,
      IsdaCompliantYieldCurve yieldCurve,
      IntrinsicIndexDataBundle intrinsicData) {

    ArgChecker.isTrue(indexPUF <= 1.0, "indexPUF must be given as a fraction. Value of {} is too high.", indexPUF);
    ArgChecker.notNull(indexCDS, "indexCDS");
    ArgChecker.isTrue(indexCoupon >= 0, "indexCoupon cannot be negative");
    ArgChecker.isTrue(indexCoupon < 10,
        "indexCoupon should be a fraction. The value of {} would be a coupon of {}", indexCoupon, indexCoupon * 1e4);
    ArgChecker.notNull(yieldCurve, "yieldCurve");
    ArgChecker.notNull(intrinsicData, "intrinsicData");

    Function1D<Double, Double> func = getHazardRateAdjFunction(indexPUF, indexCDS, indexCoupon, yieldCurve, intrinsicData);
    double x = ROOTFINDER.getRoot(func, 1.0);
    IsdaCompliantCreditCurve[] adjCC = adjustCurves(intrinsicData.getCreditCurves(), x);
    return intrinsicData.withCreditCurves(adjCC);
  }

  /**
   * Adjust the hazard rates of the credit curves of the individual single names in a index so that
   * the index is priced exactly at multiple terms. The hazard rates are multiplied by a piecewise
   * constant adjuster (e.g. all hazard rates between two index terms are increased by the same percentage).
   * When required extra knots are added to the credit curves, so the adjusted curves returned may contain
   * more knots than the original curves.
   *
   * @param indexPUF The clean prices of the index for unit current notional.
   * @param indexCDS analytic descriptions of the index for different terms
   * @param indexCoupon The coupon of the index (as a fraction)
   * @param yieldCurve The yield curve
   * @param intrinsicData The credit curves of the individual single names making up the index
   * @return credit curve adjusted so they will exactly reprice the index at the different terms.
   */
  public IntrinsicIndexDataBundle adjustCurves(
      double[] indexPUF,
      CdsAnalytic[] indexCDS,
      double indexCoupon,
      IsdaCompliantYieldCurve yieldCurve,
      IntrinsicIndexDataBundle intrinsicData) {

    ArgChecker.notEmpty(indexPUF, "indexPUF");
    ArgChecker.noNulls(indexCDS, "indexCDS");
    int nIndexTerms = indexCDS.length;
    ArgChecker.isTrue(nIndexTerms == indexPUF.length,
        "number of indexCDS ({}) does not match number of indexPUF ({})", nIndexTerms, indexPUF.length);
    if (nIndexTerms == 1) {
      return adjustCurves(indexPUF[0], indexCDS[0], indexCoupon, yieldCurve, intrinsicData);
    }
    ArgChecker.notNull(yieldCurve, "yieldCurve");
    ArgChecker.notNull(intrinsicData, "intrinsicData");
    ArgChecker.isTrue(indexCoupon >= 0, "indexCoupon cannot be negative");
    ArgChecker.isTrue(indexCoupon < 10,
        "indexCoupon should be a fraction. The value of {} would be a coupon of {}", indexCoupon, indexCoupon * 1e4);

    double[] indexKnots = new double[nIndexTerms];
    for (int i = 0; i < nIndexTerms; i++) {
      ArgChecker.isTrue(indexPUF[i] <= 1.0, "indexPUF must be given as a fraction. Value of {} is too high.", indexPUF[i]);
      indexKnots[i] = indexCDS[i].getProtectionEnd();
      if (i > 0) {
        ArgChecker.isTrue(indexKnots[i] > indexKnots[i - 1], "indexCDS must be in assending order of maturity");
      }
    }

    IsdaCompliantCreditCurve[] creditCurves = intrinsicData.getCreditCurves();
    int nCurves = creditCurves.length;
    //we cannot assume that all the credit curves have knots at the same times or that the terms of the indices fall on these knots.
    IsdaCompliantCreditCurve[] modCreditCurves = new IsdaCompliantCreditCurve[nCurves];
    int[][] indexMap = new int[nCurves][nIndexTerms];
    for (int i = 0; i < nCurves; i++) {
      if (creditCurves[i] == null) {
        modCreditCurves[i] = null; //null credit curves correspond to defaulted names, so are ignored
      } else {
        double[] ccKnots = creditCurves[i].getKnotTimes();
        double[] comKnots = DoublesScheduleGenerator.combineSets(ccKnots, indexKnots);
        int nKnots = comKnots.length;
        if (nKnots == ccKnots.length) {
          modCreditCurves[i] = creditCurves[i];
        } else {
          double[] rt = new double[nKnots];
          for (int j = 0; j < nKnots; j++) {
            rt[j] = creditCurves[i].getRT(comKnots[j]);
          }
          modCreditCurves[i] = IsdaCompliantCreditCurve.makeFromRT(comKnots, rt);
        }

        for (int j = 0; j < nIndexTerms; j++) {
          int index = Arrays.binarySearch(modCreditCurves[i].getKnotTimes(), indexKnots[j]);
          if (index < 0) {
            throw new MathException("This should not happen. There is a bug in the logic");
          }
          indexMap[i][j] = index;
        }
      }
    }

    int[] startKnots = new int[nCurves];
    int[] endKnots = new int[nCurves];
    double alpha = 1.0;
    for (int i = 0; i < nIndexTerms; i++) {
      if (i == (nIndexTerms - 1)) {
        for (int jj = 0; jj < nCurves; jj++) {
          if (modCreditCurves[jj] != null) {
            endKnots[jj] = modCreditCurves[jj].getNumberOfKnots();
          }
        }
      } else {
        for (int jj = 0; jj < nCurves; jj++) {
          if (modCreditCurves[jj] != null) {
            endKnots[jj] = indexMap[jj][i] + 1;
          }
        }
      }

      IntrinsicIndexDataBundle modIntrinsicData = intrinsicData.withCreditCurves(modCreditCurves);
      Function1D<Double, Double> func = getHazardRateAdjFunction(indexPUF[i], indexCDS[i], indexCoupon, yieldCurve,
          modIntrinsicData, startKnots, endKnots);
      alpha = ROOTFINDER.getRoot(func, alpha);
      modCreditCurves = adjustCurves(modCreditCurves, alpha, startKnots, endKnots);
      startKnots = endKnots.clone();
    }

    return intrinsicData.withCreditCurves(modCreditCurves);
  }

  private Function1D<Double, Double> getHazardRateAdjFunction(
      double indexPUF,
      CdsAnalytic indexCDS,
      double indexCoupon,
      IsdaCompliantYieldCurve yieldCurve,
      IntrinsicIndexDataBundle intrinsicData) {

    IsdaCompliantCreditCurve[] creditCurves = intrinsicData.getCreditCurves();
    double clean = intrinsicData.getIndexFactor() * indexPUF;
    return new Function1D<Double, Double>() {
      @Override
      public Double evaluate(Double x) {
        IsdaCompliantCreditCurve[] adjCurves = adjustCurves(creditCurves, x);
        return _pricer.indexPV(indexCDS, indexCoupon, yieldCurve, intrinsicData.withCreditCurves(adjCurves)) - clean;
      }
    };
  }

  private Function1D<Double, Double> getHazardRateAdjFunction(
      double indexPUF,
      CdsAnalytic indexCDS,
      double indexCoupon,
      IsdaCompliantYieldCurve yieldCurve,
      IntrinsicIndexDataBundle intrinsicData,
      int[] firstKnots,
      int[] lastKnots) {

    IsdaCompliantCreditCurve[] creditCurves = intrinsicData.getCreditCurves();
    double clean = intrinsicData.getIndexFactor() * indexPUF;
    return new Function1D<Double, Double>() {
      @Override
      public Double evaluate(Double x) {
        IsdaCompliantCreditCurve[] adjCurves = adjustCurves(creditCurves, x, firstKnots, lastKnots);
        return _pricer.indexPV(indexCDS, indexCoupon, yieldCurve, intrinsicData.withCreditCurves(adjCurves)) - clean;
      }
    };
  }

  private IsdaCompliantCreditCurve[] adjustCurves(IsdaCompliantCreditCurve[] creditCurve, double amount) {
    int nCurves = creditCurve.length;
    IsdaCompliantCreditCurve[] adjCurves = new IsdaCompliantCreditCurve[nCurves];
    for (int jj = 0; jj < nCurves; jj++) {
      adjCurves[jj] = adjustCreditCurve(creditCurve[jj], amount);
    }
    return adjCurves;
  }

  private IsdaCompliantCreditCurve adjustCreditCurve(IsdaCompliantCreditCurve creditCurve, double amount) {
    if (creditCurve == null) {
      return creditCurve;
    }
    int nKnots = creditCurve.getNumberOfKnots();
    double[] rt = creditCurve.getRt();
    double[] rtAdj = new double[nKnots];
    for (int i = 0; i < nKnots; i++) {
      rtAdj[i] = rt[i] * amount;
    }
    return IsdaCompliantCreditCurve.makeFromRT(creditCurve.getKnotTimes(), rtAdj);
  }

  private IsdaCompliantCreditCurve[] adjustCurves(
      IsdaCompliantCreditCurve[] creditCurve,
      double amount,
      int[] firstKnots,
      int[] lastknots) {

    int nCurves = creditCurve.length;
    IsdaCompliantCreditCurve[] adjCurves = new IsdaCompliantCreditCurve[nCurves];
    for (int jj = 0; jj < nCurves; jj++) {
      if (creditCurve[jj] == null) {
        adjCurves[jj] = null;
      } else {
        adjCurves[jj] = adjustCreditCurve(creditCurve[jj], amount, firstKnots[jj], lastknots[jj]);
      }
    }
    return adjCurves;
  }

  private IsdaCompliantCreditCurve adjustCreditCurve(
      IsdaCompliantCreditCurve creditCurve,
      double amount,
      int firstKnot,
      int lastKnot) {

    double[] rt = creditCurve.getRt();
    double[] rtAdj = rt.clone();
    for (int i = firstKnot; i < lastKnot; i++) {
      rtAdj[i] = rt[i] * amount;
    }
    return IsdaCompliantCreditCurve.makeFromRT(creditCurve.getKnotTimes(), rtAdj);
  }

}