text:
function varargout = volCond_gui(varargin)
% VOLCOND_GUI MATLAB code for volCond_gui.fig
%      VOLCOND_GUI, by itself, creates a new VOLCOND_GUI or raises the existing
%      singleton*.
%
%      H = VOLCOND_GUI returns the handle to a new VOLCOND_GUI or the handle to
%      the existing singleton*.
%
%      VOLCOND_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in VOLCOND_GUI.M with the given input arguments.
%
%      VOLCOND_GUI('Property','Value',...) creates a new VOLCOND_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before volCond_gui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to volCond_gui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help volCond_gui

% Last Modified by GUIDE v2.5 19-Apr-2015 07:57:27

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @volCond_gui_OpeningFcn, ...
                   'gui_OutputFcn',  @volCond_gui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before volCond_gui is made visible.
function volCond_gui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to volCond_gui (see VARARGIN)

% Choose default command line output for volCond_gui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes volCond_gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
global rQ Q thetaR NRanP sigma Id

% rQ = [0,0, get(handles.rQSlider, 'Value')] * 0.092;
rQ = [0,0, get(handles.rQSlider, 'Value')];
QAngle = get(handles.QAngleSlider, 'Value');
Q = [0,sind(QAngle), cosd(QAngle)];

sigma = 0.33; set(handles.sSigma, 'String', num2str(sigma));
Id    = 10.0e-9; set(handles.sId, 'String', num2str(Id/1e-9));

set(handles.sQAngle, 'String', get(handles.QAngleSlider, 'Value'));
set(handles.srQ, 'String', get(handles.rQSlider, 'Value'));

thetaR = 1; set(handles.sThetaRanRad, 'String', num2str(thetaR));
NRanP = 50; set(handles.sNRangePoints, 'String', num2str(NRanP));

set( gcf, 'toolbar', 'figure' )

bShowCurrents_Callback(hObject, eventdata, handles)
% This has to be run explicitly (despite it already being at the end of
% bShowCurrents_Callback). Seems like there's something fishy about ML's
% initialisation, helps re-running the first time? Works anyway...
drawFieldPlots(handles)

function drawFieldPlots(handles)
global sigma Id rQ Q bShowCurrents

M=Id/(4*pi*sigma);
% axes(handles.axes1); cla
plotSphField('infiniteSpace', rQ, Q, 1, M, bShowCurrents,handles.axes1)
% infiniteSpace_BCK(rQ, Q, plot_streams)
% axes(handles.axes2); cla
% homogSphere_BCK(rQ, Q, plot_streams)
plotSphField('homogSphere', rQ, Q, 1, M, bShowCurrents, handles.axes2)
set(handles.axes1, 'ButtonDownFcn', {@axes1_ButtonDownFcn,handles});
set(handles.axes2, 'ButtonDownFcn', {@axes2_ButtonDownFcn,handles});
% set(handles.axes1, 'PickableParts', 'all');
% set(handles.axes2, 'PickableParts', 'all');

% --- Outputs from this function are returned to the command line.
function varargout = volCond_gui_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on slider movement.
function rQSlider_Callback(hObject, eventdata, handles)
% hObject    handle to rQSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global rQ
rQ = [0,0, round(get(handles.rQSlider, 'Value')*100)/100];
set(handles.srQ, 'String', rQ(3));

drawFieldPlots(handles)

% axes(handles.axes1); cla
% infiniteSpace(rQ,Q,0)
% axes(handles.axes2); cla
% homogSphere(rQ,Q,0)
% set(handles.axes1, 'ButtonDownFcn', {@axes1_ButtonDownFcn,handles});
% set(handles.axes2, 'ButtonDownFcn', {@axes2_ButtonDownFcn,handles});

% --- Executes during object creation, after setting all properties.
function rQSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to rQSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on slider movement.
function QAngleSlider_Callback(hObject, eventdata, handles)
% hObject    handle to QAngleSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global rQ Q
QAngle = round(get(handles.QAngleSlider, 'Value'));
set(handles.sQAngle, 'String', num2str(QAngle));
Q = [0,sind(QAngle), cosd(QAngle)];

drawFieldPlots(handles)

% --- Executes during object creation, after setting all properties.
function QAngleSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to QAngleSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

