text:
(function() {
  (function(window) {
    var TouchyPannerDefinition, extend, noop;
    extend = function(object, properties) {
      var key, val;
      for (key in properties) {
        val = properties[key];
        object[key] = val;
      }
      return object;
    };
    noop = function() {};
    TouchyPannerDefinition = function(Touchy, $, EventEmitter, TweenMax) {
      var TouchyPanner;
      TouchyPanner = (function() {
        var _default_options;

        function TouchyPanner(elm, options) {
          this.elm = $(elm).first();
          this.options = $.extend({}, _default_options, options);
          this._configurePanner();
          this._setupTouchyInstance();
          this._configureOptions();
          this._configureNav();
          this._configureIndicator();
          this.value(this.options.initial_index);
          this._setupResize();
          this.emitEvent('init', [this]);
          this.elm.css('opacity', 1);
        }

        _default_options = {
          vertical: false,
          initial_index: 0,
          container_elm: '.options',
          option_elm: '.option',
          nav_elm: '.nav',
          indicator: false,
          indicator_elm: '.indicator',
          threshold: 20,
          velocityXThreshold: 1,
          deltaXThresholdPercent: .3
        };

        TouchyPanner.prototype.refreshOptions = function() {
          var _ref;
          if ((_ref = this._tl) != null) {
            _ref.kill();
          }
          this._configureOptions();
          return this.value(this.options.initial_index);
        };

        TouchyPanner.prototype._setupTouchyInstance = function() {
          this._touchy = new Touchy(this.elm);
          this._touchy.on('start', (function(_this) {
            return function(event, t, pointer) {
              return _this._onStart(event, pointer);
            };
          })(this));
          this._touchy.on('move', (function(_this) {
            return function(event, t, pointer) {
              return _this._onMove(event, pointer);
            };
          })(this));
          this._touchy.on('end', (function(_this) {
            return function(event, t, pointer) {
              return _this._onEnd(event, pointer);
            };
          })(this));
          return this._touchy.on('cancel', (function(_this) {
            return function(event, t, pointer) {
              return _this._onEnd(event, pointer);
            };
          })(this));
        };

        TouchyPanner.prototype._configurePanner = function() {
          this.elm.addClass('panner');
          this.elm.addClass(this.options.vertical ? 'panner_v' : 'panner_h');
          this._options_elm = this.elm.find(this.options.container_elm);
          return this._options_elm.css({
            position: 'relative'
          });
        };

        TouchyPanner.prototype._configureOptions = function() {
          var option, _i, _len, _ref;
          this._tl = new TimelineMax({
            paused: true
          });
          this._options = this._options_elm.find('.option');
          this._options.css({
            position: 'absolute'
          });
          this._option_count = this._options.length;
          this._option_w = this._options_elm.width();
          _ref = this._options;
          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
            option = _ref[_i];
            this._addOptionPage(option);
          }
          return true;
        };

        TouchyPanner.prototype._addOptionPage = function(option) {
          var id, offset;
          id = $(option).data('id');
          offset = {
            left: 0
          };
          this._tl.from(option, .4, {
            x: this._option_w - offset.left,
            ease: Linear.easeNone
          });
          this._tl.fromTo(option, .1, {
            opacity: 0
          }, {
            opacity: 1,
            ease: Power1.easeInOut
          }, "-=.25");
          this._tl.add("option-" + id);
          this._tl.to(option, .4, {
            x: -(this._option_w - offset.left),
            ease: Linear.easeNone
          });
          return this._tl.to(option, .1, {
            opacity: 0,
            ease: Power1.easeInOut
          }, "-=.25");
        };

        TouchyPanner.prototype._configureNav = function() {
          this._nav_elm = this.elm.find(this.options.nav_elm);
          return true;
        };

        TouchyPanner.prototype._configureIndicator = function() {
          var i, _i, _ref;
          if (!this.options.indicator) {
            return;
          }
          this._indicator_elm = this.elm.find(this.options.indicator_elm);
          for (i = _i = 1, _ref = this._option_count; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) {
            this._indicator_elm.append("<span class='icon'>");
          }
          return true;
        };

        TouchyPanner.prototype.value = function(val) {
          if (val != null) {
            return this._pageTo(val);
          } else {
            return this._current_option;
          }
        };

        TouchyPanner.prototype._pageTo = function(id, instant) {
          var data_id;
          this._current_option = id;
          data_id = this._options.eq(this._current_option).data('id');
          if (instant) {
            this._tl.seek("option-" + data_id);
          } else {
            this._tl.seek("option-" + data_id);
          }
          this._updateNavState();
          return this._updateIndicatorState();
        };

        TouchyPanner.prototype._onStart = function(e, pointer) {};

        TouchyPanner.prototype._onMove = function(e, pointer) {
          var current_time, data_id, direction, distance, duration, duration_ms, duration_per_option, duration_per_pixel, time, time_change;
          direction = this._direction();
          distance = this._distance();
          if (direction && !direction.match(/^(left|right)$/)) {
            return true;
          }
          if (distance >= this.options.threshold && !this._started) {
            this._started = true;
            return this.emitEvent('panstart', [this]);
          } else if (this._started) {
            duration = this._tl.totalDuration();
            duration_ms = duration * 1000;
            duration_per_option = duration_ms / this._option_count;
            duration_per_pixel = duration_ms / (this._option_w * this._option_count);
            data_id = this._options.eq(this._current_option).data('id');
            current_time = this._tl.getLabelTime("option-" + data_id);
            time_change = Math.abs(distance * (duration_per_pixel / 2)) / 1000;
            if (direction === "right") {
              if (current_time - time_change < 0) {
                time_change = current_time;
              }
              time = "option-" + data_id + "-=" + time_change;
            } else if (direction === "left") {
              if (current_time + time_change > duration) {
                time_change = current_time;
              }
              time = "option-" + data_id + "+=" + time_change;
            }
            this._tl.seek(time);
            return this.emitEvent('panmove', [e, this]);
          }
        };

        TouchyPanner.prototype._onEnd = function(e, pointer) {
          var current_elm, direction, distance, next_ind;
          if ($(e.target).parent().is(this._nav_elm)) {
            this._onNavEnd(e, pointer);
            return;
          }
          if (!this._started) {
            return;
          }
          direction = this._direction();
          distance = this._distance();
          current_elm = this._options.eq(this._current_option);
          current_elm.removeClass('current');
          if (direction === "left") {
            next_ind = this._current_option + 1;
          } else if (direction === "right") {
            next_ind = this._current_option - 1;
          }
          this._panTo(next_ind);
          this._started = false;
          return this.emitEvent('panend', [e, this]);
        };

        TouchyPanner.prototype._onNavEnd = function(e, pointer) {
          var elm;
          e.preventDefault();
          elm = $(e.target);
          if (elm.hasClass('prev')) {
            return this._panTo(this._current_option - 1);
          } else if (elm.hasClass('next')) {
            return this._panTo(this._current_option + 1);
          }
        };

        TouchyPanner.prototype._direction = function() {
          if (this._touchy.distance.x > 0) {
            return 'right';
          } else if (this._touchy.distance.x < 0) {
            return 'left';
          } else {
            return '';
          }
        };

        TouchyPanner.prototype._distance = function() {
          return Math.abs(this._touchy.distance.x);
        };

        TouchyPanner.prototype._panTo = function(id) {
          var data_id, elm;
          if (!(id > -1 && id < this._option_count)) {
            id = this._current_option;
          }
          elm = this._options.eq(id);
          elm.addClass('current');
          data_id = elm.data('id');
          this._tl.tweenTo("option-" + data_id, {
            ease: Strong.easeOut,
            onComplete: (function(_this) {
              return function() {
                return _this.emitEvent('panchanged', [_this]);
              };
            })(this)
          });
          this._current_option = id;
          this._updateNavState();
          return this._updateIndicatorState();
        };

        TouchyPanner.prototype._updateNavState = function() {
          if (this._current_option === 0) {
            this.elm.addClass('first');
            return this.elm.removeClass('last');
          } else if (this._current_option === this._option_count - 1) {
            this.elm.addClass('last');
            return this.elm.removeClass('first');
          } else {
            return this.elm.removeClass('first last');
          }
        };

        TouchyPanner.prototype._updateIndicatorState = function() {
          if (this._indicator_elm && this._indicator_elm.length) {
            return this._indicator_elm.find('.icon').removeClass('active').eq(this._current_option).addClass('active');
          }
        };

        TouchyPanner.prototype._valueToPercent = function(val) {
          return ((val - this.options.min_value) / (this.options.max_value - this.options.min_value)) * 100;
        };

        TouchyPanner.prototype._percentToValue = function(pct) {
          return ((pct / 100) * (this.options.max_value - this.options.min_value)) + this.options.min_value;
        };

        TouchyPanner.prototype._trimAlignValue = function(val) {
          var alignValue, step, valModStep;
          if (val <= this.options.min_value) {
            return this.options.min_value;
          }
          if (val >= this.options.max_value) {
            return this.options.max_value;
          }
          step = this.options.step > 0 ? this.options.step : 1;
          valModStep = (val - this.options.min_value) % step;
          alignValue = val - valModStep;
          if (Math.abs(valModStep) * 2 >= step) {
            alignValue += valModStep > 0 ? step : -step;
          }
          return parseFloat(alignValue.toFixed(5));
        };

        TouchyPanner.prototype._setupResize = function() {
          $(window).on('resize', (function(_this) {
            return function() {
              return _this._resize();
            };
          })(this));
          return this._resize();
        };

        TouchyPanner.prototype._resize = function() {
          if (this.options.vertical) {
            this._length = this.elm.height();
            this._offset = this.elm.offset().top;
          } else {
            this._length = this.elm.width();
            this._offset = this.elm.offset().left;
          }
          return this._setOptionHeight();
        };

        TouchyPanner.prototype._setOptionHeight = function() {
          var oh, option, _i, _len, _ref;
          if (this.elm.is(':visible')) {
            this._option_h = 0;
            _ref = this._options;
            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
              option = _ref[_i];
              oh = $(option).outerHeight();
              if (oh > this._option_h) {
                this._option_h = oh;
              }
            }
            return this._options_elm.css({
              minHeight: this._option_h
            });
          }
        };

        extend(TouchyPanner.prototype, EventEmitter.prototype);

        return TouchyPanner;

      })();
      return TouchyPanner;
    };
    if (typeof define === 'function' && define.amd) {
      return define(['touchy', 'jquery', 'eventEmitter', 'gsap', 'jquery-transform'], TouchyPannerDefinition);
    } else if (typeof exports === 'object') {
      return module.exports = TouchyPannerDefinition(require('touchy'), require('jquery'), require('wolfy87-eventemitter'), require('gsap'), require('jquery-transform'));
    } else {
      return window.TouchyPanner = TouchyPannerDefinition(window.Touchy, window.jQuery, window.EventEmitter, window.TweenMax);
    }
  })(window);

}).call(this);


text:
package tfl.web.pages;

import com.frameworkium.core.ui.annotations.Visible;
import com.frameworkium.core.ui.pages.BasePage;
import com.frameworkium.core.ui.pages.PageFactory;
import io.qameta.allure.Step;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import ru.yandex.qatools.htmlelements.annotations.Name;

public class HomePage extends BasePage<HomePage> {

    @Name("Plan A Journey Link")
    @Visible
    @FindBy(css = "li.plan-journey a")
    private WebElement planJourneyLink;

    @Step("Navigate to the TFL homepage")
    public static HomePage open() {
        // alternative to PageFactory that creates a page object instance with URL
        return new HomePage().get("https://tfl.gov.uk");
    }

    @Step("Go to the plan journey page")
    public PlanJourneyPage clickPlanJourneyLink() {
        planJourneyLink.click();
        return PageFactory.newInstance(PlanJourneyPage.class);
    }

}

redpajama_set_name: RedPajamaGithub


text:
class DigestValueTypeMapper
  include XmlSchemaMapper
  schema File.expand_path('../../vendor/ezags-protocols/eZAGS/public/UploadService.xsd', File.dirname(__FILE__))
  type 'DigestValueType'

end


