text:
import '../../../amp-carousel/0.1/amp-carousel';
import {createFixtureIframe} from '../../../../testing/iframe';
import {batchedXhrFor, bindForDoc} from '../../../../src/services';
import {ampdocServiceFor} from '../../../../src/ampdoc';
import * as sinon from 'sinon';

describe.configure().retryOnSaucelabs().run('amp-bind', function() {
  const fixtureLocation = 'test/fixtures/amp-bind-integrations.html';

  let fixture;
  let ampdoc;
  let sandbox;

  this.timeout(5000);

  beforeEach(() => {
    sandbox = sinon.sandbox.create();
    return createFixtureIframe(fixtureLocation).then(f => {
      fixture = f;
      return waitForEvent('amp:bind:initialize');
    }).then(() => {
      const ampdocService = ampdocServiceFor(fixture.win);
      ampdoc = ampdocService.getAmpDoc(fixture.doc);
    });
  });

  afterEach(() => {
    sandbox.restore();
  });

  /**
   * @param {string} name
   * @return {!Promise}
   */
  function waitForEvent(name) {
    return new Promise(resolve => {
      function callback() {
        resolve();
        fixture.win.removeEventListener(name, callback);
      };
      fixture.win.addEventListener(name, callback);
    });
  }

  /** @return {!Promise} */
  function waitForBindApplication() {
    // Bind should be available, but need to wait for actions to resolve
    // service promise for bind and call setState.
    return bindForDoc(ampdoc).then(unusedBind =>
        waitForEvent('amp:bind:setState'));
  }

  /** @return {!Promise} */
  function waitForAllMutations() {
    return bindForDoc(ampdoc).then(unusedBind =>
        waitForEvent('amp:bind:mutated'));
  }

  describe('detecting bindings under dynamic tags', () => {
    it('should NOT bind blacklisted attributes', () => {
      const dynamicTag = fixture.doc.getElementById('dynamicTag');
      const div = fixture.doc.createElement('div');
      div.innerHTML = '

';
      const textElement = div.firstElementChild;
      // for amp-live-list, dynamic element is
, which is a child
      // of the list.
      dynamicTag.firstElementChild.appendChild(textElement);
      expect(textElement.getAttribute('onclick')).to.be.null;
      expect(textElement.getAttribute('onmouseover')).to.be.null;
      expect(textElement.getAttribute('style')).to.be.null;
      expect(textElement.textContent).to.equal('');
      return waitForAllMutations().then(() => {
        fixture.doc.getElementById('changeDynamicTextButton').click();
        return waitForBindApplication();
      }).then(() => {
        expect(textElement.getAttribute('onclick')).to.be.null;
        expect(textElement.getAttribute('onmouseover')).to.be.null;
        expect(textElement.getAttribute('style')).to.be.null;
        expect(textElement.textContent).to.equal('bound');
      });
    });

    it('should NOT allow unsecure attribute values', () => {
      const div = fixture.doc.createElement('div');
      div.innerHTML = '';
      const aElement = div.firstElementChild;
      const dynamicTag = fixture.doc.getElementById('dynamicTag');
      dynamicTag.firstElementChild.appendChild(aElement);
      return waitForAllMutations().then(() => {
        // Force bind to apply bindings
        fixture.doc.getElementById('triggerBindApplicationButton').click();
        return waitForBindApplication();
      }).then(() => {
        expect(aElement.getAttribute('href')).to.be.null;
      });
    });
  });

  describe('text integration', () => {
    it('should update text when text attribute binding changes', () => {
      const textElement = fixture.doc.getElementById('textElement');
      const button = fixture.doc.getElementById('changeTextButton');
      expect(textElement.textContent).to.equal('unbound');
      button.click();
      return waitForBindApplication().then(() => {
        expect(textElement.textContent).to.equal('hello world');
      });
    });

    it('should update CSS class when class binding changes', () => {
      const textElement = fixture.doc.getElementById('textElement');
      const button = fixture.doc.getElementById('changeTextClassButton');
      expect(textElement.className).to.equal('original');
      button.click();
      return waitForBindApplication().then(() => {
        expect(textElement.className).to.equal('new');
      });
    });
  });

  describe('input integration', () => {
    it('should update dependent bindings on range input changes', () => {
      const rangeText = fixture.doc.getElementById('rangeText');
      const range = fixture.doc.getElementById('range');
      expect(rangeText.textContent).to.equal('Unbound');
      // Calling #click() the range will not generate a change event
      // so it must be generated manually.
      range.value = 47;
      range.dispatchEvent(new Event('change', {bubbles: true}));
      return waitForBindApplication().then(() => {
        expect(rangeText.textContent).to.equal('0 <= 47 <= 100');
      });
    });

    it('should update dependent bindings on checkbox input changes', () => {
      const checkboxText = fixture.doc.getElementById('checkboxText');
      const checkbox = fixture.doc.getElementById('checkbox');
      expect(checkboxText.textContent).to.equal('Unbound');
      checkbox.click();
      return waitForBindApplication().then(() => {
        expect(checkboxText.textContent).to.equal('Checked: true');
      });
    });

    it('should update dependent bindings on radio input changes', () => {
      const radioText = fixture.doc.getElementById('radioText');
      const radio = fixture.doc.getElementById('radio');
      expect(radioText.textContent).to.equal('Unbound');
      radio.click();
      return waitForBindApplication().then(() => {
        expect(radioText.textContent).to.equal('Checked: true');
      });
    });
  });

  describe('amp-carousel integration', () => {
    it('should update dependent bindings on carousel slide changes', () => {
      const slideNum = fixture.doc.getElementById('slideNum');
      const carousel = fixture.doc.getElementById('carousel');
      const impl = carousel.implementation_;
      expect(slideNum.textContent).to.equal('0');
      impl.go(1, /* animate */ false);
      return waitForBindApplication().then(() => {
        expect(slideNum.textContent).to.equal('1');
      });
    });

    it('should change slides when the slide attribute binding changes', () => {
      const carousel = fixture.doc.getElementById('carousel');
      const button = fixture.doc.getElementById('goToSlide1Button');
      const impl = carousel.implementation_;
      // No previous slide as current slide is 0th side
      expect(impl.hasPrev()).to.be.false;
      button.click();
      return waitForBindApplication().then(() => {
        // Has previous slide since the index has changed
        expect(impl.hasPrev()).to.be.true;
      });
    });
  });

  describe('amp-img integration', () => {
    it('should change src when the src attribute binding changes', () => {
      const button = fixture.doc.getElementById('changeImgSrcButton');
      const img = fixture.doc.getElementById('image');
      expect(img.getAttribute('src')).to.equal('http://www.google.com/image1');
      button.click();
      return waitForBindApplication().then(() => {
        expect(img.getAttribute('src')).to
            .equal('http://www.google.com/image2');
      });
    });

    it('should NOT change src when new value is a blocked URL', () => {
      const button = fixture.doc.getElementById('invalidSrcButton');
      const img = fixture.doc.getElementById('image');
      expect(img.getAttribute('src')).to.equal('http://www.google.com/image1');
      button.click();
      return waitForBindApplication().then(() => {
        expect(img.getAttribute('src')).to
            .equal('http://www.google.com/image1');
      });
    });

    it('should NOT change src when new value uses an invalid protocol', () => {
      const img = fixture.doc.getElementById('image');
      expect(img.getAttribute('src')).to.equal('http://www.google.com/image1');
      const ftpSrcButton = fixture.doc.getElementById('ftpSrcButton');
      ftpSrcButton.click();
      return waitForBindApplication().then(() => {
        expect(img.getAttribute('src')).to.equal('http://www.google.com/image1');
        const telSrcButton = fixture.doc.getElementById('telSrcButton');
        telSrcButton.click();
        return waitForBindApplication();
      }).then(() => {
        expect(img.getAttribute('src')).to
            .equal('http://www.google.com/image1');
      });
    });

    it('should change alt when the alt attribute binding changes', () => {
      const button = fixture.doc.getElementById('changeImgAltButton');
      const img = fixture.doc.getElementById('image');
      expect(img.getAttribute('alt')).to.equal('unbound');
      button.click();
      return waitForBindApplication().then(() => {
        expect(img.getAttribute('alt')).to.equal('hello world');
      });
    });

    it('should change width and height when their bindings change', () => {
      const button = fixture.doc.getElementById('changeImgDimensButton');
      const img = fixture.doc.getElementById('image');
      expect(img.getAttribute('height')).to.equal('200');
      expect(img.getAttribute('width')).to.equal('200');
      button.click();
      return waitForBindApplication().then(() => {
        expect(img.getAttribute('height')).to.equal('300');
        expect(img.getAttribute('width')).to.equal('300');
      });
    });
  });

  describe('amp-live-list integration', () => {
    it('should detect bindings in initial live-list elements', () => {
      const liveListItems = fixture.doc.getElementById('liveListItems');
      expect(liveListItems.children.length).to.equal(1);

      const liveListItem1 = fixture.doc.getElementById('liveListItem1');
      expect(liveListItem1.firstElementChild.textContent).to.equal('unbound');

      const button = fixture.doc.getElementById('changeLiveListTextButton');
      button.click();
      return waitForBindApplication().then(() => {
        expect(liveListItem1.firstElementChild.textContent).to
            .equal('hello world');
      });
    });

    it('should apply scope to bindings in new list items', () => {
      const liveList = fixture.doc.getElementById('liveList');
      const liveListItems = fixture.doc.getElementById('liveListItems');
      expect(liveListItems.children.length).to.equal(1);

      const existingItem = fixture.doc.getElementById('liveListItem1');
      expect(existingItem.firstElementChild.textContent).to.equal('unbound');

      const impl = liveList.implementation_;
      const update = document.createElement('div');
      update.innerHTML =
          `<div items>` +
          ` <div id="newItem" data-sort-time=${Date.now()}>` +
          `    <p [text]="liveListText">unbound</p>` +
          ` </div>` +
          `</div>`;
      impl.update(update);
      fixture.doc.getElementById('liveListUpdateButton').click();

      let newItem;
      return waitForAllMutations().then(() => {
        expect(liveListItems.children.length).to.equal(2);
        newItem = fixture.doc.getElementById('newItem');
        fixture.doc.getElementById('changeLiveListTextButton').click();
        return waitForBindApplication();
      }).then(() => {
        expect(existingItem.firstElementChild.textContent).to
            .equal('hello world');
        expect(newItem.firstElementChild.textContent).to
            .equal('hello world');
      });
    });
  });

  describe('amp-selector integration', () => {
    it('should update dependent bindings when selection changes', () => {
      const selectionText = fixture.doc.getElementById('selectionText');
      const img1 = fixture.doc.getElementById('selectorImg1');
      const img2 = fixture.doc.getElementById('selectorImg2');
      const img3 = fixture.doc.getElementById('selectorImg3');
      expect(img1.hasAttribute('selected')).to.be.false;
      expect(img2.hasAttribute('selected')).to.be.false;
      expect(img3.hasAttribute('selected')).to.be.false;
      expect(selectionText.textContent).to.equal('None');
      img2.click();
      return waitForBindApplication().then(() => {
        expect(img1.hasAttribute('selected')).to.be.false;
        expect(img2.hasAttribute('selected')).to.be.true;
        expect(img3.hasAttribute('selected')).to.be.false;
        expect(selectionText.textContent).to.equal('2');
      });
    });

    it('should update selection when bound value for selected changes', () => {
      const button = fixture.doc.getElementById('changeSelectionButton');
      const selectionText = fixture.doc.getElementById('selectionText');
      const img1 = fixture.doc.getElementById('selectorImg1');
      const img2 = fixture.doc.getElementById('selectorImg2');
      const img3 = fixture.doc.getElementById('selectorImg3');
      expect(img1.hasAttribute('selected')).to.be.false;
      expect(img2.hasAttribute('selected')).to.be.false;
      expect(img3.hasAttribute('selected')).to.be.false;
      expect(selectionText.textContent).to.equal('None');
      // Changes selection to 2
      button.click();
      return waitForBindApplication().then(() => {
        expect(img1.hasAttribute('selected')).to.be.false;
        expect(img2.hasAttribute('selected')).to.be.true;
        expect(img3.hasAttribute('selected')).to.be.false;
        expect(selectionText.textContent).to.equal('2');
      });
    });
  });

  describe('amp-video integration', () => {
    it('should support binding to src', () => {
      const button = fixture.doc.getElementById('changeVidSrcButton');
      const vid = fixture.doc.getElementById('video');
      expect(vid.getAttribute('src')).to
          .equal('https://www.google.com/unbound.webm');
      button.click();
      return waitForBindApplication().then(() => {
        expect(vid.getAttribute('src')).to
            .equal('https://www.google.com/bound.webm');
      });
    });

    it('should NOT change src when new value is a blocked URL', () => {
      const button = fixture.doc.getElementById('disallowedVidUrlButton');
      const vid = fixture.doc.getElementById('video');
      expect(vid.getAttribute('src')).to
          .equal('https://www.google.com/unbound.webm');;
      button.click();
      return waitForBindApplication().then(() => {
        expect(vid.getAttribute('src')).to
            .equal('https://www.google.com/unbound.webm');
      });
    });

    it('should NOT change src when new value uses an invalid protocol', () => {
      const button = fixture.doc.getElementById('httpVidSrcButton');
      const vid = fixture.doc.getElementById('video');
      expect(vid.getAttribute('src')).to
          .equal('https://www.google.com/unbound.webm');
      button.click();
      return waitForBindApplication().then(() => {
        // Only HTTPS is allowed
        expect(vid.getAttribute('src')).to
            .equal('https://www.google.com/unbound.webm');
      });
    });

    it('should change alt when the alt attribute binding changes', () => {
      const button = fixture.doc.getElementById('changeVidAltButton');
      const vid = fixture.doc.getElementById('video');
      expect(vid.getAttribute('alt')).to.equal('unbound');
      button.click();
      return waitForBindApplication().then(() => {
        expect(vid.getAttribute('alt')).to.equal('hello world');
      });
    });

    it('should show/hide vid controls when the control binding changes', () => {
      const showControlsButton =
          fixture.doc.getElementById('showVidControlsButton');
      const hideControlsButton =
          fixture.doc.getElementById('hideVidControlsButton');
      const vid = fixture.doc.getElementById('video');
      expect(vid.hasAttribute('controls')).to.be.false;
      showControlsButton.click();
      return waitForBindApplication().then(() => {
        expect(vid.hasAttribute('controls')).to.be.true;
        hideControlsButton.click();
        return waitForBindApplication();
      }).then(() => {
        expect(vid.hasAttribute('controls')).to.be.false;
      });
    });
  });

  describe('amp-youtube', () => {
    it('should support binding to data-video-id', () => {
      const button = fixture.doc.getElementById('youtubeButton');
      const yt = fixture.doc.getElementById('youtube');
      expect(yt.getAttribute('data-videoid')).to.equal('unbound');
      button.click();
      return waitForBindApplication().then(() => {
        expect(yt.getAttribute('data-videoid')).to.equal('bound');
      });
    });
  });

  describe('amp-brightcove', () => {
    it('should support binding to data-account', () => {
      const button = fixture.doc.getElementById('brightcoveButton');
      const bc = fixture.doc.getElementById('brightcove');
      // Force layout in case element is not in viewport.
      bc.implementation_.layoutCallback();
      const iframe = bc.querySelector('iframe');
      expect(iframe.src).to.not.contain('bound');
      button.click();
      return waitForBindApplication().then(() => {
        expect(iframe.src).to.contain('bound');
      });
    });
  });

  describe('amp-iframe', () => {
    it('should support binding to src', () => {
      const button = fixture.doc.getElementById('iframeButton');
      const ampIframe = fixture.doc.getElementById('ampIframe');
      // Force layout in case element is not in viewport.
      ampIframe.implementation_.layoutCallback();
      const iframe = ampIframe.querySelector('iframe');

      const newSrc = 'https://giphy.com/embed/DKG1OhBUmxL4Q';
      expect(ampIframe.getAttribute('src')).to.not.contain(newSrc);
      expect(iframe.src).to.not.contain(newSrc);
      button.click();
      return waitForBindApplication().then(() => {
        expect(ampIframe.getAttribute('src')).to.contain(newSrc);
        expect(iframe.src).to.contain(newSrc);
      });
    });
  });

  describe('amp-list', () => {
    it('should support binding to src', () => {
      const button = fixture.doc.getElementById('listSrcButton');
      const list = fixture.doc.getElementById('list');
      expect(list.getAttribute('src'))
          .to.equal('https://www.google.com/unbound.json');
      button.click();
      return waitForBindApplication().then(() => {
        expect(list.getAttribute('src'))
            .to.equal('https://www.google.com/bound.json');
      });
    });

    it('should NOT change src when new value uses an invalid protocol', () => {
      const button = fixture.doc.getElementById('httpListSrcButton');
      const list = fixture.doc.getElementById('list');
      expect(list.getAttribute('src'))
          .to.equal('https://www.google.com/unbound.json');
      button.click();
      return waitForBindApplication().then(() => {
        expect(list.getAttribute('src'))
            .to.equal('https://www.google.com/unbound.json');
      });
    });
  });

  describe('amp-state', () => {
    it('should not loop infinitely if updates change its src binding', () => {
      const changeAmpStateSrcButton =
          fixture.doc.getElementById('ampStateSrcButton');
      const triggerBindApplicationButton =
          fixture.doc.getElementById('triggerBindApplicationButton');
      const ampState = fixture.doc.getElementById('ampState');
      const batchedXhr = batchedXhrFor(fixture.win);
      // Stub XHR for endpoint such that it returns state that would point
      // the amp-state element back to its original source.
      sandbox.stub(batchedXhr, 'fetchJson')
          .withArgs(
              'https://www.google.com/bind/second/source',
              sinon.match.any)
          .returns(Promise.resolve({
            stateSrc: 'https://www.google.com/bind/first/source',
          }));
      // Changes amp-state's src from .../first/source to .../second/source.
      changeAmpStateSrcButton.click();
      return waitForBindApplication().then(() => {
        expect(ampState.getAttribute('src'))
            .to.equal('https://www.google.com/bind/second/source');
        // Wait for XHR to finish and for bind to re-apply bindings.
        return waitForBindApplication();
      }).then(() => {
        // bind applications caused by an amp-state mutation SHOULD NOT update
        // src attributes on amp-state elements.
        expect(ampState.getAttribute('src'))
            .to.equal('https://www.google.com/bind/second/source');
        // Trigger a bind apply that isn't from an amp-state
        triggerBindApplicationButton.click();
        return waitForBindApplication();
      }).then(() => {
        // Now that a non-amp-state mutation has ocurred, the amp-state's src
        // attribute can be updated with the new src from the XHR.
        expect(ampState.getAttribute('src'))
            .to.equal('https://www.google.com/bind/first/source');
      });
    });
  });
});


