text:
var web3Utility = require('./js/utility/web3.js');
var config = require('./js/config.js');
var Buffer = web3Utility.Buffer;
var async = require('async');
var cookieUtility = require("./js/utility/cookie.js");
var crypto = require("./js/crypto.js");
var networkUtility = require("./js/utility/network.js");
var ipfsHelper = require("./js/utility/ipfs.js");

//** Globals ** //

var web3 = web3Utility.initWeb3(new Web3(), config.ethProvider, {"network": "kovan", "etherscanApiKey": config.etherscanApiKey});
var ipfs = ipfsHelper.initIpfs(config.ipfsProtocol + "://" + config.ipfsIpAddress, config.ipfsPort);
var registryContract;
var userAccount;
var scanner;
var ownIpfsHash;

//**  ** //

main();

function main() {
    initUi();

    initClickListeners();

    loadData();
}

function initUi() {
    initScanner();
    initProfile();
}

function initProfile() {
    loadTemplate(config.baseUrl + '/html/' + 'profile.ejs', 'profileContainer', {});
    initUserInfo();
}

function initScanner() {
    loadTemplate(config.baseUrl + '/html/' + 'scanner.ejs', 'scannerContainer', {});
}

function initUserInfo() {
    if (userExists()) {
        userAccount = initUserAccount();
        console.log(userAccount.publicKey);
    } else {
        initNewAccount();
    }
    showUserAccountInfo(userAccount);
}

function loadData() {
    async.waterfall([
        loadContract,
        fetchPersona,
        fetchIpfsFile
    ], function (error, result) {
        if (error) {
            showErrorState(error);
        } else {
            populateFormWithPersonaData(result);
        }
    });
}

function beginScanner() {
    scanner = new Instascan.Scanner({ video: document.getElementById('preview'), facingMode: 'environment' });
    scanner.addListener('scan', function (content) {
        console.log(content);
        parseScannedContent(content, function(error, result) {
            if (error) {
                showErrorMessage(error)
            } else {
                var txHash = result.hash;
                showSuccessMessage("Shared data successfully: \n View transaction" )
            }
        });
    });

    Instascan.Camera.getCameras().then(function (cameras) {
        if (cameras.length > 0) {
            // todo fix rear camera issue
            var index = (cameras.length > 1 && cameras[1]) ? 1 : 0;
            console.log(index);

            if (scanner) {
                try {
                    scanner.start(cameras[0]);
                } catch(e) {
                    console.log(e);
                    console.log(e.message);
                }
            }
        } else {
            console.error('No cameras found.');
        }
    }).catch(function (e) {
        console.error(e.message);
    });
}

function parseScannedContent(content, callback) {
    var data = JSON.parse(content);
    if (data.publicKey && data.hash && data.permissions) {
        showAuthorizationDialog(data, function(data) {

            var fileContents = buildFileContents(data.permissions);
            var encryptedData = crypto.encrypt(data.publicKey, userAccount.privateKey, fileContents);

            networkUtility.post(config.identityRouterUrl + "/" + data.hash, {}, {"data": encryptedData}, function (error, response) {
                if (error) {
                    console.error(error);
                    callback(error, undefined);
                } else {
                    console.log(response);
                    callback(undefined, response);
                }
            });
        });
    } else {
        console.log("invalid format");
    }
}

function createRecordInSmartContract(address, ipfsPointer, callback) {
    var key = web3.fromAscii("identity_profile");
    web3Utility.send(web3, registryContract, config.personaRegistryAddress, 'setClaim', [address, key, ipfsPointer, {
        gas: 250000,
        price: config.defaultGasPrice,
        value: 0
    }], userAccount.address, userAccount.privateKey, undefined, function (functionError, result) {
        if (functionError) {
            console.log(functionError);
            callback(functionError, undefined);
        } else {
            console.log(result);
            callback(undefined, result);
        }
    });
}

function stopScanner() {
    if (scanner) {
      scanner.stop();
    }
}

function showAuthorizationDialog(data, callback) {
    var permissionsTableHtml = "
"
    for (var i = 0; i < data.permissions.length; i++) {
        permissionsTableHtml += "
"
        if (data.permissions[i] === "name") {
            permissionsTableHtml += ''
        } else if (data.permissions[i] === "email") {
            permissionsTableHtml += ''
        } else if (data.permissions[i] === "city") {
            permissionsTableHtml += ''
        } else if (data.permissions[i] === "country") {
            permissionsTableHtml += ''
        }
        permissionsTableHtml += "	 	" + data.permissions[i] + "	";
        permissionsTableHtml += "
"
    }
    permissionsTableHtml += "
";

    alertify.confirm("Confirm Transaction",
        "

" + data.name + "
 " +
        "
is requesting access to the following data:
" +
        "
" +
        "
" +
        permissionsTableHtml +
        "
" +
        "
", function (closeEvent) {
            callback(data);
    }, function() {
        showErrorMessage("App not authorized");
    }).set('labels', {ok:'Approve', cancel:'Reject'});

    document.getElementById('alert-icon').style.backgroundImage = 'url(' + blockies.create({
        seed: account.address, size: 8, scale: 16
    }).toDataURL()+')'
}

function showErrorState(error) {

}

function loadTemplate(url, element, data) {
    if ($('#' + element).length) {
        new EJS({url: url}).update(element, data);
    } else {
        console.log(element + ' template found')
    }
}

function showScannerTab() {
    beginScanner();
    $('#scannerContainer').show();
    $('#profileContainer').hide();
}

function showProfileTab() {
    stopScanner();

    $('#scannerContainer').hide();
    $('#profileContainer').show();
}

function userExists() {
    return cookieUtility.readCookie("account");
}

function initUserAccount() {
    return JSON.parse(cookieUtility.readCookie("account"));
}

function initNewAccount() {
    userAccount = web3Utility.createAccount();
    cookieUtility.saveCookie("account", JSON.stringify(userAccount));
}

function showUserAccountInfo(account) {
    $('#user-address').text(account.address);
    $('#user-public-key').text(crypto.createPublicKey(userAccount.privateKey).toString());
    $('#user-private-key').text(account.privateKey);

    document.getElementById('icon').style.backgroundImage = 'url(' + blockies.create({
        seed: account.address, size: 8, scale: 16
    }).toDataURL()+')'
}

function loadContract(callback) {
    web3Utility.loadContract(web3, config.baseUrl, config.personaRegistryContract + ".json", config.personaRegistryAddress,
        function(error, contract) {
        if (error) {
            console.log(error);
            callback(error, undefined);
        } else {
            registryContract = contract;
            callback(null, contract);
        }
    });
}

function fetchPersona(contract, callback) {
    var key = web3.fromAscii("identity_profile");
    web3Utility.callContractFunction(web3, contract, config.personaRegistryAddress, 'getClaim',
        [userAccount.address, userAccount.address, key], function(error, result) {
        if (error) {
            console.log(error);
            callback(error, undefined);
        } else {
            if (result === "0x0000000000000000000000000000000000000000000000000000000000000000") {
                callback(undefined, "");
            } else {
                ownIpfsHash = web3.toAscii(result);
                console.log(ownIpfsHash);
                callback(undefined, ownIpfsHash);
            }
        }
    });
}

function populateFormWithPersonaData(fileContents) {
    console.log(fileContents);
    try {
        var decrypted = JSON.parse(crypto.decrypt(userAccount.privateKey, fileContents));
        for (var field in decrypted) {
            if (decrypted.hasOwnProperty(field)) {
                $('input[name="' + field + '"]').val(decrypted[field]);
            }
        }
    } catch(error) {
        console.log(error);
    }
}

function showNewAccountPrompt(account) {
    var message = "Here is your new Ethereum account: " + account.address +
        "

Please BACKUP the private key for this account: " + account.privateKey +
        "

and DO NOT share it with anybody. ";

    alertify.alert("New Keys Created", message);
}

function initClickListeners() {
    $('#create-button').click(function() {
        createPersona();
    });

    $('#public-key-toggle').click(function() {
        $('#user-public-key').show();
    });

    $('#private-key-toggle').click(function() {
        $('#user-private-key').show();
    });

    $('#tab-scanner').click(function() {
        showScannerTab();
    });

    $('#tab-profile').click(function() {
        showProfileTab();
    });
}

function createPersona() {
    savePersonaForSelf(function(error, result) {
        if (error) {
            showErrorMessage(error);
        } else {
            var txHash = result.txHash;
            showSuccessMessage("Information updated successfully: \n View transaction" )
        }
    });
}

function showErrorMessage(message) {
    alertify.error(message);
}

function showSuccessMessage(message) {
    alertify.success(message);
}