text:
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports Aspose.Cells.GridDesktop

Namespace WorkingWithRowsandColumns
	Public Partial Class RemovingRow
		Inherits Form
		Public Sub New()
			InitializeComponent()
		End Sub

		Private Sub button1_Click(sender As Object, e As EventArgs)
			' ExStart:1
			' Accessing first worksheet of the Grid
			Dim sheet As Worksheet = gridDesktop1.Worksheets(0)

			' Removing the first row of the worksheet
			sheet.RemoveRow(0)
            ' ExEnd:1
			MessageBox.Show("Row has been removed.")
		End Sub
	End Class
End Namespace


text:
<component name="libraryTable">
  <library name="Maven: org.netbeans.api:org-netbeans-libs-asm:RELEASE82">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/org/netbeans/api/org-netbeans-libs-asm/RELEASE82/org-netbeans-libs-asm-RELEASE82.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/org/netbeans/api/org-netbeans-libs-asm/RELEASE82/org-netbeans-libs-asm-RELEASE82-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/org/netbeans/api/org-netbeans-libs-asm/RELEASE82/org-netbeans-libs-asm-RELEASE82-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
/*
 *  This file is part of the Heritrix web crawler (crawler.archive.org).
 *
 *  Licensed to the Internet Archive (IA) by one or more individual
 *  contributors.
 *
 *  The IA licenses this file to You 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.
 */
package org.archive.crawler.reporting;

import java.io.PrintWriter;
import java.util.Iterator;
import java.util.Map;

import org.archive.bdb.DisposableStoredSortedMap;

import com.sleepycat.collections.StoredIterator;

/**
 * The "Seeds Report", results per provided seed.
 *
 * @contributor gojomo
 */
public class SeedsReport extends Report {

    @Override
    public void write(PrintWriter writer, StatisticsTracker stats) {
        // Build header.
        writer.print("[code] [status] [seed] [redirect]\n");

        long seedsCrawled = 0;
        long seedsTotal = 0;
        DisposableStoredSortedMap<Integer, SeedRecord> seedsByCode = stats.calcSeedRecordsSortedByStatusCode();
//        for (Map.Entry<Integer,SeedRecord> entry : seedsByCode.entrySet()) {
        Iterator<Map.Entry<Integer,SeedRecord>> iter = seedsByCode.entrySet().iterator();
        while(iter.hasNext()) {
            Map.Entry<Integer,SeedRecord> entry = iter.next();
            SeedRecord sr = entry.getValue();
            writer.print(sr.getStatusCode());
            writer.print(" ");
            seedsTotal++;
            if((sr.getStatusCode() > 0)) {
                seedsCrawled++;
                writer.print("CRAWLED");
            } else {
                writer.print("NOTCRAWLED");
            }
            writer.print(" ");
            writer.print(sr.getUri());
            if(sr.getRedirectUri()!=null) {
                writer.print(" ");
                writer.print(sr.getRedirectUri());
            }
            writer.print("\n");
        }
        StoredIterator.close(iter);
        seedsByCode.dispose();
        stats.seedsTotal = seedsTotal;
        stats.seedsCrawled = seedsCrawled;
    }

    @Override
    public String getFilename() {
        return "seeds-report.txt";
    }

}


text:
"""
Settings defaults - settings should be overridden in the project's settings.py
"""
from django.conf import settings

DEBUG = getattr(settings, 'DEBUG', True)

BLOG_PING_GOOGLE = getattr(settings, 'BLOG_PING_GOOGLE', False)

BLOG_COMMENTS_EMAIL_NOTIFICATION = getattr(settings,
    'BLOG_COMMENTS_EMAIL_NOTIFICATION', False)

BLOG_COMMENTS_AUTO_MODERATE = getattr(settings,
    'BLOG_COMMENTS_AUTO_MODERATE', False)
BLOG_COMMENTS_MODERATE_AFTER = getattr(settings,
    'BLOG_COMMENTS_MODERATE_AFTER', None)

BLOG_COMMENTS_AUTO_CLOSE = getattr(settings, 'BLOG_COMMENTS_AUTO_CLOSE', False)
BLOG_COMMENTS_CLOSE_AFTER = getattr(settings, 'BLOG_COMMENTS_CLOSE_AFTER', None)


text:
#include "WinlFlow.h"
#include "OvsCore.h"
#include "OFFlow.h"
#include "OFDatapath.h"
#include "PacketInfo.h"
#include "OFAction.h"
#include "Argument.h"
#include "WinlDevice.h"
#include "MessageToFlowMatch.h"
#include "Message.h"
#include "FlowToMessage.h"
#include "Argument.h"
#include "ArgumentType.h"
#include "Winetlink.h"
#include "Attribute.h"
#include "Error.h"
#include "OFFlowTable.h"
#include "Winetlink.h"
#include "List.h"

static OVS_ERROR _CreateActionsFromArgGroup(OVS_ARGUMENT_GROUP* pOriginalActionsGroup, OVS_FLOW_MATCH* pFlowMatch, _Out_ OVS_OFPACKET_INFO* pMaskedPI, OVS_ACTIONS** ppActions)
{
    OVS_ACTIONS* pActions = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    pActions = Actions_Create();
    CHECK_B_E(pActions, OVS_ERROR_NOMEM);

    ApplyMaskToPacketInfo(pMaskedPI, &(pFlowMatch->packetInfo), &(pFlowMatch->flowMask));

    CHECK_B_E(CopyArgumentGroup(pActions->pActionGroup, pOriginalActionsGroup, /*actionsToAdd*/0), OVS_ERROR_NOMEM);
    CHECK_B_E(ProcessReceivedActions(pActions->pActionGroup, pMaskedPI, /*recursivity depth*/0), OVS_ERROR_INVAL);

Cleanup:
    if (error == OVS_ERROR_NOERROR)
    {
        *ppActions = pActions;
    }
    else
    {
        OVS_REFCOUNT_DESTROY(pActions);
    }

    return error;
}

static OVS_ERROR _Flow_SetMask(OVS_FLOW_TABLE* pFlowTable, OVS_FLOW_MATCH* pFlowMatch, _Inout_ OVS_FLOW* pFlow)
{
    OVS_FLOW_MASK* pOutMask = NULL, *pInMask = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    pInMask = &(pFlowMatch->flowMask);

    pOutMask = FlowTable_FindFlowMask(pFlowTable, pInMask);
    if (!pOutMask)
    {
        pOutMask = FlowMask_Create();
        CHECK_B_E(pOutMask, OVS_ERROR_INVAL);

        pOutMask->packetInfo = pInMask->packetInfo;
        pOutMask->piRange = pInMask->piRange;

        FlowTable_InsertFlowMask(pFlowTable, pOutMask);
    }

    ++pOutMask->refCount;
    pFlow->pMask = pOutMask;

Cleanup:
    if (error != OVS_ERROR_NOERROR)
    {
        FlowMask_DeleteReference(pOutMask);
    }

    return error;
}

static OVS_ERROR _InsertNewFlow(OVS_FLOW_TABLE* pFlowTable, OVS_ACTIONS* pActions, OVS_FLOW_MATCH* pFlowMatch, OVS_OFPACKET_INFO* pMaskedPI)
{
    OVS_FLOW* pFlow = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    pFlow = Flow_Create();
    CHECK_B_E(pFlow, OVS_ERROR_INVAL);

    pFlow = OVS_REFCOUNT_REFERENCE(pFlow);
    OVS_CHECK(pFlow);

    Flow_ClearStats_Unsafe(pFlow);

    pFlow->unmaskedPacketInfo = pFlowMatch->packetInfo;
    pFlow->maskedPacketInfo = *pMaskedPI;

    CHECK_E(_Flow_SetMask(pFlowTable, pFlowMatch, pFlow));
    OVS_CHECK(pFlow->pMask);
    pFlow->pActions = pActions;

    DBGPRINT_FLOW(LOG_LOUD, "flow created: ", pFlow);
    FlowTable_InsertFlow_Unsafe(pFlowTable, pFlow);

Cleanup:
    if (error != OVS_ERROR_NOERROR)
    {
        if (pFlow)
        {
            OVS_REFCOUNT_DEREF_AND_DESTROY(pFlow);
        }
    }

    return error;
}

static VOID _SetExistingFlow(OVS_FLOW* pFlow, const OVS_ARGUMENT_GROUP* pArgGroup, OVS_ACTIONS* pActions)
{
    OVS_ACTIONS* pOldActions = NULL;
    LOCK_STATE_EX lockState = { 0 };

    FLOW_LOCK_READ(pFlow, &lockState);

    //the old actions may be in use at the moment (e.g. execute actions on packet)
    //so we remove it from flow now, but will possibly destroy it (the actions struct) later
    pOldActions = pFlow->pActions;
    pFlow->pActions = pActions;

    DBGPRINT_FLOW(LOG_LOUD, "flow create/set: ", pFlow);

    FLOW_UNLOCK(pFlow, &lockState);
    //the pFlow does not become invalidated between locks, because it's referenced
    FLOW_LOCK_WRITE(pFlow, &lockState);

    OVS_REFCOUNT_DESTROY(pOldActions);

    if (FindArgument(pArgGroup, OVS_ARGTYPE_FLOW_CLEAR))
    {
        Flow_ClearStats_Unsafe(pFlow);
    }

    FLOW_UNLOCK(pFlow, &lockState);
}

static OVS_ERROR _ExtractFowInfoFromArgs(_In_ const OVS_MESSAGE* pMsg, BOOLEAN actionsOptional, _Out_ OVS_FLOW_MATCH* pFlowMatch,
    _Out_ OVS_OFPACKET_INFO* pMaskedPI, _Out_ OVS_ACTIONS** ppActions)
{
    OVS_ARGUMENT_GROUP* pPIGroup = NULL, *pMaskGroup = NULL, *pActionsGroup = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    pPIGroup = FindArgumentGroup(pMsg->pArgGroup, OVS_ARGTYPE_FLOW_PI_GROUP);
    CHECK_B_E(pPIGroup, OVS_ERROR_INVAL);
    pMaskGroup = FindArgumentGroup(pMsg->pArgGroup, OVS_ARGTYPE_FLOW_MASK_GROUP);

    FlowMatch_Initialize(pFlowMatch, /*have mask*/ TRUE);
    CHECK_B_E(GetFlowMatchFromArguments(pFlowMatch, pPIGroup, pMaskGroup), OVS_ERROR_INVAL);

    pActionsGroup = FindArgumentGroup(pMsg->pArgGroup, OVS_ARGTYPE_FLOW_ACTIONS_GROUP);
    if (!pActionsGroup && !actionsOptional)
    {
        OVS_CHECK(__UNEXPECTED__);
        error = OVS_ERROR_INVAL;
        goto Cleanup;
    }

    CHECK_E(_CreateActionsFromArgGroup(pActionsGroup, pFlowMatch, pMaskedPI, ppActions));

Cleanup:
    return error;
}

static OVS_ERROR _ExtractPIFromArgsAndFindFlow_Ref(_In_ OVS_ARGUMENT_GROUP* pArgGroup, OVS_FLOW_TABLE* pFlowTable, _Out_ OVS_FLOW** ppFlow)
{
    OVS_ARGUMENT_GROUP* pPIGroup = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;
    OVS_FLOW_MATCH flowMatch = { 0 };
    OVS_FLOW* pFlow = NULL;

    pPIGroup = FindArgumentGroup(pArgGroup, OVS_ARGTYPE_FLOW_PI_GROUP);
    CHECK_B_E(pPIGroup, OVS_ERROR_INVAL);

    FlowMatch_Initialize(&flowMatch, /*have mask*/ FALSE);
    CHECK_B_E(GetFlowMatchFromArguments(&flowMatch, pPIGroup, /*mask group*/ NULL), OVS_ERROR_INVAL);

    pFlow = FlowTable_FindExactFlow_Ref(pFlowTable, &flowMatch);
    CHECK_B_E(pFlow, OVS_ERROR_NOENT);

Cleanup:
    if (error == OVS_ERROR_NOERROR)
    {
        *ppFlow = pFlow;
    }

    return error;
}