text:
#include <system.hh>

#include "chain.h"
#include "predicate.h"
#include "filters.h"
#include "report.h"
#include "session.h"

namespace ledger {

post_handler_ptr chain_pre_post_handlers(post_handler_ptr base_handler,
                                         report_t&        report)
{
  post_handler_ptr handler(base_handler);

  // anonymize_posts removes all meaningful information from xact payee's and
  // account names, for the sake of creating useful bug reports.
  if (report.HANDLED(anon))
    handler.reset(new anonymize_posts(handler));

  // This filter_posts will only pass through posts matching the `predicate'.
  if (report.HANDLED(limit_)) {
    DEBUG("report.predicate",
          "Report predicate expression = " << report.HANDLER(limit_).str());
    handler.reset(new filter_posts
                  (handler, predicate_t(report.HANDLER(limit_).str(),
                                        report.what_to_keep()),
                   report));
  }

  // budget_posts takes a set of posts from a data file and uses them to
  // generate "budget posts" which balance against the reported posts.
  //
  // forecast_posts is a lot like budget_posts, except that it adds xacts
  // only for the future, and does not balance them against anything but the
  // future balance.

  if (report.budget_flags != BUDGET_NO_BUDGET) {
    budget_posts * budget_handler =
      new budget_posts(handler, report.terminus.date(), report.budget_flags);
    budget_handler->add_period_xacts(report.session.journal->period_xacts);
    handler.reset(budget_handler);

    // Apply this before the budget handler, so that only matching posts are
    // calculated toward the budget.  The use of filter_posts above will
    // further clean the results so that no automated posts that don't match
    // the filter get reported.
    if (report.HANDLED(limit_))
      handler.reset(new filter_posts
                    (handler, predicate_t(report.HANDLER(limit_).str(),
                                          report.what_to_keep()),
                     report));
  }
  else if (report.HANDLED(forecast_while_)) {
    forecast_posts * forecast_handler
      = new forecast_posts(handler,
                           predicate_t(report.HANDLER(forecast_while_).str(),
                                       report.what_to_keep()),
                           report,
                           (report.HANDLED(forecast_years_) ?
                            lexical_cast<std::size_t>
                            (report.HANDLER(forecast_years_).value) : 5UL));
    forecast_handler->add_period_xacts(report.session.journal->period_xacts);
    handler.reset(forecast_handler);

    // See above, under budget_posts.
    if (report.HANDLED(limit_))
      handler.reset(new filter_posts
                    (handler, predicate_t(report.HANDLER(limit_).str(),
                                          report.what_to_keep()),
                     report));
  }

  return handler;
}

post_handler_ptr chain_post_handlers(post_handler_ptr base_handler,
                                     report_t&        report,
                                     bool             for_accounts_report)
{
  post_handler_ptr       handler(base_handler);
  predicate_t            display_predicate;
  predicate_t            only_predicate;
  display_filter_posts * display_filter = NULL;

  expr_t& expr(report.HANDLER(amount_).expr);
  expr.set_context(&report);

  report.HANDLER(total_).expr.set_context(&report);
  report.HANDLER(display_amount_).expr.set_context(&report);
  report.HANDLER(display_total_).expr.set_context(&report);

  if (! for_accounts_report) {
    // Make sure only forecast postings which match are allowed through
    if (report.HANDLED(forecast_while_)) {
      handler.reset(new filter_posts
                    (handler, predicate_t(report.HANDLER(forecast_while_).str(),
                                          report.what_to_keep()),
                     report));
    }

    // truncate_xacts cuts off a certain number of _xacts_ from being
    // displayed.  It does not affect calculation.
    if (report.HANDLED(head_) || report.HANDLED(tail_))
      handler.reset
        (new truncate_xacts(handler,
                            report.HANDLED(head_) ?
                            lexical_cast<int>(report.HANDLER(head_).value) : 0,
                            report.HANDLED(tail_) ?
                            lexical_cast<int>(report.HANDLER(tail_).value) : 0));

    // display_filter_posts adds virtual posts to the list to account
    // for changes in value of commodities, which otherwise would affect
    // the running total unpredictably.
    display_filter = new display_filter_posts(handler, report,
                                              report.HANDLED(revalued) &&
                                              ! report.HANDLED(no_rounding));
    handler.reset(display_filter);

    // filter_posts will only pass through posts matching the
    // `display_predicate'.
    if (report.HANDLED(display_)) {
      display_predicate = predicate_t(report.HANDLER(display_).str(),
                                      report.what_to_keep());
      handler.reset(new filter_posts(handler, display_predicate, report));
    }
  }

  // changed_value_posts adds virtual posts to the list to account for changes
  // in market value of commodities, which otherwise would affect the running
  // total unpredictably.
  if (report.HANDLED(revalued) &&
      (! for_accounts_report || report.HANDLED(unrealized)))
    handler.reset(new changed_value_posts(handler, report, for_accounts_report,
                                          report.HANDLED(unrealized),
                                          display_filter));

  // calc_posts computes the running total.  When this appears will determine,
  // for example, whether filtered posts are included or excluded from the
  // running total.
  handler.reset(new calc_posts(handler, expr, (! for_accounts_report ||
                                               (report.HANDLED(revalued) &&
                                                report.HANDLED(unrealized)))));

  // filter_posts will only pass through posts matching the
  // `secondary_predicate'.
  if (report.HANDLED(only_)) {
    only_predicate = predicate_t(report.HANDLER(only_).str(),
                                 report.what_to_keep());
    handler.reset(new filter_posts(handler, only_predicate, report));
  }

  if (! for_accounts_report) {
    // sort_posts will sort all the posts it sees, based on the `sort_order'
    // value expression.
    if (report.HANDLED(sort_)) {
      if (report.HANDLED(sort_xacts_))
        handler.reset(new sort_xacts(handler, report.HANDLER(sort_).str()));
      else
        handler.reset(new sort_posts(handler, report.HANDLER(sort_).str()));
    }

    // collapse_posts causes xacts with multiple posts to appear as xacts
    // with a subtotaled post for each commodity used.
    if (report.HANDLED(collapse))
      handler.reset(new collapse_posts(handler, report, expr,
                                       display_predicate, only_predicate,
                                       report.HANDLED(collapse_if_zero)));

    // subtotal_posts combines all the posts it receives into one subtotal
    // xact, which has one post for each commodity in each account.
    //
    // period_posts is like subtotal_posts, but it subtotals according to time
    // periods rather than totalling everything.
    //
    // day_of_week_posts is like period_posts, except that it reports
    // all the posts that fall on each subsequent day of the week.
    if (report.HANDLED(equity))
      handler.reset(new posts_as_equity(handler, report, expr));
    else if (report.HANDLED(subtotal))
      handler.reset(new subtotal_posts(handler, expr));
  }

  if (report.HANDLED(dow))
    handler.reset(new day_of_week_posts(handler, expr));
  else if (report.HANDLED(by_payee))
    handler.reset(new by_payee_posts(handler, expr));

  // interval_posts groups posts together based on a time period, such as
  // weekly or monthly.
  if (report.HANDLED(period_))
    handler.reset(new interval_posts(handler, expr,
                                     report.HANDLER(period_).str(),
                                     report.HANDLED(exact),
                                     report.HANDLED(empty)));

  if (report.HANDLED(date_))
    handler.reset(new transfer_details(handler, transfer_details::SET_DATE,
                                       report.session.journal->master,
                                       report.HANDLER(date_).str(),
                                       report));

  if (report.HANDLED(account_)) {
    handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT,
                                       report.session.journal->master,
                                       report.HANDLER(account_).str(),
                                       report));
  }
  else if (report.HANDLED(pivot_)) {
    string pivot = report.HANDLER(pivot_).str();
    pivot = string("\"") + pivot + ":\" + tag(\"" + pivot + "\")";
    handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT,
                                       report.session.journal->master, pivot,
                                       report));
  }

  if (report.HANDLED(payee_))
    handler.reset(new transfer_details(handler, transfer_details::SET_PAYEE,
                                       report.session.journal->master,
                                       report.HANDLER(payee_).str(),
                                       report));

  // related_posts will pass along all posts related to the post received.  If
  // the `related_all' handler is on, then all the xact's posts are passed;
  // meaning that if one post of an xact is to be printed, all the post for
  // that xact will be printed.
  if (report.HANDLED(related))
    handler.reset(new related_posts(handler, report.HANDLED(related_all)));

  if (report.HANDLED(inject_))
    handler.reset(new inject_posts(handler, report.HANDLED(inject_).str(),
                                   report.session.journal->master));

  return handler;
}

} // namespace ledger