function sQAngle_Callback(hObject, eventdata, handles)
% hObject    handle to sQAngle (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sQAngle as text
%        str2double(get(hObject,'String')) returns contents of sQAngle as a double
QAngle = round(str2double(get(handles.sQAngle, 'String')));
set(handles.QAngleSlider, 'Value', QAngle);
QAngleSlider_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function sQAngle_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sQAngle (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function srQ_Callback(hObject, eventdata, handles)
% hObject    handle to srQ (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of srQ as text
%        str2double(get(hObject,'String')) returns contents of srQ as a double

% --- Executes during object creation, after setting all properties.
function srQ_CreateFcn(hObject, eventdata, handles)
% hObject    handle to srQ (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in bSelRange.
function bSelRange_Callback(hObject, eventdata, handles)
% hObject    handle to bSelRange (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of bSelRange
global range_points
range_points = [];

% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
axes2_ButtonDownFcn(hObject, eventdata, handles)

% --- Executes on mouse press over axes background.
function axes2_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axes2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global range_points thetaR NRanP rQ Q Id sigma bShowCurrents

clear coordinates
coordinates = get(hObject,'CurrentPoint');

cols = ['b','r'];
linestyle = '-';

M=Id/(4*pi*sigma);

if get(handles.bSelLinRange,'Value') > 0 || ...
     get(handles.bSelThetaRange,'Value') > 0 % select range ON

    % if theta-range, fix to sphere!
    if get(handles.bSelThetaRange,'Value') > 0
         R = sqrt(dot(coordinates(1,1:2), coordinates(1,1:2)));
         coordinates(1,1:2) = coordinates(1,1:2)/R * thetaR;
         linestyle = 'none';
    end
    range_points = [range_points; coordinates(1,1:2)];
    for ii = 1:2,
        curax = eval(['handles.axes' num2str(ii)]);
        if size(range_points,1) == 1
            if bShowCurrents
                Nstreams = 15; % hard-coded here from plotSphField.m!
                to_delete = (ii+2) + Nstreams ;% left are arrow, circle (line) & contour + currents
            else
                to_delete = (ii+2);% arrow, circle (line) & contour
            end
            children = get(curax,'Children');
            for jj = 1:length(children)-to_delete
%             for jj = 1:length(children)-(2) % left are contour & circle!
                delete(children(jj))
            end
        end
        plot(curax,range_points(:,1), range_points(:,2),'md',...
            'LineWidth',2,'MarkerSize',10,'MarkerFaceColor','m',...
            'LineStyle',linestyle);

    end

    if size(range_points,1) > 1,

        for ii = 1:2,
            curax = eval(['handles.axes' num2str(ii)]);

            % if theta-range, fix to sphere!
            if get(handles.bSelThetaRange,'Value') > 0
                % these are -pi -> pi
                Th = atan2(range_points(:,2), range_points(:,1));
                % convert -pi/2 -> 2/3 pi, then re-wrap
                Th(Th<0) = Th(Th<0) + 2*pi;
                Th = Th + pi/2;
                Th(Th>2*pi) = Th(Th>2*pi) - 2*pi;

                Th_start = min(Th) - pi/2;
                Th_stop = max(Th) - pi/2;
                Th_step = (Th_stop-Th_start) / NRanP;
                theta = [Th_start:Th_step:Th_stop];
                %theta = linspace(Th_start,Th_stop,nTheta);
                plot(curax, thetaR*cos(theta), thetaR*sin(theta), ...
                    'Color','m', ...
                    'LineWidth', 2, 'Hittest', 'off',...
                    'LineStyle','-.');
                Y = cos(fliplr(theta)); Z = sin(fliplr(theta));
%                 x = pi/2-Th_stop:Th_step:pi/2-Th_start;
                x = (pi/2-fliplr(theta))/(2*pi)*360;
                xlab = 'Theta (degrees)';
            elseif get(handles.bSelLinRange,'Value') > 0
                Y = linspace(range_points(1,1), range_points(2,1), NRanP);
                Z = linspace(range_points(1,2), range_points(2,2), NRanP);
                x = sqrt((Y-range_points(1,1)).^2 + (Z-range_points(1,2)).^2);
                xlab = 'Distance on line (a.u.)';
            end
            figure(101); clf; hold on; grid on
            V_is = infiniteSpace(rQ, Q, thetaR, M, Y, Z);
            V_hs = homogSphere(rQ, Q, thetaR, M, Y, Z);
            range_rad = sqrt(Y.^2 + Z.^2);
            V_hs(range_rad > 1) = 0;
            %V = calc_field(src_vec, sig, X, Y);
            %d = sqrt(X.^2 + Y.^2);
            plot(x, 1e9*V_is, 'Color', [0 0.4470 0.7410], 'Linewidth', 2);
            plot(x, 1e9*V_hs, 'Color', [0.8500 0.3250 0.0980], 'Linewidth', 2);
            hl = legend('infiniteSpace','homogSphere', 'Location', 'best');
            set(hl,'FontSize',14);
            xlabel(xlab)
            ylabel('Electric potential (nV)')
            set(gca, 'FontSize', 14)
        end
        range_points = [];
        set(handles.bSelLinRange,'Value',0)
        set(handles.bSelThetaRange,'Value',0)
    end
end

% --- Executes on button press in bSelLinRange.
function bSelLinRange_Callback(hObject, eventdata, handles)
% hObject    handle to bSelLinRange (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of bSelLinRange
global range_points
range_points = [];

% --- Executes on button press in bSelThetaRange.
function bSelThetaRange_Callback(hObject, eventdata, handles)
% hObject    handle to bSelThetaRange (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of bSelThetaRange
global range_points
range_points = [];

function sThetaRanRad_Callback(hObject, eventdata, handles)
% hObject    handle to sThetaRanRad (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sThetaRanRad as text
%        str2double(get(hObject,'String')) returns contents of sThetaRanRad as a double
global thetaR
thetaR = str2num(get(handles.sThetaRanRad, 'String'));

function sNRangePoints_Callback(hObject, eventdata, handles)
% hObject    handle to sNRangePoints (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sNRangePoints as text
%        str2double(get(hObject,'String')) returns contents of sNRangePoints as a double
global NRanP
NRanP = str2num(get(handles.sNRangePoints, 'String'));

function sSigma_Callback(hObject, eventdata, handles)
% hObject    handle to sSigma (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sSigma as text
%        str2double(get(hObject,'String')) returns contents of sSigma as a double
global sigma
sigma = str2double(get(handles.sSigma, 'String'));
rQSlider_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function sSigma_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sSigma (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function sId_Callback(hObject, eventdata, handles)
% hObject    handle to sId (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of sId as text
%        str2double(get(hObject,'String')) returns contents of sId as a double
global Id
Id = 1e-9 * str2double(get(handles.sId, 'String'));
rQSlider_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function sId_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sId (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in bShowCurrents.
function bShowCurrents_Callback(hObject, eventdata, handles)
% hObject    handle to bShowCurrents (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of bShowCurrents
global bShowCurrents

bShowCurrents = get(handles.bShowCurrents,'Value');
drawFieldPlots(handles)


text:
import os
import sys
import random
import string

LOOPS_COUNT = 100000

strings_dict = dict()
for i in range(0, LOOPS_COUNT):
    random_str = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(3)])
    if strings_dict.get(random_str, None) != None:
        strings_dict[random_str] += 1
    else:
         strings_dict[random_str] = 1

#for str in strings_dict:
    #print "String is %s,%d" % ( str, strings_dict[str])

redpajama_set_name: RedPajamaGithub


text:
@import 'part:@lyra/base/theme/variables-style';

.root {
  display: block;
  height: 100vh;
  width: 100vw;
  overflow-y: auto;
  color: var(--body-text);
}

.title {
  margin: 0;
  background-color: var(--state-danger-color);
  font-size: var(--font-size-large);
  padding: var(--large-padding);
  color: var(--state-danger-color--text);
}

.list {
  display: block;
  margin: 0;
  padding: 0;
  padding: var(--large-padding);
}

.path {
  font-size: var(--font-size-large);
  word-spacing: -0.25em;
}

.segment {
  @nest &:not(:last-child)::after {
    padding: 0 0.5em;
    content: '➝';
  }
}

.problems {
  display: block;
  margin: 0;
  padding: 0;
}

.problem {
  display: flex;
  margin: 0;
  padding: 0;
  color: var(--body-text);
  font-size: var(--font-size-xsmall);
  margin-bottom: var(--medium-padding);
}

.problemSeverity {
  padding: 1em;
  margin-right: 1em;
  min-width: 4em;
  text-align: center;
}

.problemSeverityIcon {
  display: block;
  font-size: 2em;
}

.problemSeverityText {
  display: block;
  font-size: var(--font-size-tiny);
  margin: 1em 0;
  font-weight: 700;
  text-transform: uppercase;
}

.problemLink {
  clear: both;
  margin: 1em 0;
  display: inline-block;
  color: var(--body-text);

  @nest &:hover {
    color: var(--brand-primary);
  }
}

.problemMessage {
  padding-top: 0.5em;
  font-family: var(--font-family-monospace);
}

.problem_error {
  composes: problem;
  color: var(--state-danger-color);

  @nest & .problemSeverity {
    color: var(--state-danger-color);
    border-right: 2px solid var(--state-danger-color);
  }
}

.problem_warning {
  composes: problem;

  @nest & .problemSeverity {
    color: var(--state-warning-color);
    border-right: 2px solid var(--state-warning-color);
  }
}

.listItem {
  display: block;
  padding: 0.5em 0;
}

.arrow {
  padding: 0 0.5em;
}

.pathSegmentTypeName {
  font-weight: 700;
}

.pathSegmentTypeType {
  font-weight: 300;
  font-size: var(--font-size-small);
}

.pathSegmentProperty {
  font-weight: 300;
}


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

<title>AtomLayerCompatibility</title>
<meta name="date" content="2016-12-22">
<link rel="stylesheet" type="text/css" href="../../../../../../javadoc-stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

edu.brown.cs.systems.tracingplane.atom_layer

Class AtomLayerCompatibility

java.lang.Object

edu.brown.cs.systems.tracingplane.atom_layer.AtomLayerCompatibility

public class AtomLayerCompatibility
extends java.lang.Object

This class just does type checking on BaggageAtoms instances to ensure they are compatible with the
 AtomLayer installed in the current process. In general, BaggageAtoms instances should never be created by any
 atom layer other than the one installed in the current process.

Field Summary

Fields

Modifier and Type
Field and Description

(package private) static org.slf4j.Logger
log

Constructor Summary

Constructors

Constructor and Description

AtomLayerCompatibility()

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static <B extends BaggageAtoms>
java.util.List<java.nio.ByteBuffer>
atoms(AtomLayer<B> contextLayer,
     Baggage maybeAtoms)

static <B extends BaggageAtoms>
java.util.List<java.nio.ByteBuffer>
atoms(AtomLayer<B> contextLayer,
     BaggageAtoms atoms)

static <B extends BaggageAtoms>
B
wrap(AtomLayer<B> contextLayer,
    java.util.List<java.nio.ByteBuffer> atoms)

Methods inherited from class java.lang.Object

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

Field Detail

log

static final org.slf4j.Logger log

Constructor Detail

AtomLayerCompatibility

public AtomLayerCompatibility()

Method Detail

wrap

public static <B extends BaggageAtoms> B wrap(AtomLayer<B> contextLayer,
                                              java.util.List<java.nio.ByteBuffer> atoms)

atoms

public static <B extends BaggageAtoms> java.util.List<java.nio.ByteBuffer> atoms(AtomLayer<B> contextLayer,
                                                                                Baggage maybeAtoms)

atoms

public static <B extends BaggageAtoms> java.util.List<java.nio.ByteBuffer> atoms(AtomLayer<B> contextLayer,
                                                                                BaggageAtoms atoms)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
// Copyright 2017, Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using Google.Cloud.Firestore.V1Beta1;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using static Google.Cloud.Firestore.Tests.ProtoHelpers;
using static Google.Cloud.Firestore.V1Beta1.DocumentTransform.Types;

namespace Google.Cloud.Firestore.Tests
{
    // Just tests for the handling of sentinel values. These use
    // WriteBatch.Set as it lets us check the update mask handling too.
    public partial class WriteBatchTest
    {
        public static TheoryData<object> SentinelValuesInArraysData { get; } = new TheoryData<object>
        {
            // Single check that ServerTimestamp counts as a sentinel value. For the rest of the
            // test data, we'll just use Delete
            new { Values = new[] { SentinelValue.ServerTimestamp } },

            // Directly in an array
            new { Values = new[] { SentinelValue.Delete } },

            // In a field in an array
            new { Values = new[] { new { DeleteMe = SentinelValue.Delete } } },

            // In a nested array
            new { Values = new[] { new { DeleteMe = new[] { SentinelValue.Delete } } } },

            // An array within a map
            new { Foo = new { Score = 10, Values = new[] { SentinelValue.Delete } } }
        };

        public static TheoryData<object> NoSentinelValuesInArraysData { get; } = new TheoryData<object>
        {
            // Each object has a sentinel value in a valid position.
            new { Values = new[] { 1, 2 }, DeleteMe = SentinelValue.Delete },
            new { Values = new[] { new { Fields = new { NestedArray = new[] { 1, 2 }, Text = "Foo" } } }, DeleteMe = SentinelValue.Delete }
        };

        /// <summary>
        /// Array values cannot contain sentinel values (delete/server-timestamp) anywhere,
        /// including via recursion.
        /// </summary>
        [Theory]
        [MemberData(nameof(SentinelValuesInArraysData))]
        public void SentinelValuesInArrays(object documentData)
        {
            var db = FirestoreDb.Create("proj", "db", new FakeFirestoreClient());
            var batch = db.CreateWriteBatch();
            var doc = db.Document("col/doc");
            Assert.Throws<ArgumentException>(() => batch.Set(doc, documentData, SetOptions.MergeAll));
        }

        [Theory]
        [MemberData(nameof(NoSentinelValuesInArraysData))]
        public void NoSentinelValuesInArrays(object documentData)
        {
            var db = FirestoreDb.Create("proj", "db", new FakeFirestoreClient());
            var batch = db.CreateWriteBatch();
            var doc = db.Document("col/doc");
            // Don't check the result, just that it doesn't throw.
            batch.Set(doc, documentData, SetOptions.MergeAll);
        }

        [Fact]
        public void SentinelValues_Simple()
        {
            var db = FirestoreDb.Create("project", "db", new FakeFirestoreClient());
            var batch = db.CreateWriteBatch();
            var doc = db.Document("col/doc");
            var data = new { Name = "Test", DeleteMe = SentinelValue.Delete, Timestamp = SentinelValue.ServerTimestamp };
            batch.Set(doc, data, SetOptions.MergeAll);

            var expectedUpdate = new Write
            {
                Update = new Document
                {
                    Name = doc.Path,
                    Fields = { { "Name", CreateValue("Test") } }
                },
                UpdateMask = new DocumentMask { FieldPaths = { "Name", "DeleteMe" } }
            };
            var expectedTransform = new Write
            {
                Transform = new DocumentTransform
                {
                    Document = doc.Path,
                    FieldTransforms = { ServerTimestampTransform("Timestamp") }
                }
            };
            AssertWrites(batch, (expectedUpdate, true), (expectedTransform, false));
        }

        [Fact]
        public void SentinelValues_NestedSentinels()
        {
            var db = FirestoreDb.Create("project", "db", new FakeFirestoreClient());
            var batch = db.CreateWriteBatch();
            var doc = db.Document("col/doc");
            var data = new
            {
                ValueA = new { Name = "Test", TimestampA = SentinelValue.ServerTimestamp, DeleteMeA = SentinelValue.Delete },
                ValueB = new { TimestampB = SentinelValue.ServerTimestamp, DeleteMeB = SentinelValue.Delete },
            };
            batch.Set(doc, data, SetOptions.MergeAll);

            var expectedUpdate = new Write
            {
                Update = new Document
                {
                    Name = doc.Path,
                    Fields =
                    {
                        { "ValueA", CreateMap(("Name", CreateValue("Test"))) },
                    }
                },
                UpdateMask = new DocumentMask { FieldPaths = { "ValueA.Name", "ValueA.DeleteMeA", "ValueB.DeleteMeB" } }
            };
            var expectedTransform = new Write
            {
                Transform = new DocumentTransform
                {
                    Document = doc.Path,
                    FieldTransforms = { ServerTimestampTransform("ValueA.TimestampA"), ServerTimestampTransform("ValueB.TimestampB") }
                }
            };
            AssertWrites(batch, (expectedUpdate, true), (expectedTransform, false));
        }

        [Fact]
        public void SentinelValues_OnlyTransform()
        {
            var db = FirestoreDb.Create("project", "db", new FakeFirestoreClient());
            var batch = db.CreateWriteBatch();
            var doc = db.Document("col/doc");
            var data = new { Timestamp = SentinelValue.ServerTimestamp };
            batch.Set(doc, data, SetOptions.MergeAll);
            // No Update.
            var expectedTransform = new Write
            {
                Transform = new DocumentTransform
                {
                    Document = doc.Path,
                    FieldTransforms = { ServerTimestampTransform("Timestamp") }
                }
            };
            AssertWrites(batch, (expectedTransform, true));
        }

        private static FieldTransform ServerTimestampTransform(string fieldPath) =>
            new FieldTransform { FieldPath = fieldPath, SetToServerValue = FieldTransform.Types.ServerValue.RequestTime };
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace ObjectTrackingDemo
{
    public sealed partial class EffectSettingsControl : UserControl
    {
        public event RoutedEventHandler ColorButtonClicked
        {
            add
            {
                colorPickerButton.Click += value;
            }
            remove
            {
                colorPickerButton.Click -= value;
            }
        }
        public event RangeBaseValueChangedEventHandler SliderValueChanged
        {
            add
            {
                thresholdSlider.ValueChanged += value;
            }
            remove
            {
                thresholdSlider.ValueChanged -= value;
            }
        }

        public Color ColorButtonColor
        {
            get
            {
                return (Color)GetValue(ColorButtonColorProperty);
            }
            set
            {
                SetValue(ColorButtonColorProperty, value);
            }
        }
        private static readonly DependencyProperty ColorButtonColorProperty =
            DependencyProperty.Register("ColorButtonColor", typeof(Color), typeof(EffectSettingsControl),
                new PropertyMetadata(Color.FromArgb(0xff, 0x0, 0x0, 0x0)));

        public double SliderValue
        {
            get
            {
                return thresholdSlider.Value;
            }
            set
            {
                thresholdSlider.Value = value;
            }
        }

        public EffectSettingsControl()
        {
            this.InitializeComponent();
            thresholdSlider.Value = 0;
        }

        public void SetSliderText(string text)
        {
            thresholdTextBlock.Text = text;
        }
    }
}


text:
@implementation QBitTorrentsListCell

#pragma mark -  Lifecycle

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];

    if (self) {
        self.textLabel.font = [AppearanceManager fontBoldWithSize:18];
        self.textLabel.numberOfLines = 2;

        self.detailTextLabel.font = [AppearanceManager fontNormalWithSize:12];
        self.detailTextLabel.numberOfLines = 2;

        self.selectionStyle = UITableViewCellSelectionStyleNone;

        self.imageView.contentMode = UIViewContentModeCenter;
    }

    return self;
}

#pragma mark - View

-(void)layoutSubviews
{
    [super layoutSubviews];

    [self adjustSubviews];
}

#pragma mark - Properties

-(void)setTorrent:(QBitTorrent *)torrent
{
    if (torrent != _torrent) {
        _torrent = torrent;

        switch (torrent.state) {
            case QBitTorrentStateDownloading:
                self.imageView.image = [UIImage imageNamed:@"downloading"];
                break;
            case QBitTorrentStateUploading:
                self.imageView.image = [UIImage imageNamed:@"uploading"];
                break;
            default:
                self.imageView.image = [UIImage imageNamed:@"paused"];
                break;
        }

        // Update cell content with torrent data
        self.textLabel.text = torrent.name;

        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ \n %@ ", [self torrentStateDescription], [self torrentProgressStatusDescription]]];

        self.detailTextLabel.attributedText = text;

        // Ajuste cell layout with new content
        [self adjustSubviews];
    }
}

#pragma mark - Public

+(CGFloat)height
{
    return 100.0;
}

#pragma mark -  Private

- (void)adjustSubviews
{
    CGRect frame = self.detailTextLabel.frame;
    frame.origin.y = CGRectGetMaxY(self.textLabel.frame) + 5.0;
    self.detailTextLabel.frame = frame;
}

-(NSString *)torrentStateDescription
{
    QBitTorrentState state = self.torrent.state;

    if (state == QBitTorrentStateUploading) {
        return NSLocalizedString(@"seeding", @"");
    } else if (state == QBitTorrentStateDownloading) {
        return [NSString stringWithFormat:@"%@, %@ %@", NSLocalizedString(@"downloading", @""), NSLocalizedString(@"ETA", @"ETA - estimated time of arrival"), self.torrent.eta];
    }

    return NSLocalizedString(@"closed", @"");
}

-(NSString *)torrentProgressStatusDescription
{
    QBitTorrentState state = self.torrent.state;

    NSNumber *progressPercent = [NSNumber numberWithFloat:self.torrent.progress * 100];

    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setMaximumFractionDigits:0];
    [formatter setRoundingMode:NSNumberFormatterRoundDown];

    if (state == QBitTorrentStateUploading) {
        return [NSString stringWithFormat:@"%@ (%@%%) - UP at %@", self.torrent.size, [formatter stringFromNumber:progressPercent], self.torrent.upSpeed];
    } else if (state == QBitTorrentStateDownloading) {
        NSNumber *torrentSize = [formatter numberFromString:self.torrent.size];
        NSNumber *sizeDownloaded = [NSNumber numberWithFloat:self.torrent.progress * torrentSize.floatValue];

        return [NSString stringWithFormat:@"%@ of %@ (%@%%) - DL at %@", [formatter stringFromNumber:sizeDownloaded], self.torrent.size, [formatter stringFromNumber:progressPercent], self.torrent.dlSpeed];
    }

    return [NSString stringWithFormat:@"%@%% of %@", [formatter stringFromNumber:progressPercent], self.torrent.size];
}

@end


text:
  <link rel="stylesheet" href="maven-theme.css">
  <title>AppSecInc. MSI Extensions</title>

Main Page

Related Pages

Namespaces

Classes

Files

src

Tools

ODBQ

ODBQ Directory Reference

Files

file  	ODBQ.cpp

file  	ODBQCmdEngine.cpp

file  	ODBQCmdEngine.h [code]

file  	StdAfx.cpp

file  	StdAfx.h [code]

     © Application Security Inc. - All Rights Reserved

     http://msiext.codeplex.com

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


text:
**IPvFoo** is a Chrome extension that adds an icon to your location bar, indicating whether the current page was fetched using IPv4 or IPv6. When you click the icon, a pop-up appears, listing the IP address for each domain that served the page elements.

Everything is captured privately using the webRequest API, without creating any additional network traffic.

## Add to Chrome
https://chrome.google.com/webstore/detail/ipvfoo/ecanpcehffngcegjmadlcijfolapggal

## Screenshot:
![Screenshot](/misc/screenshot_webstore_640x400.png?raw=true)

## Firefox Support:
IPvFoo now [runs on Firefox](https://addons.mozilla.org/firefox/addon/ipvfoo-pmarks/), but there are [a few bugs](https://github.com/pmarks-net/ipvfoo/issues/32) to work out.


text:
using System.ComponentModel;

namespace Tailviewer.Ui
{
	/// <summary>
	/// The view model for a fly-out which is laid on top of other content.
	/// </summary>
	public interface IFlyoutViewModel
		: INotifyPropertyChanged
	{
		void Update();
		string Name { get; }
	}
}


text:
package org.drools.workbench.screens.enums.client.editor;

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

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class EnumParserTest {

    @Test
    public void testFromStringParsing1() {
        //Perfectly valid
        final String content = "'Fact.field' : ['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( 1,
                      enums.size() );
        assertEquals( "Fact",
                      enums.get( 0 ).getFactName() );
        assertEquals( "field",
                      enums.get( 0 ).getFieldName() );
        assertEquals( "['a', 'b']",
                      enums.get( 0 ).getContext() );
    }

    @Test
    public void testFromStringParsing2() {
        //Fact is not prefixed with '
        final String content = "Fact.field' : ['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "Fact.field' : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringParsing3() {
        //Field is not suffixed with '
        final String content = "'Fact.field : ['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "'Fact.field : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringParsing4() {
        //Spaces omitted around colon
        final String content = "'Fact.field':['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( 1,
                      enums.size() );
        assertEquals( "Fact",
                      enums.get( 0 ).getFactName() );
        assertEquals( "field",
                      enums.get( 0 ).getFieldName() );
        assertEquals( "['a', 'b']",
                      enums.get( 0 ).getContext() );
    }

    @Test
    public void testFromStringParsing5() {
        //Space before colon omitted
        final String content = "'Fact.field': ['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( 1,
                      enums.size() );
        assertEquals( "Fact",
                      enums.get( 0 ).getFactName() );
        assertEquals( "field",
                      enums.get( 0 ).getFieldName() );
        assertEquals( "['a', 'b']",
                      enums.get( 0 ).getContext() );
    }

    @Test
    public void testFromStringParsing6() {
        //Space after colon omitted
        final String content = "'Fact.field' :['a', 'b']";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( 1,
                      enums.size() );
        assertEquals( "Fact",
                      enums.get( 0 ).getFactName() );
        assertEquals( "field",
                      enums.get( 0 ).getFieldName() );
        assertEquals( "['a', 'b']",
                      enums.get( 0 ).getContext() );
    }

    @Test
    public void testFromStringMissingFact1() {
        final String content = "field' : ['a', 'b']";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "field' : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringMissingFact2() {
        final String content = ".field' : ['a', 'b']";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( ".field' : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringMissingField1() {
        final String content = "Fact' : ['a', 'b']";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "Fact' : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringMissingField2() {
        final String content = "Fact.' : ['a', 'b']";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "Fact.' : ['a', 'b']",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringMissingContext() {
        final String content = "Fact.field' :";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "Fact.field' :",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringInvalidSyntax() {
        final String content = "This isn't even close to a correct definition";
        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( "This isn't even close to a correct definition",
                      enums.get( 0 ).getRaw() );
    }

    @Test
    public void testFromStringComments() {
        final String content = "'Fact.field' : ['a', 'b']\n"
                + "\n"
                + "#A comment\n"
                + "//Another comment\n";

        final List<EnumRow> enums = EnumParser.fromString( content );
        assertFalse( enums.isEmpty() );
        assertEquals( 1,
                      enums.size() );
        assertEquals( "Fact",
                      enums.get( 0 ).getFactName() );
        assertEquals( "field",
                      enums.get( 0 ).getFieldName() );
        assertEquals( "['a', 'b']",
                      enums.get( 0 ).getContext() );
    }

    @Test
    public void testToString1() {
        final List<EnumRow> content = new ArrayList<EnumRow>() {{
            add( new EnumRow( "Fact",
                              "field",
                              "['a', 'b']" ) );
            add( new EnumRow( "A raw value" ) );
        }};

        final String enums = EnumParser.toString( content );
        assertEquals( enums,
                      "'Fact.field' : ['a', 'b']\n" +
                              "A raw value\n" );
    }

}


text:
cbuffer Parameters
{
		//	common control parameters
	float2 Center;
	float Radius;
	float Adjustment;

	uint2 SurfaceMins;			// Minimum coord of the "CachedSurface", in terrain uber-surface coords
	uint2 SurfaceMaxs;			// Max coord of the "CachedSurface", in terrain uber-surface coords
	uint2 DispatchOffset;		// Terrain uber-surfacec coord when dispatchThreadId = uint3(0,0,0)
}

float LengthSquared(float2 input) { return dot(input, input); }

cbuffer PaintParameters
{
	uint paintValue;
}

RWTexture2D<uint> OutputSurface : register(u0);
Texture2D<uint> InputSurface;

[numthreads(16, 16, 1)]
	void Paint(uint3 dispatchThreadId : SV_DispatchThreadID)
{
	uint2 surfaceSpaceCoord = DispatchOffset + dispatchThreadId.xy;
	float rsq = LengthSquared(float2(surfaceSpaceCoord) - Center);
	if (surfaceSpaceCoord.x <= SurfaceMaxs.x && surfaceSpaceCoord.y <= SurfaceMaxs.y && rsq < (Radius*Radius)) {
		OutputSurface[surfaceSpaceCoord - SurfaceMins] = paintValue;
	}
}


text:
#include <common.h>
#include <dm.h>
#include <fdt_support.h>
#include <asm/io.h>
#include <dm/device-internal.h>

DECLARE_GLOBAL_DATA_PTR;

fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index)
{
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
	fdt_addr_t addr;

	if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {
		const fdt32_t *reg;
		int len = 0;
		int na, ns;

		na = fdt_address_cells(gd->fdt_blob,
				       dev_of_offset(dev->parent));
		if (na < 1) {
			debug("bad #address-cells\n");
			return FDT_ADDR_T_NONE;
		}

		ns = fdt_size_cells(gd->fdt_blob, dev_of_offset(dev->parent));
		if (ns < 0) {
			debug("bad #size-cells\n");
			return FDT_ADDR_T_NONE;
		}

		reg = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "reg",
				  &len);
		if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) {
			debug("Req index out of range\n");
			return FDT_ADDR_T_NONE;
		}

		reg += index * (na + ns);

		/*
		 * Use the full-fledged translate function for complex
		 * bus setups.
		 */
		addr = fdt_translate_address((void *)gd->fdt_blob,
					     dev_of_offset(dev), reg);
	} else {
		/*
		 * Use the "simple" translate function for less complex
		 * bus setups.
		 */
		addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
				dev_of_offset(dev->parent), dev_of_offset(dev),
				"reg", index, NULL, false);
		if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) {
			if (device_get_uclass_id(dev->parent) ==
			    UCLASS_SIMPLE_BUS)
				addr = simple_bus_translate(dev->parent, addr);
		}
	}

	/*
	 * Some platforms need a special address translation. Those
	 * platforms (e.g. mvebu in SPL) can configure a translation
	 * offset in the DM by calling dm_set_translation_offset() that
	 * will get added to all addresses returned by devfdt_get_addr().
	 */
	addr += dm_get_translation_offset();

	return addr;
#else
	return FDT_ADDR_T_NONE;
#endif
}

fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
				   fdt_size_t *size)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
	/*
	 * Only get the size in this first call. We'll get the addr in the
	 * next call to the exisiting dev_get_xxx function which handles
	 * all config options.
	 */
	fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev),
					   "reg", index, size, false);

	/*
	 * Get the base address via the existing function which handles
	 * all Kconfig cases
	 */
	return devfdt_get_addr_index(dev, index);
#else
	return FDT_ADDR_T_NONE;
#endif
}

fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name)
{
#if CONFIG_IS_ENABLED(OF_CONTROL)
	int index;

	index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
				      "reg-names", name);
	if (index < 0)
		return index;

	return devfdt_get_addr_index(dev, index);
#else
	return FDT_ADDR_T_NONE;
#endif
}

fdt_addr_t devfdt_get_addr(struct udevice *dev)
{
	return devfdt_get_addr_index(dev, 0);
}

void *devfdt_get_addr_ptr(struct udevice *dev)
{
	return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
}

void *devfdt_map_physmem(struct udevice *dev, unsigned long size)
{
	fdt_addr_t addr = devfdt_get_addr(dev);

	if (addr == FDT_ADDR_T_NONE)
		return NULL;

	return map_physmem(addr, size, MAP_NOCACHE);
}


text:
<!doctype html>
<html>
    <head>
        <title>AudioTrack properties read from input stream metadata</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
            </head>
    <body>
        <script>
            async_test(function(t)
            {
                var audio = document.createElement("audio");
                audio.src = "../content/test.webm";

                audio.onloadedmetadata = t.step_func_done(function()
                {
                    assert_equals(audio.audioTracks.length, 1, "audioTracks.length");
                    assert_true(audio.audioTracks[0].enabled, "audioTrack.enabled");
                    assert_equals(audio.audioTracks[0].id, "2", "audioTrack.id");
                    assert_equals(audio.audioTracks[0].kind, "main", "audioTrack.kind");
                    assert_equals(audio.audioTracks[0].label, "", "audioTrack.label");
                    assert_equals(audio.audioTracks[0].language, "", "audioTrack.language");
                });
            });
            async_test(function(t)
            {
                var ac1 = new AudioContext();
                var stream1 = ac1.createMediaStreamDestination().stream;

                var ac2 = new AudioContext();
                var stream2 = ac2.createMediaStreamDestination().stream;

                var audio = document.createElement("audio");
                var tracks = [...stream1.getTracks(), ...stream2.getTracks()];
                var stream = new MediaStream(tracks);
                audio.srcObject = stream;
                audio.onloadedmetadata = t.step_func_done(function()
                {
                    assert_equals(audio.audioTracks.length, 2, "audioTracks.length");

                    assert_true(audio.audioTracks[0].enabled, "audioTrack.enabled");
                    assert_true("id" in audio.audioTracks[0], "audioTrack.id");
                    assert_equals(audio.audioTracks[0].kind, "main", "audioTrack.kind");
                    assert_true("label" in audio.audioTracks[0], "audioTrack.label");
                    assert_equals(audio.audioTracks[0].language, "", "audioTrack.language");

                    assert_false(audio.audioTracks[1].enabled, "audioTrack.enabled");
                    assert_true("id" in audio.audioTracks[1], "audioTrack.id");
                    assert_equals(audio.audioTracks[1].kind, "main", "audioTrack.kind");
                    assert_true("label" in audio.audioTracks[1], "audioTrack.label");
                    assert_equals(audio.audioTracks[1].language, "", "audioTrack.language");
                });
            });
        </script>
    </body>
</html>