_Use_decl_annotations_
OVS_ERROR WinlFlow_New(OVS_FLOW_TABLE* pFlowTable, const OVS_MESSAGE* pMsg, const FILE_OBJECT* pFileObject)
{
    OVS_OFPACKET_INFO packetInfo = { 0 }, maskedPacketInfo = { 0 };
    OVS_FLOW* pFoundFlow = NULL, *pFlow = NULL;
    OVS_MESSAGE replyMsg = { 0 };
    OVS_FLOW_MATCH flowMatch = { 0 };
    OVS_ERROR error = OVS_ERROR_NOERROR;
    OVS_ACTIONS* pActions = NULL;

    CHECK_E(_ExtractFowInfoFromArgs(pMsg, /*actions opt*/ FALSE, &flowMatch, &maskedPacketInfo, &pActions));

    /*** PROCESS DATA: ADD / SET FLOW ***/
    pFlow = FlowTable_FindFlowMatchingMaskedPI_Ref(pFlowTable, &packetInfo);
    if (!pFlow)
    {
        CHECK_E(_InsertNewFlow(pFlowTable, pActions, &flowMatch, &maskedPacketInfo));
    }
    else
    {
        LOCK_STATE_EX lockState = { 0 };
        BOOLEAN packetInfoEqual = FALSE;

        //if we have cmd = new with the flag 'exclusive', it means we're not allowed to override existing flows.
        //the flag 'create' is accepted as well: 'create' may be set instead of 'exclusive'
        if (pMsg->flags & OVS_MESSAGE_FLAG_CREATE &&
            pMsg->flags & OVS_MESSAGE_FLAG_EXCLUSIVE)
        {
            FLOW_LOCK_READ(pFlow, &lockState);
            DBGPRINT_FLOW(LOG_LOUD, "flow create/set failed (EXISTS but Create & Exclusive): ", pFlow);
            FLOW_UNLOCK(pFlow, &lockState);

            error = OVS_ERROR_EXIST;
            goto Cleanup;
        }

        FLOW_LOCK_READ(pFlow, &lockState);
        packetInfoEqual = PacketInfo_Equal(&pFlow->unmaskedPacketInfo, &(flowMatch.packetInfo), flowMatch.piRange.endRange);
        FLOW_UNLOCK(pFlow, &lockState);

        if (!packetInfoEqual)
        {
            OVS_REFCOUNT_DEREFERENCE(pFlow);

            pFlow = FlowTable_FindExactFlow_Ref(pFlowTable, &flowMatch);
            if (!pFlow)
            {
                DEBUGP(LOG_LOUD, "flow create/set failed (flow does not match the unmasked key): ");

                error = OVS_ERROR_INVAL;
                goto Cleanup;
            }
        }

        pFoundFlow = pFlow;

        _SetExistingFlow(pFoundFlow, pMsg->pArgGroup, pActions);
    }

    /*** REPLY ***/
    CHECK_E(CreateMsgFromFlow(pFlow, pMsg, &replyMsg, OVS_MESSAGE_COMMAND_NEW));
    CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)&replyMsg, 1, pFileObject, OVS_MULTICAST_GROUP_NONE));

    /*** cleanup ***/
Cleanup:
    DestroyArgumentGroup(replyMsg.pArgGroup);

    OVS_REFCOUNT_DEREFERENCE(pFlow);

    return error;
}

_Use_decl_annotations_
OVS_ERROR WinlFlow_Set(OVS_FLOW_TABLE* pFlowTable, const OVS_MESSAGE* pMsg, const FILE_OBJECT* pFileObject)
{
    OVS_OFPACKET_INFO maskedPacketInfo = { 0 };
    OVS_FLOW* pFlow = NULL;
    OVS_MESSAGE replyMsg = { 0 };
    OVS_ACTIONS* pActions = NULL;
    OVS_FLOW_MATCH flowMatch = { 0 };
    OVS_ERROR error = OVS_ERROR_NOERROR;

    CHECK_E(_ExtractFowInfoFromArgs(pMsg, /*actions opt*/ TRUE, &flowMatch, &maskedPacketInfo, &pActions));

    pFlow = FlowTable_FindExactFlow_Ref(pFlowTable, &flowMatch);
    CHECK_B_E(pFlow, OVS_ERROR_NOENT);
    _SetExistingFlow(pFlow, pMsg->pArgGroup, pActions);

    /*** reply ***/
    CHECK_E(CreateMsgFromFlow(pFlow, pMsg, &replyMsg, OVS_MESSAGE_COMMAND_NEW));
    CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)&replyMsg, 1, pFileObject, OVS_MULTICAST_GROUP_NONE));

Cleanup:
    DestroyArgumentGroup(replyMsg.pArgGroup);
    OVS_REFCOUNT_DEREFERENCE(pFlow);

    return error;
}

_Use_decl_annotations_
OVS_ERROR WinlFlow_Get(OVS_FLOW_TABLE* pFlowTable, const OVS_MESSAGE* pMsg, const FILE_OBJECT* pFileObject)
{
    OVS_MESSAGE replyMsg = { 0 };
    OVS_FLOW *pFlow = NULL;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    CHECK_E(_ExtractPIFromArgsAndFindFlow_Ref(pMsg->pArgGroup, pFlowTable, &pFlow));

    CHECK_E(CreateMsgFromFlow(pFlow, pMsg, &replyMsg, OVS_MESSAGE_COMMAND_NEW));
    CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)&replyMsg, 1, pFileObject, OVS_MULTICAST_GROUP_NONE));

Cleanup:
    DestroyArgumentGroup(replyMsg.pArgGroup);
    OVS_REFCOUNT_DEREFERENCE(pFlow);

    return error;
}

_Use_decl_annotations_
OVS_ERROR WinlFlow_Delete(OVS_DATAPATH* pDatapath, OVS_FLOW_TABLE* pFlowTable, const OVS_MESSAGE* pMsg, const FILE_OBJECT* pFileObject)
{
    OVS_MESSAGE replyMsg = { 0 };
    OVS_FLOW* pFlow = NULL;
    LOCK_STATE_EX lockState = { 0 };
    OVS_ERROR error = OVS_ERROR_NOERROR;

    if (!pMsg->pArgGroup)
    {
        CHECK_E(Datapath_FlushFlows(pDatapath));

        //i.e. must send reply = ok
        WriteErrorToDevice((OVS_NLMSGHDR*)pMsg, OVS_ERROR_NOERROR, pFileObject, OVS_MULTICAST_GROUP_NONE);
        goto Cleanup;
    }

    CHECK_E(_ExtractPIFromArgsAndFindFlow_Ref(pMsg->pArgGroup, pFlowTable, &pFlow));

    FLOWTABLE_LOCK_WRITE(pFlowTable, &lockState);
    DBGPRINT_FLOW(LOG_LOUD, "deleting flow: ", pFlow);
    //remove the flow from the list of flows
    FlowTable_RemoveFlow_Unsafe(pFlowTable, pFlow);
    FLOWTABLE_UNLOCK(pFlowTable, &lockState);

    CHECK_E(CreateMsgFromFlow(pFlow, pMsg, &replyMsg, OVS_MESSAGE_COMMAND_DELETE));
    OVS_REFCOUNT_DEREF_AND_DESTROY(pFlow);

    CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)&replyMsg, 1, pFileObject, OVS_MULTICAST_GROUP_NONE));

Cleanup:
    DestroyArgumentGroup(replyMsg.pArgGroup);
    OVS_REFCOUNT_DEREFERENCE(pFlow);

    return error;
}

static OVS_ERROR _CreateMsgsFromFlows(OVS_MESSAGE* msgs, ULONG countMsgs, const OVS_MESSAGE* pInMsg, OVS_FLOW_TABLE* pFlowTable)
{
    LOCK_STATE_EX lockState = { 0 };
    OVS_ERROR error = OVS_ERROR_NOERROR;
    ULONG j = 0;

    FLOWTABLE_LOCK_READ(pFlowTable, &lockState);

    for (ULONG i = 0; i < OVS_FLOW_TABLE_HASH_COUNT; ++i)
    {
        OVS_FLOW* pFlow = NULL;
        LIST_ENTRY* pList = NULL;

        pList = pFlowTable->pFlowLists + i;

        OVS_LIST_FOR_EACH(OVS_FLOW, pFlow, pList)
        {
            OVS_MESSAGE* pReplyMsg = msgs + j;

            CHECK_E(CreateMsgFromFlow(pFlow, pInMsg, pReplyMsg, OVS_MESSAGE_COMMAND_NEW));
            pReplyMsg->flags |= OVS_MESSAGE_FLAG_MULTIPART;

            ++j;
        }
    }

    //there must be room for one more message: the dump done message
    OVS_CHECK(j == countMsgs - 1);

    CHECK_E(CreateReplyMsgDone(pInMsg, msgs + j, sizeof(OVS_MESSAGE_DONE), OVS_MESSAGE_COMMAND_NEW));

Cleanup:
    FLOWTABLE_UNLOCK(pFlowTable, &lockState);

    return error;
}

_Use_decl_annotations_
OVS_ERROR WinlFlow_Dump(OVS_FLOW_TABLE* pFlowTable, const OVS_MESSAGE* pMsg, const FILE_OBJECT* pFileObject)
{
    OVS_MESSAGE* msgs = NULL;
    UINT countMsgs = 0;
    OVS_ERROR error = OVS_ERROR_NOERROR;

    if (pFlowTable->countFlows > 0)
    {
        countMsgs = pFlowTable->countFlows + 1;
        msgs = KZAlloc(countMsgs * sizeof(OVS_MESSAGE));
        CHECK_B_E(msgs, OVS_ERROR_NOMEM);

        RtlZeroMemory(msgs, countMsgs * sizeof(OVS_MESSAGE));

        CHECK_E(_CreateMsgsFromFlows(msgs, countMsgs, pMsg, pFlowTable));
        CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)msgs, countMsgs, pFileObject, OVS_MULTICAST_GROUP_NONE));
    }

    //if we have no flow, write only "done"
    else
    {
        OVS_MESSAGE msgDone = { 0 };

        CHECK_E(CreateReplyMsgDone(pMsg, &msgDone, sizeof(OVS_MESSAGE_DONE), OVS_MESSAGE_COMMAND_NEW));
        CHECK_E(WriteMsgsToDevice((OVS_NLMSGHDR*)&msgDone, 1, pFileObject, OVS_MULTICAST_GROUP_NONE));
    }

Cleanup:
    DestroyMessages(msgs, countMsgs);

    return error;
}


text:
from typing import List, Optional, Tuple, Union

import torch

from ..lazy import InterpolatedLazyTensor, lazify
from ..models.exact_prediction_strategies import InterpolatedPredictionStrategy
from ..utils.broadcasting import _mul_broadcast_shape
from ..utils.grid import create_grid
from ..utils.interpolation import Interpolation
from .grid_kernel import GridKernel
from .kernel import Kernel