redpajama_set_name: RedPajamaGithub


text:
import DS from 'ember-data';
// import Ember from 'ember';

var attr = DS.attr;

export default DS.Model.extend({
  name:  attr('string')
});


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

        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
                <!-- Customize your theme here. -->
                <item name="colorPrimary">@color/colorPrimary</item>
                <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
                <item name="colorAccent">@color/colorAccent</item>
                <item name="colorControlNormal">#c5c5c5</item>
                <item name="colorControlActivated">@color/colorAccent</item>
                <item name="colorControlHighlight">@color/colorAccent</item>
                <item name="android:windowTranslucentStatus">false</item>
        </style>
</resources>


text:
<resources>
    <string name="app_name">viewflow</string>
    <string name="hello">Hello World!</string>
</resources>


text:
<?php

namespace PhpSpec\Runner;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use PhpSpec\Runner\Maintainer\LetAndLetgoMaintainer;
use PhpSpec\Formatter\Presenter\Presenter;
use PhpSpec\Specification;
use PhpSpec\Event\ExampleEvent;
use PhpSpec\Loader\Node\ExampleNode;
use PhpSpec\Exception\Exception as PhpSpecException;
use PhpSpec\Exception\Example as ExampleException;
use Prophecy\Exception as ProphecyException;
use Exception;

class ExampleRunner
{
    /**
     * @var EventDispatcherInterface
     */
    private $dispatcher;
    /**
     * @var Presenter
     */
    private $presenter;
    /**
     * @var Maintainer\Maintainer[]
     */
    private $maintainers = array();

    /**
     * @param EventDispatcherInterface $dispatcher
     * @param Presenter       $presenter
     */
    public function __construct(EventDispatcherInterface $dispatcher, Presenter $presenter)
    {
        $this->dispatcher = $dispatcher;
        $this->presenter  = $presenter;
    }

    /**
     * @param Maintainer\Maintainer $maintainer
     */
    public function registerMaintainer(Maintainer\Maintainer $maintainer)
    {
        $this->maintainers[] = $maintainer;

        @usort($this->maintainers, function ($maintainer1, $maintainer2) {
            return $maintainer2->getPriority() - $maintainer1->getPriority();
        });
    }

    /**
     * @param ExampleNode $example
     *
     * @return int
     */
    public function run(ExampleNode $example)
    {
        $startTime = microtime(true);
        $this->dispatcher->dispatch(
            'beforeExample',
            new ExampleEvent($example)
        );

        try {
            $this->executeExample(
                $example->getSpecification()->getClassReflection()->newInstance(),
                $example
            );

            $status    = ExampleEvent::PASSED;
            $exception = null;
        } catch (ExampleException\PendingException $e) {
            $status    = ExampleEvent::PENDING;
            $exception = $e;
        } catch (ExampleException\SkippingException $e) {
            $status    = ExampleEvent::SKIPPED;
            $exception = $e;
        } catch (ProphecyException\Prediction\PredictionException $e) {
            $status    = ExampleEvent::FAILED;
            $exception = $e;
        } catch (ExampleException\FailureException $e) {
            $status    = ExampleEvent::FAILED;
            $exception = $e;
        } catch (Exception $e) {
            $status    = ExampleEvent::BROKEN;
            $exception = $e;
        }

        if ($exception instanceof PhpSpecException) {
            $exception->setCause($example->getFunctionReflection());
        }

        $runTime = microtime(true) - $startTime;
        $this->dispatcher->dispatch(
            'afterExample',
            $event = new ExampleEvent($example, $runTime, $status, $exception)
        );

        return $event->getResult();
    }

    /**
     * @param Specification $context
     * @param ExampleNode            $example
     *
     * @throws \PhpSpec\Exception\Example\PendingException
     * @throws \Exception
     */
    protected function executeExample(Specification $context, ExampleNode $example)
    {
        if ($example->isPending()) {
            throw new ExampleException\PendingException();
        }

        $matchers      = new MatcherManager($this->presenter);
        $collaborators = new CollaboratorManager($this->presenter);
        $maintainers   = array_filter($this->maintainers, function ($maintainer) use ($example) {
            return $maintainer->supports($example);
        });

        // run maintainers prepare
        foreach ($maintainers as $maintainer) {
            $maintainer->prepare($example, $context, $matchers, $collaborators);
        }

        // execute example
        $reflection = $example->getFunctionReflection();

        try {
            $reflection->invokeArgs($context, $collaborators->getArgumentsFor($reflection));
        } catch (\Exception $e) {
            $this->runMaintainersTeardown(
                $this->searchExceptionMaintainers($maintainers),
                $example,
                $context,
                $matchers,
                $collaborators
            );
            throw $e;
        }

        $this->runMaintainersTeardown($maintainers, $example, $context, $matchers, $collaborators);
    }