function savePersonaForSelf(callback) {
    var publicKey = crypto.createPublicKey(userAccount.privateKey).toString();
    console.log(publicKey);

    var fileContents = buildFileContents(["name", "email", "city", "country"]);
    var encryptedData = crypto.encrypt(publicKey, userAccount.privateKey, fileContents);

    saveIpfsFile(publicKey + "-" + publicKey, encryptedData, function(error, response) {
        if (error) {
            console.log(error);
            callback(error, undefined);
        } else {
            var ipfsPointer = response[0].hash;

            if (ownIpfsHash !== ipfsPointer) {
                alertify.confirm("Confirm Transaction", "
Save record in smart contract.
" +
                    "
" +
                    "
" +
                    "
From:	 	" + userAccount.address + "
" +
                    "
To:	 	" + config.personaRegistryAddress + "
" +
                    "
Gas Cost:	 	(Estimated) 0.00052 - 0.00172 ETH
" +
                    "
" +
                    "
", function (closeEvent) {
                        createRecordInSmartContract(userAccount.address, ipfsPointer, function (functionError, result) {
                            if (functionError) {
                                console.log(functionError);
                                callback(functionError, undefined);
                            } else {
                                console.log(result);
                                callback(undefined, result);
                            }
                        });
                }, function() {
                    showErrorMessage("Record not created");
                }).set('labels', {ok:'Approve', cancel:'Reject'})
            } else {
                callback(undefined, response);
            }
        }
    });
}

function buildFileContents(fields) {
    var data = {};
    for (var i = 0; i < fields.length; i++) {
        var field = fields[i];
        data[field] = $('input[name="' + field + '"]').val();
    }

    return JSON.stringify(data);
}

function fetchIpfsFile(ipfsPointer, callback) {
    if (!ipfsPointer) {
        callback("No pointer found", undefined);
    } else {
        networkUtility.get(config.ipfsFetchUrl + "/" +  ipfsPointer, {}, function (error, response) {
            if (error) {
                callback(error.message, undefined);
            } else if (response.error) {
                callback(response.error, undefined);
            } else {
                callback(undefined, response);
            }
        })
    }
}

function saveIpfsFile(name, data, callback) {
    ipfsHelper.saveIpfsFile(ipfs, name, data, function(error, response) {
        if (error) {
            callback(error.message, undefined);
        } else {
            callback(undefined, response);
        }
    });
}


text:
'use strict';

angular.module('dashboardApp')
    .factory('Project', function ($resource, DateUtils) {
        return $resource('api/projects/:id', {}, {
            'query': { method: 'GET', isArray: true},
            'get': {
                method: 'GET',
                transformResponse: function (data) {
                    data = angular.fromJson(data);
                    return data;
                }
            },
            'update': { method:'PUT' }
        });
    });

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using NCrontab;

namespace sendash {

    public enum ServiceState {
        SERVICE_STOPPED = 0x00000001,
        SERVICE_START_PENDING = 0x00000002,
        SERVICE_STOP_PENDING = 0x00000003,
        SERVICE_RUNNING = 0x00000004,
        SERVICE_CONTINUE_PENDING = 0x00000005,
        SERVICE_PAUSE_PENDING = 0x00000006,
        SERVICE_PAUSED = 0x00000007,
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct ServiceStatus {
        public long dwServiceType;
        public ServiceState dwCurrentState;
        public long dwControlsAccepted;
        public long dwWin32ExitCode;
        public long dwServiceSpecificExitCode;
        public long dwCheckPoint;
        public long dwWaitHint;
    };

    public partial class Sendash : ServiceBase {
        [DllImport("advapi32.dll", SetLastError = true)]
        private static extern bool SetServiceStatus(IntPtr handle, ref ServiceStatus serviceStatus);
        [DllImport("advapi32.dll", EntryPoint = "QueryServiceStatus", CharSet = CharSet.Auto)]
        internal static extern bool QueryServiceStatus(IntPtr hService, ref ServiceStatus dwServiceStatus);

        //private System.ComponentModel.IContainer components;
        //private System.Diagnostics.EventLog eventLog1;

        public Sendash() {
            InitializeComponent();

            eventLog1 = new System.Diagnostics.EventLog();
            if (!System.Diagnostics.EventLog.SourceExists("Sendash")) {
                System.Diagnostics.EventLog.CreateEventSource("Sendash", "Sendash");
            }
            eventLog1.Source = "Sendash";
            eventLog1.Log = "Sendash";
        }

        protected override void OnStart(string[] args) {
            // Update the service state to Start Pending.
            ServiceStatus serviceStatus = new ServiceStatus();
            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            eventLog1.WriteEntry("In OnStart");

            // Set up a timer to trigger every minute.
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 60000; // 60 seconds
            timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
            timer.Start();

            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }

        protected override void OnStop() {
            eventLog1.WriteEntry("In onStop.");
        }

        public void OnTimer(object sender, System.Timers.ElapsedEventArgs args) {

            eventLog1.WriteEntry("Tick: " + DateTime.Now.ToString(), EventLogEntryType.Information, 501);

            // this will (hopefully) be stored in the registry by another subroutine someplace.
            // we'll need to do some error handling on this in case the Parse() below fails.
            // there's a function called TryParse(), maybe worth looking into
            var CronTabString = "*/10 * * * *"; // every two minutes.

            var Schedule = CrontabSchedule.Parse(CronTabString);
            var NextRun = Schedule.GetNextOccurrence(DateTime.Now);

            if ((NextRun > DateTime.Now) && (NextRun < DateTime.Now.AddMinutes(1))) {
                // WE ARE IN THE ZONE
                // IT IS GO TIME
                // CONQUER, YOU LOUSY BASTARDS

                eventLog1.WriteEntry("Tick matches schedule! (TimeNow: " + DateTime.Now.ToString() + " ; Schedule: " + CronTabString + "; NextRun: " + NextRun.ToString() + ")", EventLogEntryType.Information, 502);

                string PathToInput = Path.GetFullPath(@"c:\sendash\input.txt");

                if (File.Exists(PathToInput)) {

                    eventLog1.WriteEntry("Input File Located (" + PathToInput + ")", EventLogEntryType.Information, 595);

                    string ScriptContents;
                    try {
                        ScriptContents = File.ReadAllText(PathToInput);

                        Runspace runspace = RunspaceFactory.CreateRunspace();
                        runspace.Open();
                        using (PowerShell PowerShellInstance = PowerShell.Create()) {
                            PowerShellInstance.Runspace = runspace;
                            PowerShellInstance.AddScript(ScriptContents);
                            Collection<PSObject> results = PowerShellInstance.Invoke();

                            // Do something with result ...

                            String OutputString = "\n" + ScriptContents + "\n";

                            // loop through each output object item
                            foreach (PSObject outputItem in results) {
                                // if null object was dumped to the pipeline during the script then a null
                                // object may be present here. check for null to prevent potential NRE.
                                if (outputItem != null) {
                                    //TODO: do something with the output item
                                    OutputString += outputItem.BaseObject.GetType().FullName;
                                    OutputString += outputItem.BaseObject.ToString() + "\n";
                                }
                            }

                            eventLog1.WriteEntry("Execution Results: " + OutputString, EventLogEntryType.Information, 600);

                        }
                        runspace.Close();

                    } catch (Exception e) {
                        eventLog1.WriteEntry("The file could not be read (" + PathToInput + ")" + e.Message, EventLogEntryType.Error, 596);
                    }
                }
            }
        }
    }
}


text:
Workflow Executions API . projects . locations

Instance Methods

  workflows()

Returns the workflows Resource.

  close()

Close httplib2 connections.

Method Details

    close()

Close httplib2 connections.


text:
=======================================
GETPROP: exposed property get algorithm
=======================================

Background
==========

Consider the following expression::

  x = y[z]

The following happens compile time:

* ``z`` is parsed as an identifier reference

* ``y`` is parsed as an identifier reference

* ``y[z]`` is parsed as a property accessor (E5 Section 11.2.1)

* When the simple assignment is parsed, the ``y[z]`` compiler knows that
  the property accessor is used as a right-hand-side value, so it emits
  whatever internal bytecode is required to read the property value
  during execution

The following happens run time:

* The compiled code contains the sequence described in E5 Section 11.2.1:

  + ``baseValue = GetValue(y)``, where ``y`` is the identifier reference

  + ``propertyNameValue = GetValue(z)``, where ``z`` is the identifier reference

  + ``CheckObjectCoercible(baseValue)``, which throws a ``TypeError`` if the
    ``baseValue`` is ``null`` or ``undefined``

  + Create a property reference with ``baseValue`` as the base reference and
    ``ToString(propertyNameValue)`` as the property name (and strict flag
    based on current code strictness)

* Call ``GetValue()`` for the property reference.  This results in the
  following sub-steps of E5 Section 8.7.1 to be executed:

  + ``base`` is the result of ``GetValue(y)`` (identifier lookup result
    directly)

  + The referenced name is ``ToString(GetValue(z))`` (identifier lookup
    result with coercion)

  + If ``base`` is not a primitive: use ``[[Get]]`` directly for
    ``base`` and the referenced name

  + Else use a variant for ``[[Get]]``

The ``[[Get]]`` variant for a primitive base is specified explicitly in
E5 Section 8.7.1.  This seems a bit odd, as it seems equivalent to:

* Let ``O`` be ``ToObject(base)``

* Call ``[[Get]]`` for ``O`` and referenced name

However, *this is not the case*.  There is a subtle difference in the case
that the property is an accessor.  Normally the ``this`` binding for the
getter is the object given to ``[[Get]]``.  Here the ``this`` binding is
the *uncoerced primitive value*.

This leads to externally visible behavior, illustrated in the following::