class GridInterpolationKernel(GridKernel):
    r"""
    Implements the KISS-GP (or SKI) approximation for a given kernel.
    It was proposed in `Kernel Interpolation for Scalable Structured Gaussian Processes`_,
    and offers extremely fast and accurate Kernel approximations for large datasets.

    Given a base kernel `k`, the covariance :math:`k(\mathbf{x_1}, \mathbf{x_2})` is approximated by
    using a grid of regularly spaced *inducing points*:

    .. math::

       \begin{equation*}
          k(\mathbf{x_1}, \mathbf{x_2}) = \mathbf{w_{x_1}}^\top K_{U,U} \mathbf{w_{x_2}}
       \end{equation*}

    where

    * :math:`U` is the set of gridded inducing points

    * :math:`K_{U,U}` is the kernel matrix between the inducing points

    * :math:`\mathbf{w_{x_1}}` and :math:`\mathbf{w_{x_2}}` are sparse vectors based on
      :math:`\mathbf{x_1}` and :math:`\mathbf{x_2}` that apply cubic interpolation.

    The user should supply the size of the grid (using the :attr:`grid_size` attribute).
    To choose a reasonable grid value, we highly recommend using the
    :func:`gpytorch.utils.grid.choose_grid_size` helper function.
    The bounds of the grid will automatically be determined by data.

    (Alternatively, you can hard-code bounds using the :attr:`grid_bounds`, which
    will speed up this kernel's computations.)

    .. note::

        `GridInterpolationKernel` can only wrap **stationary kernels** (such as RBF, Matern,
        Periodic, Spectral Mixture, etc.)

    Args:
        - :attr:`base_kernel` (Kernel):
            The kernel to approximate with KISS-GP
        - :attr:`grid_size` (Union[int, List[int]]):
            The size of the grid in each dimension.
            If a single int is provided, then every dimension will have the same grid size.
        - :attr:`num_dims` (int):
            The dimension of the input data. Required if `grid_bounds=None`
        - :attr:`grid_bounds` (tuple(float, float), optional):
            The bounds of the grid, if known (high performance mode).
            The length of the tuple must match the number of dimensions.
            The entries represent the min/max values for each dimension.
        - :attr:`active_dims` (tuple of ints, optional):
            Passed down to the `base_kernel`.

    .. _Kernel Interpolation for Scalable Structured Gaussian Processes:
        http://proceedings.mlr.press/v37/wilson15.pdf
    """

    def __init__(
        self,
        base_kernel: Kernel,
        grid_size: Union[int, List[int]],
        num_dims: int = None,
        grid_bounds: Optional[Tuple[float, float]] = None,
        active_dims: Tuple[int, ...] = None,
    ):
        has_initialized_grid = 0
        grid_is_dynamic = True

        # Make some temporary grid bounds, if none exist
        if grid_bounds is None:
            if num_dims is None:
                raise RuntimeError("num_dims must be supplied if grid_bounds is None")
            else:
                # Create some temporary grid bounds - they'll be changed soon
                grid_bounds = tuple((-1.0, 1.0) for _ in range(num_dims))
        else:
            has_initialized_grid = 1
            grid_is_dynamic = False
            if num_dims is None:
                num_dims = len(grid_bounds)
            elif num_dims != len(grid_bounds):
                raise RuntimeError(
                    "num_dims ({}) disagrees with the number of supplied "
                    "grid_bounds ({})".format(num_dims, len(grid_bounds))
                )

        if isinstance(grid_size, int):
            grid_sizes = [grid_size for _ in range(num_dims)]
        else:
            grid_sizes = list(grid_size)

        if len(grid_sizes) != num_dims:
            raise RuntimeError("The number of grid sizes provided through grid_size do not match num_dims.")

        # Initialize values and the grid
        self.grid_is_dynamic = grid_is_dynamic
        self.num_dims = num_dims
        self.grid_sizes = grid_sizes
        self.grid_bounds = grid_bounds
        grid = create_grid(self.grid_sizes, self.grid_bounds)

        super(GridInterpolationKernel, self).__init__(
            base_kernel=base_kernel, grid=grid, interpolation_mode=True, active_dims=active_dims,
        )
        self.register_buffer("has_initialized_grid", torch.tensor(has_initialized_grid, dtype=torch.bool))

    @property
    def _tight_grid_bounds(self):
        grid_spacings = tuple((bound[1] - bound[0]) / self.grid_sizes[i] for i, bound in enumerate(self.grid_bounds))
        return tuple(
            (bound[0] + 2.01 * spacing, bound[1] - 2.01 * spacing)
            for bound, spacing in zip(self.grid_bounds, grid_spacings)
        )

    def _compute_grid(self, inputs, last_dim_is_batch=False):
        n_data, n_dimensions = inputs.size(-2), inputs.size(-1)
        if last_dim_is_batch:
            inputs = inputs.transpose(-1, -2).unsqueeze(-1)
            n_dimensions = 1
        batch_shape = inputs.shape[:-2]

        inputs = inputs.reshape(-1, n_dimensions)
        interp_indices, interp_values = Interpolation().interpolate(self.grid, inputs)
        interp_indices = interp_indices.view(*batch_shape, n_data, -1)
        interp_values = interp_values.view(*batch_shape, n_data, -1)
        return interp_indices, interp_values

    def _inducing_forward(self, last_dim_is_batch, **params):
        return super().forward(self.grid, self.grid, last_dim_is_batch=last_dim_is_batch, **params)

    def forward(self, x1, x2, diag=False, last_dim_is_batch=False, **params):
        # See if we need to update the grid or not
        if self.grid_is_dynamic:  # This is true if a grid_bounds wasn't passed in
            if torch.equal(x1, x2):
                x = x1.reshape(-1, self.num_dims)
            else:
                x = torch.cat([x1.reshape(-1, self.num_dims), x2.reshape(-1, self.num_dims)])
            x_maxs = x.max(0)[0].tolist()
            x_mins = x.min(0)[0].tolist()

            # We need to update the grid if
            # 1) it hasn't ever been initialized, or
            # 2) if any of the grid points are "out of bounds"
            update_grid = (not self.has_initialized_grid.item()) or any(
                x_min < bound[0] or x_max > bound[1]
                for x_min, x_max, bound in zip(x_mins, x_maxs, self._tight_grid_bounds)
            )

            # Update the grid if needed
            if update_grid:
                grid_spacings = tuple(
                    (x_max - x_min) / (gs - 4.02) for gs, x_min, x_max in zip(self.grid_sizes, x_mins, x_maxs)
                )
                self.grid_bounds = tuple(
                    (x_min - 2.01 * spacing, x_max + 2.01 * spacing)
                    for x_min, x_max, spacing in zip(x_mins, x_maxs, grid_spacings)
                )
                grid = create_grid(
                    self.grid_sizes, self.grid_bounds, dtype=self.grid[0].dtype, device=self.grid[0].device,
                )
                self.update_grid(grid)

        base_lazy_tsr = lazify(self._inducing_forward(last_dim_is_batch=last_dim_is_batch, **params))
        if last_dim_is_batch and base_lazy_tsr.size(-3) == 1:
            base_lazy_tsr = base_lazy_tsr.repeat(*x1.shape[:-2], x1.size(-1), 1, 1)

        left_interp_indices, left_interp_values = self._compute_grid(x1, last_dim_is_batch)
        if torch.equal(x1, x2):
            right_interp_indices = left_interp_indices
            right_interp_values = left_interp_values
        else:
            right_interp_indices, right_interp_values = self._compute_grid(x2, last_dim_is_batch)

        batch_shape = _mul_broadcast_shape(
            base_lazy_tsr.batch_shape, left_interp_indices.shape[:-2], right_interp_indices.shape[:-2],
        )
        res = InterpolatedLazyTensor(
            base_lazy_tsr.expand(*batch_shape, *base_lazy_tsr.matrix_shape),
            left_interp_indices.detach().expand(*batch_shape, *left_interp_indices.shape[-2:]),
            left_interp_values.expand(*batch_shape, *left_interp_values.shape[-2:]),
            right_interp_indices.detach().expand(*batch_shape, *right_interp_indices.shape[-2:]),
            right_interp_values.expand(*batch_shape, *right_interp_values.shape[-2:]),
        )

        if diag:
            return res.diag()
        else:
            return res

    def prediction_strategy(self, train_inputs, train_prior_dist, train_labels, likelihood):
        return InterpolatedPredictionStrategy(train_inputs, train_prior_dist, train_labels, likelihood)


