text:
#include "config.h"
#include "PageRuleCollector.h"

#include "CSSDefaultStyleSheets.h"
#include "StyleProperties.h"
#include "StyleRule.h"

namespace WebCore {

static inline bool comparePageRules(const StyleRulePage* r1, const StyleRulePage* r2)
{
    return r1->selector()->specificityForPage() < r2->selector()->specificityForPage();
}

bool PageRuleCollector::isLeftPage(int pageIndex) const
{
    bool isFirstPageLeft = false;
    if (!m_state.rootElementStyle()->isLeftToRightDirection())
        isFirstPageLeft = true;

    return (pageIndex + (isFirstPageLeft ? 1 : 0)) % 2;
}

bool PageRuleCollector::isFirstPage(int pageIndex) const
{
    // FIXME: In case of forced left/right page, page at index 1 (not 0) can be the first page.
    return (!pageIndex);
}

String PageRuleCollector::pageName(int /* pageIndex */) const
{
    // FIXME: Implement page index to page name mapping.
    return emptyString();
}

void PageRuleCollector::matchAllPageRules(int pageIndex)
{
    const bool isLeft = isLeftPage(pageIndex);
    const bool isFirst = isFirstPage(pageIndex);
    const String page = pageName(pageIndex);

    matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle, isLeft, isFirst, page);
    matchPageRules(m_ruleSets.userStyle(), isLeft, isFirst, page);
    // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
    if (m_ruleSets.isAuthorStyleDefined())
        matchPageRules(&m_ruleSets.authorStyle(), isLeft, isFirst, page);
}

void PageRuleCollector::matchPageRules(RuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName)
{
    if (!rules)
        return;

    Vector<StyleRulePage*> matchedPageRules;
    matchPageRulesForList(matchedPageRules, rules->pageRules(), isLeftPage, isFirstPage, pageName);
    if (matchedPageRules.isEmpty())
        return;

    std::stable_sort(matchedPageRules.begin(), matchedPageRules.end(), comparePageRules);

    for (unsigned i = 0; i < matchedPageRules.size(); i++)
        m_result.addMatchedProperties(matchedPageRules[i]->properties());
}

static bool checkPageSelectorComponents(const CSSSelector* selector, bool isLeftPage, bool isFirstPage, const String& pageName)
{
    for (const CSSSelector* component = selector; component; component = component->tagHistory()) {
        if (component->match() == CSSSelector::Tag) {
            const AtomicString& localName = component->tagQName().localName();
            if (localName != starAtom() && localName != pageName)
                return false;
        } else if (component->match() == CSSSelector::PagePseudoClass) {
            CSSSelector::PagePseudoClassType pseudoType = component->pagePseudoClassType();
            if ((pseudoType == CSSSelector::PagePseudoClassLeft && !isLeftPage)
                || (pseudoType == CSSSelector::PagePseudoClassRight && isLeftPage)
                || (pseudoType == CSSSelector::PagePseudoClassFirst && !isFirstPage))
            {
                return false;
            }
        }
    }
    return true;
}

void PageRuleCollector::matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>& rules, bool isLeftPage, bool isFirstPage, const String& pageName)
{
    for (unsigned i = 0; i < rules.size(); ++i) {
        StyleRulePage* rule = rules[i];

        if (!checkPageSelectorComponents(rule->selector(), isLeftPage, isFirstPage, pageName))
            continue;

        // If the rule has no properties to apply, then ignore it.
        const StyleProperties& properties = rule->properties();
        if (properties.isEmpty())
            continue;

        // Add this rule to our list of matched rules.
        matchedRules.append(rule);
    }
}

} // namespace WebCore


text:
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, OnInit, OnDestroy, Inject, ElementRef, AfterViewInit } from '@angular/core'
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
import { Observable } from 'rxjs'

import { Disposer } from '../../lib/class'
import { ReactiveStoreService, KEY } from '../../state'