  // add test getter
  Object.defineProperty(String.prototype, 'test', {
    get: function() { print(typeof this); },
    set: function(x) { print(typeof this); },
  });

  "foo".test;  // prints 'string'

  var s = new String("foo");
  s.test;      // prints 'object'

Behavior in ECMAScript implementations seems to vary:

* NodeJS / V8: prints 'string' and 'object' as expected

* Rhino: prints 'object' and 'object'

* Smjs: prints 'object' and 'object'

``GetValue()`` allows the caller to skip creation of the coerced object
(which is one of: a ``Boolean``, a ``Number``, or a ``String``; see E5
Section 9.9, ``ToObject()``).

Note: the replacement ``[[Get]]`` overrides whatever ``[[Get]]`` function
would normally be used for the target object.  For instance, if there were
some primitive-to-object coercion which created an arguments object, the
arguments object exotic ``[[Get]]`` behavior would be skipped.  However,
since the arguments and ``Function`` objects are the only objects with
non-default ``[[Get]]``, this is not an issue in practice.

First draft
===========

When the property accessor is created, the base reference and property
name are "coerced" to a value using ``GetValue()``.  In the example
above, this causes ``x``\ 's and ``foo``\ 's values to be looked up.
These correspond to steps 1-4 of the property accessor expression in
E5 Section 11.2.1.  When compiling, these are converted into whatever
code is necessary to fetch the two values into VM registers.

The relevant part begins after that in steps 5-8, which first perform
some coercions and then create a property accessor.  The accessor is
then acted upon by ``GetValue()``, and ultimately ``[[Get]]`` or its
variant.

Combining all of these, we get the first draft (for base value ``O``
and property name value ``P``):

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original for a possible getter call.)

2. Call ``CheckObjectCoercible`` with ``O`` as argument.  In practice: if
   ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. Let ``O`` be ``ToObject(O)``.
   (This is side effect free.)

5. If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

6. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

7. If ``desc`` is ``undefined``, return ``undefined``.

8. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

9. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

10. If ``orig`` is a ``Function`` object or an ``arguments`` object which
    contains a ``[[ParameterMap]]`` internal property:

    a. (Arguments or Function object exotic behavior.)
       If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
       object, throw a ``TypeError`` exception.

11. Return ``res``.

Notes:

* Steps 2-3 come from the property accessor evaluation rules in E5 Section
  11.2.1.  In particular, ``CheckObjectCoercible()`` is called before the
  key is coerced to a string.  Since the key string coercion may have side
  effects, the order of evaluation matters.

  Note that ``ToObject()`` has no side effects (this can be seen from a
  case by case inspection), so steps 3 and 4 can be reversed.

* Step 4 comes from ``GetValue()``.

* Steps 5 and forward come from ``[[Get]]``; here with exotic behaviors
  inlined, but ``[[GetProperty]]`` not inlined.

We could inline the ``[[GetProperty]]`` call to the algorithm.  However,
because the current implementation doesn't do so, that has been omitted
for now.

Improving type checking of base value
=====================================

A variant where steps 3 and 4 are reversed and expanded is as follows:

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original for a possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part.)

   b. Else if ``O`` is a boolean, a number, or a string, set ``O`` to
      ``ToObject(O)``.

   c. Else if ``O`` is an object, do nothing.

   d. Throw a ``TypeError``.
      (Note that this case should not happen, as steps a-c are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

5. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

6. If ``desc`` is ``undefined``, return ``undefined``.

7. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

8. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

9. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

10. Return ``res``.

Avoiding temporary objects
==========================

If the base value is not an object, step 4 in the above algorithm creates
a temporary object given to ``[[GetProperty]]`` for a property descriptor
lookup.  The first object in the prototype chain is the temporary object,
while the rest are already established non-temporary objects.

If we knew that the property ``P`` could never be an *own property* of the
temporary object, we could skip creation of the temporary object altogether.
Instead, we could simply start ``[[GetProperty]]`` from the internal
prototype that the coerced object would get without actually creating the
object.

Since the coerced object is created by ``ToObject`` from a primitive value,
we know that it is a ``Boolean`` instance, a ``Number`` instance, or a ``String``
instance (see E5 Section 9.9).  The "own properties" of these are:

* ``Boolean``: none

* ``Number``: none

* ``String``: ``"length"`` and index properties for string characters

So, the coercion can be skipped safely for everything except ``String``\ s.
This is unfortunate, because it is conceivably the string primitive value
which is most likely to be accessed through a coercion, e.g. as in::

  var t = "my string";
  print(t.length);

In any case, avoiding temporary creation for everything but ``Strings``
can be worked into the algorithm e.g. as follows:

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original fora possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part.)

   b. If ``O`` is a boolean: set ``O`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``O`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string, set ``O`` to ``ToObject(O)``.

   e. Else if ``O`` is an object, do nothing.

   f. Else, throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

5. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

6. If ``desc`` is ``undefined``, return ``undefined``.

7. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

8. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

9. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

10. Return ``res``.

If we change step 2.d to get the related string value (length or character
of the string) directly, no temporaries need to be created due to coercion.
However, if the property name ``P`` is checked, it needs to be string coerced
which happens only later in step 3.  If we add a separate coercion to step 2.d,
``P`` will be coerced twice unless step 3 is then explicitly skipped; this is
not an issue as the latter coercion is a NOP and can in any case be easily
skipped.

This variant is as follows:

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original for a possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part.)

   b. If ``O`` is a boolean: set ``O`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``O`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string:

      1. Set ``P`` to ``ToString(P)``.
         (This may have side effects if ``P`` is an object.)

      2. If ``P`` is ``length``, return the length of the primitive string
         value as a number.

      3. If ``P`` is a valid array index within the string length, return
         a one-character substring of the primitive string value at the
         specified index.

      4. Else, set ``O`` to the built-in ``String`` prototype object
         (skip creation of temporary)

      5. Goto LOOKUP.  (Avoid double coercion of ``P``.)

   e. Else if ``O`` is an object, do nothing.

   f. Else, throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. **LOOKUP:**
   If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

5. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

6. If ``desc`` is ``undefined``, return ``undefined``.

7. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

8. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

9. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

10. Return ``res``.

Fast path for array indices
===========================

When the property name is a number and a *valid array index*, we'd prefer
to be able to lookup the property without coercing the number to a string.
This "fast path" needs to work for the common cases; rare cases can go
through the ordinary algorithm which requires a ``ToString()`` coercion.

There are many ways to do a (compliant) fast path.  The simple case we're
considering here is the case when the target object has an "own property"
matching the property name (a number).

A simple "shallow fast path" could be:

* If ``P`` is a whole number in the range [0,2**32-2] (a valid array index)
  AND ``O`` has an array part
  AND ``O`` has no conflicting "exotic behaviors", then:

  + Let ``idx`` be the array index represented by ``P``

  + If the array part of ``O`` contains ``idx`` and the key exists,
    read and return the value.  Note that the value can be ``undefined``

* Else use normal algorithm.

Some notes:

* The behavior of the fast path must match the behavior of the normal
  algorithm exactly (including side effects).  This should be the case
  here, but can be verified by simulating the normal algorithm with the
  assumption of a number as a property name, with the target property
  present as an "own data property" of the target object.

* The conflicting exotic behaviors are currently: ``String`` object exotic
  behavior, and arguments object exotic behavior.  Array exotic behaviors
  are not conflicting for read operations.

* A certain key in the array can be defined even if the value is ``undefined``.
  The check is whether the key has been defined, i.e. ``[[HasProperty]]``
  would be true.  Internally, the value "unused" is used to denote unused
  entries with unused keys, while the value "undefined" represents an
  undefined value with a defined key.  For instance, the following defines
  an array key::

    var a = [];
    a[10] = undefined;  // "10" will now enumerate

* The fast path avoids the ``ToString()`` coercion which *may*, in general,
  have side effects (at least for objects).  However, the fast path only
  applies if ``P`` is a number, and the ``ToString()`` coercion of a number
  is side effect free.

* If the array part does *not* contain the key, the normal algorithm is
  always used, regardless of whether the ancestors contain the key or not.
  This means that if a non-existent key is accessed from the array (even
  if the index is within the current array length), string interning will
  be required with this fast path.  For instance::

    var a = [];
    a[0] = 'foo';
    a[2] = 'bar';

    // fast path ok, no string interning
    print(a[0]);

    // fast path fails, string interned but still not found
    print(a[1]);