text:
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { AuthenticateService } from '../../../services/authenticate.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-register',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit{
  token = this.authenticateService.token;
  problems: Object;
  registrationForm: FormGroup;
  email: FormControl;
  password: FormControl;
  passwordAgain: FormControl;

  constructor(
    private authenticateService: AuthenticateService,
    private router: Router
  ) {
    this.email = new FormControl('',[Validators.required, Validators.pattern(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])+/)]);
    this.password = new FormControl('',[Validators.required, Validators.minLength(5)]);
    this.passwordAgain = new FormControl('',[Validators.required]);
  }

  ngOnInit() {
    this.registrationForm = new FormGroup({
      email: this.email,
      password: this.password,
      passwordAgain: this.passwordAgain
    });
    this.updateProblems();
    this.registrationForm.valueChanges.subscribe(data => {
      this.updateProblems();
    })
  }

  onRegisterSubmit() {
    this.updateProblems();
    for (let property in this.registrationForm.controls) {
      this.registrationForm.controls[property].markAsDirty();
      this.registrationForm.controls[property].markAsTouched();
    }

    if (this.registrationForm.valid) {
      if (this.registrationForm.controls['password'].value != this.registrationForm.controls['passwordAgain'].value) {
        this.registrationForm.controls['passwordAgain'].setErrors({
          match: false
        });
      } else {
        this.registerUser();
      }
    }
  }

  updateProblems() {
    let emailProblem;

    if (this.email.hasError('EMAIL_ALREADY_EXISTS')) {
      emailProblem = 'REGISTER.EMAIL_EXISTS';
    } else {
      emailProblem = this.email.hasError('required') ? 'REGISTER.REQUIRED_FIELD' : 'REGISTER.INVALID_EMAIL';
    }

    let passwordProblem = this.password.hasError('required') ? 'REGISTER.REQUIRED_FIELD' : 'REGISTER.BASIC_PASSWORD';
    let passwordAgainProblem = this.passwordAgain.hasError('required') ? 'REGISTER.REQUIRED_FIELD' : 'REGISTER.PASSWORD_DONT_MATCH';

    this.problems = {
      email: emailProblem,
      password: passwordProblem,
      passwordAgain: passwordAgainProblem
    };
  }

  registerUser() {
    const user = {
      email: this.email.value,
      password: this.password.value
    }

    this.authenticateService.registerUser(user).subscribe(
      data => {
        if (data.success) {
          this.router.navigateByUrl('/');
        }
      },
      err => {
        if(err.status == 400) {
          this.registrationForm.controls['email'].setErrors({'EMAIL_ALREADY_EXISTS': true});
          this.updateProblems();
        }
      });
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _5.HexadecimalToBinary
{
    class Program
    {
        //•	Write a program to convert hexadecimal numbers to binary numbers (directly).

        static int HexadecimalToDecimal(string str)
        {
            int result = 0;
            int multiplyer = 1;
            for (int i = str.Length - 1; i >= 0; i--)
            {
                int digit = 0;
                char ch = str[i];
                switch (ch)
                {
                    case 'A': digit = 10; break;
                    case 'B': digit = 11; break;
                    case 'C': digit = 12; break;
                    case 'D': digit = 13; break;
                    case 'E': digit = 14; break;
                    case 'F': digit = 15; break;
                    default: digit = ch - '0'; break;
                }

                result += digit * multiplyer;
                multiplyer *= 16;
            }
            return result;
        }

        static string DecimalToBinary(int number)
        {
            if (number < 0)
            {
                number = -number;
            }
            // result = "";
            List<int> numb = new List<int>();
            while (number > 0)
            {
                numb.Add(number % 2);
                number /= 2;
            }
            numb.Reverse();
            string result = string.Join("", numb);
            return result;
        }

        static string HexadecimalToBinary(string str)
        {
            int numb = HexadecimalToDecimal(str);
            string result = DecimalToBinary(numb);
            return result;
        }

        static string HexadecimalToBinaryDirect(string str) //direct conversion Hexadecimal -> Binary
        {
            string result = String.Empty;
            for (int i = 0; i < str.Length; i++)
            {
                switch (str[i])
                {
                    case 'A': result += "1010"; break;
                    case 'B': result += "1011"; break;
                    case 'C': result += "1100"; break;
                    case 'D': result += "1101"; break;
                    case 'E': result += "1110"; break;
                    case 'F': result += "1111"; break;
                    case '9': result += "1001"; break;
                    case '8': result += "1000"; break;
                    case '7': result += "0111"; break;
                    case '6': result += "0110"; break;
                    case '5': result += "0101"; break;
                    case '4': result += "0100"; break;
                    case '3': result += "0011"; break;
                    case '2': result += "0010"; break;
                    case '1': result += "0001"; break;
                    case '0': result += "0000"; break;
                    default: Console.WriteLine("Wrong number!"); break;
                }
            }

            return result;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Please, enter hexadecimal numbrt");
            string str = Console.ReadLine();
            Console.WriteLine();
            Console.WriteLine("Hexadecimal {0} to binary number is: {1}", str, HexadecimalToBinary(str));
            Console.WriteLine("To 32 bits: ");
            Console.WriteLine(HexadecimalToBinary(str).PadLeft(32, '0'));
            Console.WriteLine();
            Console.WriteLine("Hexadecimal {0} to binary number (directly) is: {1}", str, HexadecimalToBinaryDirect(str));
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">BannerExample</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>

    <!-- This is an ad unit ID for a test ad. Replace with your own banner ad unit id. -->
    <string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
    <string name="title_activity_ad_free">AdFreeActivity</string>

</resources>


text:
<?php

namespace Tmdb\Tests\Factory;

use Tmdb\Factory\AuthenticationFactory;

class AuthenticationFactoryTest extends TestCase
{
    /**
     * @test
     */
    public function shouldCreateRequestToken()
    {
        /**
         * @var AuthenticationFactory $factory
         */
        $factory = $this->getFactory();

        $token = $factory->createRequestToken($this->loadByFile('authentication/request_token.json'));

        $this->assertEquals('09-02-2012', $token->getExpiresAt()->format('d-m-Y'));
        $this->assertEquals('641bf16c663db167c6cffcdff41126039d4445bf', $token->getToken());
        $this->assertEquals(true, $token->getSuccess());
    }

    /**
     * @test
     */
    public function shouldCreateSessionToken()
    {
        /**
         * @var AuthenticationFactory $factory
         */
        $factory = $this->getFactory();

        $token = $factory->createSessionToken($this->loadByFile('authentication/session_token.json'));

        $this->assertEquals('80b2bf99520cd795ff54e31af97917bc9e3a7c8c', $token->getToken());
        $this->assertEquals(true, $token->getSuccess());
    }

    /**
     * @test
     */
    public function shouldCreateGuestSessionToken()
    {
        /**
         * @var AuthenticationFactory $factory
         */
        $factory = $this->getFactory();

        $token = $factory->createGuestSessionToken($this->loadByFile('authentication/guest_session_token.json'));

        $this->assertEquals('04-12-2012', $token->getExpiresAt()->format('d-m-Y'));
        $this->assertEquals('0c550fd5da2fc3f321ab3bs9b60ca108', $token->getToken());
        $this->assertEquals(true, $token->getSuccess());
    }

    /**
     * @test
     * @expectedException \Tmdb\Exception\NotImplementedException
     */
    public function shouldThrowExceptionForCreate()
    {
        /**
         * @var AuthenticationFactory $factory
         */
        $factory = $this->getFactory();

        $factory->create(array());
    }

    /**
     * @test
     * @expectedException \Tmdb\Exception\NotImplementedException
     */
    public function shouldThrowExceptionForCreateCollection()
    {
        /**
         * @var AuthenticationFactory $factory
         */
        $factory = $this->getFactory();

        $factory->createCollection(array());
    }

    protected function getFactoryClass()
    {
        return 'Tmdb\Factory\AuthenticationFactory';
    }
}


text:
/**
 * Swaggy Jenkins
 * Jenkins API clients generated from Swagger / Open API specification
 *
 * The version of the OpenAPI document: 1.5.1-pre.0
 * Contact: blah@cliffano.com
 *
 * NOTE: This class is auto generated by OpenAPI-Generator 6.0.0.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#include "GithubRepositorypermissions.h"

#include <string>
#include <vector>
#include <sstream>
#include <stdexcept>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>

using boost::property_tree::ptree;
using boost::property_tree::read_json;
using boost::property_tree::write_json;

namespace org {
namespace openapitools {
namespace server {
namespace model {

GithubRepositorypermissions::GithubRepositorypermissions(boost::property_tree::ptree const& pt)
{
        fromPropertyTree(pt);
}

std::string GithubRepositorypermissions::toJsonString(bool prettyJson /* = false */)
{
    return toJsonString_internal(prettyJson);
}

void GithubRepositorypermissions::fromJsonString(std::string const& jsonString)
{
    fromJsonString_internal(jsonString);
}

boost::property_tree::ptree GithubRepositorypermissions::toPropertyTree()
{
    return toPropertyTree_internal();
}

void GithubRepositorypermissions::fromPropertyTree(boost::property_tree::ptree const& pt)
{
    fromPropertyTree_internal(pt);
}

std::string GithubRepositorypermissions::toJsonString_internal(bool prettyJson)
{
	std::stringstream ss;
	write_json(ss, this->toPropertyTree(), prettyJson);
	return ss.str();
}

void GithubRepositorypermissions::fromJsonString_internal(std::string const& jsonString)
{
	std::stringstream ss(jsonString);
	ptree pt;
	read_json(ss,pt);
	this->fromPropertyTree(pt);
}

ptree GithubRepositorypermissions::toPropertyTree_internal()
{
	ptree pt;
	ptree tmp_node;
	pt.put("admin", m_Admin);
	pt.put("push", m_Push);
	pt.put("pull", m_Pull);
	pt.put("_class", m__class);
	return pt;
}

void GithubRepositorypermissions::fromPropertyTree_internal(ptree const &pt)
{
	ptree tmp_node;
	m_Admin = pt.get("admin", false);
	m_Push = pt.get("push", false);
	m_Pull = pt.get("pull", false);
	m__class = pt.get("_class", "");
}

bool GithubRepositorypermissions::isAdmin() const
{
    return m_Admin;
}

void GithubRepositorypermissions::setAdmin(bool value)
{
	m_Admin = value;
}
bool GithubRepositorypermissions::isPush() const
{
    return m_Push;
}

void GithubRepositorypermissions::setPush(bool value)
{
	m_Push = value;
}
bool GithubRepositorypermissions::isPull() const
{
    return m_Pull;
}

void GithubRepositorypermissions::setPull(bool value)
{
	m_Pull = value;
}
std::string GithubRepositorypermissions::get_Class() const
{
    return m__class;
}

void GithubRepositorypermissions::set_Class(std::string value)
{
	m__class = value;
}

std::vector<GithubRepositorypermissions> createGithubRepositorypermissionsVectorFromJsonString(const std::string& json)
{
    std::stringstream sstream(json);
    boost::property_tree::ptree pt;
    boost::property_tree::json_parser::read_json(sstream,pt);

    auto vec = std::vector<GithubRepositorypermissions>();
    for (const auto& child: pt) {
        vec.emplace_back(GithubRepositorypermissions(child.second));
    }

    return vec;
}

}
}
}
}


text:
import binascii
import logging
import struct
import time

import serial

# I2C addresses
BNO055_ADDRESS_A = 0x28
BNO055_ADDRESS_B = 0x29
BNO055_ID = 0xA0

# Page id register definition
BNO055_PAGE_ID_ADDR = 0X07

# PAGE0 REGISTER DEFINITION START
BNO055_CHIP_ID_ADDR = 0x00
BNO055_ACCEL_REV_ID_ADDR = 0x01
BNO055_MAG_REV_ID_ADDR = 0x02
BNO055_GYRO_REV_ID_ADDR = 0x03
BNO055_SW_REV_ID_LSB_ADDR = 0x04
BNO055_SW_REV_ID_MSB_ADDR = 0x05
BNO055_BL_REV_ID_ADDR = 0X06

# Accel data register
BNO055_ACCEL_DATA_X_LSB_ADDR = 0X08
BNO055_ACCEL_DATA_X_MSB_ADDR = 0X09
BNO055_ACCEL_DATA_Y_LSB_ADDR = 0X0A
BNO055_ACCEL_DATA_Y_MSB_ADDR = 0X0B
BNO055_ACCEL_DATA_Z_LSB_ADDR = 0X0C
BNO055_ACCEL_DATA_Z_MSB_ADDR = 0X0D

# Mag data register
BNO055_MAG_DATA_X_LSB_ADDR = 0X0E
BNO055_MAG_DATA_X_MSB_ADDR = 0X0F
BNO055_MAG_DATA_Y_LSB_ADDR = 0X10
BNO055_MAG_DATA_Y_MSB_ADDR = 0X11
BNO055_MAG_DATA_Z_LSB_ADDR = 0X12
BNO055_MAG_DATA_Z_MSB_ADDR = 0X13

# Gyro data registers
BNO055_GYRO_DATA_X_LSB_ADDR = 0X14
BNO055_GYRO_DATA_X_MSB_ADDR = 0X15
BNO055_GYRO_DATA_Y_LSB_ADDR = 0X16
BNO055_GYRO_DATA_Y_MSB_ADDR = 0X17
BNO055_GYRO_DATA_Z_LSB_ADDR = 0X18
BNO055_GYRO_DATA_Z_MSB_ADDR = 0X19

# Euler data registers
BNO055_EULER_H_LSB_ADDR = 0X1A
BNO055_EULER_H_MSB_ADDR = 0X1B
BNO055_EULER_R_LSB_ADDR = 0X1C
BNO055_EULER_R_MSB_ADDR = 0X1D
BNO055_EULER_P_LSB_ADDR = 0X1E
BNO055_EULER_P_MSB_ADDR = 0X1F

# Quaternion data registers
BNO055_QUATERNION_DATA_W_LSB_ADDR = 0X20
BNO055_QUATERNION_DATA_W_MSB_ADDR = 0X21
BNO055_QUATERNION_DATA_X_LSB_ADDR = 0X22
BNO055_QUATERNION_DATA_X_MSB_ADDR = 0X23
BNO055_QUATERNION_DATA_Y_LSB_ADDR = 0X24
BNO055_QUATERNION_DATA_Y_MSB_ADDR = 0X25
BNO055_QUATERNION_DATA_Z_LSB_ADDR = 0X26
BNO055_QUATERNION_DATA_Z_MSB_ADDR = 0X27

# Linear acceleration data registers
BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR = 0X28
BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR = 0X29
BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR = 0X2A
BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR = 0X2B
BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR = 0X2C
BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR = 0X2D

# Gravity data registers
BNO055_GRAVITY_DATA_X_LSB_ADDR = 0X2E
BNO055_GRAVITY_DATA_X_MSB_ADDR = 0X2F
BNO055_GRAVITY_DATA_Y_LSB_ADDR = 0X30
BNO055_GRAVITY_DATA_Y_MSB_ADDR = 0X31
BNO055_GRAVITY_DATA_Z_LSB_ADDR = 0X32
BNO055_GRAVITY_DATA_Z_MSB_ADDR = 0X33

# Temperature data register
BNO055_TEMP_ADDR = 0X34

# Status registers
BNO055_CALIB_STAT_ADDR = 0X35
BNO055_SELFTEST_RESULT_ADDR = 0X36
BNO055_INTR_STAT_ADDR = 0X37

BNO055_SYS_CLK_STAT_ADDR = 0X38
BNO055_SYS_STAT_ADDR = 0X39
BNO055_SYS_ERR_ADDR = 0X3A

# Unit selection register
BNO055_UNIT_SEL_ADDR = 0X3B
BNO055_DATA_SELECT_ADDR = 0X3C

# Mode registers
BNO055_OPR_MODE_ADDR = 0X3D
BNO055_PWR_MODE_ADDR = 0X3E

BNO055_SYS_TRIGGER_ADDR = 0X3F
BNO055_TEMP_SOURCE_ADDR = 0X40

# Axis remap registers
BNO055_AXIS_MAP_CONFIG_ADDR = 0X41
BNO055_AXIS_MAP_SIGN_ADDR = 0X42

# Axis remap values
AXIS_REMAP_X = 0x00
AXIS_REMAP_Y = 0x01
AXIS_REMAP_Z = 0x02
AXIS_REMAP_POSITIVE = 0x00
AXIS_REMAP_NEGATIVE = 0x01