    /**
     * @param Maintainer\Maintainer[] $maintainers
     * @param ExampleNode                      $example
     * @param Specification           $context
     * @param MatcherManager                   $matchers
     * @param CollaboratorManager              $collaborators
     */
    private function runMaintainersTeardown(
        array $maintainers,
        ExampleNode $example,
        Specification $context,
        MatcherManager $matchers,
        CollaboratorManager $collaborators
    ) {
        foreach (array_reverse($maintainers) as $maintainer) {
            $maintainer->teardown($example, $context, $matchers, $collaborators);
        }
    }

    /**
     * @param Maintainer\Maintainer[] $maintainers
     *
     * @return Maintainer\Maintainer[]
     */
    private function searchExceptionMaintainers(array $maintainers)
    {
        return array_filter(
            $maintainers,
            function ($maintainer) {
                return $maintainer instanceof LetAndLetgoMaintainer;
            }
        );
    }
}


text:
namespace Decoder
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.pictureBox = new System.Windows.Forms.PictureBox();
            this.inProgressGroupBox = new System.Windows.Forms.GroupBox();
            this.filesInText = new System.Windows.Forms.Label();
            this.filesInLabel = new System.Windows.Forms.Label();
            this.srcCdrText = new System.Windows.Forms.Label();
            this.srcCdrLabel = new System.Windows.Forms.Label();
            this.recOutText = new System.Windows.Forms.Label();
            this.recOutLabel = new System.Windows.Forms.Label();
            this.progressBar = new System.Windows.Forms.ProgressBar();
            this.exitButton = new System.Windows.Forms.Button();
            this.sinceStartupGroupBox = new System.Windows.Forms.GroupBox();
            this.filesOutText = new System.Windows.Forms.Label();
            this.filesOutLabel = new System.Windows.Forms.Label();
            this.timerText = new System.Windows.Forms.Label();
            this.startTimeText = new System.Windows.Forms.Label();
            this.recOutTotalText = new System.Windows.Forms.Label();
            this.recOutTotalLabel = new System.Windows.Forms.Label();
            this.timerLabel = new System.Windows.Forms.Label();
            this.startTimeLabel = new System.Windows.Forms.Label();
            this.decodeButton = new System.Windows.Forms.Button();
            this.tabControl = new System.Windows.Forms.TabControl();
            this.jobTabPage = new System.Windows.Forms.TabPage();
            this.jobPropertyGrid = new System.Windows.Forms.PropertyGrid();
            this.jobToolStrip = new System.Windows.Forms.ToolStrip();
            this.newToolButton = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.openToolButton = new System.Windows.Forms.ToolStripButton();
            this.saveToolButton = new System.Windows.Forms.ToolStripButton();
            this.logTabPage = new System.Windows.Forms.TabPage();
            this.logListView = new System.Windows.Forms.ListView();
            this.timeColumnHeader = new System.Windows.Forms.ColumnHeader();
            this.messageColumnHeader = new System.Windows.Forms.ColumnHeader();
            this.helpButton = new System.Windows.Forms.Button();
            this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.statusBindingSource = new System.Windows.Forms.BindingSource(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
            this.inProgressGroupBox.SuspendLayout();
            this.sinceStartupGroupBox.SuspendLayout();
            this.tabControl.SuspendLayout();
            this.jobTabPage.SuspendLayout();
            this.jobToolStrip.SuspendLayout();
            this.logTabPage.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.statusBindingSource)).BeginInit();
            this.SuspendLayout();
            //
            // pictureBox
            //
            this.pictureBox.Dock = System.Windows.Forms.DockStyle.Top;
            this.pictureBox.Image = global::Decoder.Properties.Resources.decoder_logo_1;
            this.pictureBox.Location = new System.Drawing.Point(0, 0);
            this.pictureBox.Name = "pictureBox";
            this.pictureBox.Size = new System.Drawing.Size(480, 83);
            this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.pictureBox.TabIndex = 4;
            this.pictureBox.TabStop = false;
            //
            // inProgressGroupBox
            //
            this.inProgressGroupBox.Controls.Add(this.filesInText);
            this.inProgressGroupBox.Controls.Add(this.filesInLabel);
            this.inProgressGroupBox.Controls.Add(this.srcCdrText);
            this.inProgressGroupBox.Controls.Add(this.srcCdrLabel);
            this.inProgressGroupBox.Controls.Add(this.recOutText);
            this.inProgressGroupBox.Controls.Add(this.recOutLabel);
            this.inProgressGroupBox.Controls.Add(this.progressBar);
            this.inProgressGroupBox.Location = new System.Drawing.Point(6, 6);
            this.inProgressGroupBox.Name = "inProgressGroupBox";
            this.inProgressGroupBox.Size = new System.Drawing.Size(244, 105);
            this.inProgressGroupBox.TabIndex = 7;
            this.inProgressGroupBox.TabStop = false;
            this.inProgressGroupBox.Text = "In Progress";
            //
            // filesInText
            //
            this.filesInText.AutoSize = true;
            this.filesInText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "CdrFilesIn", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0"));
            this.filesInText.Location = new System.Drawing.Point(83, 40);
            this.filesInText.Name = "filesInText";
            this.filesInText.Size = new System.Drawing.Size(58, 13);
            this.filesInText.TabIndex = 11;
            this.filesInText.Text = "filesInText";
            //
            // filesInLabel
            //
            this.filesInLabel.AutoSize = true;
            this.filesInLabel.Location = new System.Drawing.Point(8, 40);
            this.filesInLabel.Name = "filesInLabel";
            this.filesInLabel.Size = new System.Drawing.Size(69, 13);
            this.filesInLabel.TabIndex = 10;
            this.filesInLabel.Text = "CDR Files In:";
            //
            // srcCdrText
            //
            this.srcCdrText.AutoEllipsis = true;
            this.srcCdrText.AutoSize = true;
            this.srcCdrText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "CurrentCdrFile", true));
            this.srcCdrText.Location = new System.Drawing.Point(54, 22);
            this.srcCdrText.MaximumSize = new System.Drawing.Size(184, 13);
            this.srcCdrText.Name = "srcCdrText";
            this.srcCdrText.Size = new System.Drawing.Size(60, 13);
            this.srcCdrText.TabIndex = 8;
            this.srcCdrText.Text = "srcCdrText";
            //
            // srcCdrLabel
            //
            this.srcCdrLabel.AutoSize = true;
            this.srcCdrLabel.Location = new System.Drawing.Point(8, 22);
            this.srcCdrLabel.Name = "srcCdrLabel";
            this.srcCdrLabel.Size = new System.Drawing.Size(40, 13);
            this.srcCdrLabel.TabIndex = 7;
            this.srcCdrLabel.Text = "File In:";
            //
            // recOutText
            //
            this.recOutText.AutoSize = true;
            this.recOutText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "RecordsOut", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0"));
            this.recOutText.Location = new System.Drawing.Point(85, 58);
            this.recOutText.Name = "recOutText";
            this.recOutText.Size = new System.Drawing.Size(44, 13);
            this.recOutText.TabIndex = 6;
            this.recOutText.Text = "recText";
            //
            // recOutLabel
            //
            this.recOutLabel.AutoSize = true;
            this.recOutLabel.Location = new System.Drawing.Point(8, 58);
            this.recOutLabel.Name = "recOutLabel";
            this.recOutLabel.Size = new System.Drawing.Size(71, 13);
            this.recOutLabel.TabIndex = 3;
            this.recOutLabel.Text = "Records Out:";
            //
            // progressBar
            //
            this.progressBar.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.statusBindingSource, "Percent", true));
            this.progressBar.Location = new System.Drawing.Point(6, 79);
            this.progressBar.Name = "progressBar";
            this.progressBar.Size = new System.Drawing.Size(231, 14);
            this.progressBar.TabIndex = 0;
            //
            // exitButton
            //
            this.exitButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.exitButton.Location = new System.Drawing.Point(393, 489);
            this.exitButton.Name = "exitButton";
            this.exitButton.Size = new System.Drawing.Size(75, 23);
            this.exitButton.TabIndex = 9;
            this.exitButton.Text = "Exit";
            this.exitButton.UseVisualStyleBackColor = true;
            this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
            //
            // sinceStartupGroupBox
            //
            this.sinceStartupGroupBox.Controls.Add(this.filesOutText);
            this.sinceStartupGroupBox.Controls.Add(this.filesOutLabel);
            this.sinceStartupGroupBox.Controls.Add(this.timerText);
            this.sinceStartupGroupBox.Controls.Add(this.startTimeText);
            this.sinceStartupGroupBox.Controls.Add(this.recOutTotalText);
            this.sinceStartupGroupBox.Controls.Add(this.recOutTotalLabel);
            this.sinceStartupGroupBox.Controls.Add(this.timerLabel);
            this.sinceStartupGroupBox.Controls.Add(this.startTimeLabel);
            this.sinceStartupGroupBox.Location = new System.Drawing.Point(256, 6);
            this.sinceStartupGroupBox.Name = "sinceStartupGroupBox";
            this.sinceStartupGroupBox.Size = new System.Drawing.Size(207, 105);
            this.sinceStartupGroupBox.TabIndex = 12;
            this.sinceStartupGroupBox.TabStop = false;
            this.sinceStartupGroupBox.Text = "Since Startup";
            //
            // filesOutText
            //
            this.filesOutText.AutoSize = true;
            this.filesOutText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "CdrFilesOut", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0"));
            this.filesOutText.Location = new System.Drawing.Point(89, 76);
            this.filesOutText.Name = "filesOutText";
            this.filesOutText.Size = new System.Drawing.Size(66, 13);
            this.filesOutText.TabIndex = 10;
            this.filesOutText.Text = "filesOutText";
            //
            // filesOutLabel
            //
            this.filesOutLabel.AutoSize = true;
            this.filesOutLabel.Location = new System.Drawing.Point(6, 76);
            this.filesOutLabel.Name = "filesOutLabel";
            this.filesOutLabel.Size = new System.Drawing.Size(77, 13);
            this.filesOutLabel.TabIndex = 9;
            this.filesOutLabel.Text = "CDR Files Out:";
            //
            // timerText
            //
            this.timerText.AutoSize = true;
            this.timerText.Location = new System.Drawing.Point(89, 40);
            this.timerText.Name = "timerText";
            this.timerText.Size = new System.Drawing.Size(51, 13);
            this.timerText.TabIndex = 5;
            this.timerText.Text = "00:00:00";
            //
            // startTimeText
            //
            this.startTimeText.AutoSize = true;
            this.startTimeText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "StartTime", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "G"));
            this.startTimeText.Location = new System.Drawing.Point(89, 22);
            this.startTimeText.Name = "startTimeText";
            this.startTimeText.Size = new System.Drawing.Size(112, 13);
            this.startTimeText.TabIndex = 4;
            this.startTimeText.Text = "dd.mm.yyyy HH:mi:ss";
            //
            // recOutTotalText
            //
            this.recOutTotalText.AutoSize = true;
            this.recOutTotalText.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.statusBindingSource, "RecordsOutTotal", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0"));
            this.recOutTotalText.Location = new System.Drawing.Point(89, 58);
            this.recOutTotalText.Name = "recOutTotalText";
            this.recOutTotalText.Size = new System.Drawing.Size(44, 13);
            this.recOutTotalText.TabIndex = 3;
            this.recOutTotalText.Text = "recText";
            //
            // recOutTotalLabel
            //
            this.recOutTotalLabel.AutoSize = true;
            this.recOutTotalLabel.Location = new System.Drawing.Point(13, 58);
            this.recOutTotalLabel.Name = "recOutTotalLabel";
            this.recOutTotalLabel.Size = new System.Drawing.Size(71, 13);
            this.recOutTotalLabel.TabIndex = 2;
            this.recOutTotalLabel.Text = "Records Out:";
            //
            // timerLabel
            //
            this.timerLabel.AutoSize = true;
            this.timerLabel.Location = new System.Drawing.Point(47, 40);
            this.timerLabel.Name = "timerLabel";
            this.timerLabel.Size = new System.Drawing.Size(37, 13);
            this.timerLabel.TabIndex = 1;
            this.timerLabel.Text = "Timer:";
            //
            // startTimeLabel
            //
            this.startTimeLabel.AutoSize = true;
            this.startTimeLabel.Location = new System.Drawing.Point(25, 22);
            this.startTimeLabel.Name = "startTimeLabel";
            this.startTimeLabel.Size = new System.Drawing.Size(60, 13);
            this.startTimeLabel.TabIndex = 0;
            this.startTimeLabel.Text = "Start Time:";
            //
            // decodeButton
            //
            this.decodeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.decodeButton.Location = new System.Drawing.Point(311, 489);
            this.decodeButton.Name = "decodeButton";
            this.decodeButton.Size = new System.Drawing.Size(75, 23);
            this.decodeButton.TabIndex = 13;
            this.decodeButton.Text = "Decode";
            this.decodeButton.UseVisualStyleBackColor = true;
            this.decodeButton.Click += new System.EventHandler(this.decodeButton_Click);
            //
            // tabControl
            //
            this.tabControl.Controls.Add(this.jobTabPage);
            this.tabControl.Controls.Add(this.logTabPage);
            this.tabControl.Location = new System.Drawing.Point(2, 93);
            this.tabControl.Name = "tabControl";
            this.tabControl.SelectedIndex = 0;
            this.tabControl.Size = new System.Drawing.Size(477, 390);
            this.tabControl.TabIndex = 14;
            //
            // jobTabPage
            //
            this.jobTabPage.Controls.Add(this.jobPropertyGrid);
            this.jobTabPage.Controls.Add(this.jobToolStrip);
            this.jobTabPage.Location = new System.Drawing.Point(4, 22);
            this.jobTabPage.Name = "jobTabPage";
            this.jobTabPage.Padding = new System.Windows.Forms.Padding(3);
            this.jobTabPage.Size = new System.Drawing.Size(469, 364);
            this.jobTabPage.TabIndex = 1;
            this.jobTabPage.Text = "Job Properties";
            this.jobTabPage.UseVisualStyleBackColor = true;
            //
            // jobPropertyGrid
            //
            this.jobPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
            this.jobPropertyGrid.Location = new System.Drawing.Point(3, 28);
            this.jobPropertyGrid.Name = "jobPropertyGrid";
            this.jobPropertyGrid.Size = new System.Drawing.Size(463, 333);
            this.jobPropertyGrid.TabIndex = 0;
            this.jobPropertyGrid.ToolbarVisible = false;
            //
            // jobToolStrip
            //
            this.jobToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
            this.jobToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.newToolButton,
            this.toolStripSeparator1,
            this.openToolButton,
            this.saveToolButton});
            this.jobToolStrip.Location = new System.Drawing.Point(3, 3);
            this.jobToolStrip.Name = "jobToolStrip";
            this.jobToolStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
            this.jobToolStrip.Size = new System.Drawing.Size(463, 25);
            this.jobToolStrip.TabIndex = 1;
            this.jobToolStrip.Text = "toolStrip1";
            //
            // newToolButton
            //
            this.newToolButton.Image = ((System.Drawing.Image)(resources.GetObject("newToolButton.Image")));
            this.newToolButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.newToolButton.Name = "newToolButton";
            this.newToolButton.Size = new System.Drawing.Size(48, 22);
            this.newToolButton.Text = "New";
            this.newToolButton.ToolTipText = "Create new job.";
            this.newToolButton.Click += new System.EventHandler(this.newToolButton_Click);
            //
            // toolStripSeparator1
            //
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
            //
            // openToolButton
            //
            this.openToolButton.Image = ((System.Drawing.Image)(resources.GetObject("openToolButton.Image")));
            this.openToolButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.openToolButton.Name = "openToolButton";
            this.openToolButton.Size = new System.Drawing.Size(53, 22);
            this.openToolButton.Text = "Open";
            this.openToolButton.ToolTipText = "Open existing job-file.";
            this.openToolButton.Click += new System.EventHandler(this.openToolButton_Click);
            //
            // saveToolButton
            //
            this.saveToolButton.Image = ((System.Drawing.Image)(resources.GetObject("saveToolButton.Image")));
            this.saveToolButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.saveToolButton.Name = "saveToolButton";
            this.saveToolButton.Size = new System.Drawing.Size(81, 22);
            this.saveToolButton.Text = "Save As ...";
            this.saveToolButton.ToolTipText = "Save this settings to file.";
            this.saveToolButton.Click += new System.EventHandler(this.saveToolButton_Click);
            //
            // logTabPage
            //
            this.logTabPage.Controls.Add(this.logListView);
            this.logTabPage.Controls.Add(this.inProgressGroupBox);
            this.logTabPage.Controls.Add(this.sinceStartupGroupBox);
            this.logTabPage.Location = new System.Drawing.Point(4, 22);
            this.logTabPage.Name = "logTabPage";
            this.logTabPage.Padding = new System.Windows.Forms.Padding(6);
            this.logTabPage.Size = new System.Drawing.Size(469, 364);
            this.logTabPage.TabIndex = 2;
            this.logTabPage.Text = "Decoder Log";
            this.logTabPage.UseVisualStyleBackColor = true;
            //
            // logListView
            //
            this.logListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.timeColumnHeader,
            this.messageColumnHeader});
            this.logListView.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.logListView.FullRowSelect = true;
            this.logListView.GridLines = true;
            this.logListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.logListView.Location = new System.Drawing.Point(6, 117);
            this.logListView.Name = "logListView";
            this.logListView.Size = new System.Drawing.Size(457, 241);
            this.logListView.TabIndex = 13;
            this.logListView.UseCompatibleStateImageBehavior = false;
            this.logListView.View = System.Windows.Forms.View.Details;
            this.logListView.VirtualMode = true;
            this.logListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.logListView_RetrieveVirtualItem);
            //
            // timeColumnHeader
            //
            this.timeColumnHeader.Text = "Time";
            this.timeColumnHeader.Width = 90;
            //
            // messageColumnHeader
            //
            this.messageColumnHeader.Text = "Message";
            this.messageColumnHeader.Width = 331;
            //
            // helpButton
            //
            this.helpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.helpButton.Location = new System.Drawing.Point(12, 489);
            this.helpButton.Name = "helpButton";
            this.helpButton.Size = new System.Drawing.Size(75, 23);
            this.helpButton.TabIndex = 15;
            this.helpButton.Text = "Help";
            this.helpButton.UseVisualStyleBackColor = true;
            this.helpButton.Click += new System.EventHandler(this.helpButton_Click);
            //
            // saveFileDialog
            //
            this.saveFileDialog.Filter = "Job Files (*.job)|*.job|All Files (*.*)|*.*";
            //
            // openFileDialog
            //
            this.openFileDialog.Filter = "Job Files (*.job)|*.job|All Files (*.*)|*.*";
            //
            // statusBindingSource
            //
            this.statusBindingSource.DataSource = typeof(D900Cdr.Decoder.JobStatus);
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(480, 524);
            this.Controls.Add(this.helpButton);
            this.Controls.Add(this.tabControl);
            this.Controls.Add(this.decodeButton);
            this.Controls.Add(this.exitButton);
            this.Controls.Add(this.pictureBox);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "MainForm";
            this.Text = "Siemens D900 CDR Decoder";
            this.Shown += new System.EventHandler(this.MainForm_Shown);
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
            this.inProgressGroupBox.ResumeLayout(false);
            this.inProgressGroupBox.PerformLayout();
            this.sinceStartupGroupBox.ResumeLayout(false);
            this.sinceStartupGroupBox.PerformLayout();
            this.tabControl.ResumeLayout(false);
            this.jobTabPage.ResumeLayout(false);
            this.jobTabPage.PerformLayout();
            this.jobToolStrip.ResumeLayout(false);
            this.jobToolStrip.PerformLayout();
            this.logTabPage.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.statusBindingSource)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.PictureBox pictureBox;
        private System.Windows.Forms.GroupBox inProgressGroupBox;
        private System.Windows.Forms.Label recOutText;
        private System.Windows.Forms.Label recOutLabel;
        private System.Windows.Forms.ProgressBar progressBar;
        private System.Windows.Forms.Button exitButton;
        private System.Windows.Forms.GroupBox sinceStartupGroupBox;
        private System.Windows.Forms.Label startTimeLabel;
        private System.Windows.Forms.Label timerLabel;
        private System.Windows.Forms.Label recOutTotalLabel;
        private System.Windows.Forms.Button decodeButton;
        private System.Windows.Forms.BindingSource statusBindingSource;
        private System.Windows.Forms.Label recOutTotalText;
        private System.Windows.Forms.Label timerText;
        private System.Windows.Forms.Label startTimeText;
        private System.Windows.Forms.Label filesOutText;
        private System.Windows.Forms.Label filesOutLabel;
        private System.Windows.Forms.Label srcCdrLabel;
        private System.Windows.Forms.Label srcCdrText;
        private System.Windows.Forms.TabControl tabControl;
        private System.Windows.Forms.TabPage jobTabPage;
        private System.Windows.Forms.TabPage logTabPage;
        private System.Windows.Forms.PropertyGrid jobPropertyGrid;
        private System.Windows.Forms.Button helpButton;
        private System.Windows.Forms.ToolStrip jobToolStrip;
        private System.Windows.Forms.ToolStripButton openToolButton;
        private System.Windows.Forms.ToolStripButton newToolButton;
        private System.Windows.Forms.ToolStripButton saveToolButton;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.SaveFileDialog saveFileDialog;
        private System.Windows.Forms.OpenFileDialog openFileDialog;
        private System.Windows.Forms.ListView logListView;
        private System.Windows.Forms.ColumnHeader messageColumnHeader;
        private System.Windows.Forms.ColumnHeader timeColumnHeader;
        private System.Windows.Forms.Label filesInLabel;
        private System.Windows.Forms.Label filesInText;
    }
}