Inlining the above shallow fast path with the variant which avoids temporaries
altogether produces:

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original for a possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part.)

   b. If ``O`` is a boolean: set ``O`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``O`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string:

      1. Set ``P`` to ``ToString(P)``.
         (This may have side effects if ``P`` is an object.)

      2. If ``P`` is ``length``, return the length of the primitive string
         value as a number.

      3. If ``P`` is a valid array index within the string length, return
         a one-character substring of the primitive string value at the
         specified index.

      4. Else, set ``O`` to the built-in ``String`` prototype object
         (skip creation of temporary)

      5. Goto LOOKUP.  (Avoid double coercion of ``P``.)

   e. Else if ``O`` is an object:

      1. Array fast path: If ``O`` is an object (always true here)
         AND ``P`` is a number and a valid array index (whole number in [0,2**32-2])
         AND ``O`` internal representation has an array part
         AND ``O`` does not have conflicting exotic behaviors (cannot have
         ``String`` or arguments exotic behaviors, may have ``Array``
         behavior), then:

         a. Let ``idx`` be the array index represented by ``P``

         b. If the array part of ``O`` contains ``idx`` and the key exists,
            read and return that value.
            (Note: ``ToString(P)`` is skipped, but it would have no side
            effects as ``P`` is a number.  The ``"caller"`` check for ``P``
            is also skipped, but it would never match because ``P`` is a
            number.)

   f. Else, Throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. **LOOKUP:**
   If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

5. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

6. If ``desc`` is ``undefined``, return ``undefined``.

7. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

8. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

9. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

10. Return ``res``.

We can further improve this by adding a fast path for the case where ``O``
is a primitive string (in step 2.d):

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original fora possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part; the throw is
      unconditional.)

   b. If ``O`` is a boolean: set ``O`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``O`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string:

      1. If ``P`` is a number, is a whole number, a valid array index, and
         within the string length, return a one-character substring of the
         primitive string value at the specified index.
         (Note: ``ToString(P)`` is skipped, but it would have no side
         effects as ``P`` is a number.  The ``"caller"`` check for ``P``
         is also skipped, but it would never match because ``P`` is a
         number.)

      2. Set ``P`` to ``ToString(P)``.
         (This may have side effects if ``P`` is an object.)

      3. If ``P`` is ``length``, return the length of the primitive string
         value as a number.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      4. If ``P`` is a valid array index within the string length, return
         a one-character substring of the primitive string value at the
         specified index.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      5. Else, set ``O`` to the built-in ``String`` prototype object
         (skip creation of temporary)

      6. Goto LOOKUP.  (Avoid double coercion of ``P``.)

   e. Else if ``O`` is an object:

      1. Array fast path: If ``O`` is an object (always true here)
         AND ``P`` is a number and a valid array index (whole number in [0,2**32-2])
         AND ``O`` internal representation has an array part
         AND ``O`` does not have conflicting exotic behaviors (cannot have
         ``String`` or arguments exotic behaviors, may have ``Array``
         behavior), then:

         a. Let ``idx`` be the array index represented by ``P``

         b. If the array part of ``O`` contains ``idx`` and the key exists,
            read and return that value.
            (Note: ``ToString(P)`` is skipped, but it would have no side
            effects as ``P`` is a number.  The ``"caller"`` check for ``P``
            is also skipped, but it would never match because ``P`` is a
            number.)

   f. Else, Throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. **LOOKUP:**
   If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
   internal property:

   a. (Arguments object exotic behavior.) Let ``map`` be the value of
      the ``[[ParameterMap]]`` internal property of the arguments object.

   b. If the result of calling the ``[[GetOwnProperty]]`` internal method
      of ``map`` passing ``P`` as the argument is not ``undefined``:

      1. Return the result of calling the ``[[Get]]`` internal method of
         ``map`` passing ``P`` as the argument.

5. Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

6. If ``desc`` is ``undefined``, return ``undefined``.

7. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

8. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

9. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

10. Return ``res``.

We can also move step 4 (arguments exotic behavior) to step 2.e.  This has
the problem that step 4 assumes ``P`` has been string coerced already.  So,
a duplicate coercion is needed (like for strings):

1. Let ``orig`` be ``O``.
   (Remember the uncoerced original for a possible getter call.)

2. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part; the throw is
      unconditional.)

   b. If ``O`` is a boolean: set ``O`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``O`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string:

      1. If ``P`` is a number, is a whole number, a valid array index, and
         within the string length, return a one-character substring of the
         primitive string value at the specified index.
         (Note: ``ToString(P)`` is skipped, but it would have no side
         effects as ``P`` is a number.  The ``"caller"`` check for ``P``
         is also skipped, but it would never match because ``P`` is a
         number.)

      2. Set ``P`` to ``ToString(P)``.
         (This may have side effects if ``P`` is an object.)

      3. If ``P`` is ``length``, return the length of the primitive string
         value as a number.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      4. If ``P`` is a valid array index within the string length, return
         a one-character substring of the primitive string value at the
         specified index.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      5. Set ``O`` to the built-in ``String`` prototype object
         (skip creation of temporary)

      6. Goto LOOKUP.  (Avoid double coercion of ``P``.)

   e. Else if ``O`` is an object:

      1. Array fast path: If ``O`` is an object (always true here)
         AND ``P`` is a number and a valid array index (whole number in [0,2**32-2])
         AND ``O`` internal representation has an array part
         AND ``O`` does not have conflicting exotic behaviors (cannot have
         ``String`` or arguments exotic behaviors, may have ``Array``
         behavior), then:

         a. Let ``idx`` be the array index represented by ``P``.

         b. If the array part of ``O`` contains ``idx`` and the key exists,
            read and return that value.
            (Note: ``ToString(P)`` is skipped, but it would have no side
            effects as ``P`` is a number.  The ``"caller"`` check for ``P``
            is also skipped, but it would never match because ``P`` is a
            number.)

      2. If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
         internal property:

         a. Set ``P`` to ``ToString(P)``.

         b. (Arguments object exotic behavior.) Let ``map`` be the value of
            the ``[[ParameterMap]]`` internal property of the arguments object.

         c. If the result of calling the ``[[GetOwnProperty]]`` internal method
            of ``map`` passing ``P`` as the argument is not ``undefined``:

            1. Return the result of calling the ``[[Get]]`` internal method of
               ``map`` passing ``P`` as the argument.

         d. Else, goto LOOKUP.  (Avoid double coercion of ``P``.)

   f. Else, Throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. **LOOKUP:**
   Let ``desc`` be the result of calling the ``[[GetProperty]]`` internal
   method of ``O`` with property name ``P``.

5. If ``desc`` is ``undefined``, return ``undefined``.

6. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

7. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``orig`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

8. If ``orig`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

9. Return ``res``.

.. note:: The above is the current "shallow fast path" approach, which has a
          couple of annoying limitations.  For instance, if the array index
          is not used, the key will be coerced to string (regardless of whether
          ancestors have the key or not).  Many improvements are possible;
          these are future work.

Inlining GetProperty
====================

Inlining ``[[GetProperty]]`` (but not ``[[GetOwnProperty]]``),
maintaining the original input value in ``O`` instead of ``orig``,
and using ``curr`` instead of ``O`` otherwise, we get:

1. Check and/or coerce ``O`` as follows:

   a. If ``O`` is ``null`` or ``undefined``, throw a ``TypeError``.
      (This is the ``CheckObjectCoercible`` part; the throw is
      unconditional.)

   b. If ``O`` is a boolean: set ``curr`` to the built-in ``Boolean``
      prototype object (skip creation of temporary)

   c. Else if ``O`` is a number: set ``curr`` to the built-in ``Number``
      prototype object (skip creation of temporary)

   d. Else if ``O`` is a string:

      1. If ``P`` is a number, is a whole number, a valid array index, and
         within the string length, return a one-character substring of the
         primitive string value at the specified index.
         (Note: ``ToString(P)`` is skipped, but it would have no side
         effects as ``P`` is a number.  The ``"caller"`` check for ``P``
         is also skipped, but it would never match because ``P`` is a
         number.)

      2. Set ``P`` to ``ToString(P)``.
         (This may have side effects if ``P`` is an object.)

      3. If ``P`` is ``length``, return the length of the primitive string
         value as a number.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      4. If ``P`` is a valid array index within the string length, return
         a one-character substring of the primitive string value at the
         specified index.
         (Note: The ``"caller"`` check for ``P`` is skipped, but would
         never match.)

      5. Set ``curr`` to the built-in ``String`` prototype object
         (skip creation of temporary)

      6. Goto NEXT.  (Avoid double coercion of ``P``.)

   e. Else if ``O`` is an object:

      1. Set ``curr`` to ``O``.

      2. Array fast path: If ``O`` is an object (always true here)
         AND ``P`` is a number and a valid array index (whole number in [0,2**32-2])
         AND ``O`` internal representation has an array part
         AND ``O`` does not have conflicting exotic behaviors (cannot have
         ``String`` or arguments exotic behaviors, may have ``Array``
         behavior), then:

         a. Let ``idx`` be the array index represented by ``P``.

         b. If the array part of ``O`` contains ``idx`` and the key exists,
            read and return that value.
            (Note: ``ToString(P)`` is skipped, but it would have no side
            effects as ``P`` is a number.  The ``"caller"`` check for ``P``
            is also skipped, but it would never match because ``P`` is a
            number.)

      3. If ``O`` is an ``arguments`` object which contains a ``[[ParameterMap]]``
         internal property:

         a. Set ``P`` to ``ToString(P)``.

         b. (Arguments object exotic behavior.) Let ``map`` be the value of
            the ``[[ParameterMap]]`` internal property of the arguments object.

         c. If the result of calling the ``[[GetOwnProperty]]`` internal method
            of ``map`` passing ``P`` as the argument is not ``undefined``:

            1. Return the result of calling the ``[[Get]]`` internal method of
               ``map`` passing ``P`` as the argument.

         d. Else, goto NEXT.  (Avoid double coercion of ``P``.)

   f. Else, Throw a ``TypeError``.
      (Note that this case should not happen, as steps a-e are exhaustive.
      However, this step is useful as a fallback, and for handling any
      internal types.)