# SIC registers
BNO055_SIC_MATRIX_0_LSB_ADDR = 0X43
BNO055_SIC_MATRIX_0_MSB_ADDR = 0X44
BNO055_SIC_MATRIX_1_LSB_ADDR = 0X45
BNO055_SIC_MATRIX_1_MSB_ADDR = 0X46
BNO055_SIC_MATRIX_2_LSB_ADDR = 0X47
BNO055_SIC_MATRIX_2_MSB_ADDR = 0X48
BNO055_SIC_MATRIX_3_LSB_ADDR = 0X49
BNO055_SIC_MATRIX_3_MSB_ADDR = 0X4A
BNO055_SIC_MATRIX_4_LSB_ADDR = 0X4B
BNO055_SIC_MATRIX_4_MSB_ADDR = 0X4C
BNO055_SIC_MATRIX_5_LSB_ADDR = 0X4D
BNO055_SIC_MATRIX_5_MSB_ADDR = 0X4E
BNO055_SIC_MATRIX_6_LSB_ADDR = 0X4F
BNO055_SIC_MATRIX_6_MSB_ADDR = 0X50
BNO055_SIC_MATRIX_7_LSB_ADDR = 0X51
BNO055_SIC_MATRIX_7_MSB_ADDR = 0X52
BNO055_SIC_MATRIX_8_LSB_ADDR = 0X53
BNO055_SIC_MATRIX_8_MSB_ADDR = 0X54

# Accelerometer Offset registers
ACCEL_OFFSET_X_LSB_ADDR = 0X55
ACCEL_OFFSET_X_MSB_ADDR = 0X56
ACCEL_OFFSET_Y_LSB_ADDR = 0X57
ACCEL_OFFSET_Y_MSB_ADDR = 0X58
ACCEL_OFFSET_Z_LSB_ADDR = 0X59
ACCEL_OFFSET_Z_MSB_ADDR = 0X5A

# Magnetometer Offset registers
MAG_OFFSET_X_LSB_ADDR = 0X5B
MAG_OFFSET_X_MSB_ADDR = 0X5C
MAG_OFFSET_Y_LSB_ADDR = 0X5D
MAG_OFFSET_Y_MSB_ADDR = 0X5E
MAG_OFFSET_Z_LSB_ADDR = 0X5F
MAG_OFFSET_Z_MSB_ADDR = 0X60

# Gyroscope Offset register s
GYRO_OFFSET_X_LSB_ADDR = 0X61
GYRO_OFFSET_X_MSB_ADDR = 0X62
GYRO_OFFSET_Y_LSB_ADDR = 0X63
GYRO_OFFSET_Y_MSB_ADDR = 0X64
GYRO_OFFSET_Z_LSB_ADDR = 0X65
GYRO_OFFSET_Z_MSB_ADDR = 0X66

# Radius registers
ACCEL_RADIUS_LSB_ADDR = 0X67
ACCEL_RADIUS_MSB_ADDR = 0X68
MAG_RADIUS_LSB_ADDR = 0X69
MAG_RADIUS_MSB_ADDR = 0X6A

# Power modes
POWER_MODE_NORMAL = 0X00
POWER_MODE_LOWPOWER = 0X01
POWER_MODE_SUSPEND = 0X02

# Operation mode settings
OPERATION_MODE_CONFIG = 0X00
OPERATION_MODE_ACCONLY = 0X01
OPERATION_MODE_MAGONLY = 0X02
OPERATION_MODE_GYRONLY = 0X03
OPERATION_MODE_ACCMAG = 0X04
OPERATION_MODE_ACCGYRO = 0X05
OPERATION_MODE_MAGGYRO = 0X06
OPERATION_MODE_AMG = 0X07
OPERATION_MODE_IMUPLUS = 0X08
OPERATION_MODE_COMPASS = 0X09
OPERATION_MODE_M4G = 0X0A
OPERATION_MODE_NDOF_FMC_OFF = 0X0B
OPERATION_MODE_NDOF = 0X0C

logger = logging.getLogger(__name__)