text:
Build CoreCLR on OS X
=====================

This guide will walk you through building CoreCLR on OS X. We'll start by showing how to set up your environment from scratch.

Environment
===========

These instructions were validated on macOS 10.12. Sierra. On older versions coreFX will fail to build properly because of SSL API changes.

If your machine has Command Line Tools for XCode 6.3 installed, you'll need to update them to the 6.3.1 version or higher in order to successfully build. There was an issue with the headers that shipped with version 6.3 that was subsequently fixed in 6.3.1.

Git Setup
---------

Clone the CoreCLR and CoreFX repositories (either upstream or a fork).

```sh
dotnet-mbp:git richlander$ git clone https://github.com/dotnet/coreclr
# Cloning into 'coreclr'...

dotnet-mbp:git richlander$ git clone https://github.com/dotnet/corefx
# Cloning into 'corefx'...
```

This guide assumes that you've cloned the coreclr and corefx repositories into `~/git/coreclr` and `~/git/corefx` on your OS X machine. If your setup is different, you'll need to pay careful attention to the commands you run. In this guide, I'll always show what directory I'm in.

CMake
-----

CoreCLR has a dependency on CMake for the build. You can download it from [CMake downloads](http://www.cmake.org/download/).

Alternatively, you can install CMake from [Homebrew](http://brew.sh/).

```sh
dotnet-mbp:~ richlander$ brew install cmake
```

ICU
---
ICU (International Components for Unicode) is also required to build and run. It can be obtained via [Homebrew](http://brew.sh/).

```sh
brew install icu4c
brew link --force icu4c
```

OpenSSL
-------
The CoreFX cryptography libraries are built on OpenSSL. The version of OpenSSL included on OS X (0.9.8) has gone out of support, and a newer version is required. A supported version can be obtained via [Homebrew](http://brew.sh).

```sh
brew install openssl

# We need to make the runtime libraries discoverable, as well as make
# pkg-config be able to find the headers and current ABI version.
#
# Ensure the paths we will need exist
mkdir -p /usr/local/lib/pkgconfig

# The rest of these instructions assume a default Homebrew path of
# /usr/local/opt/<module>, with /usr/local being the answer to
# `brew --prefix`.
#
# Runtime dependencies
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

# Compile-time dependences (for pkg-config)
ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/

# Check pkg-config configuration
pkg-config --libs openssl

it should show something like '-L/usr/local/Cellar/openssl/1.0.2k/lib -lssl -lcrypto'
If pkg-config is not found, run 'brew install pkg-config'
```

If you miss a step or something changes, run clean.sh from top. cmake will cache certain parts and it may not pick up the updates.

Build the Runtime and Microsoft Core Library
============================================

To Build CoreCLR, run build.sh from the root of the coreclr repo.

```sh
dotnet-mbp:~ richlander$ cd ~/git/coreclr
dotnet-mbp:coreclr richlander$ ./build.sh
```

After the build is completed, there should some files placed in `bin/Product/OSX.x64.Debug`. The ones we are interested in are:

- `corerun`: The command line host. This program loads and starts the CoreCLR runtime and passes the managed program you want to run to it.
- `libcoreclr.dylib`: The CoreCLR runtime itself.
- `System.Private.CoreLib.dll`: Microsoft Core Library.

Build the Framework
===================

```sh
dotnet-mbp:corefx richlander$ ./build.sh
```

After the build is complete you will be able to find the output in the `bin` folder.


text:
WhatsAllApp is a Chrome extension which creates an overlay of extra information on top of WhatsApp web. This is the community edition and  at this moment it enumerates and shows the following information:
*   Profile pictures
*   Status texts
*   Display names (for chat accounts*)
*   Online statuses (for chat accounts*)

When a WhatsApp contact comes online, the corresponding entry will have a green background and the 'last seen' entry is updated.

You can download a zip file of the currently displayed accounts. The file contains a .csv file and jpegs of all the displayed profile pictures.

![shot_10](https://user-images.githubusercontent.com/12978070/44982248-8576f400-af75-11e8-993c-1ce25af3c3d4.png)
![shot_11](https://user-images.githubusercontent.com/12978070/44982251-860f8a80-af75-11e8-9f09-32057eeaaa82.png)
![shot_1](https://user-images.githubusercontent.com/12978070/44980623-b30d6e80-af70-11e8-9f19-2083f4816549.png)

## *What are chat accounts?
Chat accounts are WhatsApp users that had a chat session with you before, even if it was 2 years ago. This includes 1 on 1 chats and group chats.

## Installation
This extension is not available in the Chrome store. You have to install it manually. That is an easy task, just following these steps:

1. Click 'clone or download' and choose to download the ZIP file
2. Extract the folder from the ZIP file
3. Open up chrome://extensions/
4. Enable developer mode at the top of the screen by clicking the slider
5. Click 'load unpacked extension'
6. **Select the dist/ folder from step 2**
7. The extension should appear at the top of the list
8. Refresh your WhatsApp web
9. An orange slider should appear at the top of the screen

## Usage
Click on the arrow at the top of WhatsApp web. Enter a range of numbers or enter a list of comma separated numbers to search for. Keep in mind: the WhatsApp rate limiter is quite aggressive so don't search for hundreds of numbers at the same time.

## Development
1. Clone the repo ```git clone https://github.com/LoranKloeze/WhatsAllApp.git```
2. Make sure [Node.js](https://nodejs.org/en/) is installed
3. Run ```npm install``` or ```yarn install```
4. Run ```npx webpack``` or ```npx webpack --watch``` to pack the code from /src to /dist
5. Load the unpacked extension from /dist in Chrome

## FAQ

* __I don't see the online statuses of some numbers, why?__

    Then it is problably someone you never had contact with before. You had to have a chat session before with someone to get information about their online status or display name.

* __But I still want to see the online presence of users that never had a chat session with me before, I even want to pay for it!__

    No, not possible.

* __The extension doesn't work!__

    WhatsAllApp is built on top of the undocumentend API of WhatsApp. They are free to change their API anytime which means that this extension can break anytime. So if something like that happens, create an issue and wait for the bug fix.

* __Can I send you an email for support questions?__

    I don't offer free individual support. Please create an issue and ask the community.

* __How about the Pro version?__

    There are no plans for a pro version anymore.


text:
package org.kantega.playground.eventsourcing;

import fj.data.List;
import fj.data.Stream;

import java.util.ArrayList;

public interface AllTheFacts {

    Stream<Fact> stream();

    class AllTheInMemoryFacts implements AllTheFacts{

        final ArrayList<Fact> facts = new ArrayList<>();

        public Stream<Fact> stream(){
            return List.iterableList(facts).toStream();
        }

        public void append(Fact fact){
            facts.add(0,fact);
        }
    }

}


text:
% DOCKER(1) Docker User Manuals
% Docker Community
% JUNE 2014
# NAME
docker-save - Save an image(s) to a tar archive (streamed to STDOUT by default)

# SYNOPSIS
**docker save**
[**--help**]
[**-o**|**--output**[=*OUTPUT*]]
IMAGE [IMAGE...]

# DESCRIPTION
Produces a tarred repository to the standard output stream. Contains all
parent layers, and all tags + versions, or specified repo:tag.

Stream to a file instead of STDOUT by using **-o**.

# OPTIONS
**--help**
  Print usage statement

**-o**, **--output**=""
   Write to a file, instead of STDOUT

# EXAMPLES

Save all fedora repository images to a fedora-all.tar and save the latest
fedora image to a fedora-latest.tar:

    $ sudo docker save fedora > fedora-all.tar
    $ sudo docker save --output=fedora-latest.tar fedora:latest
    $ ls -sh fedora-all.tar
    721M fedora-all.tar
    $ ls -sh fedora-latest.tar
    367M fedora-latest.tar

# See also
**docker-load(1)** to load an image from a tar archive on STDIN.

# HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.com source material and internal work.
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>


text:
package org.apache.james.mime4j.message;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import org.apache.commons.io.IOUtils;
//BEGIN android-changed: Stubbing out logging
import org.apache.james.mime4j.Log;
import org.apache.james.mime4j.LogFactory;
//END android-changed
import org.apache.james.mime4j.util.TempPath;
import org.apache.james.mime4j.util.TempStorage;

/**
 * Binary body backed by a {@link org.apache.james.mime4j.util.TempFile}.
 *
 *
 * @version $Id: TempFileBinaryBody.java,v 1.2 2004/10/02 12:41:11 ntherning Exp $
 */
class MemoryBinaryBody extends AbstractBody implements BinaryBody {
    private static Log log = LogFactory.getLog(MemoryBinaryBody.class);

    private Entity parent = null;
    private byte[] tempFile = null;

    /**
     * Use the given InputStream to build the TemporyFileBinaryBody
     *
     * @param is the InputStream to use as source
     * @throws IOException
     */
    public MemoryBinaryBody(InputStream is) throws IOException {

        TempPath tempPath = TempStorage.getInstance().getRootTempPath();

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(is, out);
        out.close();
        tempFile = out.toByteArray();
    }

    /**
     * @see org.apache.james.mime4j.message.AbstractBody#getParent()
     */
    public Entity getParent() {
        return parent;
    }

    /**
     * @see org.apache.james.mime4j.message.AbstractBody#setParent(org.apache.james.mime4j.message.Entity)
     */
    public void setParent(Entity parent) {
        this.parent = parent;
    }

    /**
     * @see org.apache.james.mime4j.message.BinaryBody#getInputStream()
     */
    public InputStream getInputStream() throws IOException {
        return new ByteArrayInputStream(tempFile);
    }

    /**
     * @see org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream)
     */
    public void writeTo(OutputStream out) throws IOException {
	IOUtils.copy(getInputStream(),out);
    }
}


text:
#ifndef DELEGATED_FRAME_NODE_H
#define DELEGATED_FRAME_NODE_H

#include <QMutex>
#include <QSGNode>
#include <QSGTexture>
#include <QSharedData>
#include <QSharedPointer>
#include <QWaitCondition>

#include "base/memory/scoped_ptr.h"
#include "cc/quads/render_pass.h"
#include "cc/resources/transferable_resource.h"

QT_BEGIN_NAMESPACE
class QSGLayer;
class QQuickItem;
QT_END_NAMESPACE

namespace cc {
class DelegatedFrameData;
}

namespace gfx {
union TransferableFence;
}

namespace content {

class MailboxTexture;
class ResourceHolder;

// Separating this data allows another DelegatedFrameNode to reconstruct
// the QSGNode tree from the mailbox textures and render pass information.
class ChromiumCompositorData : public QSharedData {
 public:
  ChromiumCompositorData();
  ~ChromiumCompositorData();
  QHash<unsigned, QSharedPointer<ResourceHolder> > resourceHolders;
  scoped_ptr<cc::DelegatedFrameData> frameData;
};

class DelegatedFrameNode : public QSGTransformNode {
 public:
  DelegatedFrameNode();
  ~DelegatedFrameNode() override;
  void preprocess() override;
  void commit(ChromiumCompositorData *chromiumCompositorData,
      cc::ReturnedResourceArray *resourcesToRelease, QQuickItem* view);

 private:
  // Making those callbacks static bypasses base::Bind's ref-counting
  // requirement of the this pointer when the callback is a method.
  static void fetchTexturesAndUnlockQt(
      DelegatedFrameNode* frameNode,
      QList<MailboxTexture*> *mailboxesToFetch);
  static void syncPointRetired(
      DelegatedFrameNode *frameNode,
      QList<MailboxTexture *> *mailboxesToFetch);

  ResourceHolder* findAndHoldResource(
      unsigned resourceId,
      QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates);
  QSGTexture *initAndHoldTexture(
      ResourceHolder *resource,
      bool quadIsAllOpaque,
      QQuickItem* view = 0);

  QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData;
  struct SGObjects {
    SGObjects();
    ~SGObjects();
    QList<QPair<cc::RenderPassId, QSharedPointer<QSGLayer> > > renderPassLayers;
    QList<QSharedPointer<QSGRootNode> > renderPassRootNodes;
    QList<QSharedPointer<QSGTexture> > textureStrongRefs;
  } m_sgObjects;
  int m_numPendingSyncPoints;
  QMap<uint32, gfx::TransferableFence> m_mailboxGLFences;
  QWaitCondition m_mailboxesFetchedWaitCond;
  QMutex m_mutex;
};

} // namespace content

#endif // DELEGATED_FRAME_NODE_H


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

namespace _7.Cake_Ingredients
{
    class Program
    {
        static void Main(string[] args)
        {
            bool bake = false;
            int ingredient_count = 0;
            while (bake == false)
            {
                var ingredient = Console.ReadLine();
                if(ingredient.Length >= 1 && ingredient.Length <= 50)
                {
                    if (ingredient == "Bake!")
                    {
                        bake = true;
                    }
                    else
                    {
                        ingredient_count++;
                        Console.WriteLine("Adding ingredient {0}.", ingredient);
                    }
                    if (ingredient_count > 20)
                    {
                        break;
                    }
                }

            }

            if (ingredient_count > 20)
            {

            }
            else
            {
                Console.WriteLine("Preparing cake with {0} ingredients.", ingredient_count);
            }
        }
    }
}


text:
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Localisation;

namespace osu.Game.Screens.Edit.Setup
{
    internal class ResourcesSection : SetupSection
    {
        private LabelledFileChooser audioTrackChooser;
        private LabelledFileChooser backgroundChooser;

        public override LocalisableString Title => EditorSetupStrings.ResourcesHeader;

        [Resolved]
        private MusicController music { get; set; }

        [Resolved]
        private BeatmapManager beatmaps { get; set; }

        [Resolved]
        private IBindable<WorkingBeatmap> working { get; set; }

        [Resolved]
        private EditorBeatmap editorBeatmap { get; set; }

        [Resolved]
        private SetupScreenHeader header { get; set; }

        [BackgroundDependencyLoader]
        private void load()
        {
            Children = new Drawable[]
            {
                backgroundChooser = new LabelledFileChooser(".jpg", ".jpeg", ".png")
                {
                    Label = GameplaySettingsStrings.BackgroundHeader,
                    FixedLabelWidth = LABEL_WIDTH,
                    TabbableContentContainer = this
                },
                audioTrackChooser = new LabelledFileChooser(".mp3", ".ogg")
                {
                    Label = EditorSetupStrings.AudioTrack,
                    FixedLabelWidth = LABEL_WIDTH,
                    TabbableContentContainer = this
                },
            };

            if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile))
                backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);

            if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile))
                audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile);

            backgroundChooser.Current.BindValueChanged(backgroundChanged);
            audioTrackChooser.Current.BindValueChanged(audioTrackChanged);

            updatePlaceholderText();
        }

        public bool ChangeBackgroundImage(FileInfo source)
        {
            if (!source.Exists)
                return false;

            var set = working.Value.BeatmapSetInfo;

            var destination = new FileInfo($@"bg{source.Extension}");

            // remove the previous background for now.
            // in the future we probably want to check if this is being used elsewhere (other difficulties?)
            var oldFile = set.GetFile(working.Value.Metadata.BackgroundFile);

            using (var stream = source.OpenRead())
            {
                if (oldFile != null)
                    beatmaps.DeleteFile(set, oldFile);

                beatmaps.AddFile(set, stream, destination.Name);
            }

            editorBeatmap.SaveState();

            working.Value.Metadata.BackgroundFile = destination.Name;
            header.Background.UpdateBackground();

            return true;
        }

        public bool ChangeAudioTrack(FileInfo source)
        {
            if (!source.Exists)
                return false;

            var set = working.Value.BeatmapSetInfo;

            var destination = new FileInfo($@"audio{source.Extension}");

            // remove the previous audio track for now.
            // in the future we probably want to check if this is being used elsewhere (other difficulties?)
            var oldFile = set.GetFile(working.Value.Metadata.AudioFile);

            using (var stream = source.OpenRead())
            {
                if (oldFile != null)
                    beatmaps.DeleteFile(set, oldFile);

                beatmaps.AddFile(set, stream, destination.Name);
            }

            working.Value.Metadata.AudioFile = destination.Name;

            editorBeatmap.SaveState();
            music.ReloadCurrentTrack();

            return true;
        }

        private void backgroundChanged(ValueChangedEvent<FileInfo> file)
        {
            if (!ChangeBackgroundImage(file.NewValue))
                backgroundChooser.Current.Value = file.OldValue;

            updatePlaceholderText();
        }

        private void audioTrackChanged(ValueChangedEvent<FileInfo> file)
        {
            if (!ChangeAudioTrack(file.NewValue))
                audioTrackChooser.Current.Value = file.OldValue;

            updatePlaceholderText();
        }

        private void updatePlaceholderText()
        {
            audioTrackChooser.Text = audioTrackChooser.Current.Value == null
                ? EditorSetupStrings.ClickToSelectTrack
                : EditorSetupStrings.ClickToReplaceTrack;

            backgroundChooser.Text = backgroundChooser.Current.Value == null
                ? EditorSetupStrings.ClickToSelectBackground
                : EditorSetupStrings.ClickToReplaceBackground;
        }
    }
}


text:
module Mojo.Event{
export var flick : Object;
}


text:
<?php

namespace DTS\eBaySDK\MerchantData\Types\Test;

use DTS\eBaySDK\MerchantData\Types\BotBlockResponseType;

class BotBlockResponseTypeTest extends \PHPUnit_Framework_TestCase
{
    private $obj;

    protected function setUp()
    {
        $this->obj = new BotBlockResponseType();
    }

    public function testCanBeCreated()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\MerchantData\Types\BotBlockResponseType', $this->obj);
    }

    public function testExtendsBaseType()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj);
    }
}