3. Let ``P`` be ``ToString(P)``.
   (This may have side effects if ``P`` is an object.)

4. **NEXT:**
   Let ``desc`` be the result of calling the [[GetOwnProperty]] internal
   method of ``curr`` with property name ``P``.

5. If ``desc`` is ``undefined``:

   a. Let ``curr`` be the value of the ``[[Prototype]]`` internal property
      of ``curr``.

   b. If ``curr`` is not ``null``, goto NEXT.

   c. Return ``undefined``.

6. If ``IsDataDescriptor(desc)`` is ``true``:

   a. Let ``res`` be ``desc.[[Value]]``.

7. Otherwise, ``IsAccessorDescriptor(desc)`` must be ``true``:

   a. Let ``getter`` be ``desc.[[Get]]``.

   b. If ``getter`` is ``undefined``, return ``undefined``.

   c. Else let ``res`` be the result of calling the ``[[Call]]`` internal
      method of ``getter`` providing ``O`` as the ``this`` value and
      providing no arguments.
      (Note: the difference to a basic ``[[Get]]`` is that the getter ``this``
      binding is the original, uncoerced object.)

8. If ``O`` is a ``Function`` object or an ``arguments`` object which
   contains a ``[[ParameterMap]]`` internal property:

   a. (Arguments or Function object exotic behavior.)
      If ``P`` is ``"caller"`` and ``res`` is a strict mode ``Function``
      object, throw a ``TypeError`` exception.

9. Return ``res``.

Final version
=============

(See above.)


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

/**
 * @fileoverview Offline message screen implementation.
 */

login.createScreen('ErrorMessageScreen', 'error-message', function() {
  // Link which starts guest session for captive portal fixing.
  /** @const */ var FIX_CAPTIVE_PORTAL_ID = 'captive-portal-fix-link';

  /** @const */ var FIX_PROXY_SETTINGS_ID = 'proxy-settings-fix-link';

  // Class of the elements which hold current network name.
  /** @const */ var CURRENT_NETWORK_NAME_CLASS =
      'portal-network-name';

  // Link which triggers frame reload.
  /** @const */ var RELOAD_PAGE_ID = 'proxy-error-signin-retry-link';

  // Array of the possible UI states of the screen. Must be in the
  // same order as ErrorScreen::UIState enum values.
  /** @const */ var UI_STATES = [
    ERROR_SCREEN_UI_STATE.UNKNOWN,
    ERROR_SCREEN_UI_STATE.UPDATE,
    ERROR_SCREEN_UI_STATE.SIGNIN,
    ERROR_SCREEN_UI_STATE.SUPERVISED_USER_CREATION_FLOW,
    ERROR_SCREEN_UI_STATE.KIOSK_MODE,
    ERROR_SCREEN_UI_STATE.LOCAL_STATE_ERROR,
    ERROR_SCREEN_UI_STATE.AUTO_ENROLLMENT_ERROR,
    ERROR_SCREEN_UI_STATE.ROLLBACK_ERROR,
  ];

  // The help topic linked from the auto enrollment error message.
  /** @const */ var HELP_TOPIC_AUTO_ENROLLMENT = 4632009;

  // Possible error states of the screen.
  /** @const */ var ERROR_STATE = {
    UNKNOWN: 'error-state-unknown',
    PORTAL: 'error-state-portal',
    OFFLINE: 'error-state-offline',
    PROXY: 'error-state-proxy',
    AUTH_EXT_TIMEOUT: 'error-state-auth-ext-timeout',
    KIOSK_ONLINE: 'error-state-kiosk-online'
  };

  // Possible error states of the screen. Must be in the same order as
  // ErrorScreen::ErrorState enum values.
  /** @const */ var ERROR_STATES = [
    ERROR_STATE.UNKNOWN,
    ERROR_STATE.PORTAL,
    ERROR_STATE.OFFLINE,
    ERROR_STATE.PROXY,
    ERROR_STATE.AUTH_EXT_TIMEOUT,
    ERROR_STATE.KIOSK_ONLINE
  ];

  return {
    EXTERNAL_API: [
      'updateLocalizedContent',
      'onBeforeShow',
      'onBeforeHide',
      'allowGuestSignin',
      'allowOfflineLogin',
      'setUIState',
      'setErrorState',
      'showConnectingIndicator'
    ],

    // Error screen initial UI state.
    ui_state_: ERROR_SCREEN_UI_STATE.UNKNOWN,

    // Error screen initial error state.
    error_state_: ERROR_STATE.UNKNOWN,

    /** @override */
    decorate: function() {
      cr.ui.DropDown.decorate($('offline-networks-list'));
      this.updateLocalizedContent();
    },

    /**
     * Updates localized content of the screen that is not updated via template.
     */
    updateLocalizedContent: function() {
      $('auto-enrollment-offline-message-text').innerHTML =
          loadTimeData.getStringF(
              'autoEnrollmentOfflineMessageBody',
              '',
              '',
              '');
      $('auto-enrollment-learn-more').onclick = function() {
        chrome.send('launchHelpApp', [HELP_TOPIC_AUTO_ENROLLMENT]);
      };

      $('captive-portal-message-text').innerHTML = loadTimeData.getStringF(
        'captivePortalMessage',
        '',
        '',
        '');
      $(FIX_CAPTIVE_PORTAL_ID).onclick = function() {
        chrome.send('showCaptivePortal');
      };

      $('captive-portal-proxy-message-text').innerHTML =
        loadTimeData.getStringF(
          'captivePortalProxyMessage',
          '',
          '');
      $(FIX_PROXY_SETTINGS_ID).onclick = function() {
        chrome.send('openProxySettings');
      };
      $('update-proxy-message-text').innerHTML = loadTimeData.getStringF(
          'updateProxyMessageText',
          '',
          '');
      $('update-proxy-error-fix-proxy').onclick = function() {
        chrome.send('openProxySettings');
      };
      $('signin-proxy-message-text').innerHTML = loadTimeData.getStringF(
          'signinProxyMessageText',
          '',
          '',
          '',
          '');
      $(RELOAD_PAGE_ID).onclick = function() {
        var gaiaScreen = $(SCREEN_GAIA_SIGNIN);
        // Schedules an immediate retry.
        gaiaScreen.doReload();
      };
      $('signin-proxy-error-fix-proxy').onclick = function() {
        chrome.send('openProxySettings');
      };

      $('error-guest-signin').innerHTML = loadTimeData.getStringF(
          'guestSignin',
          '',
          '');
      $('error-guest-signin-link').onclick = this.launchGuestSession_;

      $('error-guest-signin-fix-network').innerHTML = loadTimeData.getStringF(
          'guestSigninFixNetwork',
          '',
          '');
      $('error-guest-fix-network-signin-link').onclick =
          this.launchGuestSession_;

      $('error-offline-login').innerHTML = loadTimeData.getStringF(
          'offlineLogin',
          '',
          '');
      $('error-offline-login-link').onclick = function() {
        chrome.send('offlineLogin');
      };

      var ellipsis = '';
      for (var i = 1; i <= 3; ++i) {
        ellipsis +=
            '.';
      }
      $('connecting-indicator').innerHTML =
          loadTimeData.getStringF('connectingIndicatorText', ellipsis);

      this.onContentChange_();
    },

    /**
     * Event handler that is invoked just before the screen in shown.
     * @param {Object} data Screen init payload.
     */
    onBeforeShow: function(data) {
      cr.ui.Oobe.clearErrors();
      cr.ui.DropDown.show('offline-networks-list', false);
      if (data === undefined)
        return;
      if ('uiState' in data)
        this.setUIState(data['uiState']);
      if ('errorState' in data && 'network' in data)
        this.setErrorState(data['errorState'], data['network']);
      if ('guestSigninAllowed' in data)
        this.allowGuestSignin(data['guestSigninAllowed']);
      if ('offlineLoginAllowed' in data)
        this.allowOfflineLogin(data['offlineLoginAllowed']);
      if ('showConnectingIndicator' in data)
        this.showConnectingIndicator(data['showConnectingIndicator']);
    },

    /**
     * Event handler that is invoked just before the screen is hidden.
     */
    onBeforeHide: function() {
      cr.ui.DropDown.hide('offline-networks-list');
    },

    /**
     * Buttons in oobe wizard's button strip.
     * @type {array} Array of Buttons.
     */
    get buttons() {
      var buttons = [];

      var rebootButton = this.ownerDocument.createElement('button');
      rebootButton.textContent = loadTimeData.getString('rebootButton');
      rebootButton.classList.add('show-with-ui-state-kiosk-mode');
      rebootButton.addEventListener('click', function(e) {
        chrome.send('rebootButtonClicked');
        e.stopPropagation();
      });
      buttons.push(rebootButton);

      var diagnoseButton = this.ownerDocument.createElement('button');
      diagnoseButton.textContent = loadTimeData.getString('diagnoseButton');
      diagnoseButton.classList.add('show-with-ui-state-kiosk-mode');
      diagnoseButton.addEventListener('click', function(e) {
        chrome.send('diagnoseButtonClicked');
        e.stopPropagation();
      });
      buttons.push(diagnoseButton);

      var certsButton = this.ownerDocument.createElement('button');
      certsButton.textContent = loadTimeData.getString('configureCertsButton');
      certsButton.classList.add('show-with-ui-state-kiosk-mode');
      certsButton.addEventListener('click', function(e) {
        chrome.send('configureCertsClicked');
        e.stopPropagation();
      });
      buttons.push(certsButton);

      var continueButton = this.ownerDocument.createElement('button');
      continueButton.id = 'continue-network-config-btn';
      continueButton.textContent = loadTimeData.getString('continueButton');
      continueButton.classList.add('show-with-error-state-kiosk-online');
      continueButton.addEventListener('click', function(e) {
        chrome.send('continueAppLaunch');
        e.stopPropagation();
      });
      buttons.push(continueButton);

      var okButton = this.ownerDocument.createElement('button');
      okButton.id = 'ok-error-screen-btn';
      okButton.textContent = loadTimeData.getString('okButton');
      okButton.classList.add('show-with-ui-state-rollback-error');
      okButton.addEventListener('click', function(e) {
        chrome.send('cancelOnReset');
        e.stopPropagation();
      });
      buttons.push(okButton);

      var spacer = this.ownerDocument.createElement('div');
      spacer.classList.add('button-spacer');
      spacer.classList.add('show-with-ui-state-kiosk-mode');
      buttons.push(spacer);

      var powerwashButton = this.ownerDocument.createElement('button');
      powerwashButton.id = 'error-message-restart-and-powerwash-button';
      powerwashButton.textContent =
        loadTimeData.getString('localStateErrorPowerwashButton');
      powerwashButton.classList.add('show-with-ui-state-local-state-error');
      powerwashButton.addEventListener('click', function(e) {
        chrome.send('localStateErrorPowerwashButtonClicked');
        e.stopPropagation();
      });
      buttons.push(powerwashButton);

      return buttons;
    },

    /**
      * Sets current UI state of the screen.
      * @param {string} ui_state New UI state of the screen.
      * @private
      */
    setUIState_: function(ui_state) {
      this.classList.remove(this.ui_state);
      this.ui_state = ui_state;
      this.classList.add(this.ui_state);

      if (ui_state == ERROR_SCREEN_UI_STATE.LOCAL_STATE_ERROR) {
        // Hide header bar and progress dots, because there are no way
        // from the error screen about broken local state.
        Oobe.getInstance().headerHidden = true;
        $('progress-dots').hidden = true;
      }
      this.onContentChange_();
    },

    /**
      * Sets current error state of the screen.
      * @param {string} error_state New error state of the screen.
      * @param {string} network Name of the current network
      * @private
      */
    setErrorState_: function(error_state, network) {
      this.classList.remove(this.error_state);
      var networkNameElems =
          document.getElementsByClassName(CURRENT_NETWORK_NAME_CLASS);
      for (var i = 0; i < networkNameElems.length; ++i)
        networkNameElems[i].textContent = network;
      this.error_state = error_state;
      this.classList.add(this.error_state);
      this.onContentChange_();
    },

    /* Method called after content of the screen changed.
     * @private
     */
    onContentChange_: function() {
      if (Oobe.getInstance().currentScreen === this)
        Oobe.getInstance().updateScreenSize(this);
    },

    /**
     * Event handler for guest session launch.
     * @private
     */
    launchGuestSession_: function() {
      chrome.send(Oobe.getInstance().isOobeUI() ?
          'launchOobeGuestSession' : 'launchIncognito');
    },

    /**
     * Prepares error screen to show guest signin link.
     * @private
     */
    allowGuestSignin: function(allowed) {
      this.classList.toggle('allow-guest-signin', allowed);
      this.onContentChange_();
    },

    /**
     * Prepares error screen to show offline login link.
     * @private
     */
    allowOfflineLogin: function(allowed) {
      this.classList.toggle('allow-offline-login', allowed);
      this.onContentChange_();
    },

    /**
      * Sets current UI state of the screen.
      * @param {number} ui_state New UI state of the screen.
      * @private
      */
    setUIState: function(ui_state) {
      this.setUIState_(UI_STATES[ui_state]);
    },

    /**
      * Sets current error state of the screen.
      * @param {number} error_state New error state of the screen.
      * @param {string} network Name of the current network
      * @private
      */
    setErrorState: function(error_state, network) {
      this.setErrorState_(ERROR_STATES[error_state], network);
    },

    /**
     * Updates visibility of the label indicating we're reconnecting.
     * @param {boolean} show Whether the label should be shown.
     */
    showConnectingIndicator: function(show) {
      this.classList.toggle('show-connecting-indicator', show);
      this.onContentChange_();
    }
  };
});