class BNO055(object):
    def __init__(self, rst=None, address=BNO055_ADDRESS_A, i2c=None, gpio=None,
                 serial_port=None, serial_timeout_sec=5, **kwargs):
        # If reset pin is provided save it and a reference to provided GPIO
        # bus (or the default system GPIO bus if none is provided).
        self._rst = rst
        if self._rst is not None:
            if gpio is None:
                import Adafruit_GPIO as GPIO
                gpio = GPIO.get_platform_gpio()
            self._gpio = gpio
            # Setup the reset pin as an output at a high level.
            self._gpio.setup(self._rst, GPIO.OUT)
            self._gpio.set_high(self._rst)
            # Wait a 650 milliseconds in case setting the reset high reset the chip.
            time.sleep(0.65)
        self._serial = None
        self.serial_attempt_delay = 0.0
        self._i2c_device = None
        if serial_port is not None:
            # Use serial communication if serial_port name is provided.
            # Open the serial port at 115200 baud, 8N1.  Add a 5 second timeout
            # to prevent hanging if device is disconnected.
            self._serial = serial.Serial(serial_port, 115200, timeout=serial_timeout_sec,
                                         writeTimeout=serial_timeout_sec)
        else:
            # Use I2C if no serial port is provided.
            # Assume we're using platform's default I2C bus if none is specified.
            if i2c is None:
                import Adafruit_GPIO.I2C as I2C
                i2c = I2C
            # Save a reference to the I2C device instance for later communication.
            self._i2c_device = i2c.get_i2c_device(address, **kwargs)

    def _serial_send(self, command, ack=True, max_attempts=5):
        # Send a serial command and automatically handle if it needs to be resent
        # because of a bus error.  If ack is True then an ackowledgement is
        # expected and only up to the maximum specified attempts will be made
        # to get a good acknowledgement (default is 5).  If ack is False then
        # no acknowledgement is expected (like when resetting the device).
        attempts = 0
        while True:
            # Flush any pending received data to get into a clean state.
            self._serial.flushInput()
            # Send the data.
            self._serial.write(command)
            logger.debug('Serial send: 0x{0}'.format(binascii.hexlify(command)))
            # Stop if no acknowledgment is expected.
            if not ack:
                return
            # Read acknowledgement response (2 bytes).
            resp = bytearray(self._serial.read(2))
            logger.debug('Serial receive: 0x{0}'.format(binascii.hexlify(resp)))
            if resp is None or len(resp) != 2:
                raise RuntimeError('Timeout waiting for serial acknowledge, is the BNO055 connected?')
            # Stop if there's no bus error (0xEE07 response) and return response bytes.
            if not (resp[0] == 0xEE and resp[1] == 0x07):
                return resp
            # Else there was a bus error so resend, as recommended in UART app
            # note at:
            #   http://ae-bst.resource.bosch.com/media/products/dokumente/bno055/BST-BNO055-AN012-00.pdf
            time.sleep(self.serial_attempt_delay)
            attempts += 1
            if attempts >= max_attempts:
                raise RuntimeError('Exceeded maximum attempts to acknowledge serial command without bus error!')

    def _write_bytes(self, address, data, ack=True):
        # Write a list of 8-bit values starting at the provided register address.
        if self._i2c_device is not None:
            # I2C write.
            self._i2c_device.writeList(address, data)
        else:
            # Build and send serial register write command.
            command = bytearray(4 + len(data))
            command[0] = 0xAA  # Start byte
            command[1] = 0x00  # Write
            command[2] = address & 0xFF
            command[3] = len(data) & 0xFF
            command[4:] = map(lambda x: x & 0xFF, data)
            resp = self._serial_send(command, ack=ack)
            # Verify register write succeeded if there was an acknowledgement.
            if resp[0] != 0xEE and resp[1] != 0x01:
                raise RuntimeError('Register write error: 0x{0}'.format(binascii.hexlify(resp)))

    def _write_byte(self, address, value, ack=True):
        # Write an 8-bit value to the provided register address.  If ack is True
        # then expect an acknowledgement in serial mode, otherwise ignore any
        # acknowledgement (necessary when resetting the device).
        if self._i2c_device is not None:
            # I2C write.
            self._i2c_device.write8(address, value)
        else:
            # Build and send serial register write command.
            command = bytearray(5)
            command[0] = 0xAA  # Start byte
            command[1] = 0x00  # Write
            command[2] = address & 0xFF
            command[3] = 1  # Length (1 byte)
            command[4] = value & 0xFF
            resp = self._serial_send(command, ack=ack)
            # Verify register write succeeded if there was an acknowledgement.
            if ack and resp[0] != 0xEE and resp[1] != 0x01:
                raise RuntimeError('Register write error: 0x{0}'.format(binascii.hexlify(resp)))

    def _read_bytes(self, address, length):
        # Read a number of unsigned byte values starting from the provided address.
        if self._i2c_device is not None:
            # I2C read.
            return bytearray(self._i2c_device.readList(address, length))
        else:
            # Build and send serial register read command.
            command = bytearray(4)
            command[0] = 0xAA  # Start byte
            command[1] = 0x01  # Read
            command[2] = address & 0xFF
            command[3] = length & 0xFF
            resp = self._serial_send(command)
            # Verify register read succeeded.
            if resp[0] != 0xBB:
                raise RuntimeError('Register read error: 0x{0}'.format(binascii.hexlify(resp)))
            # Read the returned bytes.
            length = resp[1]
            resp = bytearray(self._serial.read(length))
            logger.debug('Received: 0x{0}'.format(binascii.hexlify(resp)))
            if resp is None or len(resp) != length:
                raise RuntimeError('Timeout waiting to read data, is the BNO055 connected?')
            return resp

    def _read_byte(self, address):
        # Read an 8-bit unsigned value from the provided register address.
        if self._i2c_device is not None:
            # I2C read.
            return self._i2c_device.readU8(address)
        else:
            return self._read_bytes(address, 1)[0]

    def _read_signed_byte(self, address):
        # Read an 8-bit signed value from the provided register address.
        data = self._read_byte(address)
        if data > 127:
            return data - 256
        else:
            return data

    def _config_mode(self):
        # Enter configuration mode.
        self.set_mode(OPERATION_MODE_CONFIG)

    def _operation_mode(self):
        # Enter operation mode to read sensor data.
        self.set_mode(self._mode)

    def begin(self, mode=OPERATION_MODE_NDOF):
        """Initialize the BNO055 sensor.  Must be called once before any other
        BNO055 library functions.  Will return True if the BNO055 was
        successfully initialized, and False otherwise.
        """
        # Save the desired normal operation mode.
        self._mode = mode
        # First send a thow-away command and ignore any response or I2C errors
        # just to make sure the BNO is in a good state and ready to accept
        # commands (this seems to be necessary after a hard power down).
        try:
            self._write_byte(BNO055_PAGE_ID_ADDR, 0, ack=False)
        except IOError:
            # Swallow an IOError that might be raised by an I2C issue.  Only do
            # this for this very first command to help get the BNO and board's
            # I2C into a clear state ready to accept the next commands.
            pass
        # Make sure we're in config mode and on page 0.
        self._config_mode()
        self._write_byte(BNO055_PAGE_ID_ADDR, 0)
        # Check the chip ID
        bno_id = self._read_byte(BNO055_CHIP_ID_ADDR)
        logger.debug('Read chip ID: 0x{0:02X}'.format(bno_id))
        if bno_id != BNO055_ID:
            return False
        # Reset the device.
        if self._rst is not None:
            # Use the hardware reset pin if provided.
            # Go low for a short period, then high to signal a reset.
            self._gpio.set_low(self._rst)
            time.sleep(0.01)  # 10ms
            self._gpio.set_high(self._rst)
        else:
            # Else use the reset command.  Note that ack=False is sent because
            # the chip doesn't seem to ack a reset in serial mode (by design?).
            self._write_byte(BNO055_SYS_TRIGGER_ADDR, 0x20, ack=False)
        # Wait 650ms after reset for chip to be ready (as suggested
        # in datasheet).
        time.sleep(0.65)
        # Set to normal power mode.
        self._write_byte(BNO055_PWR_MODE_ADDR, POWER_MODE_NORMAL)
        # Default to internal oscillator.
        self._write_byte(BNO055_SYS_TRIGGER_ADDR, 0x0)
        # Enter normal operation mode.
        self._operation_mode()
        return True

    def set_mode(self, mode):
        """Set operation mode for BNO055 sensor.  Mode should be a value from
        table 3-3 and 3-5 of the datasheet:
          http://www.adafruit.com/datasheets/BST_BNO055_DS000_12.pdf
        """
        self._write_byte(BNO055_OPR_MODE_ADDR, mode & 0xFF)
        # Delay for 30 milliseconds (datasheet recommends 19ms, but a little more
        # can't hurt and the kernel is going to spend some unknown amount of time
        # too).
        time.sleep(0.025)

    def get_revision(self):
        """Return a tuple with revision information about the BNO055 chip.  Will
        return 5 values:
          - Software revision
          - Bootloader version
          - Accelerometer ID
          - Magnetometer ID
          - Gyro ID
        """
        # Read revision values.
        accel = self._read_byte(BNO055_ACCEL_REV_ID_ADDR)
        mag = self._read_byte(BNO055_MAG_REV_ID_ADDR)
        gyro = self._read_byte(BNO055_GYRO_REV_ID_ADDR)
        bl = self._read_byte(BNO055_BL_REV_ID_ADDR)
        sw_lsb = self._read_byte(BNO055_SW_REV_ID_LSB_ADDR)
        sw_msb = self._read_byte(BNO055_SW_REV_ID_MSB_ADDR)
        sw = ((sw_msb << 8) | sw_lsb) & 0xFFFF
        # Return the results as a tuple of all 5 values.
        return (sw, bl, accel, mag, gyro)

    def set_external_crystal(self, external_crystal):
        """Set if an external crystal is being used by passing True, otherwise
        use the internal oscillator by passing False (the default behavior).
        """
        # Switch to configuration mode.
        self._config_mode()
        # Set the clock bit appropriately in the SYS_TRIGGER register.
        if external_crystal:
            self._write_byte(BNO055_SYS_TRIGGER_ADDR, 0x80)
        else:
            self._write_byte(BNO055_SYS_TRIGGER_ADDR, 0x00)
        # Go back to normal operation mode.
        self._operation_mode()

    def get_system_status(self, run_self_test=True):
        """Return a tuple with status information.  Three values will be returned:
          - System status register value with the following meaning:
              0 = Idle
              1 = System Error
              2 = Initializing Peripherals
              3 = System Initialization
              4 = Executing Self-Test
              5 = Sensor fusion algorithm running
              6 = System running without fusion algorithms
          - Self test result register value with the following meaning:
              Bit value: 1 = test passed, 0 = test failed
              Bit 0 = Accelerometer self test
              Bit 1 = Magnetometer self test
              Bit 2 = Gyroscope self test
              Bit 3 = MCU self test
              Value of 0x0F = all good!
          - System error register value with the following meaning:
              0 = No error
              1 = Peripheral initialization error
              2 = System initialization error
              3 = Self test result failed
              4 = Register map value out of range
              5 = Register map address out of range
              6 = Register map write error
              7 = BNO low power mode not available for selected operation mode
              8 = Accelerometer power mode not available
              9 = Fusion algorithm configuration error
             10 = Sensor configuration error

        If run_self_test is passed in as False then no self test is performed and
        None will be returned for the self test result.  Note that running a
        self test requires going into config mode which will stop the fusion
        engine from running.
        """
        self_test = None
        if run_self_test:
            # Switch to configuration mode if running self test.
            self._config_mode()
            # Perform a self test.
            sys_trigger = self._read_byte(BNO055_SYS_TRIGGER_ADDR)
            self._write_byte(BNO055_SYS_TRIGGER_ADDR, sys_trigger | 0x1)
            # Wait for self test to finish.
            time.sleep(1.0)
            # Read test result.
            self_test = self._read_byte(BNO055_SELFTEST_RESULT_ADDR)
            # Go back to operation mode.
            self._operation_mode()
        # Now read status and error registers.
        status = self._read_byte(BNO055_SYS_STAT_ADDR)
        error = self._read_byte(BNO055_SYS_ERR_ADDR)
        # Return the results as a tuple of all 3 values.
        return (status, self_test, error)

    def get_calibration_status(self):
        """Read the calibration status of the sensors and return a 4 tuple with
        calibration status as follows:
          - System, 3=fully calibrated, 0=not calibrated
          - Gyroscope, 3=fully calibrated, 0=not calibrated
          - Accelerometer, 3=fully calibrated, 0=not calibrated
          - Magnetometer, 3=fully calibrated, 0=not calibrated
        """
        # Return the calibration status register value.
        cal_status = self._read_byte(BNO055_CALIB_STAT_ADDR)
        sys = (cal_status >> 6) & 0x03
        gyro = (cal_status >> 4) & 0x03
        accel = (cal_status >> 2) & 0x03
        mag = cal_status & 0x03
        # Return the results as a tuple of all 3 values.
        return (sys, gyro, accel, mag)

    def get_calibration(self):
        """Return the sensor's calibration data and return it as an array of
        22 bytes. Can be saved and then reloaded with the set_calibration function
        to quickly calibrate from a previously calculated set of calibration data.
        """
        # Switch to configuration mode, as mentioned in section 3.10.4 of datasheet.
        self._config_mode()
        # Read the 22 bytes of calibration data and convert it to a list (from
        # a bytearray) so it's more easily serialized should the caller want to
        # store it.
        cal_data = list(self._read_bytes(ACCEL_OFFSET_X_LSB_ADDR, 22))
        # Go back to normal operation mode.
        self._operation_mode()
        return cal_data

    def set_calibration(self, data):
        """Set the sensor's calibration data using a list of 22 bytes that
        represent the sensor offsets and calibration data.  This data should be
        a value that was previously retrieved with get_calibration (and then
        perhaps persisted to disk or other location until needed again).
        """
        # Check that 22 bytes were passed in with calibration data.
        if data is None or len(data) != 22:
            raise ValueError('Expected a list of 22 bytes for calibration data.')
        # Switch to configuration mode, as mentioned in section 3.10.4 of datasheet.
        self._config_mode()
        # Set the 22 bytes of calibration data.
        self._write_bytes(ACCEL_OFFSET_X_LSB_ADDR, data)
        # Go back to normal operation mode.
        self._operation_mode()

    def get_axis_remap(self):
        """Return a tuple with the axis remap register values.  This will return
        6 values with the following meaning:
          - X axis remap (a value of AXIS_REMAP_X, AXIS_REMAP_Y, or AXIS_REMAP_Z.
                          which indicates that the physical X axis of the chip
                          is remapped to a different axis)
          - Y axis remap (see above)
          - Z axis remap (see above)
          - X axis sign (a value of AXIS_REMAP_POSITIVE or AXIS_REMAP_NEGATIVE
                         which indicates if the X axis values should be positive/
                         normal or negative/inverted.  The default is positive.)
          - Y axis sign (see above)
          - Z axis sign (see above)

        Note that by default the axis orientation of the BNO chip looks like
        the following (taken from section 3.4, page 24 of the datasheet).  Notice
        the dot in the corner that corresponds to the dot on the BNO chip:

                           | Z axis
                           |
                           |   / X axis
                       ____|__/____
          Y axis     / *   | /    /|
          _________ /______|/    //
                   /___________ //
                  |____________|/
        """
        # Get the axis remap register value.
        map_config = self._read_byte(BNO055_AXIS_MAP_CONFIG_ADDR)
        z = (map_config >> 4) & 0x03
        y = (map_config >> 2) & 0x03
        x = map_config & 0x03
        # Get the axis remap sign register value.
        sign_config = self._read_byte(BNO055_AXIS_MAP_SIGN_ADDR)
        x_sign = (sign_config >> 2) & 0x01
        y_sign = (sign_config >> 1) & 0x01
        z_sign = sign_config & 0x01
        # Return the results as a tuple of all 3 values.
        return (x, y, z, x_sign, y_sign, z_sign)

    def set_axis_remap(self, x, y, z,
                       x_sign=AXIS_REMAP_POSITIVE, y_sign=AXIS_REMAP_POSITIVE,
                       z_sign=AXIS_REMAP_POSITIVE):
        """Set axis remap for each axis.  The x, y, z parameter values should
        be set to one of AXIS_REMAP_X, AXIS_REMAP_Y, or AXIS_REMAP_Z and will
        change the BNO's axis to represent another axis.  Note that two axises
        cannot be mapped to the same axis, so the x, y, z params should be a
        unique combination of AXIS_REMAP_X, AXIS_REMAP_Y, AXIS_REMAP_Z values.

        The x_sign, y_sign, z_sign values represent if the axis should be positive
        or negative (inverted).

        See the get_axis_remap documentation for information on the orientation
        of the axises on the chip, and consult section 3.4 of the datasheet.
        """
        # Switch to configuration mode.
        self._config_mode()
        # Set the axis remap register value.
        map_config = 0x00
        map_config |= (z & 0x03) << 4
        map_config |= (y & 0x03) << 2
        map_config |= x & 0x03
        self._write_byte(BNO055_AXIS_MAP_CONFIG_ADDR, map_config)
        # Set the axis remap sign register value.
        sign_config = 0x00
        sign_config |= (x_sign & 0x01) << 2
        sign_config |= (y_sign & 0x01) << 1
        sign_config |= z_sign & 0x01
        self._write_byte(BNO055_AXIS_MAP_SIGN_ADDR, sign_config)
        # Go back to normal operation mode.
        self._operation_mode()

    def _read_vector(self, address, count=3):
        # Read count number of 16-bit signed values starting from the provided
        # address. Returns a tuple of the values that were read.
        data = self._read_bytes(address, count * 2)
        result = [0] * count
        for i in range(count):
            result[i] = ((data[i * 2 + 1] << 8) | data[i * 2]) & 0xFFFF
            if result[i] > 32767:
                result[i] -= 65536
        return result

    def read_euler(self):
        """Return the current absolute orientation as a tuple of heading, roll,
        and pitch euler angles in degrees.
        """
        heading, roll, pitch = self._read_vector(BNO055_EULER_H_LSB_ADDR)
        return (heading / 16.0, roll / 16.0, pitch / 16.0)

    def read_magnetometer(self):
        """Return the current magnetometer reading as a tuple of X, Y, Z values
        in micro-Teslas.
        """
        x, y, z = self._read_vector(BNO055_MAG_DATA_X_LSB_ADDR)
        return (x / 16.0, y / 16.0, z / 16.0)

    def read_gyroscope(self):
        """Return the current gyroscope (angular velocity) reading as a tuple of
        X, Y, Z values in degrees per second.
        """
        x, y, z = self._read_vector(BNO055_GYRO_DATA_X_LSB_ADDR)
        return (x / 900.0, y / 900.0, z / 900.0)

    def read_accelerometer(self):
        """Return the current accelerometer reading as a tuple of X, Y, Z values
        in meters/second^2.
        """
        x, y, z = self._read_vector(BNO055_ACCEL_DATA_X_LSB_ADDR)
        return (x / 100.0, y / 100.0, z / 100.0)

    def read_linear_acceleration(self):
        """Return the current linear acceleration (acceleration from movement,
        not from gravity) reading as a tuple of X, Y, Z values in meters/second^2.
        """
        x, y, z = self._read_vector(BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR)
        return (x / 100.0, y / 100.0, z / 100.0)

    def read_gravity(self):
        """Return the current gravity acceleration reading as a tuple of X, Y, Z
        values in meters/second^2.
        """
        x, y, z = self._read_vector(BNO055_GRAVITY_DATA_X_LSB_ADDR)
        return (x / 100.0, y / 100.0, z / 100.0)

    def read_quaternion(self):
        """Return the current orientation as a tuple of X, Y, Z, W quaternion
        values.
        """
        w, x, y, z = self._read_vector(BNO055_QUATERNION_DATA_W_LSB_ADDR, 4)
        # Scale values, see 3.6.5.5 in the datasheet.
        scale = (1.0 / (1 << 14))
        return (x * scale, y * scale, z * scale, w * scale)

    def read_temp(self):
        """Return the current temperature in Celsius."""
        return self._read_signed_byte(BNO055_TEMP_ADDR)


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/chat_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_marginTop="4dp"
        tools:text="2016年5月14日" />

    <TextView
        android:id="@+id/chat_clientId"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:gravity="center"
        android:layout_gravity="center"
        android:text="Wayne" />

    <LinearLayout
        android:id="@+id/chat_item_box"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:background="@drawable/msg_bubble_incoming"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/chat_context"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:padding="2dp"
            android:textStyle="bold"
            tools:text="发送了消息
            你猜猜是啥

            " />
    </LinearLayout>