text:
function btkSetPointLabel(h, idx_or_label, new_label) %#ok
%BTKSETPOINTLABEL Modify point's label and return updated points.
%
%  BTKSETPOINTLABEL(H, INDEX, NEWLABEL) modifies point's label by NEWLABEL for
%  the point at the index INDEX.  NEWLABEL must be a non-empty string.
%
%  The point to modify can also be selected by its LABEL.
%  BTKSETPOINTLABEL(H, LABEL, NEWLABEL)
%
%  This function can also returns an updated list of points.
%  POINTS = BTKSETPOINTLABEL(H, INDEX, NEWLABEL)
%  POINTS = BTKSETPOINTLABEL(H, LABEL, NEWLABEL)
%  The format of POINTS is the same than using the function btkGetPoints
%
%  This function can also returns an updated list of points' informations.
%  [POINTS, POINTSINFO] = BTKSETPOINTLABEL(H, INDEX, NEWLABEL)
%  [POINTS, POINTSINFO] = BTKSETPOINTLABEL(H, LABEL, NEWLABEL)
%  The format of POINTSINFO is the same than using the function btkGetPoints
%
%  The acquisition is represented by the handle H.  This handle is obtained
%  by the use of a btk* function.

%  Author: A. Barré
%  Copyright 2009-2013 Biomechanical ToolKit (BTK).