text:
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.kaaproject.kaa.common.endpoint.gen;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class ProtocolVersionPair extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ProtocolVersionPair\",\"namespace\":\"org.kaaproject.kaa.common.endpoint.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"version\",\"type\":\"int\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private int id;
   private int version;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use {@link \#newBuilder()}.
   */
  public ProtocolVersionPair() {}

  /**
   * All-args constructor.
   */
  public ProtocolVersionPair(java.lang.Integer id, java.lang.Integer version) {
    this.id = id;
    this.version = version;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return id;
    case 1: return version;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: id = (java.lang.Integer)value$; break;
    case 1: version = (java.lang.Integer)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'id' field.
   */
  public java.lang.Integer getId() {
    return id;
  }

  /**
   * Sets the value of the 'id' field.
   * @param value the value to set.
   */
  public void setId(java.lang.Integer value) {
    this.id = value;
  }

  /**
   * Gets the value of the 'version' field.
   */
  public java.lang.Integer getVersion() {
    return version;
  }

  /**
   * Sets the value of the 'version' field.
   * @param value the value to set.
   */
  public void setVersion(java.lang.Integer value) {
    this.version = value;
  }

  /** Creates a new ProtocolVersionPair RecordBuilder */
  public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder() {
    return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder();
  }

  /** Creates a new ProtocolVersionPair RecordBuilder by copying an existing Builder */
  public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder other) {
    return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder(other);
  }

  /** Creates a new ProtocolVersionPair RecordBuilder by copying an existing ProtocolVersionPair instance */
  public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair other) {
    return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder(other);
  }

  /**
   * RecordBuilder for ProtocolVersionPair instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ProtocolVersionPair>
    implements org.apache.avro.data.RecordBuilder<ProtocolVersionPair> {

    private int id;
    private int version;

    /** Creates a new Builder */
    private Builder() {
      super(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.SCHEMA$);
    }

    /** Creates a Builder by copying an existing Builder */
    private Builder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.version)) {
        this.version = data().deepCopy(fields()[1].schema(), other.version);
        fieldSetFlags()[1] = true;
      }
    }

    /** Creates a Builder by copying an existing ProtocolVersionPair instance */
    private Builder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair other) {
            super(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.version)) {
        this.version = data().deepCopy(fields()[1].schema(), other.version);
        fieldSetFlags()[1] = true;
      }
    }

    /** Gets the value of the 'id' field */
    public java.lang.Integer getId() {
      return id;
    }

    /** Sets the value of the 'id' field */
    public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder setId(int value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /** Checks whether the 'id' field has been set */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }

    /** Clears the value of the 'id' field */
    public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder clearId() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'version' field */
    public java.lang.Integer getVersion() {
      return version;
    }

    /** Sets the value of the 'version' field */
    public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder setVersion(int value) {
      validate(fields()[1], value);
      this.version = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /** Checks whether the 'version' field has been set */
    public boolean hasVersion() {
      return fieldSetFlags()[1];
    }

    /** Clears the value of the 'version' field */
    public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder clearVersion() {
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public ProtocolVersionPair build() {
      try {
        ProtocolVersionPair record = new ProtocolVersionPair();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.Integer) defaultValue(fields()[0]);
        record.version = fieldSetFlags()[1] ? this.version : (java.lang.Integer) defaultValue(fields()[1]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}


text:
{
  return fs.statSync(path.join(__dirname, file)).isDirectory();
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82.h
Label Definition File: CWE36_Absolute_Path_Traversal.label.xml
Template File: sources-sink-82.tmpl.h
*/
/*
 * @description
 * CWE: 36 Absolute Path Traversal
 * BadSource: connect_socket Read data using a connect socket (client side)
 * GoodSource: Full path and file name
 * Sinks: ifstream
 *    BadSink : Open the file named in data using ifstream::open()
 * Flow Variant: 82 Data flow: data passed in a parameter to a virtual method called via a pointer
 *
 * */

#include "std_testcase.h"

#ifndef _WIN32
#include <wchar.h>
#endif

namespace CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82
{

class CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82_base
{
public:
    /* pure virtual function */
    virtual void action(wchar_t * data) = 0;
};

#ifndef OMITBAD

class CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82_bad : public CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82_base
{
public:
    void action(wchar_t * data);
};

#endif /* OMITBAD */

#ifndef OMITGOOD

class CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82_goodG2B : public CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_ifstream_82_base
{
public:
    void action(wchar_t * data);
};

#endif /* OMITGOOD */

}


text:
namespace chrono {
namespace geometry {

/// Geometric object representing a NURBS surface.
class ChApi ChSurfaceNurbs : public ChSurface {
  public:
    ChMatrixDynamic<ChVector<> > points;
    ChMatrixDynamic<> weights;
    ChVectorDynamic<> knots_u;
    ChVectorDynamic<> knots_v;
    int p_u;
    int p_v;

  public:
    /// Constructor. By default, a segment (order = 1, two points on X axis, at -1, +1)
    ChSurfaceNurbs();

    /// Constructor from a given array of control points. Input data is copied.
    /// If the knots are not provided, a uniformly spaced knot vector is made.
    /// If the weights are not provided, a constant weight vector is made.
    ChSurfaceNurbs(int morder_u,  ///< order pu: 1= linear, 2=quadratic, etc.
                   int morder_v,  ///< order pv: 1= linear, 2=quadratic, etc.
                   ChMatrixDynamic<ChVector<> >&
                       mpoints,  ///< control points, size nuxnv. Required: at least nu >= pu+1, same for v
                   ChVectorDynamic<>* mknots_u =
                       0,  ///< knots, size ku. Required ku=nu+pu+1. If not provided, initialized to uniform.
                   ChVectorDynamic<>* mknots_v =
                       0,  ///< knots, size kv. Required ku=nu+pu+1. If not provided, initialized to uniform.
                   ChMatrixDynamic<>* weights = 0  ///< weights, size nuxnv. If not provided, all weights as 1.
    );

    ChSurfaceNurbs(const ChSurfaceNurbs& source);
    ~ChSurfaceNurbs() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChSurfaceNurbs* Clone() const override { return new ChSurfaceNurbs(*this); }

    // virtual int Get_complexity() const override { return points.GetRows(); }

    /// Evaluates a point on the line, given parametric coordinate U.
    /// Parameter U always work in 0..1 range, even if knots are not in 0..1 range.
    /// So if you want to use u' in knot range, use ComputeUfromKnotU().
    /// Computed value goes into the 'pos' reference.
    /// It must be implemented by inherited classes.
    virtual void Evaluate(ChVector<>& pos, const double parU, const double parV) const override;

    /// Evaluates normal
    // virtual void Normal(ChVector<>& dir, const double parU) const override;

    // NURBS specific functions

    /// When using Evaluate() etc. you need U parameter to be in 0..1 range,
    /// but knot range is not necessarily in 0..1. So you can convert u->U,
    /// where u is in knot range, calling this:
    double ComputeUfromKnotU(const double u) const {
        return (u - this->knots_u(0)) / (knots_u(knots_u.GetRows() - 1) - knots_u(0));
    }
    /// When using Evaluate() etc. you need U parameter to be in 0..1 range,
    /// but knot range is not necessarily in 0..1. So you can convert U->u,
    /// where u is in knot range, calling this:
    double ComputeKnotUfromU(const double U) const {
        return U * (knots_u(knots_u.GetRows() - 1) - knots_u(0)) + this->knots_u(0);
    }

    /// When using Evaluate() etc. you need V parameter to be in 0..1 range,
    /// but knot range is not necessarily in 0..1. So you can convert v->V,
    /// where v is in knot range, calling this:
    double ComputeVfromKnotV(const double v) const {
        return (v - this->knots_v(0)) / (knots_v(knots_v.GetRows() - 1) - knots_v(0));
    }
    /// When using Evaluate() etc. you need V parameter to be in 0..1 range,
    /// but knot range is not necessarily in 0..1. So you can convert V->v,
    /// where v is in knot range, calling this:
    double ComputeKnotVfromV(const double V) const {
        return V * (knots_v(knots_v.GetRows() - 1) - knots_v(0)) + this->knots_v(0);
    }

    /// Access the points
    ChMatrixDynamic<ChVector<> >& Points() { return points; }

    /// Access the weights
    ChMatrixDynamic<>& Weights() { return weights; }

    /// Access the U knots
    ChVectorDynamic<>& Knots_u() { return knots_u; }

    /// Access the U knots
    ChVectorDynamic<>& Knots_v() { return knots_v; }

    /// Get the order in u direction
    int GetOrder_u() { return p_u; }

    /// Get the order in v direction
    int GetOrder_v() { return p_v; }

    /// Initial easy setup from a given array of control points. Input data is copied.
    /// If the knots are not provided, a uniformly spaced knot vector is made.
    /// If the weights are not provided, a constant weight vector is made.
    virtual void SetupData(int morder_u,  ///< order pu: 1= linear, 2=quadratic, etc.
                           int morder_v,  ///< order pv: 1= linear, 2=quadratic, etc.
                           ChMatrixDynamic<ChVector<> >&
                               mpoints,  ///< control points, size nuxnv. Required: at least nu >= pu+1, same for v
                           ChVectorDynamic<>* mknots_u =
                               0,  ///< knots u, size ku. Required ku=nu+pu+1. If not provided, initialized to uniform.
                           ChVectorDynamic<>* mknots_v =
                               0,  ///< knots v, size kv. Required ku=nu+pu+1. If not provided, initialized to uniform.
                           ChMatrixDynamic<>* weights = 0  ///< weights, size nuxnv. If not provided, all weights as 1.
    );

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow de-serialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

}  // end namespace geometry

CH_CLASS_VERSION(geometry::ChSurfaceNurbs, 0)

}  // end namespace chrono

#endif


text:
<html>
<head>
  <meta charset="UTF-8">
<<<<<<< HEAD
 <!-- <meta http-equiv="refresh" content="1" /> -->
=======
  <!--meta http-equiv="refresh" content="1" /-->
>>>>>>> 1e91b1c5155cc7e1924a381b113fc877272d39d4
  <script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
<script language="javascript" src="libraries/p5.dom.js"></script>
<script type="text/javascript" src="async.js"></script>
<script language="javascript" src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script>
  <!--<script language="javascript" src="libraries/p5.sound.js"></script>-->
  <script language="javascript" type="text/javascript" src="sketch.js"></script>
  <!-- this line removes any default padding and style. you might only need one of these values set. -->
  <style> body {padding: 0; margin: 0;} </style>
</head>

<body>
</body>
</html>


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

import javax.annotation.Generated;

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

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

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

    private static final MarshallingInfo<String> CONFIGURATIONAGGREGATORNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ConfigurationAggregatorName").build();
    private static final MarshallingInfo<StructuredPojo> FILTERS_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Filters").build();
    private static final MarshallingInfo<Integer> LIMIT_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("Limit").build();
    private static final MarshallingInfo<String> NEXTTOKEN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("NextToken").build();

    private static final DescribeAggregateComplianceByConfigRulesRequestMarshaller instance = new DescribeAggregateComplianceByConfigRulesRequestMarshaller();

    public static DescribeAggregateComplianceByConfigRulesRequestMarshaller getInstance() {
        return instance;
    }

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

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

        try {
            protocolMarshaller.marshall(describeAggregateComplianceByConfigRulesRequest.getConfigurationAggregatorName(), CONFIGURATIONAGGREGATORNAME_BINDING);
            protocolMarshaller.marshall(describeAggregateComplianceByConfigRulesRequest.getFilters(), FILTERS_BINDING);
            protocolMarshaller.marshall(describeAggregateComplianceByConfigRulesRequest.getLimit(), LIMIT_BINDING);
            protocolMarshaller.marshall(describeAggregateComplianceByConfigRulesRequest.getNextToken(), NEXTTOKEN_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
package com.rtg.util.array;

/**
 * Integer array wrapper for read only array
 */
public interface ImmutableIntArray {

  /**
   * Get the underlying value from the array.
   * @param index into the array.
   * @return the value.
   */
  int get(int index);

  /**
   * Get the length of the wrapped array.
   * @return the length of the wrapped array.
   */
  int length();

}


text:
Here comes the description of the process of creation of the "Aurelia-KendoUI Navigation Skeleton" application, in the style like

![](http://i.imgur.com/GpNepSv.png)

***Note that this might be also repeated on other online help sections***

* * *
***Note: all pages from the Intro to KendoUI help section will be augmented***


text:
import React from "react";
import { connect } from "react-redux";
import Radium from "radium";
import _ from "lodash";
import Awesome from "react-fontawesome";
import {Link} from "react-router";
import MaterialTitlePanel from "./material-title-panel-sidebar";
import SidebarItem from "./sidebar-item";

const styles = {
  sidebar: {
    width: 256,
    height: "100%"
  },
  sidebarLink: {
    display: "block",
    padding: "16px 0px 16px 16px",
    color: "#757575",
    textDecoration: "none"
  },
  divider: {
    height: 1,
    backgroundColor: "#757575"
  },
  content: {
    height: "100%",
    backgroundColor: "white"
  }
};

@Radium
class SidebarContentConversation extends React.Component {

  handleClick() {
    if (this.props.onSidebarItemClicked) {
      this.props.onSidebarItemClicked();
    }
  }

  render() {
    return (
      <MaterialTitlePanel
        showHamburger={false}
        title={"Pol.is/"+this.props.conversation_id}
        style={this.props.style ? {...styles.sidebar, ...this.props.style} : styles.sidebar}>

          <SidebarItem
            to="/"
            selected={false}
            icon="chevron-left"
            text="All Conversations"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id}
            selected={this.props.routes[2] && !this.props.routes[2].path}
            icon="gears"
            text="Configure"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/live"}
            selected={this.props.routes[2] && this.props.routes[2].path === "live"}
            icon="heartbeat"
            text="See it"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/share"}
            selected={this.props.routes[2] && this.props.routes[2].path === "share"}
            icon="code"
            text="Share & Embed"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/comments"}
            selected={this.props.routes[2] && this.props.routes[2].path === "comments"}
            icon="comments"
            text="Comments"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/participants"}
            selected={this.props.routes[2] && this.props.routes[2].path === "participants"}
            icon="users"
            text="Participants"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/summary"}
            selected={this.props.routes[2] && this.props.routes[2].path === "summary"}
            icon="list-alt"
            text="Summary"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/stats"}
            selected={this.props.routes[2] && this.props.routes[2].path === "stats"}
            icon="area-chart"
            text="Stats"/>
          <SidebarItem
            to={"/m/"+this.props.conversation_id+"/export"}
            selected={this.props.routes[2] && this.props.routes[2].path === "export"}
            icon="cloud-download"
            text="Data Export"/>

            <Awesome name="align-left"/>Docs

            <Awesome style={{color: "#4099FF"}} name="twitter"/>@UsePolis

          <Link
            style={styles.sidebarLink}
            to={"/signout"}>
            <Awesome name="sign-out"/>
            Sign Out
          </Link>

      </MaterialTitlePanel>
    );
  }
}

export default SidebarContentConversation;

//

//   <Link to="/">
//     <Awesome name="chevron-left" style={{fontSize: 24, cursor: "pointer"}}/>
//     <Awesome name="home" style={{fontSize: 24, cursor: "pointer"}}/>
//   </Link>
//

//

//   Conversation Admin
//

//
//   {"pol.is/"+this.props.conversation_id}
//


text:
require 'ec2/amitools/crypto'
require 'ec2/amitools/exception'
require 'ec2/amitools/deletebundleparameters'
require 'net/https'
require 'rexml/document'
require 'tempfile'
require 'uri'
require 'ec2/common/s3support'
require 'ec2/amitools/tool_base'

DELETE_BUNDLE_NAME = 'ec2-delete-bundle'

#------------------------------------------------------------------------------#

DELETE_BUNDLE_MANUAL=<<TEXT
#{DELETE_BUNDLE_NAME} is a command line tool to delete a bundled Amazon Image from S3 storage.
An Amazon Image may be one of the following:
- Amazon Machine Image (AMI)
- Amazon Kernel Image (AKI)
- Amazon Ramdisk Image (ARI)

#{DELETE_BUNDLE_NAME} will delete a bundled AMI specified by either its manifest file or the
prefix of the bundled AMI filenames.

#{DELETE_BUNDLE_NAME} will:
- delete the manifest and parts from the s3 bucket
- remove the bucket if and only if it is empty and you request its deletion
TEXT

#------------------------------------------------------------------------------#

RETRY_WAIT_PERIOD = 5

#------------------------------------------------------------------------------#

class DeleteFileError < AMIToolExceptions::EC2FatalError
  def initialize(file, reason)
    super(5,"Could not delete file '#{file}': #{reason}")
  end
end

class BundleDeleter < AMITool
  #----------------------------------------------------------------------------#

  # Delete the specified file.
  def delete(bucket, key, retry_delete)
    retry_s3(retry_delete) do
      begin
        response = @s3_conn.delete(bucket, key)
        return if response.success?
        raise "HTTP DELETE returned #{response.code}"
      rescue => e
        raise TryFailed.new("Failed to delete \"#{key}\": #{e.message}")
      end
    end
  end

  #----------------------------------------------------------------------------#

  # Return a list of bundle part filenames from the manifest.
  def get_part_filenames(manifest)
    parts = []
    manifest_doc = REXML::Document.new(manifest).root
    REXML::XPath.each(manifest_doc, 'image/parts/part/filename/text()') do |part|
      parts << part.to_s
    end
    return parts
  end

  #------------------------------------------------------------------------------#

  def uri2string(uri)
    s = "#{uri.scheme}://#{uri.host}:#{uri.port}#{uri.path}"
    # Remove the trailing '/'.
    return (s[-1..-1] == "/" ? s[0..-2] : s)
  end

  #------------------------------------------------------------------------------#

  def get_file_list_from_s3(bucket, keyprefix, prefix)
    s3prefix = keyprefix+prefix
    files_to_delete = []
    response = @s3_conn.list_bucket(bucket, s3prefix)
    unless response.success?
      raise "unable to list contents of bucket #{bucket}: HTTP #{response.code} response: #{response.body}"
    end
    REXML::XPath.each(REXML::Document.new(response.body), "//Key/text()") do |entry|
      entry = entry.to_s
      if entry[0,s3prefix.length] == s3prefix
        test_str = entry[(s3prefix.length)..-1]
        if (test_str =~ /^\.part\.[0-9]+$/ or
            test_str =~ /^\.manifest(\.xml)?$/)
          files_to_delete << entry[(keyprefix.length)..-1]
        end
      end
    end
    files_to_delete
  end

  #------------------------------------------------------------------------------#

  def make_s3_connection(s3_url, user, pass, method)
    EC2::Common::S3Support.new(s3_url, user, pass, method, @debug)
  end

  #------------------------------------------------------------------------------#

  def delete_bundle(url, bucket, keyprefix, user, pass, manifest, prefix, yes, clear, retry_stuff)
    begin
      # Get the S3 URL.
      s3_uri = URI.parse(url)
      s3_url = uri2string(s3_uri)
      retry_delete = retry_stuff
      v2_bucket = EC2::Common::S3Support::bucket_name_s3_v2_safe?(bucket)
      @s3_conn = make_s3_connection(s3_url, user, pass, (v2_bucket ? nil : :path))

      files_to_delete = []

      if manifest
        # Get list of files to delete from the AMI manifest.
        xml = String.new
        manifest_path = manifest
        File.open(manifest_path) { |f| xml << f.read }
        files_to_delete << File::basename(manifest)
        get_part_filenames( xml ).each do |part_info|
          files_to_delete << part_info
        end
      else
        files_to_delete = get_file_list_from_s3(bucket, keyprefix, prefix)
      end

      if files_to_delete.empty?
        $stdout.puts "No files to delete."
      else
        $stdout.puts "Deleting files:"
        files_to_delete.each { |file| $stdout.puts("   - #{file}") }
        continue = yes
        unless continue
          begin
            $stdout.print "Continue [y/N]: "
            $stdout.flush
            Timeout::timeout(PROMPT_TIMEOUT) do
              continue = gets.strip =~ /^y/i
            end
          rescue Timeout::Error
            $stdout.puts "\nNo response given, skipping the files."
            continue = false
          end
        end
        if continue
          files_to_delete.each do |file|
            delete(bucket, keyprefix+file, retry_delete)
            $stdout.puts "Deleted #{file}"
          end
        end
      end

      if clear
        $stdout.puts "Attempting to delete bucket #{bucket}..."
        @s3_conn.delete(bucket)
      end
    rescue EC2::Common::HTTP::Error => e
      $stderr.puts e.backtrace if @debug
      raise S3Error.new(e.message)
    end
    $stdout.puts "#{DELETE_BUNDLE_NAME} complete."
  end

  #------------------------------------------------------------------------------#
  # Overrides
  #------------------------------------------------------------------------------#

  def get_manual()
    DELETE_BUNDLE_MANUAL
  end

  def get_name()
    DELETE_BUNDLE_NAME
  end

  def main(p)
    delete_bundle(p.url,
                  p.bucket,
                  p.keyprefix,
                  p.user,
                  p.pass,
                  p.manifest,
                  p.prefix,
                  p.yes,
                  p.clear,
                  p.retry)
  end

end

#------------------------------------------------------------------------------#
# Script entry point. Execute only if this file is being executed.
if __FILE__ == $0
  BundleDeleter.new().run(DeleteBundleParameters)
end