</LinearLayout>


text:
package com.twitter.elephantbird.util;

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

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.thrift.TBase;
import org.apache.thrift.protocol.TType;

import com.google.protobuf.ByteString;
import com.google.protobuf.DescriptorProtos;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type;
import com.google.protobuf.Descriptors;
import com.google.protobuf.Descriptors.DescriptorValidationException;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import com.twitter.elephantbird.thrift.TStructDescriptor;
import com.twitter.elephantbird.thrift.TStructDescriptor.Field;

/**
 * Translates a Thrift object into a Protocol Buffer message.
 *

 * Enums are converted to their String representations.
 *

 * TODO: handle complex fields. Only primitives and enums are mapped right now.

 *
 * @param <T> Source thrift class
 */
public class ThriftToDynamicProto<T extends TBase<?,?>> {
  private static final Logger LOG = LogManager.getLogger(ThriftToDynamicProto.class);

  DynamicMessage.Builder protoBuilder;
  Descriptors.Descriptor msgDescriptor;
  Message protoObj;

  /**
   * Create a Dynamic Protocol Buffer message with fields equivalent to those in the provided Thrift class.
   * @param thriftClass
   * @throws DescriptorValidationException
   */
  public ThriftToDynamicProto(Class<T> thriftClass) throws DescriptorValidationException {
    this(thriftClass, new ArrayList<Pair<String, Type>>());
  }

  /**
   * Create a Dynamic Protocol Buffer message with fields equivalent to those in the provided Thrift class,
   * plus additional fields as defined by extraFields.
   * @param thriftClass
   * @param extraFields a list of pairs of (fieldName, protobufType) that defines extra fields to add to
   * the generated message.
   * @throws DescriptorValidationException
   */
  public ThriftToDynamicProto(Class<T> thriftClass, List<Pair<String, Type>> extraFields)
  throws DescriptorValidationException {
    DescriptorProtos.DescriptorProto.Builder desBuilder = DescriptorProtos.DescriptorProto.newBuilder();
    desBuilder.setName("dynaMessage");
    TStructDescriptor fieldDesc = TStructDescriptor.getInstance(thriftClass);
    int maxThriftId = 0;
    // Protocol field ids start at 1. Thrift starts at 0.
    for (Field tField : fieldDesc.getFields()) {
      Type protoType = thriftTypeToProtoType(tField);
      maxThriftId = Math.max(tField.getFieldId(), maxThriftId);
      addField(desBuilder, tField.getName(), tField.getFieldId() + 1, protoType);
    }
    int extraFieldIdx = maxThriftId + 1;
    for (Pair<String, Type> extraField : extraFields) {
      addField(desBuilder, extraField.getFirst(), ++extraFieldIdx, extraField.getSecond());
    }
    DescriptorProtos.DescriptorProto dsc = desBuilder.build();

    DescriptorProtos.FileDescriptorProto fileDescP = DescriptorProtos.FileDescriptorProto.newBuilder()
        .addMessageType(dsc).build();

    Descriptors.FileDescriptor[] fileDescs = new Descriptors.FileDescriptor[0];
    Descriptors.FileDescriptor dynamicDescriptor = Descriptors.FileDescriptor.buildFrom(fileDescP, fileDescs);
    msgDescriptor = dynamicDescriptor.findMessageTypeByName("dynaMessage");
    protoBuilder = DynamicMessage.newBuilder(msgDescriptor);
  }

  private void addField(DescriptorProtos.DescriptorProto.Builder builder, String name, int fieldIdx, Type type) {
    DescriptorProtos.FieldDescriptorProto.Builder fdBuilder =
      DescriptorProtos.FieldDescriptorProto.newBuilder()
      .setName(name)
      .setNumber(fieldIdx)
      .setType(type);
    builder.addField(fdBuilder.build());
  }

  @SuppressWarnings("unchecked")
  public DynamicMessage convert(T thriftObj) {
    DynamicMessage.Builder builder = protoBuilder.clone();

    TStructDescriptor fieldDesc = TStructDescriptor.getInstance((Class<? extends TBase<?, ?>>) thriftObj.getClass());
    int fieldId = 0;
    for (Field tField : fieldDesc.getFields()) {
      FieldDescriptor protoFieldDesc = msgDescriptor.findFieldByName(tField.getName());
      if ( protoFieldDesc == null ) {
        throw new RuntimeException("Field " + tField.getName() +
            " not found in dynamic protobuf.");
      }
      Object fieldValue = fieldDesc.getFieldValue(fieldId++, thriftObj);
      if (fieldValue == null) {
        continue;
      }
      if (tField.isEnum()) {
        // TODO: proper enum handling
        fieldValue = fieldValue.toString();
      } else if ( tField.isBuffer() ) {
        fieldValue = ByteString.copyFrom((byte [])fieldValue);
      }
      builder.setField(protoFieldDesc, fieldValue);
    }
    return builder.build();
  }

  private  Type thriftTypeToProtoType(Field tField) {
    byte thriftType = tField.getType();
    switch (thriftType)  {
      case TType.BOOL:
        return Type.TYPE_BOOL;
      case TType.BYTE:
        return Type.TYPE_INT32;
      case TType.DOUBLE:
        return Type.TYPE_DOUBLE;
      case TType.I16:
        return Type.TYPE_INT32;
      case TType.I32:
        return Type.TYPE_INT32;
      case TType.I64:
        return Type.TYPE_INT64;
      case TType.STRING:
        // Thrift thinks bytes and strings are interchangeable. Protocol buffers are not insane.
        return tField.isBuffer() ? Type.TYPE_BYTES : Type.TYPE_STRING;
      case TType.ENUM:
        // TODO: proper enum handling. For now, convert to strings.
        return Type.TYPE_STRING;
      default:
        throw new IllegalArgumentException("Can't map Thrift type " + thriftType + " to a ProtoBuf type");
    }
  }

}


text:
namespace blink {

class BaseAudioContext;
class ExceptionState;
class OscillatorOptions;
class PeriodicWave;
class PeriodicWaveImpl;

class OscillatorHandler final : public AudioScheduledSourceHandler {
 public:
  // The waveform type.
  // These must be defined as in the .idl file.
  enum : uint8_t {
    SINE = 0,
    SQUARE = 1,
    SAWTOOTH = 2,
    TRIANGLE = 3,
    CUSTOM = 4
  };

  // Breakpoints where we decide to do linear interpolation, 3-point
  // interpolation or 5-point interpolation.  See DoInterpolation().
  static constexpr float kInterpolate2Point = 0.3f;
  static constexpr float kInterpolate3Point = 0.16f;

  static scoped_refptr<OscillatorHandler> Create(AudioNode&,
                                                 float sample_rate,
                                                 const String& oscillator_type,
                                                 PeriodicWaveImpl* wave_table,
                                                 AudioParamHandler& frequency,
                                                 AudioParamHandler& detune);
  ~OscillatorHandler() override;

  // AudioHandler
  void Process(uint32_t frames_to_process) override;

  String GetType() const;
  void SetType(const String&, ExceptionState&);

  void SetPeriodicWave(PeriodicWaveImpl*);

  void HandleStoppableSourceNode() override;

 private:
  OscillatorHandler(AudioNode&,
                    float sample_rate,
                    const String& oscillator_type,
                    PeriodicWaveImpl* wave_table,
                    AudioParamHandler& frequency,
                    AudioParamHandler& detune);

  bool SetType(uint8_t);  // Returns true on success.

  // Returns true if there are sample-accurate timeline parameter changes.
  bool CalculateSampleAccuratePhaseIncrements(uint32_t frames_to_process);

  bool PropagatesSilence() const override;

  // Compute the output for k-rate AudioParams
  double ProcessKRate(int n, float* dest_p, double virtual_read_index) const;

  // Scalar version for the main loop in ProcessKRate().  Returns the updated
  // virtual_read_index.
  double ProcessKRateScalar(int start_index,
                            int n,
                            float* dest_p,
                            double virtual_read_index,
                            float frequency,
                            float rate_scale) const;

  // Vectorized version (if available) for the main loop in ProcessKRate().
  // Returns the number of elements processed and the updated
  // virtual_read_index.
  std::tuple<int, double> ProcessKRateVector(int n,
                                             float* dest_p,
                                             double virtual_read_index,
                                             float frequency,
                                             float rate_scale) const;

  // Compute the output for a-rate AudioParams
  double ProcessARate(int n,
                      float* dest_p,
                      double virtual_read_index,
                      float* phase_increments) const;

  // Scalar version of ProcessARate().  Also handles any values not handled by
  // the vector version.
  //
  //   k
  //     start index for where to write the result (and read phase_increments)
  //   n
  //     total number of frames to process
  //   destination
  //     Array where the samples values are written
  //   virtual_read_index
  //     index into the wave data tables containing the waveform
  //   phase_increments
  //     phase change to use for each frame of output
  //
  // Returns the updated virtual_read_index.
  double ProcessARateScalar(int k,
                            int n,
                            float* destination,
                            double virtual_read_index,
                            const float* phase_increments) const;

  // Vector version of ProcessARate().  Returns the number of frames processed
  // and the update virtual_read_index.
  std::tuple<int, double> ProcessARateVector(
      int n,
      float* destination,
      double virtual_read_index,
      const float* phase_increments) const;

  // Handles the linear interpolation in ProcessARateVector().
  //
  //   destination
  //     Where the interpolated values are written.
  //   virtual_read_index
  //     index into the wave table data
  //   phase_increments
  //     phase increments array
  //   periodic_wave_size
  //     Length of the periodic wave stored in the wave tables
  //   lower_wave_data
  //     Array of the 4 lower wave table arrays
  //   higher_wave_data
  //     Array of the 4 higher wave table arrays
  //   table_interpolation_factor
  //     Array of linear interpolation factors to use between the lower and
  //     higher wave tables.
  //
  // Returns the updated virtual_read_index
  double ProcessARateVectorKernel(
      float* destination,
      double virtual_read_index,
      const float* phase_increments,
      unsigned periodic_wave_size,
      const float* const lower_wave_data[4],
      const float* const higher_wave_data[4],
      const float table_interpolation_factor[4]) const;

  // One of the waveform types defined in the enum.
  uint8_t type_;

  // Frequency value in Hertz.
  scoped_refptr<AudioParamHandler> frequency_;

  // Detune value (deviating from the frequency) in Cents.
  scoped_refptr<AudioParamHandler> detune_;

  bool first_render_ = true;

  // m_virtualReadIndex is a sample-frame index into our buffer representing the
  // current playback position.  Since it's floating-point, it has sub-sample
  // accuracy.
  double virtual_read_index_ = 0;

  // Stores sample-accurate values calculated according to frequency and detune.
  AudioFloatArray phase_increments_;
  AudioFloatArray detune_values_;

  // PeriodicWaveImpl cannot cause cycles with OscillatorNode as it is not
  // scriptable.
  CrossThreadPersistent<PeriodicWaveImpl> periodic_wave_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_OSCILLATOR_HANDLER_H_


text:
using namespace std::literals;

namespace sc {

    std::vector<std::string> terminal::parse_line(std::string const &line) {
        std::vector<std::string> args;

        bool inMarks = false;
        bool inArg = false;
        char const* it = line.data();
        char const* begin;
        while (it != line.data() + line.size()) {
            if (inArg) {
                if (*it == '\'') {
                    inMarks = !inMarks;
                    continue;
                }
                if (inMarks) continue;
                if (*it == ' ') {
                    args.emplace_back(begin, it);
                    inArg = false;
                }
            }
            else {
                if (*it == ' ') continue;
                begin = it;
                inArg = true;
            }
            ++it;
        }

        return args;
    }

    void terminal::async_wait_line() {
        line_ = std::async(std::launch::async, [] {
            std::string line;
            std::getline(std::cin, line);
            return line;
        });
    }

    bool terminal::is_line_available() {
        auto status = line_.wait_for(0s);
        return status == std::future_status::ready;
    }

    std::string terminal::get_line() {
        return line_.get();
    }

}