% The following comment, MATLAB compiler pragma, is necessary to avoid
% compiling this M-file instead of linking against the MEX-file.  Don't remove.
%# mex

error(generatemsgid('NotSupported'),'MEX file for BTKSETPOINTLABEL not found');

% [EOF] btkSetPointLabel.m


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.38
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace BerkeleyDB.Internal {

using System;
using System.Runtime.InteropServices;

internal class DB_LOCK : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal DB_LOCK(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(DB_LOCK obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~DB_LOCK() {
    Dispose();
  }

  public virtual void Dispose() {
    lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
        swigCMemOwn = false;
        libdb_csharpPINVOKE.delete_DB_LOCK(swigCPtr);
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
    }
  }

  internal uint off {
    set {
      libdb_csharpPINVOKE.DB_LOCK_off_set(swigCPtr, value);
    }
    get {
      uint ret = libdb_csharpPINVOKE.DB_LOCK_off_get(swigCPtr);
      return ret;
    }
  }

  internal uint ndx {
    set {
      libdb_csharpPINVOKE.DB_LOCK_ndx_set(swigCPtr, value);
    }
    get {
      uint ret = libdb_csharpPINVOKE.DB_LOCK_ndx_get(swigCPtr);
      return ret;
    }
  }

  internal uint gen {
    set {
      libdb_csharpPINVOKE.DB_LOCK_gen_set(swigCPtr, value);
    }
    get {
      uint ret = libdb_csharpPINVOKE.DB_LOCK_gen_get(swigCPtr);
      return ret;
    }
  }

  internal db_lockmode_t mode {
    set {
      libdb_csharpPINVOKE.DB_LOCK_mode_set(swigCPtr, (int)value);
    }
    get {
      db_lockmode_t ret = (db_lockmode_t)libdb_csharpPINVOKE.DB_LOCK_mode_get(swigCPtr);
      return ret;
    }
  }

  internal DB_LOCK() : this(libdb_csharpPINVOKE.new_DB_LOCK(), true) {
  }

}

}