@Component({
  selector: 'app-slide-viewer',
  template: `
    <iframe
      [src]="safeUrl"
      frameborder="0" [width]="screenWidth" [height]="screenHeight" allowfullscreen="true"
      mozallowfullscreen="true" webkitallowfullscreen="true">
    </iframe>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SlideViewerComponent extends Disposer implements OnInit, OnDestroy, AfterViewInit {
  screenWidth: number
  screenHeight: number
  safeUrl: SafeResourceUrl
  viewerElement: HTMLIFrameElement

  constructor(
    private store: ReactiveStoreService,
    private cd: ChangeDetectorRef,
    private el: ElementRef,
    private sanitizer: DomSanitizer,
  ) {
    super()
  }

  ngOnInit() {
    this.viewerElement = this.el.nativeElement.querySelector('iframe')
    this.initGetState()
  }

  private initGetState(): void {
    this.disposable = this.store.getter()
      .filterByUpdatedKey(KEY.slideViwerConfig) // SlideViewer設定が変更されたとき。
      .subscribe(state => {
        const url = state.slideViwerConfig.url
        let fixedUrl: string = ''
        if (url.includes('docs.google.com')) {
          fixedUrl = url + '/embed?start=false&loop=false&delayms=3000'
        } else {
          fixedUrl = url
        }
        this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(fixedUrl)
        this.cd.markForCheck()
      })

    this.disposable = this.store.getter()
      .filterByUpdatedKey(KEY.windowState) // Window状態が更新されたとき。
      .subscribe(state => {
        this.screenWidth = state.windowState.innerWidth
        this.screenHeight = state.windowState.innerHeight - 50
        this.cd.markForCheck()
      })

    this.disposable = this.store.getter()
      .filterByUpdatedKey(KEY.signalFocusSlideViewer) // FocusSlideViewerのシグナルが発行されたとき。
      .debounceTime(500)
      .subscribe(state => {
        this.focusViewerElement()
      })
  }

  ngAfterViewInit() {
    this.focusViewerElement()
  }

  ngOnDestroy() {
    this.disposeSubscriptions()
  }

  focusViewerElement(): void {
    if (this.viewerElement) {
      this.viewerElement.focus()
    }
  }

}

redpajama_set_name: RedPajamaGithub


text:
#ifndef VIENNASHE_MODELS_MOBILITY_MODEL_HPP
#define VIENNASHE_MODELS_MOBILITY_MODEL_HPP

// std
#include <stdexcept>
#include <utility>

// viennashe
#include "viennashe/forwards.h"
#include "viennashe/physics/constants.hpp"
#include "viennashe/models/mobility_parameters.hpp"
#include "viennashe/models/exception.hpp"

// viennagrid
#include "viennagrid/mesh/mesh.hpp"
#include "viennagrid/algorithm/norm.hpp"
#include "viennagrid/algorithm/centroid.hpp"
#include "viennagrid/mesh/coboundary_iteration.hpp"

/** @file viennashe/models/mobility_model.hpp
    @brief Contains basic mobility models for lattice, impurity, field and surface mobility changes
 */

namespace viennashe
{
  namespace models
  {

    /** @brief This namespace contains models, which are only for the drift diffusion transport model */
    namespace dd
    {

      namespace mobility_detail
      {

        class mobility_lattice_scattering
        {
        public:

          mobility_lattice_scattering(const lattice_scattering & params) : _params(params) { }

          double operator()(double mu, double T) const
          {
            if ( _params.enabled )
            {
              return this->calculateMobilityLatticeScattering(mu, T);
            }
            else
            {
              return mu;
            }
          }

        private:
          lattice_scattering _params;

          double calculateMobilityLatticeScattering(double mu, double T) const
          {
            if ( _params.T_ref == 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.T_ref = 0 and therefore invalid");

            return mu * pow(T / _params.T_ref, -_params.alpha);
          }
        }; // mobility_lattice_scattering

        class mobility_impurity_scattering
        {
        public:

          mobility_impurity_scattering(const impurity_scattering & params) : _params(params) { }

          double operator()(double mu, double total_doping) const
          {
            if ( _params.enabled )
            {
              return this->calculateMobilityIonizedImpurityScattering(mu, total_doping);
            }
            else
            {
              return mu;
            }
          }

        private:
          impurity_scattering _params;

          double calculateMobilityIonizedImpurityScattering(double mu, double total_doping) const
          {
            if ( _params.N_ref == 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.N_ref = 0 and therefore invalid");
            if ( _params.mu_min < 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.mu_min < 0 and therefore invalid");
            if ( total_doping <= 0.0 )
              throw viennashe::models::invalid_parameter_exception("total_doping <= 0 and therefore invalid");

            double N_sum = 1.0 * total_doping;

            // Caughey and Thomas
            double N_adjust = pow(N_sum / _params.N_ref, _params.alpha);
            return _params.mu_min + (mu - _params.mu_min) / (1 + N_adjust);
          }
        }; // mobility_impurity_scattering

        class mobility_surface_scattering
        {
        public:

          mobility_surface_scattering(const surface_scattering & params) : _params(params) { }

          double operator()(double mu, double distance_to_insulator, double E_n) const
          {
            if ( _params.enabled )
            {
              return this->calculateMobilitySurfaceScattering(mu, distance_to_insulator, E_n);
            }
            else
            {
              return mu;
            }
          }

        private:
          surface_scattering _params;

          double calculateMobilitySurfaceScattering(double mu, double distance_to_insulator, double E_n) const
          {
            if ( _params.depth_ref == 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.depth_ref = 0 and therefore invalid");
            if ( _params.E_ref == 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.E_ref = 0 and therefore invalid");
            if ( _params.mu_ref < 0.0 )
              throw viennashe::models::invalid_parameter_exception("params.mu_ref < 0 and therefore invalid");
            if ( distance_to_insulator < 0.0 )
              throw viennashe::models::invalid_parameter_exception("distance_to_next_insulator < 0 and therefore invalid");

            double depth = distance_to_insulator;

            // Selberherr-Formula
            double depth_dependence = 2.0 * exp(-pow(depth / _params.depth_ref, 2)) / (1 + exp(-2.0 * pow(depth / _params.depth_ref, 2)));
            double field_dependence = pow(E_n / _params.E_ref, _params.gamma_ref);
            return ( _params.mu_ref + (mu - _params.mu_ref) * (1.0 - depth_dependence)) / (1.0 + depth_dependence * field_dependence);
          }

        }; // mobility_surface_scattering

        class mobility_field_dependence
        {
        public:

          mobility_field_dependence(const field_dependence & params) : _params(params) { }

          double operator()(double mu, double T, double E_n) const
          {
            if ( _params.enabled )
            {
              return this->calculateFieldDependentMobility(mu, T, E_n);
            }
            else
            {
              return mu;
            }
          }

        private:
          field_dependence _params;

          double get_saturation_velocity(double T) const
          {
            return _params.vsat300 / (1.0 + _params.vsat300C * (T / 300.0 - 1.0));
          }

          double calculateFieldDependentMobility(double mu, double T, double E_n) const
          {
            double F = E_n;
            double v_sat = this->get_saturation_velocity(T);
            double beta = _params.beta;

            if ( v_sat <= 0.0 )
              throw viennashe::models::invalid_parameter_exception("v_sat <= 0 and therefore invalid");
            if ( T <= 0.0 )
              throw viennashe::models::invalid_parameter_exception("T <= 0 and therefore invalid");

            double h = pow(pow(2.0 * F * mu / v_sat, beta) + 1.0, beta) + 1.0;

            return 2.0 * mu / h;
          }

        }; // mobility_field_dependence

      } // namespace mobility_detail

      /** @brief The main mobility model. Contains submodels for lattice, impurity, field and
       *         surface scattering related mobility changes. For drift diffusion only! */
      template < typename DeviceType >
      class mobility
      {
      private:
          typedef typename DeviceType::mesh_type    MeshType;
          typedef typename viennagrid::result_of::point<MeshType>::type    PointType;
          typedef typename viennagrid::result_of::facet<MeshType>::type    FacetType;
          typedef typename viennagrid::result_of::cell<MeshType>::type     CellType;

      public:
        typedef double value_type;

        mobility(const DeviceType & device, const mobility_paramters & params) : _params(params), _device(device) { }

        mobility(const mobility & mob) : _params(mob._params), _device(mob._device) { }

        /**
         * @brief Returns the mobility along a facet
         * @param facet The facet
         * @param potential An accessor (for cells) to the electrostatic potential
         * @return A mobility in SI units
         */
        template < typename PotentialAccessor >
        value_type operator()(const FacetType & facet, PotentialAccessor const & potential) const
        {
          typedef typename viennagrid::result_of::const_coboundary_range<MeshType, FacetType, CellType>::type     CellOnFacetContainer;
          typedef typename viennagrid::result_of::iterator<CellOnFacetContainer>::type                            CellOnFacetIterator;

          CellOnFacetContainer cells_on_facet(_device.mesh(), viennagrid::handle(_device.mesh(), facet));

          CellOnFacetIterator cofit = cells_on_facet.begin();
          CellType const & c1 = *cofit;
          ++cofit;
          CellType const & c2 = *cofit;

          return this->operator ()(c1, c2, potential);
        }

        /**
         * @brief Returns the mobility from a vertex to another vertex. Usage of the other, edge related, operator() is recommended.
         * @param c1 The source vertex
         * @param c2 The sink vertex
         * @param potential An accessor (for vertices) to the electrostatic potential
         * @return A mobility in SI units
         */
        template < typename PotentialAccessor >
        value_type operator()(const CellType & c1, const CellType & c2, PotentialAccessor const & potential) const
        {
          mobility_detail::mobility_lattice_scattering  lattice(_params.lattice);
          mobility_detail::mobility_impurity_scattering impurity(_params.impurity);
          //mobility_detail::mobility_surface_scattering  surface(_params.surface);
          mobility_detail::mobility_field_dependence    field(_params.field);

          const double TL = _device.get_lattice_temperature(c1);
          const double total_doping_on_cell = (_device.get_doping_n(c1) + _device.get_doping_p(c1));
          const double edge_len  = viennagrid::norm_2( viennagrid::centroid(c2) - viennagrid::centroid(c1) );
          const double    Emag   = ( -(potential(c2) - potential(c1)) / edge_len);

          double mu = _params.mu0;
          if (mu <= 0.0) throw viennashe::models::invalid_parameter_exception("The constant mobility parameter 'mu0' is smaller or equal 0!");

          mu = lattice (mu, TL);
          mu = impurity(mu, total_doping_on_cell );

          /*if ( (_params.surface.enabled ) && _device.has_distance_to_next_insulator(vt))
          {
            const PointType n      = ( viennagrid::centroid(c2) - viennagrid::centroid(c1) ) / edge_len;
            const PointType E_edge = Emag * n;
            const double distance         = _device.distance_to_next_insulator(vt);
            const PointType dist_vector_n = _device.vector_to_next_insulator(vt) / distance; // normalized distance vector

            const double En = viennagrid::inner_prod(E_edge, dist_vector_n); // projection of E on distance to insulator vector

            mu = surface (mu, distance, En);
          }*/

          mu = field (mu, TL, Emag);

          return mu;
        }

      private:
        const mobility_paramters  _params;
        const DeviceType & _device;

      }; // mobility

    } //namespace dd

  } // namespace models

} //namespace viennashe

#endif


text:
package ru.stqa.selenium.legrc.runner.steps;

import ru.stqa.selenium.legrc.runner.StepOutcome;

public class BooleanOutcome implements StepOutcome {

  private boolean outcome;

  public BooleanOutcome(boolean outcome) {
    this.outcome = outcome;
  }

  @Override
  public boolean matches(Object expected) {
    if (expected instanceof Boolean) {
      return outcome == (Boolean) expected;
    } else if (expected instanceof String && "".equals(expected)) {
      return outcome;
    } else {
      return false;
    }
  }

  @Override
  public String toString() {
    return "" + outcome;
  }
}


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Bit6-SDK-for-iOS Reference</title>
		<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.2 (build 963)" />

Bit6-SDK-for-iOS

				Bit6

Bit6-SDK-for-iOS Reference

					Next

Bit6-SDK-for-iOS Reference

The Bit6 platform helps developers quickly and easily integrate a full communications stack into their apps.

Class References

Bit6

Bit6Address

Bit6AlertView

Bit6AudioPlayerController

Bit6AudioRecorderController

Bit6CallController

Bit6CallViewController

Bit6Conversation

Bit6CurrentLocationController

Bit6FileDownloader

Bit6Group

Bit6GroupMember

Bit6Message

Bit6OutgoingMessage

Bit6OutgoingTransfer

Bit6PushNotificationCenter

Bit6Session

Bit6Transfer

Bit6Utils

Bit6VideoFeedView

Protocol References

Bit6AudioRecorderControllerDelegate

Bit6CallControllerDelegate

Bit6CurrentLocationControllerDelegate

Constant References

Bit6CallCapability

Bit6CallState

Bit6CallStreams

Bit6DataChannelState

Bit6Error

Bit6LogOptions

Bit6MessageAttachmentStatus

Bit6MessageCallChannel

Bit6MessageCallStatus

Bit6MessageFileType

Bit6MessageStatus

Bit6MessageType

Bit6TransferState

Bit6TransferType

Bit6VideoSource

Bit6WebSocketReadyState

FreeSWITCHHangupCause

					Next

© 2016 Bit6. All rights reserved. (Last updated: 2016-10-10)

						Generated by appledoc 2.2 (build 963).


text:
using Midi.Events;
using System;
using System.Collections.Generic;

namespace RoaringFangs.Formats.MIDI
{
    public class MIDIEventFilter : MIDIHelperBase
    {
        private List<Type> _Include;
        private List<Type> _Exclude;

        /// <summary>
        /// Preset filter for Note on/off events
        /// </summary>
        public static MIDIEventFilter NotesOnOffFilter
        {
            get { return _NotesOnOffFilter; }
        }

        private static readonly MIDIEventFilter _NotesOnOffFilter = new MIDIEventFilter();

        /// <summary>
        /// Preset filter for track name events
        /// </summary>
        public static MIDIEventFilter TrackNameFilter
        {
            get { return _TrackNameFilter; }
        }

        private static readonly MIDIEventFilter _TrackNameFilter = new MIDIEventFilter();

        static MIDIEventFilter()
        {
            NotesOnOffFilter.pInclude(
                typeof(Midi.Events.ChannelEvents.NoteOnEvent),
                typeof(Midi.Events.ChannelEvents.NoteOffEvent));
            //typeof(Midi.Events.MetaEvents.EndOfTrackEvent)); // todo should probably have separate meta event, or rename the filter
            TrackNameFilter.pInclude(
                typeof(Midi.Events.MetaEvents.SequenceOrTrackNameEvent));
        }

        public MIDIEventFilter()
        {
            _Include = new List<Type>();
            _Exclude = new List<Type>();
        }

        protected override void pInclude(params Type[] types)
        {
            _Include.AddRange(types);
        }

        protected override void pExclude(params Type[] types)
        {
            _Include.AddRange(types);
        }

        public bool Accepts(MidiEvent m_e)
        {
            if (_Include.Count == 0)
            {
                if (_Exclude.Count == 0)
                    return true;
                else
                    return
                        !_Exclude.Contains(m_e.GetType());
            }
            else
            {
                if (_Exclude.Count == 0)
                    return
                        _Include.Contains(m_e.GetType());
                else
                    return
                        _Include.Contains(m_e.GetType()) &&
                        !_Exclude.Contains(m_e.GetType());
            }
        }
    }
}


text:
require_relative '../../spec_helper'

describe "Range#size" do
  it "returns the number of elements in the range" do
    (1..16).size.should == 16
    (1...16).size.should == 15

    (1.0..16.0).size.should == 16
    (1.0...16.0).size.should == 15
    (1.0..15.9).size.should == 15
    (1.1..16.0).size.should == 15
    (1.1..15.9).size.should == 15
  end

  it "returns 0 if last is less than first" do
    (16..0).size.should == 0
    (16.0..0.0).size.should == 0
    (Float::INFINITY..0).size.should == 0
  end

  it 'returns Float::INFINITY for increasing, infinite ranges' do
    (0..Float::INFINITY).size.should == Float::INFINITY
    (-Float::INFINITY..0).size.should == Float::INFINITY
    (-Float::INFINITY..Float::INFINITY).size.should == Float::INFINITY
  end

  it 'returns Float::INFINITY for endless ranges if the start is numeric' do
    eval("(1..)").size.should == Float::INFINITY
    eval("(0.5...)").size.should == Float::INFINITY
  end

  it 'returns nil for endless ranges if the start is not numeric' do
    eval("('z'..)").size.should == nil
    eval("([]...)").size.should == nil
  end

  ruby_version_is "2.7" do
    it 'returns Float::INFINITY for all beginless ranges' do
      eval("(..1)").size.should == Float::INFINITY
      eval("(...0.5)").size.should == Float::INFINITY
      eval("(..nil)").size.should == Float::INFINITY
      eval("(...'o')").size.should == Float::INFINITY
    end
  end

  it "returns nil if first and last are not Numeric" do
    (:a..:z).size.should be_nil
    ('a'..'z').size.should be_nil
  end
end


text:
<?php

/**
 * Backend Catalog Price Rules controller
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
namespace Magento\CatalogRule\Controller\Adminhtml\Promo;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\Stdlib\DateTime\Filter\Date;

abstract class Catalog extends Action
{
    /**
     * Authorization level of a basic admin session
     *
     * @see _isAllowed()
     */
    const ADMIN_RESOURCE = 'Magento_CatalogRule::promo_catalog';

    /**
     * Dirty rules notice message
     *
     *
     * @var string
     */
    protected $_dirtyRulesNoticeMessage;

    /**
     * Core registry
     *
     * @var Registry
     */
    protected $_coreRegistry = null;

    /**
     * Date filter instance
     *
     * @var \Magento\Framework\Stdlib\DateTime\Filter\Date
     */
    protected $_dateFilter;

    /**
     * Constructor
     *
     * @param Context $context
     * @param Registry $coreRegistry
     * @param Date $dateFilter
     */
    public function __construct(Context $context, Registry $coreRegistry, Date $dateFilter)
    {
        parent::__construct($context);
        $this->_coreRegistry = $coreRegistry;
        $this->_dateFilter = $dateFilter;
    }

    /**
     * Init action
     *
     * @return $this
     */
    protected function _initAction()
    {
        $this->_view->loadLayout();
        $this->_setActiveMenu(
            'Magento_CatalogRule::promo_catalog'
        )->_addBreadcrumb(
            __('Promotions'),
            __('Promotions')
        );
        return $this;
    }

    /**
     * Set dirty rules notice message
     *
     * @param string $dirtyRulesNoticeMessage
     * @return void
     * @codeCoverageIgnore
     */
    public function setDirtyRulesNoticeMessage($dirtyRulesNoticeMessage)
    {
        $this->_dirtyRulesNoticeMessage = $dirtyRulesNoticeMessage;
    }

    /**
     * Get dirty rules notice message
     *
     * @return string
     */
    public function getDirtyRulesNoticeMessage()
    {
        $defaultMessage = __(
            'We found updated rules that are not applied. Please click "Apply Rules" to update your catalog.'
        );
        return $this->_dirtyRulesNoticeMessage ? $this->_dirtyRulesNoticeMessage : $defaultMessage;
    }
}


text:
@interface ZZQFavouriteViewController ()<UIScrollViewDelegate, UITableViewDelegate, UITableViewDataSource>

//商家的cell
@property(nonatomic, strong)ZZQFavouriteTableViewCell * menchantCell;
//菜品的cell
@property(nonatomic, strong)ZZQFavouriteMenuTableViewCell * menuCell;
//商家收藏的数据数组
@property(nonatomic, strong)ZZQMerchant * favMenchant;
@property(nonatomic, strong)NSMutableArray<ZZQMerchant *> * menchantArray;
//菜品收藏的数据数组
@property(nonatomic, strong)ZZQMenu * favMenu;
@property(nonatomic, strong)NSMutableArray<ZZQMenu *> * menuArray;
//商家收藏tableview
@property(nonatomic, strong)UITableView * menchantTableView;
//菜品收藏的tableview
@property(nonatomic, strong)UITableView * menuTableView;
//ScrollView
@property(nonatomic, strong)UIScrollView * scrollView;
@property(nonatomic, strong)UIButton * storeBtn;
@property(nonatomic, strong)UIButton * menuBtn;
@property(nonatomic, strong)UILabel * line;

@end

@implementation ZZQFavouriteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"收藏";
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self initForView];

    [self initForStoreData];
    [self initForStoreFavView];

    [self initForMenuData];
    [self initMenuFavView];
}

#pragma mark
#pragma mark ============= 设置scrollView和tableView
- (void)initForView{
    //设置两个button和scrollview
    UIFont * font = [UIFont fontWithName:FANGZHENG_FONT size:16];
    _storeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _storeBtn.frame = CGRectMake(0, 64, SCREEN_WIDTH/2, BTN_H);
    _storeBtn.backgroundColor = [UIColor whiteColor];
    [_storeBtn setTitle:@"厨房" forState:UIControlStateNormal];
    [_storeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_storeBtn setTitleColor:[UIColor colorWithRed:0.87 green:0.00 blue:0.09 alpha:1.00] forState:UIControlStateSelected];
    _storeBtn.titleLabel.font = font;
    _storeBtn.selected = YES;
    [_storeBtn addTarget:self action:@selector(storeAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_storeBtn];

    _menuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _menuBtn.frame = CGRectMake(SCREEN_WIDTH/2, 64, SCREEN_WIDTH/2, BTN_H);
    _menuBtn.backgroundColor = [UIColor whiteColor];
    [_menuBtn setTitle:@"菜品" forState:UIControlStateNormal];
    [_menuBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_menuBtn setTitleColor:[UIColor colorWithRed:0.87 green:0.00 blue:0.09 alpha:1.00] forState:UIControlStateSelected];
    _menuBtn.titleLabel.font = font;
    [_menuBtn addTarget:self action:@selector(menuAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_menuBtn];

    _line = [[UILabel alloc] initWithFrame:CGRectMake(0, 64+BTN_H-2, SCREEN_WIDTH/2, 2)];
    _line.backgroundColor = [UIColor colorWithRed:0.87 green:0.00 blue:0.09 alpha:1.00];
    [self.view addSubview:_line];

    _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_line.frame), SCREEN_WIDTH, SCREEN_HEIGHT-64-BTN_H)];
    _scrollView.showsVerticalScrollIndicator = NO;
    _scrollView.showsHorizontalScrollIndicator = NO;
    _scrollView.bounces = NO;
    _scrollView.pagingEnabled = YES;
    [self.view addSubview:_scrollView];
    _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*2, _scrollView.height);
    _scrollView.delegate = self;
}

- (void)storeAction:(UIButton *)btn{
    [self initForStoreData];
    btn.selected = YES;
    _menuBtn.selected = NO;
    __weak typeof(self)myself = self;
    [UIView animateWithDuration:0.5 animations:^{
        CGRect rect = myself.line.frame;
        rect.origin.x = 0;
        myself.line.frame = rect;
        myself.scrollView.contentOffset = CGPointMake(0, 0);
    }];
}
- (void)menuAction:(UIButton *)btn{
    [self initForMenuData];
    btn.selected = YES;
    _storeBtn.selected = NO;
    __weak typeof(self)myself = self;
    [UIView animateWithDuration:0.5 animations:^{
        CGRect rect = myself.line.frame;
        rect.origin.x = SCREEN_WIDTH/2;
        myself.line.frame = rect;
        myself.scrollView.contentOffset = CGPointMake(SCREEN_WIDTH, 0);
    }];
}

//收藏菜品的tableview
- (void)initMenuFavView{
    _menuTableView = [[UITableView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH, _scrollView.height) style:UITableViewStyleGrouped];
    _menuTableView.showsHorizontalScrollIndicator = NO;
    _menuTableView.showsVerticalScrollIndicator = NO;
    _menuTableView.bounces = NO;
    _menuTableView.delegate = self;
    _menuTableView.dataSource = self;
    _menuTableView.tag = 1001;
    [_scrollView addSubview:_menuTableView];
//    _menuTableView.backgroundColor = [UIColor redColor];
}

//收藏店铺的tableview
- (void)initForStoreFavView{
    _menchantTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, _scrollView.height) style:UITableViewStyleGrouped];
    _menchantTableView.showsHorizontalScrollIndicator = NO;
    _menchantTableView.showsVerticalScrollIndicator = NO;
    _menchantTableView.bounces = NO;
    _menchantTableView.delegate = self;
    _menchantTableView.dataSource = self;
    _menchantTableView.tag = 1000;
    [_scrollView addSubview:_menchantTableView];
//    _menchantTableView.backgroundColor = [UIColor blueColor];
}

#pragma mark
#pragma mark ============= 请求数据
- (void)initForStoreData{
    __weak typeof(self)myself = self;
    _menchantArray = [[NSMutableArray alloc] init];
    AVUser * user = [AVUser currentUser];
    if (user) {
        AVQuery * stroeQuery = [AVQuery queryWithClassName:@"FavouriteMechants"];
        [stroeQuery whereKey:@"userID" equalTo:[user objectId]];
        [stroeQuery findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
            if (objects.count != 0) {
                NSInteger numSum = objects.count;
                for (AVObject * obj in objects) {
                    NSString * storeName = [obj objectForKey:@"favStoreName"];
                    AVQuery * query = [AVQuery queryWithClassName:@"Merchants"];
                    [query whereKey:@"name" equalTo:storeName];
                    [query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
                        if (objects.count != 0) {
                            myself.favMenchant = [[ZZQMerchant alloc] init];
                            myself.favMenchant = [myself.favMenchant setMerchantDetail:objects[0]];
                            [myself.menchantArray addObject:myself.favMenchant];
                            if (myself.menchantArray.count == numSum) {
                                [myself.menchantTableView reloadData];
                            }
                        }
                    }];
                }
            }
        }];
    }
}

- (void)initForMenuData{
    __weak typeof(self)myself = self;
    _menuArray = [[NSMutableArray alloc] init];
    AVUser * user = [AVUser currentUser];
    if (user) {
        AVQuery * menuQuery = [AVQuery queryWithClassName:@"FavoutiteMenus"];
        [menuQuery whereKey:@"userId" equalTo:[user objectId]];
        [menuQuery findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
            if (objects.count != 0) {
                NSInteger numSum = objects.count;
                for (AVObject * obj in objects) {
                    NSString * menuId = [obj objectForKey:@"menuId"];
                    AVQuery * query = [AVQuery queryWithClassName:@"Menus"];
                    [query whereKey:@"objectId" equalTo:menuId];
                    [query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
                        if (objects.count != 0) {
                            myself.favMenu = [[ZZQMenu alloc] init];
                            myself.favMenu = [myself.favMenu getMenuWithObject:objects[0]];
                            [myself.menuArray addObject:myself.favMenu];
                            if (myself.menuArray.count == numSum) {
                                [myself.menuTableView reloadData];
                            }
                        }
                    }];
                }
            }
        }];
    }
}

#pragma mark
#pragma mark ============== 代理
//tableView代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (tableView.tag == 1000) {
        //点店铺收藏
        return _menchantArray.count;
    }else{
        return _menuArray.count;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 120;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (tableView.tag == 1000) {
        _menchantCell = [tableView dequeueReusableCellWithIdentifier:MENCHANT_CELL];
        if (_menchantCell == nil) {
            _menchantCell = [[ZZQFavouriteTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:MENCHANT_CELL];
        }
        _menchantCell.selectionStyle = UITableViewCellSelectionStyleNone;
        [_menchantCell setCellForModle:_menchantArray[indexPath.row]];
        return _menchantCell;
    }else{
        _menuCell = [tableView dequeueReusableCellWithIdentifier:MENU_CELL];
        if (_menuCell == nil) {
            _menuCell = [[ZZQFavouriteMenuTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
                                                             reuseIdentifier:MENU_CELL];
        }
        _menuCell.selectionStyle = UITableViewCellSelectionStyleNone;
        [_menuCell setCellForModle:_menuArray[indexPath.row]];
        return _menuCell;
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView clearSelectedRowsAnimated:YES];
}

//scrollView代理
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    __weak typeof(self)myself = self;
    if (_scrollView.contentOffset.x / SCREEN_WIDTH == 0) {
        [UIView animateWithDuration:0.5 animations:^{
            CGRect rect = myself.line.frame;
            rect.origin.x = 0;
            myself.line.frame = rect;
            myself.menuBtn.selected = NO;
            myself.storeBtn.selected = YES;
//            [myself initForStoreData];
        }];
    }else if(_scrollView.contentOffset.x / SCREEN_WIDTH == 1){
        [UIView animateWithDuration:0.5 animations:^{
            CGRect rect = myself.line.frame;
            rect.origin.x = SCREEN_WIDTH/2;
            myself.line.frame = rect;
            myself.menuBtn.selected = YES;
            myself.storeBtn.selected = NO;
//            [myself initForMenuData];
        }];
    }
}

#pragma mark
#pragma mark ============= 设置其它内容
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
@extends('layouts.app')

@section('content')

 Genetic Code Service

				A service for analyzing genetic code and use it for customized treatments

 What is Genetic Code?

				The genetic code is the set of rules by which information encoded in
				genetic material (DNA or RNA sequences) is translated into proteins
				(amino acid sequences) by living cells.

				Science Daily

@endsection


text:
<!DOCTYPE html>

    <title>debugging node</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="icon"       href="../../images/js.png">
    <link rel="stylesheet" href="remark-custom.css">

    <textarea id="source" cols="100" rows="40" style="display: none;">

# debugging node

### tips and tools for debugging your node programs

Patrick Mueller
-
IBMer
-
[`@pmuellr`](https://twitter.com/pmuellr)
-
[`muellerware.org`](http://muellerware.org)

.smaller[.smaller[
<http://pmuellr.github.io/slides/2014/04-debugging-node>

<http://pmuellr.github.io/slides/2014/04-debugging-node/snippets.html> (code snippets)
]]

---

layout: true

{{content}}

---

## Patrick Mueller

developer advocate at IBM for
[node.js](http://nodejs.org)
and
[BlueMix](https://bluemix.net)

Raleigh, NC

more of my slides: <http://pmuellr.github.io/slides>

---

## what is BlueMix?

Platform-as-a-Service product.  Runs node apps! Runs any apps!

Based on the [Cloud Foundry](http://cloudfoundry.org) open source project

For more info: <https://bluemix.net>

For more info on node on BlueMix:

> <http://node-stuff.mybluemix.net>

---

class: center, middle

## The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.

-- Brian Kernighan, "Unix for Beginners" (1979)

---

class: center, middle

# logging

---

## `alert()`

```js
//!snippet: alert.js
```

---

## `console.log()`

```js
//!snippet: console_log.js
```

---

## `console.time()`

```js
//!snippet: console_time.js
```

---

## `console.trace()`

```js
//!snippet: console_trace.js
```

---

## npm `debug`

```js
//!snippet: debug.js
```

> DEBUG=* node debug.js
thing-B churning +0ms
thing-A thrashing +0ms
thing-B churning +339ms
thing-A thrashing +501ms
thing-B churning +333ms
thing-B churning +334ms
thing-A thrashing +502ms
...

---

## npm `winston`

```js
//!snippet: winston.js
```

---

class: center, middle

# error handling

---

## builtin `process` events

```js
//!snippet: process-events.js
```

---

### `Error.prepareStackTrace()` - before

```js
//!snippet: v8_prepareStackTrace-before.js
```

---

### `Error.prepareStackTrace()` - after

```js
//!snippet: v8_prepareStackTrace-after.js
```

---

## `Error.prepareStackTrace()`

see also:

* <https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi>

* <https://mail.mozilla.org/pipermail/es-discuss/2014-March/036764.html>

---

### npm `long-stack-traces` - before

```js
//!snippet: long-stack-traces-before.js
```

---

### npm `long-stack-traces` - after

```js
//!snippet: long-stack-traces-after.js
```

---

### npm `Q.longStackSupport` - before

```js
//!snippet: q-longStack-before.js
```

---

### npm `Q.longStackSupport` - after

```js
//!snippet: q-longStack-after.js
```

---

class: center, middle

# early warning systems

---

class: center, middle

## If debugging is the process of removing bugs, then programming must be the process of putting them in.

### -- Edsger W. Dijkstra

---

## testing

```js
//!snippet: testing.js
```

---

## testing

* mocha - <http://visionmedia.github.io/mocha/>

* jasmine - <http://jasmine.github.io>

---

## linting

> jshint snippets/*.js
snippets/alert.js: line 1, col 17, Missing semicolon.

snippets/console_log.js: line 1, col 19, Missing semicolon.
snippets/console_log.js: line 4, col 26, Missing semicolon.
snippets/console_log.js: line 7, col 25, Missing semicolon.
snippets/console_log.js: line 10, col 35, Missing semicolon.
snippets/console_log.js: line 13, col 21, Missing semicolon.

snippets/console_time.js: line 1, col 20, Missing semicolon.
snippets/console_time.js: line 2, col 10, Missing semicolon.
snippets/console_time.js: line 3, col 23, Missing semicolon.
snippets/console_time.js: line 8, col 21, Missing semicolon.
snippets/console_time.js: line 13, col 34, Missing semicolon.

snippets/console_trace.js: line 1, col 19, Missing semicolon.
snippets/console_trace.js: line 2, col 19, Missing semicolon.

... repeats ad nauseum ...

---

## linting

* jshint - <http://jshint.com/>

* jslint - <http://jslint.com/>

---

class: center, middle

# etc

---

## builtin module `repl`

```js
//!snippet: repl.js
```

---

## builtin debugger

```js
//!snippet: debugger.js
```

---

## builtin debugger

> node debug debugger.js
< debugger listening on port 5858
connecting... ok
...
debug> watch("x")
debug> cont
break in debugger.js:2
Watchers:
  0: x = undefined

  1 function a() {
  2 	debugger
  3 	var x = 1
  4 	var y = 2
debug> next

...
debug> next
break in debugger.js:4
Watchers:
  0: x = 1

  2 	debugger
  3 	var x = 1
  4 	var y = 2
  5 	console.log(x + " + " ...
  6 }
debug> cont
< 1 + 2 = 3
program terminated
debug>

---

## npm `hooker`

```js
//!snippet: hooker.js
```

---

## npm `hooker`

prints:
```
-> Math.max: [5,6,7]
<- Math.max: 7
-> Math.sqrt: [2]
<- Math.sqrt: 1.4142135623730951
```

also provides

* filtering arguments
* overriding results
* https://github.com/cowboy/javascript-hooker

---

## node 0.12 module `tracing`

```js
//!snippet: node-12-tracing.js
```

---

## node 0.12 module `tracing`

```js
// prints:
//
// before: [object Timer]
// before: [object Object]
// after:  [object Object]
// after:  [object Timer]
// before: [object Timer]
// before: [object Object]
// after:  [object Object]
// after:  [object Timer]
...
```

the bad: spartan!

the good: spartan! lots of low hanging fruit to pick!

---

## node 0.12 module `tracing`

* <http://nodejs.org/dist/v0.11.13/docs/api/tracing.html>

* allows userdata to be associated with a handler

* has event emitter `v8` which emits GC information

---

class: center, middle

# tools

---

## node-inspector

* reuses the user interface from Chrome Dev Tools
* set breakpoints
* watch expressions
* <https://github.com/node-inspector/node-inspector>

```
sudo npm -g install node-inspector
...
node-debug program.js
```

just for fun, try
```
node-debug `which node-debug`
```

---

---

## IDEs

* Eclipse Orion - <https://wiki.eclipse.org/Orion/Node/Getting_started>

* Eclipse - <https://github.com/joyent/node/wiki/using-eclipse-as-node-applications-debugger>

* WebStorm - <http://www.jetbrains.com/webstorm/>

* Cloud9 IDE - <https://c9.io/>

---

## newrelic

* framework specific timing for:
  * express, connect, hapi, restify
  * mongodb, redis, mysql, memcached
  * add your own: <https://docs.newrelic.com/docs/nodejs/nodejs-agent-api>

* unhandled exceptions

* works locally and on a server

---

## newrelic

* get account key from newrelic
* `npm install newrelic`
* `cp node_modules/newrelic/newrelic.js .`
* `edit newrelic.js`, add account key
* add `require('newrelic')` to start of your app
* start app
* watch monitoring dashboard at newrelic

more info: <https://docs.newrelic.com/docs/nodejs/>

movie: <https://www.youtube.com/watch?v=EA5yVDVr3K0>

---

---

## nodprof

```
nodprof --serve --port 8081&
open http://localhost:8081
...
nodprof `which npm` info grunt
```

sample: http://muellerware.org/nodprof-static/

for more info:

* <https://github.com/pmuellr/nodprof>
* <https://code.google.com/p/v8/source/browse/trunk/include/v8-profiler.h>
* other profilers

---

---

class: center, middle

# `fin`

    </textarea>


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<form id="target" class="form-horizontal" method="post" action="<?php echo site_url("collect/editor_form");?>">
    <input type="hidden" name="cid" value="<?php echo $collectinfo['id'];?>">
    <fieldset>

            <legend style="color:red;margin-left: 120px;padding-bottom: 10px;">
                <?php echo validation_errors(); ?>

            </legend>

            采集编号

                <input type="text" placeholder="采集编号" class="input-xlarge" name="collect_code" value="<?php echo $collectinfo['collect_code'];?>">

请输入采集编号

            采集标题

                <input type="text" placeholder="采集标题" class="input-xlarge" name="collect_title" value="<?php echo $collectinfo['collect_title'];?>">

请输入采集标题

            采集方法

                <input type="text" placeholder="采集方法" class="input-xlarge" name="collect_method" value="<?php echo $collectinfo['collect_method'];?>">

请输入采集方法

            采集说明

                <textarea class="form-control" name="collect_content" rows="3" style="width: 400px;height: 350px"><?php echo $collectinfo['collect_content'];?>
                </textarea>

请输入采集说明

            保存

                <button class="btn btn-success">提交</button>

    </fieldset>
</form>


text:
<?php

namespace Faker\Tests;

use Faker\Tests\Base\AbstractProject,
    Faker\Components\Config\DSNParser;

class DSNParserTest  extends AbstractProject
{

    public function testParseODBC()
    {
        $parser = new DSNParser();
        $dsn    = 'odbc(access)://admin@/datasourcename';

        $config = $parser->parse($dsn);

        $this->assertEquals('odbc',$config['phptype']);
        $this->assertEquals('access',$config['dbsyntax']);
        $this->assertEquals('admin',$config['username']);
        $this->assertFalse($config['password']);
        $this->assertEquals('datasourcename',$config['database']);
        $this->assertEquals('tcp',$config['protocol']);

    }

    public function testMysqlDSN()
    {
        $parser = new DSNParser();
        $dsn    = 'mysql://user@unix(/path/to/socket)/pear';
        $config = $parser->parse($dsn);

        $this->assertEquals('mysql',$config['phptype']);
        $this->assertEquals('mysql',$config['dbsyntax']);
        $this->assertEquals('user',$config['username']);
        $this->assertFalse($config['password']);
        $this->assertEquals('pear',$config['database']);
        $this->assertEquals('unix',$config['protocol']);
        $this->assertEquals('/path/to/socket',$config['socket']);

    }

    public function testMysqlSqlite()
    {
        $parser = new DSNParser();
        $dsn    = 'sqlite:////full/unix/path/to/file.db?mode=0666';
        $config = $parser->parse($dsn);

        $this->assertEquals('sqlite',$config['phptype']);
        $this->assertEquals('sqlite',$config['dbsyntax']);
        $this->assertFalse($config['username']);
        $this->assertFalse($config['password']);
        $this->assertEquals('/full/unix/path/to/file.db',$config['database']);
        $this->assertEquals('tcp',$config['protocol']);
        $this->assertFalse($config['socket']);

        #extras
        $this->assertEquals('0666',$config['mode']);
    }

    public function testMysqlPgsql()
    {
        $parser = new DSNParser();
        $dsn    = 'pgsql://user:pass@tcp(localhost:5555)/pear';
        $config = $parser->parse($dsn);

        $this->assertEquals('pgsql',$config['phptype']);
        $this->assertEquals('pgsql',$config['dbsyntax']);
        $this->assertEquals('user',$config['username']);
        $this->assertEquals('pass',$config['password']);
        $this->assertEquals('pear',$config['database']);
        $this->assertEquals('tcp',$config['protocol']);
        $this->assertFalse($config['socket']);
        $this->assertEquals('5555',$config['port']);
        $this->assertEquals('localhost',$config['hostspec']);
    }

}
/* End of File */


text:
require_relative '../../errors/http_forbidden_exception'

module Saklient
  module Cloud
    module Errors

      # 要求された操作は許可されていません. このゾーンではこの操作は禁止されています. 他のゾーンでお試しください.
      class DisabledInSandboxException < Saklient::Errors::HttpForbiddenException

        # @param [Fixnum] status
        # @param [String] code
        # @param [String] message
        def initialize(status, code = nil, message = '')
          super(status, code, (message).nil? || message == '' ? '要求された操作は許可されていません。このゾーンではこの操作は禁止されています。他のゾーンでお試しください。' : message)
        end

      end

    end
  end
end


text:
from django.test import TestCase
from django.test import Client

class HomeUrlConfigTests(TestCase):

    def test_get_to_empty_will_return_a_permanent_redirect(self):
        # Setup
        c = Client()

        # Execute
        response = c.get('/', {})

        # Verify
        self.assertEquals(response.status_code, 301)

    def test_get_to_home_will_return_a_view(self):
        # Setup
        c = Client()

        # Execute
        response = c.get('/home/', {})

        # Verify
        self.assertEquals(response.status_code, 200)


text: <!-- 原始文件:addons/modules/shopping/template/mobile/contactus.html -->


text:
using System.Web;
using Autofac;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler;
using Microsoft.Owin.Security.DataHandler.Serializer;
using Microsoft.Owin.Security.DataProtection;
using NLayer.BLL.Services.Implementation;
using NLayer.DAL;
using NLayer.DAL.Entities;
using Owin;

namespace NLayer.PL.IoC.Autofac.Modules
{
    /// <summary>
    /// Adds components in the container.
    /// </summary>
    public class BusinessLogicModule : Module
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BusinessLogicModule" /> class.
        /// </summary>
        /// <param name="appBuilder">The application builder.</param>
        public BusinessLogicModule(IAppBuilder appBuilder)
        {
            AppBuilder = appBuilder;
        }

        /// <summary>
        /// The application builder.
        /// </summary>
        public IAppBuilder AppBuilder { get; private set; }

        #region Overrides of Module

        /// <summary>Override to add registrations to the container.</summary>
        /// <remarks>
        /// Note that the ContainerBuilder parameter is unique to this module.
        /// </remarks>
        /// <param name="builder">The builder through which components can be
        /// registered.</param>
        protected override void Load(ContainerBuilder builder)
        {
            builder.Register(c => new UserStore<User>(c.Resolve<AppDbContext>()))
                .AsImplementedInterfaces()
                .InstancePerLifetimeScope();

            builder.RegisterType<ApplicationUserStore>()
                .As<IUserStore<User>>()
                .InstancePerLifetimeScope();

            builder.RegisterType<ApplicationUserManager>()
                .AsSelf()
                .InstancePerLifetimeScope();

            builder.RegisterType<ApplicationSignInManager>()
                .AsSelf()
                .InstancePerLifetimeScope();

            builder.RegisterType<RoleStore<IdentityRole>>()
                .As<IRoleStore<IdentityRole, string>>();

            builder.Register<IAuthenticationManager>(c => HttpContext.Current.GetOwinContext().Authentication)
                .InstancePerLifetimeScope();

            builder.Register<IDataProtectionProvider>(c => AppBuilder.GetDataProtectionProvider())
                .InstancePerLifetimeScope();

            builder.RegisterType<TicketDataFormat>()
                .As<ISecureDataFormat<AuthenticationTicket>>();

            builder.RegisterType<TicketSerializer>()
                .As<IDataSerializer<AuthenticationTicket>>();

            builder.RegisterAssemblyTypes(typeof(ExternalDataService).Assembly)
                .Where(t => t.Name.EndsWith("Service"))
                .AsImplementedInterfaces()
                .InstancePerLifetimeScope();
        }

        #endregion
    }
}


text:
@implementation SR_ScanListItmeModel

@end


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.18 at 01:26:07 PM PDT
//

package umich.ms.io.type.mzidentml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ResidueType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ResidueType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <attribute name="code" use="required" type="{http://psidev.info/psi/pi/mzIdentML/1.2}chars" />
 *       <attribute name="mass" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResidueType", namespace = "http://psidev.info/psi/pi/mzIdentML/1.2")
public class ResidueType {

    @XmlAttribute(name = "code", required = true)
    protected String code;
    @XmlAttribute(name = "mass", required = true)
    protected float mass;

    /**
     * Gets the value of the code property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCode() {
        return code;
    }

    /**
     * Sets the value of the code property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCode(String value) {
        this.code = value;
    }

    /**
     * Gets the value of the mass property.
     *
     */
    public float getMass() {
        return mass;
    }

    /**
     * Sets the value of the mass property.
     *
     */
    public void setMass(float value) {
        this.mass = value;
    }

}


text:
<?php
/*
 * Plugin Name: Nocaptcha Mail.Ru
 * Plugin URL: https://nocaptcha.mail.ru
 * Description: Adds integration with Nocaptcha Mail.Ru - free intelligent CAPTCHA service.
 * Version: 1.0.0
 * Author: Oleg Kovalev
 * Author URI: mailto:man0xff@gmail.com
 * License: MIT
 * License URI: http://opensource.org/licenses/MIT
 * Text Domain: nocaptcha
 * Domain Path: /languages/
 */

require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );

define( 'NOCAPTCHA_API_SERVER', 'https://api-nocaptcha.mail.ru' );

$nocaptcha_widgets_num = 0;

function nocaptcha_load_textdomain() {
    load_plugin_textdomain( 'nocaptcha', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}

function nocaptcha_options_register() {
    add_settings_section(
        'auth',
        __( 'Authorization', 'nocaptcha' ),
        'nocaptcha_options_auth_section',
        'nocaptcha'
    );
    add_settings_section(
        'common',
        __( 'General Settings', 'nocaptcha' ),
        null,
        'nocaptcha'
    );
    add_settings_field(
        'public_key',
        __( 'Public Key', 'nocaptcha' ),
        'nocaptcha_options_public_key',
        'nocaptcha',
        'auth'
    );
    add_settings_field(
        'private_key',
        __( 'Private Key', 'nocaptcha' ),
        'nocaptcha_options_private_key',
        'nocaptcha',
        'auth'
    );
    add_settings_field(
        'forms',
        __( 'Forms', 'nocaptcha' ),
        'nocaptcha_options_forms',
        'nocaptcha',
        'common'
    );
    add_settings_field(
        'ru_lang',
        __( 'Use Russian-language widget for languages', 'nocaptcha' ),
        'nocaptcha_options_ru_lang',
        'nocaptcha',
        'common'
    );
    add_settings_field(
        'margins',
        __( 'Widget margins', 'nocaptcha' ),
        'nocaptcha_options_margin',
        'nocaptcha',
        'common'
    );
    register_setting( 'nocaptcha', 'nocaptcha_public_key' );
    register_setting( 'nocaptcha', 'nocaptcha_private_key' );
    register_setting( 'nocaptcha', 'nocaptcha_ru_lang' );
    register_setting( 'nocaptcha', 'nocaptcha_form_login' );
    register_setting( 'nocaptcha', 'nocaptcha_form_reg' );
    register_setting( 'nocaptcha', 'nocaptcha_form_lost' );
    register_setting( 'nocaptcha', 'nocaptcha_form_comment' );
    register_setting( 'nocaptcha', 'nocaptcha_hide_auth' );
    register_setting( 'nocaptcha', 'nocaptcha_use_margins' );
    register_setting( 'nocaptcha', 'nocaptcha_margins' );
}

function nocaptcha_options_auth_section() {
    _e( '
Before using Nocaptcha service you should register your domain and get the public and private keys.
', 'nocaptcha' );
}

function nocaptcha_options_public_key() {
    $val = nocaptcha_get_option( 'nocaptcha_public_key' );
    echo '<input type="text" size="40" maxlength="32" value="' . $val . '" name="nocaptcha_public_key">';
}

function nocaptcha_options_private_key() {
    $val = nocaptcha_get_option( 'nocaptcha_private_key' );
    echo '<input type="text" size="40" maxlength="32" value="' . $val . '" name="nocaptcha_private_key" autocomplete="off">';
}

function nocaptcha_options_margin() {
    ?>

        <input type="radio" name="nocaptcha_use_margins" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_use_margins' ), 1 ); ?>>
        <?php _e( 'Use top and bottom margins', 'nocaptcha' ); ?>

        <input style="margin-right: 30px;" type="text" name="nocaptcha_margins" size="5" value="<?php echo nocaptcha_get_option( 'nocaptcha_margins' ); ?>">

        <input type="radio" name="nocaptcha_use_margins" value="0" <?php checked( nocaptcha_get_option( 'nocaptcha_use_margins' ), 0 ); ?>>
        <?php _e( 'Do not use margins', 'nocaptcha' ); ?>

        <?php _e( 'If necessary, you can adjust the margins in the theme stylesheet.', 'nocaptcha' ); ?>

    <?php
}

function nocaptcha_options_forms() {
    ?>

        <input type="checkbox" name="nocaptcha_form_comment" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_form_comment' ), 1 ); ?>>
        <?php _e( 'Comment form', 'nocaptcha' ); ?>

        <input type="checkbox" name="nocaptcha_hide_auth" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_hide_auth' ), 1 ); ?>>
        <?php _e( 'Hide CAPTCHA for logged in users', 'nocaptcha' ); ?>

        <input type="checkbox" name="nocaptcha_form_login" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_form_login' ), 1 ); ?>>
        <?php _e( 'Login form', 'nocaptcha' ); ?>

        <input type="checkbox" name="nocaptcha_form_reg" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_form_reg' ), 1 ); ?>>
        <?php _e( 'Registration form', 'nocaptcha' ); ?>

        <input type="checkbox" name="nocaptcha_form_lost" value="1" <?php checked( nocaptcha_get_option( 'nocaptcha_form_lost' ), 1 ); ?>>
        <?php _e( 'Lost password form', 'nocaptcha' ); ?>

        <?php _e( 'How to add Nocaptcha to arbitrary form described below.', 'nocaptcha' ); ?>

    <?php
}

function nocaptcha_options_ru_lang() {
    $selected = preg_split( '/,/', nocaptcha_get_option( 'nocaptcha_ru_lang' ), -1, PREG_SPLIT_NO_EMPTY );
    $values = array();
    $translations = wp_get_available_translations();
    $values['en_US'] = 'English (United States)';
    foreach ( $translations as $locale => $translation ) {
        $values[$locale] = $translation['native_name'];
    }

    nocaptcha_multiselect( array(
        'values'          => $values,
        'selected'        => $selected,
        'name'            => 'nocaptcha_ru_lang',
        'label_selected'  => __( 'Selected languages', 'nocaptcha' ),
        'label_available' => __( 'Available languages', 'nocaptcha' ),
    ));
    ?>

        <?php _e( 'English-language widget will be used for the rest of languages.', 'nocaptcha' ); ?>

    <?php
}

function nocaptcha_options_add_menu() {
    add_options_page(
        __( 'Nocaptcha Mail.Ru Settings', 'nocaptcha' ),
        __( 'Nocaptcha Mail.Ru', 'nocaptcha' ),
        'manage_options',
        'nocaptcha',
        'nocaptcha_options'
    );
}

function nocaptcha_options() {
    ?>

<?php _e( 'Nocaptcha Mail.Ru Settings', 'nocaptcha' ); ?>

        <form method="post" action="options.php">
            <?php settings_fields('nocaptcha'); ?>
            <?php do_settings_sections('nocaptcha'); ?>
            <?php submit_button(); ?>
        </form>

<?php _e( 'How to add Nocaptcha to arbitrary form', 'nocaptcha' ); ?>

<?php _e( 'Description', 'nocaptcha' ); ?>

    <?php
}

function nocaptcha_error_log( $message ) {
    error_log( 'ERROR: nocaptcha: ' . $message );
}

function nocaptcha_check_request() {
    $params = array(
        'private_key'   => nocaptcha_get_option( 'nocaptcha_private_key' ),
        'captcha_id'    => $_REQUEST['captcha_id'],
        'captcha_value' => $_REQUEST['captcha_value'],
    );
    $url = NOCAPTCHA_API_SERVER . '/check?' . http_build_query( $params );
    $resp = @file_get_contents( $url );
    if ( $resp === false ) {
        nocaptcha_error_log( 'check request failed' );
        return null;
    }
    $data = json_decode( $resp );
    if ( ! $data ) {
        nocaptcha_error_log( 'invalid check response' );
        return null;
    }
    if ( $data->status == 'not found' ) {
        return false;
    }
    if ( $data->status !== 'ok' ) {
        nocaptcha_error_log( 'service returned an error: ' . $data->desc );
        return null;
    }
    if ( ! $data->is_correct ) {
        return false;
    }
    return true;
}

function nocaptcha_check_request_error( $errors = null ) {
    $result = nocaptcha_check_request();
    if ( $result === null ) {
        return nocaptcha_add_error( $errors, __( 'ERROR: Internal service error.', 'nocaptcha' ) );
    } elseif ( $result === false ) {
        return nocaptcha_add_error( $errors, __( 'ERROR: Incorrect CAPTCHA code.', 'nocaptcha' ) );
    }
    return null;
}

function nocaptcha_check_login_request( $user, $password ) {
    $errors = nocaptcha_check_request_error();
    if ( $errors !== null ) {
        return $errors;
    }
    return $user;
}

function nocaptcha_check_registration_request( $errors, $sanitized_user_login, $user_email ) {
    nocaptcha_check_request_error( $errors );
    return $errors;
}

function nocaptcha_check_password_reset_request( $result, $user_id ) {
    $errors = nocaptcha_check_request_error();
    if ( $errors !== null ) {
        return $errors;
    }
    return $result;
}

function nocaptcha_check_comment_request() {
    $errors = nocaptcha_check_request_error();
    if ( $errors !== null ) {
        wp_die( $errors );
    }
}

function nocaptcha_add_error( $errors, $message ) {
    if ( $errors === null ) {
        return new WP_Error( 'nocaptcha_error', $message );
    }
    $errors->add( 'nocaptcha_error', $message );
    return $errors;
}

function nocaptcha_get_widget( $tabindex = null ) {
    global $nocaptcha_widgets_num;

    if ( $nocaptcha_widgets_num == 0 ) {
        add_action( 'wp_footer', 'nocaptcha_add_settings_and_script', 100 );
        add_action( 'login_footer', 'nocaptcha_add_settings_and_script', 100 );
    }

    $tag = '

';
    $nocaptcha_widgets_num++;
    return $tag;
}

function nocaptcha_add_widget() {
    echo nocaptcha_get_widget();
}

function nocaptcha_add_widget_and_script() {
    echo nocaptcha_get_widget();
    echo nocaptcha_get_settings_and_script();
}

function nocaptcha_add_widget_comment( $default ) {
    if ( nocaptcha_get_option( 'nocaptcha_hide_auth' ) && is_user_logged_in() ) {
        return $default;
    }
    return $default . nocaptcha_get_widget();
}

function nocaptcha_add_widget_comment_button( $default ) {
    if ( nocaptcha_get_option( 'nocaptcha_hide_auth' ) && is_user_logged_in() ) {
        return $default;
    }
    return nocaptcha_get_widget() . $default;
}

function nocaptcha_get_language() {
    $locale = get_locale();
    $locales = preg_split( '/,/', nocaptcha_get_option( 'nocaptcha_ru_lang' ), -1, PREG_SPLIT_NO_EMPTY );
    if ( in_array( $locale, $locales ) ) {
        return 'ru';
    }
    return 'en';
}

function nocaptcha_add_settings_and_script() {
    echo nocaptcha_get_settings_and_script();
}

function nocaptcha_get_settings_and_script() {
    global $nocaptcha_widgets_num;

    if ( $nocaptcha_widgets_num == 0 ) {
        return '';
    }

    $language = nocaptcha_get_language();
    $containers = array();
    for ( $i = 0; $i < $nocaptcha_widgets_num; $i++ ) {
        $containers[] = "'nocaptcha$i'";
    }
    $containers = join( ',', $containers );
    $url = NOCAPTCHA_API_SERVER . '/captcha?public_key=' . nocaptcha_get_option( 'nocaptcha_public_key' );

    $data  = '';
    $data .= '';
    return $data;
}

function nocaptcha_get_option( $name ) {
    $defaults = array(
        'nocaptcha_public_key'   => '',
        'nocaptcha_private_key'  => '',
        'nocaptcha_ru_lang'      => 'ru_RU,uk',
        'nocaptcha_form_login'   => 0,
        'nocaptcha_form_reg'     => 0,
        'nocaptcha_form_lost'    => 0,
        'nocaptcha_form_comment' => 0,
        'nocaptcha_hide_auth'    => 0,
        'nocaptcha_use_margins'  => 1,
        'nocaptcha_margins'      => '20px',
    );
    return get_option( $name, $defaults[$name] );
}

function nocaptcha_add_widget_margins() {
    $margin = nocaptcha_get_option( 'nocaptcha_margins' );
    ?>

    <?php
}

function nocaptcha_add_forms_actions() {
    global $wp_version;

    if ( nocaptcha_get_option( 'nocaptcha_form_login' ) ) {
        add_action( 'login_form', 'nocaptcha_add_widget', 100 );
        add_filter( 'wp_authenticate_user', 'nocaptcha_check_login_request', 1, 2 );
    }
    if ( nocaptcha_get_option( 'nocaptcha_form_reg' ) ) {
        add_action( 'register_form', 'nocaptcha_add_widget', 100 );
        add_filter( 'registration_errors', 'nocaptcha_check_registration_request', 1, 3 );
    }
    if ( nocaptcha_get_option( 'nocaptcha_form_lost' ) ) {
        add_action( 'lostpassword_form',
                    'nocaptcha_add_widget', 100 );
        add_filter( 'allow_password_reset',
                    'nocaptcha_check_password_reset_request', 1, 2 );
    }
    if ( nocaptcha_get_option( 'nocaptcha_form_comment' ) ) {
        if ( ! nocaptcha_get_option( 'nocaptcha_hide_auth' ) || ! is_user_logged_in() ) {
            if ( version_compare( $wp_version, '4.2.0' ) >= 0 ) {
                add_action( 'comment_form_submit_button',
                            'nocaptcha_add_widget_comment_button', 1 );
            } else {
                add_action( 'comment_form_field_comment',
                            'nocaptcha_add_widget_comment', 100 );
            }
            add_filter( 'pre_comment_on_post',
                        'nocaptcha_check_comment_request', 1 );
        }
    }
}

add_action('plugins_loaded', 'nocaptcha_load_textdomain');

if ( is_admin() ) {
    require_once( 'multiselect.php' );
    add_action( 'admin_menu' , 'nocaptcha_options_add_menu' );
    add_action( 'admin_init' , 'nocaptcha_options_register' );
} else {
    add_action( 'init', 'nocaptcha_add_forms_actions' );
    if ( nocaptcha_get_option( 'nocaptcha_use_margins' ) ) {
        add_action( 'wp_head', 'nocaptcha_add_widget_margins' );
        add_action( 'login_head', 'nocaptcha_add_widget_margins' );
    }
}
?>


text:
module FeatureProps {
    import IFeature          = csComp.Services.IFeature;
    import IFeatureType      = csComp.Services.IFeatureType;
    import IPropertyType     = csComp.Services.IPropertyType;
    import IPropertyTypeData = csComp.Services.IPropertyTypeData;

    class FeaturePropsOptions implements L.SidebarOptions {
        public position   : string;
        public closeButton: boolean;
        public autoPan    : boolean;

        constructor(position: string) {
            this.position    = position;
            this.closeButton = true;
            this.autoPan     = true;
        }
    }

    export interface IFeaturePropsScope extends ng.IScope {
        vm                              : FeaturePropsCtrl;
        showMenu                        : boolean;
        poi                             : IFeature;
        callOut                         : CallOut;
        tabs                            : JQuery;
        tabScrollDelta                  : number;
        featureTabActivated(sectionTitle: string, section: CallOutSection);
        autocollapse(init: boolean)     : void;
    }

    export interface ICallOutProperty {
        key         : string;
        value       : string;
        property    : string;
        canFilter   : boolean;
        canStyle    : boolean;
        feature     : IFeature;
        description?: string;
        meta?: IPropertyType;
        isFilter    : boolean;
    }

    export class CallOutProperty implements ICallOutProperty {
        constructor(
            public key         : string,
            public value       : string,
            public property    : string,
            public canFilter   : boolean,
            public canStyle    : boolean,
            public feature     : IFeature,
            public isFilter    : boolean,
            public isSensor    : boolean,
            public description?: string,
            public meta?       : IPropertyType,
            public timestamps? : number[],
            public sensor?     : number[]) { }
    }

    export interface ICallOutSection {
        propertyTypes: { [label: string]: IPropertyType }; // Probably not needed
        properties     : Array<ICallOutProperty>;
        sectionIcon    : string;
        addProperty(key: string, value: string, property: string, canFilter: boolean, canStyle: boolean, feature: IFeature, isFilter: boolean, description?: string, meta?: IPropertyType) : void;
        hasProperties(): boolean;
    }

    export class CallOutSection implements ICallOutSection {
        propertyTypes: { [label: string]: IPropertyType };
        properties   : Array<ICallOutProperty>;
        sectionIcon  : string;

        constructor(sectionIcon?: string) {
            this.propertyTypes   = {};
            this.properties      = [];
            this.sectionIcon     = sectionIcon;
        }

        showSectionIcon(): boolean { return !csComp.StringExt.isNullOrEmpty(this.sectionIcon); }

        addProperty(key: string, value: string, property: string, canFilter: boolean, canStyle: boolean, feature: IFeature, isFilter: boolean, description?: string, meta?: IPropertyType ): void {
            var isSensor = typeof feature.sensors !== 'undefined' && feature.sensors.hasOwnProperty(property);
            if (isSensor)
                this.properties.push(new CallOutProperty(key, value, property, canFilter, canStyle, feature, isFilter, isSensor, description ? description : null, meta, feature.timestamps, feature.sensors[property]));
            else
                this.properties.push(new CallOutProperty(key, value, property, canFilter, canStyle, feature, isFilter, isSensor, description ? description : null, meta));
        }

        hasProperties(): boolean {
            return this.properties != null && this.properties.length > 0;
        }
    }

    declare var String;

    export class CallOut {
        public title   : string;
        public icon    : string;
        public sections: { [title: string]: ICallOutSection; };

        constructor(private type: IFeatureType, private feature: IFeature, private propertyTypeData: IPropertyTypeData, private layerservice: csComp.Services.LayerService ) {
            this.sections = {};
            //if (type == null) this.createDefaultType();
            this.setTitle();
            this.setIcon(feature);

            var infoCallOutSection   = new CallOutSection('fa-info');
            var searchCallOutSection = new CallOutSection('fa-filter');
            var hierarchyCallOutSection = new CallOutSection('fa-link');

            var displayValue: string;
            if (type != null) {
                var propertyTypes = csComp.Helpers.getPropertyTypes(type, propertyTypeData);
                propertyTypes.forEach((mi: IPropertyType) => {
                    var callOutSection = this.getOrCreateCallOutSection(mi.section) || infoCallOutSection;
                    callOutSection.propertyTypes[mi.label] = mi;
                    var text = feature.properties[mi.label]; if (mi.type === "hierarchy") {
                    var count = this.calculateHierarchyValue(mi, feature, propertyTypeData, layerservice);
                        text = count + ";" + feature.properties[mi.calculation];
                    }
                    displayValue = csComp.Helpers.convertPropertyInfo(mi, text);
                    // Skip empty, non-editable values
                    if (!mi.canEdit && csComp.StringExt.isNullOrEmpty(displayValue)) return;

                    var canFilter = (mi.type === "number" || mi.type === "text"    || mi.type === "options");
                    var canStyle  = (mi.type === "number" || mi.type === "options" || mi.type === "color");
                    if (mi.filterType != null) canFilter = mi.filterType.toLowerCase() != "none";
                    if (mi.visibleInCallOut)
                    {
                        callOutSection.addProperty(mi.title, displayValue, mi.label, canFilter, canStyle, feature, false, mi.description, mi);
                    }
                    if (mi.type === "hierarchy") {
                        hierarchyCallOutSection.addProperty(mi.title, displayValue, mi.label, canFilter, canStyle, feature, false, mi.description, mi);
                    }
                    searchCallOutSection.addProperty(mi.title, displayValue, mi.label, canFilter, canStyle, feature, false, mi.description);
                });
            }
            if (infoCallOutSection.properties.length > 0) this.sections['AAA Info'] = infoCallOutSection; // The AAA is added as the sections are sorted alphabetically
            if (hierarchyCallOutSection.properties.length > 0) this.sections['hierarchy'] = hierarchyCallOutSection;
            if (searchCallOutSection.properties.length > 0) this.sections['zzz Search'] = searchCallOutSection;
        }

        private calculateHierarchyValue(mi: IPropertyType, feature: IFeature, propertyTypeData: IPropertyTypeData, layerservice: csComp.Services.LayerService): number {
            var countResults = [];
            var result: number = -1;
            var propertyTypes = csComp.Helpers.getPropertyTypes(feature.fType, propertyTypeData);
            for (var p in propertyTypes) {
                var pt = propertyTypes[p];
                if (pt.type === "relation" && mi.targetrelation === pt.label) {
                    countResults[pt.label] = pt.count;
                    if (mi.calculation === "count") {
                        result = pt.count;
                    }
                }
            }

            if (mi.calculation === "ratio") {
                var featureName = feature.properties[mi.subject];
                layerservice.project.features.forEach((f: csComp.Services.IFeature) => {
                    if (f.properties.hasOwnProperty(mi.target) && f.properties[mi.target] === featureName) {
                        if (f.properties.hasOwnProperty(mi.targetproperty)) {
                            result = +f.properties[mi.targetproperty] / countResults[mi.targetrelation];
                        }
                    }
                });
            }
            return result;
        }

        public sectionCount(): number {
            return Object.keys(this.sections).length;
        }

        public firstSection(): ICallOutSection {
            //Return first section that has an icon
            //TODO: Swap locations
            var firstSec;
            for (var i = 0; i < (this.sectionCount() - 1); i++) {
                if (this.sections[Object.keys(this.sections)[i]].sectionIcon) {
                    firstSec = this.sections[Object.keys(this.sections)[i]];
                    break;
                }
            }
            return firstSec;
        }

        public lastSection(): ICallOutSection {
            return this.sections[Object.keys(this.sections)[this.sectionCount()-1]];
        }

        private getOrCreateCallOutSection(sectionTitle: string): ICallOutSection {
            if (!sectionTitle) {
                return null;
            }
            if (sectionTitle in this.sections)
                return this.sections[sectionTitle];
            this.sections[sectionTitle] = new CallOutSection();
            return this.sections[sectionTitle];
        }

        /**
         * Set the title of the callout to the title of the feature.
         */
        private setTitle() {
            this.title = CallOut.title(this.type, this.feature);
        }

        private setIcon(feature: csComp.Services.IFeature) {
            this.icon = (this.type == null || this.type.style == null || !this.type.style.hasOwnProperty('iconUri') || this.type.style.iconUri.toLowerCase().indexOf('_media') >= 0)
                ? ''
                : this.type.style.iconUri.indexOf('{') >= 0
                    ? csComp.Helpers.convertStringFormat(feature, this.type.style.iconUri)
                    : this.type.style.iconUri;
        }

        public static title(type: IFeatureType, feature: IFeature): string {
            var title = '';
            if (type != null && type.style != null && type.style.nameLabel)
                title = feature.properties[type.style.nameLabel];
            else {
                if (feature.properties.hasOwnProperty('Name')) title = feature.properties['Name'];
                else if (feature.properties.hasOwnProperty('name')) title = feature.properties['name'];
                else if (feature.properties.hasOwnProperty('naam')) title = feature.properties['naam'];
            }
            if (!csComp.StringExt.isNullOrEmpty(title) && !$.isNumeric(title))
                title = title.replace(/&/g, '&');
            return title;
        }
    }

    export class FeaturePropsCtrl {
        private scope: IFeaturePropsScope;

        // $inject annotation.
        // It provides $injector with information about dependencies to be injected into constructor
        // it is better to have it close to the constructor, because the parameters must match in count and type.
        // See http://docs.angularjs.org/guide/di
        public static $inject = [
            '$scope',
            '$location',
            '$sce',
            'mapService',
            'layerService',
            'messageBusService'
        ];

        // dependencies are injected via AngularJS $injector
        // controller's name is registered in Application.ts and specified from ng-controller attribute in index.html
        constructor(
            private $scope             : IFeaturePropsScope,
            private $location          : ng.ILocationService,
            private $sce               : ng.ISCEService,
            private $mapService        : csComp.Services.MapService,
            private $layerService      : csComp.Services.LayerService,
            private $messageBusService : csComp.Services.MessageBusService
            ) {
            this.scope = $scope;
            $scope.vm = this;
            $scope.showMenu = false;

            $scope.featureTabActivated = function (sectionTitle: string, section: CallOutSection) {
                $messageBusService.publish('FeatureTab', 'activated', { sectionTitle: sectionTitle, section: section });
            };

            $messageBusService.subscribe("sidebar", this.sidebarMessageReceived);
            $messageBusService.subscribe("feature", this.featureMessageReceived);

            var widthOfList = function () {
                var itemsWidth = 0;
                $('#featureTabs>li').each(function () {
                    var itemWidth = $(this).outerWidth();

                    itemsWidth += itemWidth;
                });
                return itemsWidth;
            }

            $scope.autocollapse = function (initializeTabPosition = false) {
                //                console.log('autocollapse');
                var tabs = $('#featureTabs');

                //                console.log('#ft.ow(): ' + tabs.outerWidth());
                //                console.log('wol: ' + widthOfList());
                //                console.log('ml: ' + tabs.css('margin-left'));

                if (tabs.outerWidth() < widthOfList() || parseFloat(tabs.css('margin-left')) < 0) {
                    $('#leftArr').show();
                    $('#rightArr').show();
                    if (initializeTabPosition) {
                        tabs.animate({ 'margin-left': '20px' }, 'slow');
                    }
                } else {
                    $('#leftArr').hide();
                    $('#rightArr').hide();
                    if (initializeTabPosition) {
                        tabs.animate({ 'margin-left': '0px' }, 'slow');
                    }
                }
            };

            $scope.autocollapse(true); // when document first loads
            $scope.tabs = $('#featureTabs');
            $scope.tabScrollDelta = $scope.tabs.outerWidth();

            $('#leftArr').click(function () {
                //console.log('leftArr');
                //var tabs = $('#featureTabs');
                var current = parseFloat($scope.tabs.css('margin-left'));
                var min = 20;
                var nextPos = $scope.tabScrollDelta;

                if (current + nextPos > min) {
                    nextPos = min - current;
                }

                $scope.tabs.animate({ 'margin-left': '+=' + nextPos + 'px' }, 'slow', function () {
                    //                    console.log('rightarr hide');
                    $('#rightArr').show();
                    $('#leftArr').show();
                    $scope.autocollapse(false);
                });
            });

            $('#rightArr').click(function () {
                //var tabs = $('#featureTabs');
                var max = widthOfList() - $scope.tabs.outerWidth() + 30;
                //var current = Math.abs(parseFloat($scope.tabs.css('margin-left')));
                var nextPos = $scope.tabScrollDelta;
                nextPos = Math.min(max, nextPos);

                $scope.tabs.animate({ 'margin-left': '-=' + nextPos + 'px' }, 'slow', function () {
                    $('#leftArr').show();
                    $('#rightArr').show();

                    $scope.autocollapse(false);
                });
            });
        }

        public toTrusted(html: string): string {
            try {
                if (html === undefined || html === null)
                    return this.$sce.trustAsHtml(html);
                return this.$sce.trustAsHtml(html.toString());
            } catch (e) {
                console.log(e + ': ' + html);
                return '';
            }
        }

        public openLayer(property : FeatureProps.CallOutProperty){
          if (property.feature!=null && property.feature.properties.hasOwnProperty(property.meta.label))
          {
            var link = property.feature.properties[property.meta.label];
            alert(link);
          }

        }

        public createScatter(property: FeatureProps.CallOutProperty) {
            var sc = new csComp.Services.GroupFilter();
            sc.property = property.property;
            sc.property2 = "opp_land";
            sc.id = csComp.Helpers.getGuid();
            sc.filterType = "scatter";
            sc.title = sc.property;
            var l = this.$layerService.findLayer(this.$scope.poi.layerId);
            this.$layerService.setFilter(sc,l.group);
            //alert('scatter ' + property.property);
        }

        /**
         * Callback function
         * @see {http://stackoverflow.com/questions/12756423/is-there-an-alias-for-this-in-typescript}
         * @see {http://stackoverflow.com/questions/20627138/typescript-this-scoping-issue-when-called-in-jquery-callback}
         * @todo {notice the strange syntax using a fat arrow =>, which is to preserve the this reference in a callback!}
         */
        private sidebarMessageReceived = (title: string): void => {
            //console.log("sidebarMessageReceived");
            switch (title) {
                case "toggle":
                    this.$scope.showMenu = !this.$scope.showMenu;
                    break;
                case "show":
                    this.$scope.showMenu = true;
                    break;
                case "hide":
                    this.$scope.showMenu = false;
                    break;
                default:
            }
            // NOTE EV: You need to call apply only when an event is received outside the angular scope.
            // However, make sure you are not calling this inside an angular apply cycle, as it will generate an error.
            if (this.$scope.$root.$$phase != '$apply' && this.$scope.$root.$$phase != '$digest') {
                this.$scope.$apply();
            }
        }

        private featureMessageReceived = (title: string, feature: IFeature): void => {
            //console.log("FPC: featureMessageReceived");
            switch (title) {
                case "onFeatureSelect":
                    break;
                case "onRelationsUpdated":
                    this.setShowSimpleTimeline();
                    this.displayFeature(feature);
                    this.updateHierarchyLinks(feature);
                    this.$scope.poi = feature;
                    this.$scope.autocollapse(true);
                    break;
                case "onFeatureUpdated":
                    this.displayFeature(this.$layerService.lastSelectedFeature);
                    this.$scope.poi = this.$layerService.lastSelectedFeature;
                break;
               default:
            }
            if (this.$scope.$root.$$phase != '$apply' && this.$scope.$root.$$phase != '$digest') {
                this.$scope.$apply();
            }
        }

        private displayFeature(feature: IFeature): void {
            if (!feature) return;
            var featureType = feature.fType;
            // If we are dealing with a sensor, make sure that the feature's timestamps are valid so we can add it to a chart
            if (typeof feature.sensors !== 'undefined' && typeof feature.timestamps === 'undefined')
                feature.timestamps = this.$layerService.findLayer(feature.layerId).timestamps;
            this.$scope.callOut = new CallOut(featureType, feature, this.$layerService.propertyTypeData, this.$layerService);
        }

        private updateHierarchyLinks(feature: IFeature): void {
            if (!feature) return;
            // Add properties defined inside of layers to the project-wide properties.
            this.$layerService.project.groups.forEach((group) => {
                group.layers.forEach((l) => {
                    if (l.type == "hierarchy" && l.enabled) {
                        if ((<any>(l.data)) && (<any>(l.data)).features) {
                            (<any>(l.data)).features[0].fType.propertyTypeData.forEach((pt) => {
                                if (pt.type == "hierarchy") {
                                    if (pt.targetlayer == feature.layerId) {
                                        var featureType = this.$layerService.featureTypes[feature.featureTypeName];
                                        var propertyTypes = csComp.Helpers.getPropertyTypes(feature.fType, this.$layerService.propertyTypeData);
                                        var found = false;
                                        propertyTypes.forEach((p) => {
                                            if (p.label === pt.label) {
                                                found = true;
                                            }
                                        });
                                        if (!found) featureType.propertyTypeData.push(pt);
                                    }
                                }
                            });
                        }
                    }
                });
            });
            csComp.Helpers.getPropertyTypes
        }

        showSensorData(property: ICallOutProperty) {
            console.log(property);
        }

        timestamps = new Array<{ title: string; timestamp: number }>();
        showSimpleTimeline: boolean;
        focusTime         : string;

        setShowSimpleTimeline() {
            if (this.$mapService.timelineVisible
                || typeof this.$layerService.lastSelectedFeature === 'undefined'
                || this.$layerService.lastSelectedFeature == null) {
                this.showSimpleTimeline = false;
                return;
            }
            var feature = this.$layerService.lastSelectedFeature;
            this.showSimpleTimeline = (typeof feature.sensors !== 'undefined' && feature.sensors !== null);
            if (this.showSimpleTimeline) this.setTimestamps();
        }

        setTimestamps() {
            var feature = this.$layerService.lastSelectedFeature;
            var layer = this.$layerService.findLayer(feature.layerId);
            if ((typeof layer.timestamps === 'undefined' || layer.timestamps == null) &&
                (typeof feature.timestamps === 'undefined' || feature.timestamps == null)) return [];
            var time = this.timestamps = new Array<{ title: string; timestamp: number }>();
            (layer.timestamps || feature.timestamps).forEach((ts) => {
                var date = new Date(ts);
                var dateString = String.format("{0}-{1:00}-{2:00}", date.getFullYear(), date.getUTCMonth() + 1, date.getUTCDate());
                if (date.getUTCHours() > 0 || date.getUTCMinutes() > 0)
                    dateString += String.format(" {0:00}:{1:00}", date.getUTCHours(), date.getUTCMinutes());
                time.push({ title: dateString, timestamp: ts} );
            });

            // Set focus time
            var focus = this.$layerService.project.timeLine.focus;
            if (focus > time[time.length - 1].timestamp) {
                this.focusTime = time[time.length - 1].title;
                this.setTime(time[time.length - 1]);
            } else if (focus < time[0].timestamp) {
                this.focusTime = time[0].title;
                this.setTime(time[0]);
            }
            else {
                for (var i = 1; i < time.length; i++) {
                    if (focus > time[i].timestamp) continue;
                    this.focusTime = time[i].title;
                    this.setTime(time[i]);
                    break;
                }
            }
            return time;
        }

        setTime(time: { title: string; timestamp: number} ) {
            this.focusTime = time.title;
            this.$layerService.project.timeLine.setFocus(new Date(time.timestamp));
            this.$messageBusService.publish("timeline", "focusChange", time.timestamp);
        }
    }
}


text:
package fm.last.ivy.plugins.svnresolver;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ivy.plugins.repository.Resource;

/**
 * A Resource implementation for Subversion.
 */
public class SvnResource implements Resource {

  private String source;
  private boolean exists = false;
  private long lastModified = 0;
  private long contentLength = 0;
  private SvnRepository repository = null;
  private boolean resolved = false;

  /**
   * Constructs a new Subversion resource.
   *
   * @param repository The repository that was used to resolve this resource.
   * @param source Subversion string identifying the resource
   * @param exists Whether the resource exists or not.
   * @param lastModified When the resource was last modified (committed).
   * @param contentLength The size of the resource in bytes.
   */
  public SvnResource(SvnRepository repository, String source, boolean exists, long lastModified, long contentLength) {
    this.source = source;
    this.exists = exists;
    this.lastModified = lastModified;
    this.contentLength = contentLength;
    this.resolved = true;
  }

  /**
   * Constructs a new Subversion resource.
   *
   * @param repository The repository that was used to resolve this resource.
   * @param source Subversion string identifying the resource
   */
  public SvnResource(SvnRepository repository, String source) {
    this.repository = repository;
    this.source = source;
    this.resolved = false;
  }

  /**
   * Constructs a new Subversion resource.
   */
  public SvnResource() {
    this.resolved = true;
  }

  /**
   * Resolves this resource via its repository.
   */
  private void resolve() {
    SvnResource resolved = repository.resolveResource(source);
    this.contentLength = resolved.getContentLength();
    this.lastModified = resolved.getLastModified();
    this.exists = resolved.exists();
    this.resolved = true;
  }

  /**
   * Clones this resource.
   *
   * @param cloneName
   * @return A clone of this resource.
   */
  public Resource clone(String cloneName) {
    return new SvnResource(repository, cloneName);
  }

  /**
   * Checks whether this resource is available.
   *
   * @return Whether the resource is available or not.
   */
  public boolean exists() {
    if (!resolved) {
      resolve();
    }
    return this.exists;
  }

  /*
   * (non-Javadoc)
   * @see org.apache.ivy.repository.Resource#getContentLength()
   */
  public long getContentLength() {
    if (!resolved) {
      resolve();
    }
    return this.contentLength;
  }

  /*
   * (non-Javadoc)
   * @see org.apache.ivy.repository.Resource#getLastModified()
   */
  public long getLastModified() {
    if (!resolved) {
      resolve();
    }
    return this.lastModified;
  }

  /*
   * (non-Javadoc)
   * @see org.apache.ivy.repository.Resource#getName()
   */
  public String getName() {
    return source;
  }

  /**
   * Returns whether this resource is local or not.
   *
   * @return Currently always returns false.
   * @see org.apache.ivy.repository.Resource#isLocal()
   */
  public boolean isLocal() {
    // svn resources are not on the file system so return false
    return false;
  }

  /**
   * Gets an input stream for this resource.
   *
   * @return
   * @throw UnsupportedOperationException This is currently always thrown.
   * @see org.apache.ivy.repository.Resource#openStream()
   */
  public InputStream openStream() throws IOException {
    throw new UnsupportedOperationException("Opening an input stream on a SVN resource not currently supported");
  }

  /**
   * Generates a String representation of this object.
   *
   * @return A String reprentation of this object.
   */
  public String toString() {
    return source;
  }

}