text:
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, NetworkThread
from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script import CScript, OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP
from io import BytesIO

def cltv_invalidate(tx):
    '''Modify the signature in vin 0 of the tx to fail CLTV

    Prepends -1 CLTV DROP in the scriptSig itself.
    '''
    tx.vin[0].scriptSig = CScript([OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP] +
                                  list(CScript(tx.vin[0].scriptSig)))

'''
This test is meant to exercise BIP65 (CHECKLOCKTIMEVERIFY)
Connect to a single node.
Mine 2 (version 3) blocks (save the coinbases for later).
Generate 98 more version 3 blocks, verify the node accepts.
Mine 749 version 4 blocks, verify the node accepts.
Check that the new CLTV rules are not enforced on the 750th version 4 block.
Check that the new CLTV rules are enforced on the 751st version 4 block.
Mine 199 new version blocks.
Mine 1 old-version block.
Mine 1 new version block.
Mine 1 old version block, see that the node rejects.
'''

class BIP65Test(ComparisonTestFramework):

    def __init__(self):
        super().__init__()
        self.num_nodes = 1

    def setup_network(self):
        # Must set the blockversion for this test
        self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
                                 extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=3']],
                                 binary=[self.options.testbinary])

    def run_test(self):
        test = TestManager(self, self.options.tmpdir)
        test.add_all_connections(self.nodes)
        NetworkThread().start() # Start up network handling in another thread
        test.run()

    def create_transaction(self, node, coinbase, to_address, amount):
        from_txid = node.getblock(coinbase)['tx'][0]
        inputs = [{ "txid" : from_txid, "vout" : 0}]
        outputs = { to_address : amount }
        rawtx = node.createrawtransaction(inputs, outputs)
        signresult = node.signrawtransaction(rawtx)
        tx = CTransaction()
        f = BytesIO(hex_str_to_bytes(signresult['hex']))
        tx.deserialize(f)
        return tx

    def get_tests(self):

        self.coinbase_blocks = self.nodes[0].generate(2)
        height = 3  # height of the next block to build
        self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
        self.nodeaddress = self.nodes[0].getnewaddress()
        self.last_block_time = get_mocktime() + 1

        ''' 398 more version 3 blocks '''
        test_blocks = []
        for i in range(398):
            block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
            block.nVersion = 3
            block.rehash()
            block.solve()
            test_blocks.append([block, True])
            self.last_block_time += 1
            self.tip = block.sha256
            height += 1
        yield TestInstance(test_blocks, sync_every_block=False)

        ''' Mine 749 version 4 blocks '''
        test_blocks = []
        for i in range(749):
            block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
            block.nVersion = 4
            block.rehash()
            block.solve()
            test_blocks.append([block, True])
            self.last_block_time += 1
            self.tip = block.sha256
            height += 1
        yield TestInstance(test_blocks, sync_every_block=False)

        '''
        Check that the new CLTV rules are not enforced in the 750th
        version 3 block.
        '''
        spendtx = self.create_transaction(self.nodes[0],
                self.coinbase_blocks[0], self.nodeaddress, 1.0)
        cltv_invalidate(spendtx)
        spendtx.rehash()

        block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
        block.nVersion = 4
        block.vtx.append(spendtx)
        block.hashMerkleRoot = block.calc_merkle_root()
        block.rehash()
        block.solve()

        self.last_block_time += 1
        self.tip = block.sha256
        height += 1
        yield TestInstance([[block, True]])

        ''' Mine 199 new version blocks on last valid tip '''
        test_blocks = []
        for i in range(199):
            block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
            block.nVersion = 4
            block.rehash()
            block.solve()
            test_blocks.append([block, True])
            self.last_block_time += 1
            self.tip = block.sha256
            height += 1
        yield TestInstance(test_blocks, sync_every_block=False)

        ''' Mine 1 old version block '''
        block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
        block.nVersion = 3
        block.rehash()
        block.solve()
        self.last_block_time += 1
        self.tip = block.sha256
        height += 1
        yield TestInstance([[block, True]])

        ''' Mine 1 new version block '''
        block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
        block.nVersion = 4
        block.rehash()
        block.solve()
        self.last_block_time += 1
        self.tip = block.sha256
        height += 1
        yield TestInstance([[block, True]])

        '''
        Check that the new CLTV rules are enforced in the 951st version 4
        block.
        '''
        spendtx = self.create_transaction(self.nodes[0],
                self.coinbase_blocks[1], self.nodeaddress, 1.0)
        cltv_invalidate(spendtx)
        spendtx.rehash()

        block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
        block.nVersion = 4
        block.vtx.append(spendtx)
        block.hashMerkleRoot = block.calc_merkle_root()
        block.rehash()
        block.solve()
        self.last_block_time += 1
        yield TestInstance([[block, False]])

        ''' Mine 1 old version block, should be invalid '''
        block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
        block.nVersion = 3
        block.rehash()
        block.solve()
        self.last_block_time += 1
        yield TestInstance([[block, False]])

if __name__ == '__main__':
    BIP65Test().main()


text:
/**
 * @module BgProcess
 * @submodule models/Source
 */
define(['backbone'], function (BB) {

	/**
	 * Feed module
	 * @class Source
	 * @constructor
	 * @extends Backbone.Model
	 */
	var Source = BB.Model.extend({
		defaults: {
			title: '',
			url: 'about:blank',
			base: '',
			updateEvery: 180, // in minutes
			lastUpdate: 0,
			count: 0, // unread
			countAll: 0,
			username: '',
			password: '',
			hasNew: false,
			isLoading: false,
			autoremove: 0 // in days
		},

		initialize: function() {
			// in case user quits Opera when the source is being updated
			this.set('isLoading', false);
		},

		getPass: function() {
			var str = this.get('password');
			if (str.indexOf('enc:') != 0) return str;

			var dec = '';
			for (var i=4; i<str.length; i++) {
				dec += String.fromCharCode(str.charCodeAt(i) - 13);
			}
			return dec;
		},
		setPass: function(str) {
			if (!str) {
				this.save('password', '');
				return;
			}

			var enc = 'enc:';
			for (var i=0; i<str.length; i++) {
				enc += String.fromCharCode(str.charCodeAt(i) + 13);
			}
			this.set('password', enc);
		}

	});

	return Source;
});


text:
/*
 * Copyright (c) 2003 World Wide Web Consortium,
 * (Massachusetts Institute of Technology, Institut National de
 * Recherche en Informatique et en Automatique, Keio University). All
 * Rights Reserved. This program is distributed under the W3C's Software
 * Intellectual Property License. This program is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.
 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
 */

package org.w3c.dom5.html;

/**
 * A selectable choice. See the OPTION element definition in HTML 4.01.
 *
See also the Document Object Model (DOM) Level 2 HTML Specification.
 */
public interface HTMLOptionElement extends HTMLElement {
    /**
     * Returns the FORM element containing this control. Returns
     * null if this control is not within the context of a
     * form.
     */
    public HTMLFormElement getForm();

    /**
     * Represents the value of the HTML selected attribute. The value of this
     * attribute does not change if the state of the corresponding form
     * control, in an interactive user agent, changes. See the selected
     * attribute definition in HTML 4.01.
     * @version DOM Level 2
     */
    public boolean getDefaultSelected();
    /**
     * Represents the value of the HTML selected attribute. The value of this
     * attribute does not change if the state of the corresponding form
     * control, in an interactive user agent, changes. See the selected
     * attribute definition in HTML 4.01.
     * @version DOM Level 2
     */
    public void setDefaultSelected(boolean defaultSelected);

    /**
     * The text contained within the option element.
     */
    public String getText();

    /**
     * The index of this OPTION in its parent SELECT
     * , starting from 0.
     * @version DOM Level 2
     */
    public int getIndex();

    /**
     * The control is unavailable in this context. See the disabled attribute
     * definition in HTML 4.01.
     */
    public boolean getDisabled();
    /**
     * The control is unavailable in this context. See the disabled attribute
     * definition in HTML 4.01.
     */
    public void setDisabled(boolean disabled);

    /**
     * Option label for use in hierarchical menus. See the label attribute
     * definition in HTML 4.01.
     */
    public String getLabel();
    /**
     * Option label for use in hierarchical menus. See the label attribute
     * definition in HTML 4.01.
     */
    public void setLabel(String label);

    /**
     * Represents the current state of the corresponding form control, in an
     * interactive user agent. Changing this attribute changes the state of
     * the form control, but does not change the value of the HTML selected
     * attribute of the element.
     */
    public boolean getSelected();
    /**
     * Represents the current state of the corresponding form control, in an
     * interactive user agent. Changing this attribute changes the state of
     * the form control, but does not change the value of the HTML selected
     * attribute of the element.
     */
    public void setSelected(boolean selected);

    /**
     * The current form control value. See the value attribute definition in
     * HTML 4.01.
     */
    public String getValue();
    /**
     * The current form control value. See the value attribute definition in
     * HTML 4.01.
     */
    public void setValue(String value);

}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace BeautyTeamWeb.ViewModels
{
    public class Bind
    {
        [Required]
        public virtual int school { get; set; }
        [Required]
        [DataType(DataType.EmailAddress)]
        public virtual string email { get; set; }
        [Required]
        public virtual string aaoaccount { get; set; }
        [Required]
        public virtual string aaopass { get; set; }
        [Required]
        public virtual string openid { get; set; }
    }
}