text:
<?php
if (!defined('IN_CB')) { die('You are not allowed to access to this page.'); }

$imageKeys = array();
function registerImageKey($key, $value) {
    global $imageKeys;
    $imageKeys[$key] = $value;
}

function getImageKeys() {
    global $imageKeys;
    return $imageKeys;
}

function getElementHtml($tag, $attributes, $content = false) {
    $code = '<' . $tag;
    foreach ($attributes as $attribute => $value) {
        $code .= ' ' . $attribute . '="' . $value . '"';
    }

    if ($content === false || $content === null) {
        $code .= ' />';
    } else {
        $code .= '>' . $content . '</' . $tag . '>';
    }

    return $code;
}

function getInputTextHtml($name, $currentValue, $attributes = array()) {
    $defaultAttributes = array(
        'id' => $name,
        'name' => $name
    );

    $finalAttributes = array_merge($defaultAttributes, $attributes);
    if ($currentValue !== null) {
        $finalAttributes['value'] = $currentValue;
    }

    return getElementHtml('input', $finalAttributes, false);
}

function getOptionGroup($options, $currentValue) {
    $content = '';
    foreach ($options as $optionKey => $optionValue) {
        if (is_array($optionValue)) {
            $content .= '<optgroup label="' . $optionKey . '">' . getOptionGroup($optionValue, $currentValue) . '</optgroup>';
        } else {
            $optionAttributes = array();
            if ($currentValue == $optionKey) {
                $optionAttributes['selected'] = 'selected';
            }
            $content .= getOptionHtml($optionKey, $optionValue, $optionAttributes);
        }
    }

    return $content;
}

function getOptionHtml($value, $content, $attributes = array()) {
    $defaultAttributes = array(
        'value' => $value
    );

    $finalAttributes = array_merge($defaultAttributes, $attributes);

    return getElementHtml('option', $finalAttributes, $content);
}

function getSelectHtml($name, $currentValue, $options, $attributes = array()) {
    $defaultAttributes = array(
        'size' => 1,
        'id' => $name,
        'name' => $name
    );

    $finalAttributes = array_merge($defaultAttributes, $attributes);
    $content = getOptionGroup($options, $currentValue);

    return getElementHtml('select', $finalAttributes, $content);
}

function getCheckboxHtml($name, $currentValue, $attributes = array()) {
    $defaultAttributes = array(
        'type' => 'checkbox',
        'id' => $name,
        'name' => $name,
        'value' => isset($attributes['value']) ? $attributes['value'] : 'On'
    );

    $finalAttributes = array_merge($defaultAttributes, $attributes);
    if ($currentValue == $finalAttributes['value']) {
        $finalAttributes['checked'] = 'checked';
    }

    return getElementHtml('input', $finalAttributes, false);
}

function getButton($value, $output = null) {
    $escaped = false;
    $finalValue = $value[0] === '&' ? $value : htmlentities($value);
    if ($output === null) {
        $output = $value;
    } else {
        $escaped = true;
    }

    $code = '<input type="button" value="' . $finalValue . '" data-output="' . $output . '"' . ($escaped ? ' data-escaped="true"' : '') . ' />';
    return $code;
}

/**
 * Returns the fonts available for drawing.
 *
 * @return string[]
 */
function listfonts($folder) {
    $array = array();
    if (($handle = opendir($folder)) !== false) {
        while (($file = readdir($handle)) !== false) {
            if(substr($file, -4, 4) === '.ttf') {
                $array[$file] = $file;
            }
        }
    }
    closedir($handle);

    array_unshift($array, 'No Label');

    return $array;
}

/**
 * Returns the barcodes present for drawing.
 *
 * @return string[]
 */
function listbarcodes() {
    include_once('barcode.php');

    $availableBarcodes = array();
    foreach ($supportedBarcodes as $file => $title) {
        if (file_exists($file)) {
            $availableBarcodes[$file] = $title;
        }
    }

    return $availableBarcodes;
}

function findValueFromKey($haystack, $needle) {
    foreach ($haystack as $key => $value) {
        if (strcasecmp($key, $needle) === 0) {
            return $value;
        }
    }

    return null;
}
?>


text:
Memguard is a lightweight and extensible memory security and protection library for Java and Android applications.
Memguard protects your sensitive data in memory against memory editing software (Like trainers, GameGuardian in Android etc..).

### Installation
##### For Gradle
Add dependencies to your projects build.gradle file
```groovy
dependencies {
    compile 'com.tolpp.memguard:memguard:0.0.1'
    // compile 'com.tolpp.memguard:memguard-serializer-fst:0.0.1' // uncomment if you will use fst serializer
}
```

##### For Maven
Add dependencies to your projects pom.xml file.
```xml
<dependency>
    <groupId>com.tolpp.memguard</groupId>
    <artifactId>memguard</artifactId>
    <version>0.0.1</version>
</dependency>
```

### Simple Usage
```java
Guard<Integer> score = new Guard.Builder<Integer>().value(10).build();
score.set(20);
Integer unboxedInt = score.get();
```

### Customizing Serializer
New serializer can be given during creating builder.
```java
new Guard.Builder<String>()
    .serializer(FstSerializer.create())
    .build()
```

### Customizing Encoder
Encoders can be given via encoder factories to the builder. If you give more than one encoder,
Guard encodes serialized variable as same order as the your adding order of the encoder factories.

```java
new Guard.Builder<String>()
    .addEncoderFactory(RandomXorEncoderFactory.create())
    .addEncoderFactory(YourEncoderFactory.create())
    .build()
```

By default, memguard uses Java's default serializer as serializer and RandomXorEncoder as variable encoder.

### TODO's
- [x] Continuous integration
- [ ] Wiki page
- [x] Add project to maven central
- [ ] Add RSA Encryption encoder

### License
Apache 2.0

redpajama_set_name: RedPajamaGithub


text:
from django.contrib import admin

from . import models

class GoogleCalendarAdmin(admin.ModelAdmin):
    list_display = ('__str__', 'http_link')

admin.site.register(models.GoogleCalendar, GoogleCalendarAdmin)


text:
<?php

// No direct access
defined('_JEXEC') or die;
?>
<?php
$themes = T3Common::get_themes ();
$currthemes = preg_split('/,/', $this->getParam('themes'));
?>

<?php echo JText::_('CHANGE_THEMES')?>

  <?php foreach ($themes as $theme=>$themeinfo) : ?>
    <li class="theme theme-<?php echo str_replace('.','-',$theme).(in_array($theme, $currthemes)?'-active':'') ?>">
      <input type="checkbox" id="user_themes_<?php echo $theme ?>" name="user_themes" value="<?php echo $theme ?>" <?php echo in_array($theme, $currthemes)?'checked="checked"':'' ?> />
      <label for="user_themes_<?php echo $theme ?>" title="<?php echo $this->getInfo ($themeinfo, 'description')?$this->getInfo ($themeinfo, 'description'):$theme ?>">
        <?php echo $this->getInfo ($themeinfo, 'name')?$this->getInfo ($themeinfo, 'name'):$theme ?>

  <?php endforeach; ?>


text:
namespace net {
class X509Certificate;
}

namespace content {
class ResourceDispatcherHostLoginDelegate;
class ResourceLoaderDelegate;
class ResourceRequestInfoImpl;

// This class is responsible for driving the URLRequest (i.e., calling Start,
// Read, and servicing events).  It has a ResourceHandler, which is typically a
// chain of ResourceHandlers, and is the ResourceController for its handler.
class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate,
                                      public SSLErrorHandler::Delegate,
                                      public SSLClientAuthHandler::Delegate,
                                      public ResourceController {
 public:
  ResourceLoader(scoped_ptr<net::URLRequest> request,
                 scoped_ptr<ResourceHandler> handler,
                 ResourceLoaderDelegate* delegate);
  ~ResourceLoader() override;

  void StartRequest();
  void CancelRequest(bool from_renderer);

  void ReportUploadProgress();

  bool is_transferring() const { return is_transferring_; }
  void MarkAsTransferring();
  void CompleteTransfer();

  net::URLRequest* request() { return request_.get(); }
  ResourceRequestInfoImpl* GetRequestInfo();

  void ClearLoginDelegate();

  // IPC message handlers:
  void OnUploadProgressACK();

 private:
  // net::URLRequest::Delegate implementation:
  void OnReceivedRedirect(net::URLRequest* request,
                          const net::RedirectInfo& redirect_info,
                          bool* defer) override;
  void OnAuthRequired(net::URLRequest* request,
                      net::AuthChallengeInfo* info) override;
  void OnCertificateRequested(net::URLRequest* request,
                              net::SSLCertRequestInfo* info) override;
  void OnSSLCertificateError(net::URLRequest* request,
                             const net::SSLInfo& info,
                             bool fatal) override;
  void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override;
  void OnResponseStarted(net::URLRequest* request) override;
  void OnReadCompleted(net::URLRequest* request, int bytes_read) override;

  // SSLErrorHandler::Delegate implementation:
  void CancelSSLRequest(int error, const net::SSLInfo* ssl_info) override;
  void ContinueSSLRequest() override;

  // SSLClientAuthHandler::Delegate implementation.
  void ContinueWithCertificate(net::X509Certificate* cert) override;
  void CancelCertificateSelection() override;

  // ResourceController implementation:
  void Resume() override;
  void Cancel() override;
  void CancelAndIgnore() override;
  void CancelWithError(int error_code) override;

  void StartRequestInternal();
  void CancelRequestInternal(int error, bool from_renderer);
  // Stores the SignedCertificateTimestamps held in |sct_list| in the
  // SignedCertificateTimestampStore singleton, associated with |process_id|.
  // On return, |sct_ids| contains the assigned ID and verification status of
  // each SignedCertificateTimestamp.
  void StoreSignedCertificateTimestamps(
      const net::SignedCertificateTimestampAndStatusList& sct_list,
      int process_id,
      SignedCertificateTimestampIDStatusList* sct_ids);
  void CompleteResponseStarted();
  void StartReading(bool is_continuation);
  void ResumeReading();
  void ReadMore(int* bytes_read);
  // Passes a read result to the handler.
  void CompleteRead(int bytes_read);
  void ResponseCompleted();
  void CallDidFinishLoading();
  void RecordHistograms();

  bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; }

  // Used for categorizing loading of prefetches for reporting in histograms.
  // NOTE: This enumeration is used in histograms, so please do not add entries
  // in the middle.
  enum PrefetchStatus {
    STATUS_UNDEFINED,
    STATUS_SUCCESS_FROM_CACHE,
    STATUS_SUCCESS_FROM_NETWORK,
    STATUS_CANCELED,
    STATUS_MAX,
  };

  enum DeferredStage {
    DEFERRED_NONE,
    DEFERRED_START,
    DEFERRED_NETWORK_START,
    DEFERRED_REDIRECT,
    DEFERRED_READ,
    DEFERRED_RESPONSE_COMPLETE,
    DEFERRED_FINISH
  };
  DeferredStage deferred_stage_;

  scoped_ptr<net::URLRequest> request_;
  scoped_ptr<ResourceHandler> handler_;
  ResourceLoaderDelegate* delegate_;

  scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_;
  scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_;

  uint64 last_upload_position_;
  bool waiting_for_upload_progress_ack_;
  base::TimeTicks last_upload_ticks_;
  base::TimeTicks read_deferral_start_time_;

  // Indicates that we are in a state of being transferred to a new downstream
  // consumer.  We are waiting for a notification to complete the transfer, at
  // which point we'll receive a new ResourceHandler.
  bool is_transferring_;

  base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
};

}  // namespace content

#endif  // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_


text:
This is a Ruby on Rails hello world example app for [the Passenger application server](https://www.phusionpassenger.com/).

The `master` branch contains the code without Passenger installed.

The `end_result` branch contains the code with Passenger installed.

Run `git diff origin/master..origin/end_result` to see what's different.


text:
@implementation TopicModel

@end


text:
<?php

namespace PiApp\AdminBundle\DataFixtures\ORM;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use PiApp\AdminBundle\Entity\Page;
use PiApp\AdminBundle\Repository\PageRepository;

/**
 * Page DataFixtures.
 *
 * @category   Admin_DataFixtures
 * @package    ORM
 *
 * @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
 */
class PagesFixtures extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * Load language fixtures
     *
     * @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
     * @since 2012-01-23
     */
    public function load(ObjectManager $manager)
    {
        $field1 = new Page();
        $field1->setRouteName('home_page');
        $field1->setUrl('');
        $field1->setLayout($this->getReference('layout-pi-orchestra'));
        $field1->setUser($this->getReference('user-admin'));
        $field1->setMetaContentType(PageRepository::TYPE_TEXT_HTML);
        $field1->setCacheable(false);
        $field1->setLifetime("86400");
        $field1->setPublic(false);
        $field1->setEnabled(true);
        $manager->persist($field1);

        $field2 = new Page();
        $field2->setRouteName('error_404');
        $field2->setUrl('error');
        $field2->setLayout($this->getReference('layout-pi-error'));
        $field2->setUser($this->getReference('user-admin'));
        $field2->setMetaContentType(PageRepository::TYPE_TEXT_HTML);
        $field2->setCacheable(false);
        $field1->setLifetime("86400");
        $field2->setPublic(false);
        $field2->setEnabled(true);
        $manager->persist($field2);

        $manager->flush();

        $this->addReference('page-homepage', $field1);
        $this->addReference('page-error', $field2);
    }

    /**
     * Retrieve the order number of current fixture
     *
     * @return integer
     *
     * @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
     * @since 2012-01-23
     */
    public function getOrder()
    {
        // The order in which fixtures will be loaded
        return 3;
    }
}


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Tabs, Icon, Tooltip } from 'antd';
import _ from 'lodash';
import styles from './BuddyPanel.less';
import Conversation from './Conversation';
import OrganizationsContainer from '../containers/OrganizationsContainer';

const TabPane = Tabs.TabPane;

const getConversations = (userListInfo, historySessions, openSingleTalk) => {
  const sessionItems = historySessions.map((item) => {
    const key = item.fromUserId.low ? `${item.fromUserId.high}-${item.fromUserId.low}` : item.fromUserId;

    const userIndex = _.findIndex(userListInfo, user => _.isEqual(user.userId, item.fromUserId));
    const buddy = userListInfo[userIndex];

    const lastData = item.latestMsg.msgData;

    const utf8Buf = Buffer.from(lastData, 'base64');
    // console.log(utf8Buf.toString('base64').toString('base64'));
    let msgStr = '';
    try {
      msgStr = utf8Buf.toString('utf8');
    } catch (e) {
      console.warn(e.message);
      msgStr = '';
    }

    return {
      key,
      name: buddy.userNickName,
      history: msgStr,
      count: item.unReadCnt,
      onlineStatus: buddy.onlineStatus,
      openSesssion: () => { openSingleTalk(buddy); }
    };
  });

  return sessionItems.map(s =>
    <Conversation {...s} />
  );
};

class BuddyPanel extends Component {
  static propTypes = {
    allUsersInfo: PropTypes.shape({
      userListInfo: PropTypes.array
    }).isRequired,
    historySessions: PropTypes.arrayOf(PropTypes.shape({
      fromUserId: PropTypes.any,
      latestMsg: PropTypes.any.isRequired
    })).isRequired,
    openSingleTalk: PropTypes.func.isRequired
  };

  shouldComponentUpdate (nextProps) {
    const { allUsersInfo } = nextProps;
    const { userListInfo } = allUsersInfo;
    if (!userListInfo || userListInfo.length === 0) {
      return false;
    }
    return true;
  }
  /*
  componentDidUpdate () {
    const { allUsersInfo } = this.props;
    const { userListInfo } = allUsersInfo;
    // 已经接收到用户列表再做最新会话请求
    if (userListInfo && userListInfo.length > 0) {
      return (
loading
);
    }
  }
  */

  render () {
    const { historySessions, allUsersInfo, openSingleTalk } = this.props;
    const { userListInfo } = allUsersInfo;
    if (!userListInfo || userListInfo.length === 0) {
      return (

          <Icon type="loading" />

加载中...

      );
    }
    const conversationItems = getConversations(userListInfo, historySessions, openSingleTalk);
    return (

        <Tabs>
          <TabPane
            tab={
              <Tooltip title={'会话'}>
                <Icon type="message" />
              </Tooltip>
            }
            key="1"
          >
            {conversationItems}
          </TabPane>
          <TabPane
            tab={
              <Tooltip title={'联系人'}>
                <Icon type="user" />
              </Tooltip>
            }
            key="2"
          >
            <Tabs>
              <TabPane tab="组织构架" key="a1">
                <OrganizationsContainer />
              </TabPane>
              <TabPane tab="所属企业" key="a2" />
            </Tabs>
          </TabPane>
          <TabPane
            tab={
              <Tooltip title={'群组'}>
                <Icon type="team" />
              </Tooltip>
            }
            key="3"
          />
        </Tabs>

    );
  }
}

export default BuddyPanel;


text:
% Reference Card for Boost.Spirit 2.5.9
% Copyright (c) 2014 Richard Thomson. May be freely distributed.
% Created Friday, October 31, 2014
% Updated Tuesday, July 12, 2016
% Thanks to Joseph H. Silverman for his TeX reference card on which
% this reference card is based.
% Thanks to Stephen Gildea for the multicolumn macro package
% which Joseph Silverman modified from his GNU emacs reference card
% TeX is a trademark of the American Mathematical Society

%**start of header
\newcount\columnsperpage

% This file can be printed with 1, 2, or 3 columns per page (see below).
% [For 2 or 3 columns, you'll need 6 and 8 point fonts.]
% Specify how many you want here.  Nothing else needs to be changed.

\columnsperpage=3

% Smaller (97%) pdf file with horizontal offset 1.5in
% dvipdfm -l -m 0.97 -x 1.5in -o spirit-reference.pdf spirit-reference.dvi

% There are a couple extra sections included at the end of the document
% (after the \bye) that didn't fit into six columns.
% It would be nice to have additional sections covering:
% \hrules and \vrules, Registers
% \input and \output files (including \read, \write, \message)

% This reference card is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% This file is intended to be processed by plain TeX (TeX82).
%
% The final reference card has six columns, three on each side.
% This file can be used to produce it in any of three ways:
% 1 column per page
%    produces six separate pages, each of which needs to be reduced to 80%.
%    This gives the best resolution.
% 2 columns per page
%    produces three already-reduced pages.
%    You will still need to cut and paste.
% 3 columns per page
%    produces two pages which must be printed sideways to make a
%    ready-to-use 8.5 x 11 inch reference card.
%    For this you need a dvi device driver that can print sideways.
% Which mode to use is controlled by setting \columnsperpage above.
%
% Author:
%  Richard Thomson
%  Internet:  legalize@xmission.com
%  (based on a reference card by Joseph H. Silverman)
%  (reference card macros due to Stephen Gildea)

% History:
%  Version 1.0 - October 2014
%  Version 1.1 - July 2016

\def\versionnumber{1.0}  % Version of this reference card
\def\year{2016}
\def\month{July}
\def\version{\month\ \year\ v\versionnumber}

\def\shortcopyrightnotice{
\vskip 0pt plus 2 fill\begingroup\parskip=0pt\small
   \centerline{\copyright\ \number\year\ Richard Thomson,
   Permissions on back.  v\versionnumber}

Send comments and corrections to Richard Thomson,
$\langle$legalize@xmission.com$\rangle$

\endgroup}

\def\copyrightnotice{
\vskip 1ex plus 2 fill\begingroup\parskip=0pt\small
\centerline{Copyright \copyright\ \year\ Richard Thomson, \version}

Permission is granted to make and distribute copies of
this card provided the copyright notice and this permission notice
are preserved on all copies.

\endgroup}

% make \bye not \outer so that the \def\bye in the \else clause below
% can be scanned without complaint.
\def\bye{\par\vfill\supereject\end}

\newdimen\intercolumnskip
\newbox\columna
\newbox\columnb

\def\ncolumns{\the\columnsperpage}

\message{[\ncolumns\space
   column\if 1\ncolumns\else s\fi\space per page]}

\def\scaledmag#1{ scaled \magstep #1}

% This multi-way format was designed by Stephen Gildea
% October 1986.
\if 1\ncolumns
   \hsize 4in
   \vsize 10in
   \voffset -.7in
   \font\titlefont=\fontname\tenbf \scaledmag3
   \font\headingfont=\fontname\tenbf \scaledmag2
   \font\smallfont=\fontname\sevenrm
   \font\smallsy=\fontname\sevensy

   \footline{\hss\folio}
   \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
\else
   \hsize 3.2in
   \vsize 7.95in
   \hoffset -.75in
   \voffset -.745in
   \font\titlefont=cmbx10 \scaledmag2
   \font\headingfont=cmbx10 \scaledmag1
   \font\smallfont=cmr6
   \font\smallsy=cmsy6
   \font\eightrm=cmr8
   \font\eighti=cmmi8
   \font\eightsy=cmsy8
   \font\eightbf=cmbx8
   \font\eighttt=cmtt8
   \font\eightit=cmti8
   \font\eightsl=cmsl8
   \textfont0=\eightrm
   \textfont1=\eighti
   \textfont2=\eightsy
   \def\rm{\eightrm}
   \def\bf{\eightbf}
   \def\tt{\eighttt}
   \def\it{\eightit}
   \def\sl{\eightsl}
   \normalbaselineskip=.8\normalbaselineskip
   \normallineskip=.8\normallineskip
   \normallineskiplimit=.8\normallineskiplimit
   \normalbaselines\rm          %make definitions take effect

   \if 2\ncolumns
     \let\maxcolumn=b
     \footline{\hss\rm\folio\hss}
     \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
   \else \if 3\ncolumns
     \let\maxcolumn=c
     \nopagenumbers
   \else
     \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
     \errmessage{Illegal number of columns per page}
   \fi\fi

   \intercolumnskip=.46in
   \def\abc{a}
   \output={%
       % This next line is useful when designing the layout.
       %\immediate\write16{Column \folio\abc\space starts with \firstmark}
       \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
       \else\if a\abc
        \global\setbox\columna\columnbox \global\def\abc{b}
         %% in case we never use \columnb (two-column mode)
         \global\setbox\columnb\hbox to -\intercolumnskip{}
       \else
        \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
   \def\multicolumnformat{\shipout\vbox{\makeheadline
       \hbox{\box\columna\hskip\intercolumnskip
         \box\columnb\hskip\intercolumnskip\columnbox}
       \makefootline}\advancepageno}
   \def\columnbox{\leftline{\pagebody}}

   \def\bye{\par\vfill\supereject
     \if a\abc \else\null\vfill\eject\fi
     \if a\abc \else\null\vfill\eject\fi
     \end}
\fi

% ***** Verbatim typesetting *****

% Verbatim typesetting is done by
%    \verbatim"stuff to verbatim typeset"
% Any character can be used in place of ".
% E.g. \verbatim?stuff? or \verbatim|stuff|.  Cf. TeXbook pp.380-382

\def\uncatcodespecials{\def\do##1{\catcode`##1=12}\dospecials}
\def\setupverbatim{\tt%
\def\par{\leavevmode\endgraf}\catcode`\`=\active%
\obeylines\uncatcodespecials\obeyspaces}
\def\verbatim{\begingroup\setupverbatim\doverbatim}
\def\doverbatim#1{\def\next##1#1{##1\endgroup}\next}

\def\\{\verbatim}
\def\ds{\displaystyle}
\def\SPC{\quad} % space between symbol and command

\parindent 0pt
\parskip 1ex plus .5ex minus .5ex

\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}

\outer\def\newcolumn{\vfill\eject}

\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex minus.5ex}

%\outer\def\section#1{\par\filbreak
%  \vskip 1ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
%  \vskip 1ex plus 1ex minus .5ex}
\outer\def\section#1{\par\filbreak
   \vskip .75ex plus 1ex minus 2ex {\headingfont #1}\mark{#1}%
   \vskip .5ex plus .5ex minus .5ex}

\def\paralign{\vskip\parskip\halign}

\def\<#1>{$\langle${\rm #1}$\rangle$}

\def\begintext{\par\leavevmode\begingroup\parskip0pt\rm}
\def\endtext{\endgroup}

\def\unused{$unused$}

% ************  TEXT STARTS HERE **************************

\title{Boost.Spirit 2.5.9 Reference Card}

\section{Primitive Parsers}

% ***** Three Column Format *****
\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
%----------- 3 Column Data -------------------
\\|attr(a)|&Attribute&\\|A|\cr
\\|eoi|&End of Input&\unused\cr
\\|eol|&End of Line&\unused\cr
\\|eps|&Epsilon&\unused\cr
\\|eps(p)|&&\unused\cr
\\|symbols<Ch,T,Lookup>|&Symbol Table&\\|T|\cr
}

\section{Unary Parsers}

% ***** Three Column Format *****
\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
%----------- 3 Column Data -------------------
\\|&a|&And Predicate&\unused\cr
\\|!a|&Not Predicate&\unused\cr
\\|*a|&Zero or More&\\|vector<A>|\cr
\\|*u|&&\unused\cr
\\|-a|&Optional&\\|optional<A>|\cr
\\|-u|&&\unused\cr
\\|+a|&One or More&\\|vector<A>|\cr
\\|+u|&&\unused\cr
\\|attr_cast<T>(p)|&Attribute Cast&\\|T|\cr
}

\section{Binary Parsers}

% ***** Three Column Format *****
\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
%----------- 3 Column Data -------------------
\\|a - b|&Difference&\\|A|\cr
\\|u - b|&&\unused\cr
\\|a % b|&Separated List&\\|vector<A>|\cr
\\|u % b|&&\unused\cr
}

\section{N-ary Parsers}

% ***** Three Column Format *****
\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
%----------- 3 Column Data -------------------
\\/a | b/&Alternative&\\|variant<A, B>|\cr
\\/a | u/& &\\|optional<A>|\cr
\\/a | b | u/& &\\|optional<variant<A,B>>|\cr
\\/u | b/& &\\|optional<B>|\cr
\\/u | u/& &\unused\cr
\\/a | a/& &\\|A|\cr
\\|a > b|&Expect&\\|tuple<A,B>|\cr
\\|a > u|& &\\|A|\cr
\\|u > b|& &\\|B|\cr
\\|u > u|& &\unused\cr
\\|a > vA|& &\\|vector<A>|\cr
\\|vA > a|& &\\|vector<A>|\cr
\\|vA > vA|& &\\|vector<A>|\cr
\\|a ^ b|&Permute&\\|tuple<optional<A>,optional<B>>|\cr
\\|a ^ u|& &\\|optional<A>|\cr
\\|u ^ b|& &\\|optional<B>|\cr
\\|u ^ u|& &\unused\cr
\\|a >> b|&Sequence&\\|tuple<A,B>|\cr
\\|a >> u|& &\\|A|\cr
\\|u >> b|& &\\|B|\cr
\\|u >> u|& &\unused\cr
\\|a >> a|& &\\|vector<A>|\cr
\\|a >> vA|& &\\|vector<A>|\cr
\\|vA >> a|& &\\|vector<A>|\cr
\\|vA >> vA|& &\\|vector<A>|\cr
\\/a || b/&Sequence Or&\\|tuple<optional<A>,optional<B>>|\cr
\\/a || u/& &\\|optional<A>|\cr
\\/u || a/& &\\|optional<A>|\cr
\\/u || u/& &\unused\cr
\\/a || a/& &\\|vector<optional<A>>|\cr
}

\section{Nonterminal Parsers}

\paralign to\hsize{
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|rule<It,RT(A1,...,An),Skip,Loc>|&Rule&\\|RT|\cr
\\|rule<It>|& &\unused\cr
\\|rule<It,Skip>|& &\unused\cr
\\|rule<It,Loc>|& &\unused\cr
\\|rule<It,Skip,Loc>|& &\unused\cr
\\|grammar<It,RT(A1,...,An),Skip,Loc>|&Grammar&\\|RT|\cr
\\|grammar<It>|& &\unused\cr
\\|grammar<It,Skip>|& &\unused\cr
\\|grammar<It,Loc>|& &\unused\cr
\\|grammar<It,Skip,Loc>|& &\unused\cr
}

\section{Parser Directives}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|as<T>()[a]|&Atomic Assignment&\\|T|\cr
\\|expect[a]|&Expectation&\\|A|\cr
\\|expect[u]|&&\unused\cr
\\|hold[a]|&Hold Attribute&\\|A|\cr
\\|hold[u]|&&\unused\cr
\\|lexeme[a]|&Lexeme&\\|A|\cr
\\|lexeme[u]|&&\unused\cr
\\|matches[a]|&Matches&\\|bool|\cr
\\|no_case[a]|&Case Insensitive&\\|A|\cr
\\|no_case[u]|&&\unused\cr
\\|no_skip[a]|&No Skipping&\\|A|\cr
\\|no_skip[u]|&&\unused\cr
\\|omit[a]|&Omit Attribute&\unused\cr
\\|raw[a]|&Raw Iterators&\\|iterator_range<It>|\cr
\\|raw[u]|&&\unused\cr
\\|repeat[a]|&Repeat&\\|vector<A>|\cr
\\|repeat[u]|&&\unused\cr
\\|repeat(n)[a]|&&\\|vector<A>|\cr
\\|repeat(n)[u]|&&\unused\cr
\\|repeat(min,max)[a]|&&\\|vector<A>|\cr
\\|repeat(min,max)[u]|&&\unused\cr
\\|repeat(min,inf)[a]|&&\\|vector<A>|\cr
\\|repeat(min,inf)[u]|&&\unused\cr
\\|skip[a]|&Skip Whitespace&\\|A|\cr
\\|skip[u]|&&\unused\cr
\\|skip(p)[a]|&&\\|A|\cr
\\|skip(p)[u]|&&\unused\cr
}

\section{Semantic Actions}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|p[fa]|&Apply Semantic Action&\\|A|\cr
\\|p[|$phoenix$ $lambda$\\|]|&&\\|A|\cr
}

\paralign to\hsize{%
#\hfil\cr
\\|template<typename Attrib>|\cr
\\|void fa(Attrib& attr);|\cr
\cr
\\|template<typename Attrib, typename Context>|\cr
\\|void fa(Attrib& attr, Context& context);|\cr
\cr
\\|template<typename Attrib, typename Context>|\cr
\\|void fa(Attrib& attr, Context& context, bool& pass);|\cr
}

\section{Phoenix Placeholders}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|_1|, \\|_2|, $\dots$, \\|_N|&Nth Attribute of \\|p|\cr
\\|_val|&Enclosing rule's synthesized attribute\cr
\\|_r1|, \\|_r2|, $\dots$, \\|_rN|&Enclosing rule's Nth inherited
attribute.\cr
\\|_a|, \\|_b|, $\dots$, \\|_j|&Enclosing rule's local variables.\cr
\\|_pass|&Assign \\|false| to \\|_pass| to force failure.\cr
}

\section{Iterator Parser API}

\paralign to \hsize{#\cr
\\|bool parse<It, Exp>(|\cr
\\|    It& first, It last, Exp const& expr);|\cr
\\|bool parse<It, Exp, A1, ..., An>(|\cr
\\|    It& first, It last, Exp const& expr,|\cr
\\|    A1& a1, ..., An& an);|\cr
\\|bool phrase_parse<It, Exp, Skipper>(|\cr
\\|    It& first, It last, Exp const& expr,|\cr
\\|    Skipper const& skipper,|\cr
\\|    skip_flag post_skip = postskip);|\cr
\\|bool phrase_parse<It, Exp, Skipper, A1, ..., An>(|\cr
\\|    It& first, It last, Exp const& expr,|\cr
\\|    Skipper const& skipper,|\cr
\\|    A1& a1, ..., An& an);|\cr
\\|bool phrase_parse<It, Exp, Skipper, A1, ..., An>(|\cr
\\|    It& first, It last, Exp const& expr,|\cr
\\|    Skipper const& skipper,|\cr
\\|    skip_flag post_skip,|\cr
\\|    A1& a1, ..., An& an);|\cr
}

\section{Stream Parser API}

\paralign to\hsize{#\cr
$unspecified$\\| match<Exp>(Exp const& expr);|\cr
$unspecified$\\| match<Exp, A1, ..., An>(|\cr
\\|    Exp const& expr,|\cr
\\|    A1& a1, ..., An& an);|\cr
$unspecified$\\| phrase_match<Exp, Skipper>(|\cr
\\|    Exp const& expr,|\cr
\\|    Skipper const& skipper,|\cr
\\|    skip_flag post_skip = postskip);|\cr
$unspecified$\\| phrase_match<Exp, Skipper, A1, ..., An>(|\cr
\\|    Exp const& expr,|\cr
\\|    Skipper const& skipper,|\cr
\\|    skip_flag post_skip,|\cr
\\|    A1& a1, ..., An& an);|\cr
}

\shortcopyrightnotice

\section{Binary Value Parsers}

% ***** Three Column Format *****
\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|byte_|&Native Byte&\\|uint_least8_t|\cr
\\|byte_(b)|&&\unused\cr
\\|word|&Native Word&\\|uint_least16_t|\cr
\\|word(w)|&&\unused\cr
\\|dword|&Native Double Word&\\|uint_least32_t|\cr
\\|dword(dw)|&&\unused\cr
\\|qword|&Native Quad Word&\\|uint_least64_t|\cr
\\|qword(qw)|&&\unused\cr
\\|bin_float|&Native Float&\\|float|\cr
\\|bin_float(f)|&&\unused\cr
\\|bin_double|&Native Double&\\|double|\cr
\\|bin_double(d)|&&\unused\cr
\\|little_|$item$&Little Endian $item$&as above\cr
\\|little_|$item$\\|(w)|&&\unused\cr
\\|big_|$item$&Big Endian $item$&as above\cr
\\|big_|$item$\\|(w)|&&\unused\cr
}

\section{Character Encodings}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|ascii|&7-bit ASCII\cr
\\|iso8859_1|&ISO 8859-1\cr
\\|standard|&Using \\|<cctype>|\cr
\\|standard_wide|&Using \\|<cwctype>|\cr
}

\section{Character Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|c|&Character Literal&\unused\cr
\\|lit(c)|&&\unused\cr
\\|ns::char_|&Any Character&\\|ns::char_type|\cr
\\|ns::char_(c)|&Character Value&\\|ns::char_type|\cr
\\|ns::char_(f,l)|&Character Range&\\|ns::char_type|\cr
\\|ns::char_(str)|&Any Character in String&\\|ns::char_type|\cr
\\|~cp|&Characters not in \\|cp|&Attribute of \\|cp|\cr
}

\section{Character Class Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|ns::alnum|&Letters or Digits&\\|ns::char_type|\cr
\\|ns::alpha|&Alphabetic&\\|ns::char_type|\cr
\\|ns::blank|&Spaces or Tabs&\\|ns::char_type|\cr
\\|ns::cntrl|&Control Characters&\\|ns::char_type|\cr
\\|ns::digit|&Numeric Digits&\\|ns::char_type|\cr
\\|ns::graph|&Non-space Printing Characters&\\|ns::char_type|\cr
\\|ns::lower|&Lower Case Letters&\\|ns::char_type|\cr
\\|ns::print|&Printing Characters&\\|ns::char_type|\cr
\\|ns::punct|&Punctuation&\\|ns::char_type|\cr
\\|ns::space|&White Space&\\|ns::char_type|\cr
\\|ns::upper|&Upper Case Letters&\\|ns::char_type|\cr
\\|ns::xdigit|&Hexadecimal Digits&\\|ns::char_type|\cr
}

\section{String Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|str|&String Literal&\unused\cr
\\|lit(str)|&&\unused\cr
\\|ns::string("str")|&String&\\|basic_string<char>|\cr
\\|ns::string(L"str")|&&\\|basic_string<wchar_t>|\cr
}

\section{Unsigned Integer Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|lit(num)|&Integer Literal&\unused\cr
\\|ushort_|&Short&\\|unsigned short|\cr
\\|ushort_(num)|&Short Value&\\|unsigned short|\cr
\\|uint_|&Integer&\\|unsigned int|\cr
\\|uint_(num)|&Integer Value&\\|unsigned int|\cr
\\|ulong_|&Long&\\|unsigned long|\cr
\\|ulong_(num)|&Long Value&\\|unsigned long|\cr
\\|ulong_long|&Long Long&\\|unsigned long long|\cr
\\|ulong_long(num)|&Long Long Value&\\|unsigned long long|\cr
\\|bin|&Binary Integer&\\|unsigned int|\cr
\\|bin(num)|&Binary Integer Value&\\|unsigned int|\cr
\\|oct|&Octal Integer&\\|unsigned int|\cr
\\|oct(num)|&Octal Integer Value&\\|unsigned int|\cr
\\|hex|&Hexadecimal Integer&\\|unsigned int|\cr
\\|hex(num)|&Hex Integer Value&\\|unsigned int|\cr
}

\section{Generalized Unsigned Integer Parser}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|uint_parser<T,Radix,MinDigits,MaxDigits>|&\\|T|\cr
\\|uint_parser<T,Radix,MinDigits,MaxDigits>(num)|&\\|T|\cr
}

\section{Signed Integer Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|lit(num)|&Integer Literal&\unused\cr
\\|short_|&Short&\\|short|\cr
\\|short_(num)|&Short Value&\\|short|\cr
\\|int_|&Integer&\\|int|\cr
\\|int_(num)|&Integer Value&\\|int|\cr
\\|long_|&Long&\\|long|\cr
\\|long_(num)|&Long Value&\\|long|\cr
\\|long_long|&Long Long&\\|long long|\cr
\\|long_long(num)|&Long Long Value&\\|long long|\cr
}

\section{Generalized Signed Integer Parser}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|int_parser<T,Radix,MinDigits,MaxDigits>|&\\|T|\cr
\\|int_parser<T,Radix,MinDigits,MaxDigits>(num)|&\\|T|\cr
}

\section{Real Number Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|lit(num)|&Real Number Literal&\unused\cr
\\|float_|&Float&\\|float|\cr
\\|float_(num)|&Float Value&\\|float|\cr
\\|double_|&Double&\\|double|\cr
\\|double_(num)|&Double Value&\\|double|\cr
\\|long_double|&Long Double&\\|long double|\cr
\\|long_double(num)|&Long Double Value&\\|long double|\cr
}

\section{Generalized Real Number Parser}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|real_parser<T,RealPolicies>|&\\|T|\cr
\\|real_parser<T,RealPolicies>(num)|&\\|T|\cr
}

\section{Boolean Parsers}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|lit(boolean)|&Boolean Literal&\unused\cr
\\|false_|&Match ``\\|false|''&\\|bool|\cr
\\|true_|&Match ``\\|true|''&\\|bool|\cr
\\|bool_|&Boolean&\\|bool|\cr
\\|bool_(boolean)|&Boolean Value&\\|bool|\cr
}

\section{Generalized Boolean Parser}

\paralign to\hsize{%
#\hfil\SPC\tabskip=0pt plus 1 fil
&#\hfil\cr
\\|bool_parser<T,BoolPolicies>|&\\|T|\cr
\\|bool_parser<T,BoolPolicies>(boolean)|&\\|T|\cr
}

\copyrightnotice

\bye


text:
    #script directory
    $myRunDirectory = $PSScriptRoot;
    $myConfigFile = $myRunDirectory+"\backup.config"
    #Parameters form backup.config - xml file
	if( -Not (Test-Path -Path $myConfigFile ) )
	{
	    write-host "Config file  $myConfigFile missing. Create it!" -ForegroundColor "DarkRed";
		exit 1;
	}
	[xml]$config = Get-Content "$myRunDirectory\backup.config";

    #commonSettings Section
	$backupDirectory = $config.configuration.commonSettings.backupDirectory;
    $backL4S = $backupDirectory+"\application";
	$backDB = $backupDirectory+"\database";
	[int]$DayOfRun = $config.configuration.commonSettings.dayOfRun;
	[int]$Days = $config.configuration.commonSettings.delOlderAs;
	$compress = $config.configuration.dbSettings.compressDBbackup;
	if($compress.ToUpper() -eq "YES") { $CompressDbBackup=$true } else { $CompressDbBackup=$false }

    #dbSettings section
    $dbSettingsSection = $config.GetElementsByTagName("dbSettings");
    $databasesArray = $dbSettingsSection.GetElementsByTagName("database");
	$DBServer=$config.configuration.dbSettings.databaseServer;

    #appSettings section
    $appSettings = $config.GetElementsByTagName("appSettings");
    $applicationValues = $appSettings.GetElementsByTagName("add");

	#variable
	$date = Get-Date -Format yyyyMMddHHmmss;
	$dayOfWeek = [Int] (Get-Date).DayOfWeek;

#Region Functions
function CheckBackupDirectory(){
	# Test if backup dir Exist if not create
	if( -Not (Test-Path -Path $backL4S ) )
	{
	    New-Item -ItemType directory -Path $backL4S;
	}

	if( -Not (Test-Path -Path $backDB ) )
	{
	    New-Item -ItemType directory -Path $backDB;
	}
}

function BackupApplication(){
	foreach ($app in $applicationValues)
	{
         $appName = $app.Key +"_archive_$($date).zip";
         $appPath = $app.Value;
         $archiveName="$($backL4S)\$($appName)";
         if( Test-Path -Path $appPath )
	      {
            Compress-Archive -Path $appPath -DestinationPath $archiveName;
          }
	}
}
function DatabaseFullBackup(){
	foreach ($db in $databasesArray){
      $dbname = $db.InnerXML;
	  Backup-SqlDatabase -ServerInstance $DBServer -Database $dbname -BackupFile "$($backDB)\$($dbname)_db_$($date).bak"
	}

}

function DatabaseIncBackup(){
 #differntial backup of application database
	foreach ($db in $databasesArray){
      $dbname = $db.InnerXML;
	  if ($dbname.ToUpper() -ne "MASTER" -and $dbname.ToUpper() -ne "MSDB" -and $dbname.ToUpper() -ne "MODEL") {
		 Backup-SqlDatabase -ServerInstance $DBServer -Incremental $dbname -BackupFile "$($backDB)\$($dbname)_db_$($date).inc"
	  }
	}
}

function CompressDbBackup(){
#Create zip from db backup
    $DB_ArchiveNameBAK="DB_FULL_archive_$($date).zip";
	$DB_ArchiveNameINC="DB_INC_archive_$($date).zip";
	$archiveName="$($backDB)\$($DB_ArchiveNameBAK)";
	$backDBfile="$($backDB)\*.bak";
	$files = Get-ChildItem -Path $backDBfile;
	if ( $files.count -gt 0 ) {Compress-Archive -Path $backDBfile -DestinationPath $archiveName;}

	$archiveName="$($backDB)\$($DB_ArchiveNameINC)";
	$backDBfile="$($backDB)\*.inc";
	$files = Get-ChildItem -Path $backDBfile;
	if ( $files.count -gt 0 ) {Compress-Archive -Path $backDBfile -DestinationPath $archiveName;}

	$backDBfile="$($backDB)\*.[bi][an][kc]";
	$files = Get-ChildItem -Path $backDBfile;

	foreach ($file in $files)
			{
				write-host "Deleting File $file" -ForegroundColor "DarkRed"
				Remove-Item $file.FullName | out-null
			}

}
function DeleteOldFiles([string]$delPath){
    #----- get files from DB backup #
	$Now = Get-Date;
	$Extension = "*.[bz][ai][kp]";
	$LastWrite = $Now.AddDays(-$Days)
	$Files = Get-Childitem $delPath -Include $Extension -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}
	foreach ($File in $Files)
		{
		if ($File -ne $NULL)
			{
			write-host "Deleting File $File" -ForegroundColor "DarkRed";
			Remove-Item $File.FullName | out-null;
			}
		else
			{
			Write-Host "No more files to delete!" -foregroundcolor "Green";
			}
		}
}
#end region

# ******* MAIN ******
# Full Backup Database # in saturday full backup #check if exist some backup

    CheckBackupDirectory;
	$filesDB = Get-ChildItem -Path "$($backDB)\*.[bz][ai][kp]";
	$filesAPP = Get-ChildItem -Path "$($backL4S)\*.zip";

	if (( $dayOfWeek -eq $DayOfRun ) -or (( $filesAPP.count -eq 0 ) -and ( $filesDB.count -eq 0 ))) {
		BackupApplication;
		DatabaseFullBackup;
		if ($CompressDbBackup){	CompressDbBackup }
		DeleteOldFiles $backL4S;
		DeleteOldFiles $backDB;
	} else {
		DatabaseIncBackup;
	}

    exit 0;


text:
#ifndef LOG2PLOT_LOGGER_H_
#define LOG2PLOT_LOGGER_H_

#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <log2plot/container.h>
#include <cmath>
#include <sstream>
#include <assert.h>

namespace log2plot
{

// legend for a number of points (x_i,y_i)
std::string legend2DPoint(const unsigned int &n=4);

// legend for a fully connected graph of n points
std::string legendFullyConnected(const uint n);

// legend for a fully disconnected graph of n points
std::string legendFullyDisconnected(const uint n);

// Close all files and call the Python interpreter on the given script path
inline void closePreviousPlots()
{
  [[maybe_unused]] const auto out = system("killall log2plot -q");
}

// Builds YAML-proof single-lined matrix
template<class Coord>
static std::string toYAMLVector(const std::vector<Coord> &M)
{
  std::stringstream ss;
  unsigned int i,j;
  ss << "[";
  for(i=0;i<M.size();++i)
  {
    ss << "[";
    for(j=0;j<M[i].size()-1;++j)
      ss << M[i][j] << ", ";
    ss << M[i][j] << "]";
    if(i != M.size()-1)
      ss << ",";
  }
  ss << "]";
  return ss.str();
}

const double nan = std::nan("");

template<class T>
void setNaN(T& v, uint start = 0, uint end = 0)
{
  if(start == 0 && end == 0)
    end = v.size();
  for(uint i = start; i < end; ++i)
    v.operator[](i) = nan;
}

class Logger
{
protected:

  std::string file_path;

  // related to high-level functions
  unsigned int buff, subsamp, buff_count = 0, iter_count = 0;
  double * time{};
  std::string time_unit = "s";
  std::vector<double> time_buff;
  std::vector<double> steps, steps_timed;
  std::vector<std::vector<uint>> grouped_vars;

  // logger variables and pointer to the last entered
  std::vector<std::unique_ptr<GenericContainer> > logged_vars;
  GenericContainer* last{};

  bool first_update = true;
  uint nb_fixed_objects = 0;

  // write initial information in latest saved variable
  void writeInitialInfo(const std::string &name, const std::string &legend, const std::string &xlabel, const std::string &ylabel, const bool &keep_file);

  // build explicit legend from implicit
  static std::string buildLegend(const std::string &legend, const unsigned int len);

  // calls python to plot this / these files
  void plotFiles(const std::string &script_path, const std::vector<std::string> &files, bool verbose, bool display);

public:
  // constructor with default values
  Logger(std::string _file_path = "", unsigned int _buffer = 10, unsigned int _subsampling = 1)
    :  file_path(_file_path), buff(_buffer), subsamp(_subsampling)
  {
    logged_vars.clear();
    steps.clear();
    steps_timed.clear();
  }

  ~Logger()
  {
    for(auto &var: logged_vars)
      var->close(steps, steps_timed);
  }

  // **** Parameter methods ****

  // Set pointer to time variable
  inline void setTime(double &t, const std::string &unit = "s") {time = &t;time_unit = unit;}
  // number of calls before flushing to file
  inline void setBuffer(unsigned int b) {buff = b;}
  // if any subsampling
  inline void setSubSampling(unsigned int s) {subsamp = s;}
  // path to files to be saved, can include any prefix for files
  inline void setSavePath(std::string _file_path) {file_path = _file_path;}

  // **** Functions to add new variables to be saved ****

  // Save iteration-based vector
  template<class T>
  inline void save(T &v, const std::string &name, const std::string &legend, const std::string &ylabel, bool keep_file = true)
  {
    // add this to logged variables
    logged_vars.push_back(std::make_unique<Container<T>>(LogType::ITERATION, v));
    // and write initial info
    writeInitialInfo(name, buildLegend(legend, v.size()), "iterations", ylabel, keep_file);
  }

  // Save time-based vector
  template<class T>
  inline void saveTimed(T &v, const std::string &name, const std::string &legend, const std::string &ylabel, bool keep_file = true)
  {
    // add this to logged variables
    logged_vars.push_back(std::make_unique<Container<T>>(LogType::TIME, v));
    // and write initial info
    writeInitialInfo(name, buildLegend(legend, v.size()), "time [" + time_unit + "]", ylabel, keep_file);
  }

  // Save XY vector
  template<class T>
  inline void saveXY(T &v, const std::string &name, const std::string &legend, const std::string &xlabel, const std::string &ylabel, bool keep_file = true)
  {
    // add this to logged variables
    logged_vars.push_back(std::make_unique<Container<T>>(LogType::XY, v));
    // and write initial info
    writeInitialInfo(name, buildLegend(legend, v.size()/2), xlabel, ylabel, keep_file);
  }

  // Save 3D pose or position
  template<class T>
  inline void save3Dpose(T &v, const std::string &name, const std::string &legend, bool invert = false, bool keep_file = true)
  {
    assert(v.size() == 3 || v.size() == 6);
    // add this to logged variables
    logged_vars.push_back(std::make_unique<Container<T>>(LogType::POSE, v));
    // and write initial info
    writeInitialInfo(name, "["+legend+"]", "", "", keep_file);
    if(invert)
      last->writeInfo("invertPose", "True");
  }

  // **** End functions for new variables ****

  // tells to plot the next n added variables in the same plot
  void regroupNext(uint n)
  {
    const auto idx = static_cast<uint>(logged_vars.size());
    grouped_vars.push_back({});
    for(uint i = 0; i < n; ++i)
      grouped_vars.back().push_back(idx + i);
  }

  // **** Functions to specify metadata for the last registered variable ****

  // Units
  void setUnits(const std::string units) {last->writeInfo("units", units);}
  // Line types
  void setLineType(const std::string lineType) {last->writeInfo("lineType", lineType);}

  // Dashed steps
  void setSteps(std::vector<double> _steps)
  {
    last->setSteps(_steps);
  }

  // standard arguments
  void setPlotArgs(std::string args)
  {
    last->writeInfo("args", args);
  }

  // 3D plot: show camera
  void showMovingCamera(const std::vector<double> &desired_pose = {},const double &x = 1.5, const double &y = 1, const double &z = 4);
  // 3D plot: show box
  void showMovingBox(const double &x = 10, const double &y = 5, const double &z = 3, const std::vector<double> &desired_pose = {});
  // 3D plot: custom object with a (nx3) matrix
  virtual void showMovingObject(const std::vector<std::vector<double>> &M, const std::string &graph, const std::vector<double> &desired_pose = {});
  // 3D plot: fixed 3D-box
  void showFixedBox(const double &xm, const double &ym, const double &zm, const double &xM, const double &yM, const double &zM, const std::string &color = "");
  // 3D plot: fixed 2D-rectangle on Z=0
  void showFixedRectangle(const double &xm, const double &ym, const double &xM, const double &yM, const std::string &color = "");
  // 3D plot: any fixed object from a list of 3D coordinates (related to object frame)
  template <class Point3D>
  void showFixedObject(const std::vector<Point3D> &M, const std::string &graph, const std::string &color = "")
  {
    std::stringstream ss;
    ss << "fixedObject" << ++nb_fixed_objects;
    last->writeInfo(ss.str(), "");
    last->writeInfo("    nodes", toYAMLVector(M));
    last->writeInfo("    graph", graph);
    if(color!="")
      last->writeInfo("    color", color);
  }
  virtual void showFixedObject(const std::vector<std::vector<double>> &M, const std::string &graph, const std::string &color = "")
  {
    showFixedObject<std::vector<double>>(M, graph, color);
  }

  // **** End metadata functions ****

  // Add a current moment for all iteration or time-based plots
  void writeStep()
  {
    steps.push_back(iter_count / subsamp);
    if(time)
      steps_timed.push_back(*time);
  }

  // add several time-steps for all iteration or time-based plots
  void writeStepsAll(std::vector<double> _iterations, std::vector<double> _times = {})
  {
    steps = _iterations;
    steps_timed = _times;
  }

  // Updates all saved variables
  virtual void update(const bool &flush = false);

  // Low-level static functions
  // Build 3D box nodes depending on dimensions
  static std::vector<std::vector<double> > buildBoxNodes(const double &xm, const double &ym, const double &zm, const double &xM, const double &yM, const double &zM);

  void plot(const std::string &script_path, bool verbose = false, bool display = true);
  void plot(bool verbose = false, bool display = true);

  // Close all files and call interpreter without actual plotting
  void generateFigures(const std::string &script_path, bool verbose = false)
  {
    plot(script_path, verbose, false);
  }
  void generateFigures(bool verbose = false)
  {
    plot(verbose, false);
  }

};
}

#endif /* LOG2PLOTLOGGER_H_ */


text:
module Spree
  module Api
    module Ams
      class OrdersController < Spree::Api::OrdersController
        include Serializable
        include Requestable
      end
    end
  end
end


text:
package iptables

import (
	"bytes"
	"fmt"
	"io"
	"net"
	"os/exec"
	"regexp"
	"strconv"
	"strings"
	"syscall"
)

// Adds the output of stderr to exec.ExitError
type Error struct {
	exec.ExitError
	cmd        exec.Cmd
	msg        string
	exitStatus *int //for overriding
}

func (e *Error) ExitStatus() int {
	if e.exitStatus != nil {
		return *e.exitStatus
	}
	return e.Sys().(syscall.WaitStatus).ExitStatus()
}

func (e *Error) Error() string {
	return fmt.Sprintf("running %v: exit status %v: %v", e.cmd.Args, e.ExitStatus(), e.msg)
}

// IsNotExist returns true if the error is due to the chain or rule not existing
func (e *Error) IsNotExist() bool {
	return e.ExitStatus() == 1 &&
		(e.msg == "iptables: Bad rule (does a matching rule exist in that chain?).\n" ||
			e.msg == "iptables: No chain/target/match by that name.\n")
}

// Protocol to differentiate between IPv4 and IPv6
type Protocol byte

const (
	ProtocolIPv4 Protocol = iota
	ProtocolIPv6
)

type IPTables struct {
	path           string
	proto          Protocol
	hasCheck       bool
	hasWait        bool
	hasRandomFully bool
	v1             int
	v2             int
	v3             int
	mode           string // the underlying iptables operating mode, e.g. nf_tables
}

// New creates a new IPTables.
// For backwards compatibility, this always uses IPv4, i.e. "iptables".
func New() (*IPTables, error) {
	return NewWithProtocol(ProtocolIPv4)
}

// New creates a new IPTables for the given proto.
// The proto will determine which command is used, either "iptables" or "ip6tables".
func NewWithProtocol(proto Protocol) (*IPTables, error) {
	path, err := exec.LookPath(getIptablesCommand(proto))
	if err != nil {
		return nil, err
	}
	vstring, err := getIptablesVersionString(path)
	v1, v2, v3, mode, err := extractIptablesVersion(vstring)

	checkPresent, waitPresent, randomFullyPresent := getIptablesCommandSupport(v1, v2, v3)

	ipt := IPTables{
		path:           path,
		proto:          proto,
		hasCheck:       checkPresent,
		hasWait:        waitPresent,
		hasRandomFully: randomFullyPresent,
		v1:             v1,
		v2:             v2,
		v3:             v3,
		mode:           mode,
	}
	return &ipt, nil
}

// Proto returns the protocol used by this IPTables.
func (ipt *IPTables) Proto() Protocol {
	return ipt.proto
}

// Exists checks if given rulespec in specified table/chain exists
func (ipt *IPTables) Exists(table, chain string, rulespec ...string) (bool, error) {
	if !ipt.hasCheck {
		return ipt.existsForOldIptables(table, chain, rulespec)

	}
	cmd := append([]string{"-t", table, "-C", chain}, rulespec...)
	err := ipt.run(cmd...)
	eerr, eok := err.(*Error)
	switch {
	case err == nil:
		return true, nil
	case eok && eerr.ExitStatus() == 1:
		return false, nil
	default:
		return false, err
	}
}

// Insert inserts rulespec to specified table/chain (in specified pos)
func (ipt *IPTables) Insert(table, chain string, pos int, rulespec ...string) error {
	cmd := append([]string{"-t", table, "-I", chain, strconv.Itoa(pos)}, rulespec...)
	return ipt.run(cmd...)
}

// Append appends rulespec to specified table/chain
func (ipt *IPTables) Append(table, chain string, rulespec ...string) error {
	cmd := append([]string{"-t", table, "-A", chain}, rulespec...)
	return ipt.run(cmd...)
}

// AppendUnique acts like Append except that it won't add a duplicate
func (ipt *IPTables) AppendUnique(table, chain string, rulespec ...string) error {
	exists, err := ipt.Exists(table, chain, rulespec...)
	if err != nil {
		return err
	}

	if !exists {
		return ipt.Append(table, chain, rulespec...)
	}

	return nil
}

// Delete removes rulespec in specified table/chain
func (ipt *IPTables) Delete(table, chain string, rulespec ...string) error {
	cmd := append([]string{"-t", table, "-D", chain}, rulespec...)
	return ipt.run(cmd...)
}

// List rules in specified table/chain
func (ipt *IPTables) List(table, chain string) ([]string, error) {
	args := []string{"-t", table, "-S", chain}
	return ipt.executeList(args)
}

// List rules (with counters) in specified table/chain
func (ipt *IPTables) ListWithCounters(table, chain string) ([]string, error) {
	args := []string{"-t", table, "-v", "-S", chain}
	return ipt.executeList(args)
}

// ListChains returns a slice containing the name of each chain in the specified table.
func (ipt *IPTables) ListChains(table string) ([]string, error) {
	args := []string{"-t", table, "-S"}

	result, err := ipt.executeList(args)
	if err != nil {
		return nil, err
	}

	// Iterate over rules to find all default (-P) and user-specified (-N) chains.
	// Chains definition always come before rules.
	// Format is the following:
	// -P OUTPUT ACCEPT
	// -N Custom
	var chains []string
	for _, val := range result {
		if strings.HasPrefix(val, "-P") || strings.HasPrefix(val, "-N") {
			chains = append(chains, strings.Fields(val)[1])
		} else {
			break
		}
	}
	return chains, nil
}

// Stats lists rules including the byte and packet counts
func (ipt *IPTables) Stats(table, chain string) ([][]string, error) {
	args := []string{"-t", table, "-L", chain, "-n", "-v", "-x"}
	lines, err := ipt.executeList(args)
	if err != nil {
		return nil, err
	}

	appendSubnet := func(addr string) string {
		if strings.IndexByte(addr, byte('/')) < 0 {
			if strings.IndexByte(addr, '.') < 0 {
				return addr + "/128"
			}
			return addr + "/32"
		}
		return addr
	}

	ipv6 := ipt.proto == ProtocolIPv6

	rows := [][]string{}
	for i, line := range lines {
		// Skip over chain name and field header
		if i < 2 {
			continue
		}

		// Fields:
		// 0=pkts 1=bytes 2=target 3=prot 4=opt 5=in 6=out 7=source 8=destination 9=options
		line = strings.TrimSpace(line)
		fields := strings.Fields(line)

		// The ip6tables verbose output cannot be naively split due to the default "opt"
		// field containing 2 single spaces.
		if ipv6 {
			// Check if field 6 is "opt" or "source" address
			dest := fields[6]
			ip, _, _ := net.ParseCIDR(dest)
			if ip == nil {
				ip = net.ParseIP(dest)
			}

			// If we detected a CIDR or IP, the "opt" field is empty.. insert it.
			if ip != nil {
				f := []string{}
				f = append(f, fields[:4]...)
				f = append(f, "  ") // Empty "opt" field for ip6tables
				f = append(f, fields[4:]...)
				fields = f
			}
		}

		// Adjust "source" and "destination" to include netmask, to match regular
		// List output
		fields[7] = appendSubnet(fields[7])
		fields[8] = appendSubnet(fields[8])

		// Combine "options" fields 9... into a single space-delimited field.
		options := fields[9:]
		fields = fields[:9]
		fields = append(fields, strings.Join(options, " "))
		rows = append(rows, fields)
	}
	return rows, nil
}

func (ipt *IPTables) executeList(args []string) ([]string, error) {
	var stdout bytes.Buffer
	if err := ipt.runWithOutput(args, &stdout); err != nil {
		return nil, err
	}

	rules := strings.Split(stdout.String(), "\n")

	// strip trailing newline
	if len(rules) > 0 && rules[len(rules)-1] == "" {
		rules = rules[:len(rules)-1]
	}

	// nftables mode doesn't return an error code when listing a non-existent
	// chain. Patch that up.
	if len(rules) == 0 && ipt.mode == "nf_tables" {
		v := 1
		return nil, &Error{
			cmd:        exec.Cmd{Args: args},
			msg:        "iptables: No chain/target/match by that name.",
			exitStatus: &v,
		}
	}

	for i, rule := range rules {
		rules[i] = filterRuleOutput(rule)
	}

	return rules, nil
}

// NewChain creates a new chain in the specified table.
// If the chain already exists, it will result in an error.
func (ipt *IPTables) NewChain(table, chain string) error {
	return ipt.run("-t", table, "-N", chain)
}

// ClearChain flushed (deletes all rules) in the specified table/chain.
// If the chain does not exist, a new one will be created
func (ipt *IPTables) ClearChain(table, chain string) error {
	err := ipt.NewChain(table, chain)

	// the exit code for "this table already exists" is different for
	// different iptables modes
	existsErr := 1
	if ipt.mode == "nf_tables" {
		existsErr = 4
	}

	eerr, eok := err.(*Error)
	switch {
	case err == nil:
		return nil
	case eok && eerr.ExitStatus() == existsErr:
		// chain already exists. Flush (clear) it.
		return ipt.run("-t", table, "-F", chain)
	default:
		return err
	}
}

// RenameChain renames the old chain to the new one.
func (ipt *IPTables) RenameChain(table, oldChain, newChain string) error {
	return ipt.run("-t", table, "-E", oldChain, newChain)
}

// DeleteChain deletes the chain in the specified table.
// The chain must be empty
func (ipt *IPTables) DeleteChain(table, chain string) error {
	return ipt.run("-t", table, "-X", chain)
}

// ChangePolicy changes policy on chain to target
func (ipt *IPTables) ChangePolicy(table, chain, target string) error {
	return ipt.run("-t", table, "-P", chain, target)
}

// Check if the underlying iptables command supports the --random-fully flag
func (ipt *IPTables) HasRandomFully() bool {
	return ipt.hasRandomFully
}

// Return version components of the underlying iptables command
func (ipt *IPTables) GetIptablesVersion() (int, int, int) {
	return ipt.v1, ipt.v2, ipt.v3
}

// run runs an iptables command with the given arguments, ignoring
// any stdout output
func (ipt *IPTables) run(args ...string) error {
	return ipt.runWithOutput(args, nil)
}

// runWithOutput runs an iptables command with the given arguments,
// writing any stdout output to the given writer
func (ipt *IPTables) runWithOutput(args []string, stdout io.Writer) error {
	args = append([]string{ipt.path}, args...)
	if ipt.hasWait {
		args = append(args, "--wait")
	} else {
		fmu, err := newXtablesFileLock()
		if err != nil {
			return err
		}
		ul, err := fmu.tryLock()
		if err != nil {
			return err
		}
		defer ul.Unlock()
	}

	var stderr bytes.Buffer
	cmd := exec.Cmd{
		Path:   ipt.path,
		Args:   args,
		Stdout: stdout,
		Stderr: &stderr,
	}

	if err := cmd.Run(); err != nil {
		switch e := err.(type) {
		case *exec.ExitError:
			return &Error{*e, cmd, stderr.String(), nil}
		default:
			return err
		}
	}

	return nil
}

// getIptablesCommand returns the correct command for the given protocol, either "iptables" or "ip6tables".
func getIptablesCommand(proto Protocol) string {
	if proto == ProtocolIPv6 {
		return "ip6tables"
	} else {
		return "iptables"
	}
}

// Checks if iptables has the "-C" and "--wait" flag
func getIptablesCommandSupport(v1 int, v2 int, v3 int) (bool, bool, bool) {
	return iptablesHasCheckCommand(v1, v2, v3), iptablesHasWaitCommand(v1, v2, v3), iptablesHasRandomFully(v1, v2, v3)
}

// getIptablesVersion returns the first three components of the iptables version
// and the operating mode (e.g. nf_tables or legacy)
// e.g. "iptables v1.3.66" would return (1, 3, 66, legacy, nil)
func extractIptablesVersion(str string) (int, int, int, string, error) {
	versionMatcher := regexp.MustCompile(`v([0-9]+)\.([0-9]+)\.([0-9]+)(?:\s+\((\w+))?`)
	result := versionMatcher.FindStringSubmatch(str)
	if result == nil {
		return 0, 0, 0, "", fmt.Errorf("no iptables version found in string: %s", str)
	}

	v1, err := strconv.Atoi(result[1])
	if err != nil {
		return 0, 0, 0, "", err
	}

	v2, err := strconv.Atoi(result[2])
	if err != nil {
		return 0, 0, 0, "", err
	}

	v3, err := strconv.Atoi(result[3])
	if err != nil {
		return 0, 0, 0, "", err
	}

	mode := "legacy"
	if result[4] != "" {
		mode = result[4]
	}
	return v1, v2, v3, mode, nil
}

// Runs "iptables --version" to get the version string
func getIptablesVersionString(path string) (string, error) {
	cmd := exec.Command(path, "--version")
	var out bytes.Buffer
	cmd.Stdout = &out
	err := cmd.Run()
	if err != nil {
		return "", err
	}
	return out.String(), nil
}

// Checks if an iptables version is after 1.4.11, when --check was added
func iptablesHasCheckCommand(v1 int, v2 int, v3 int) bool {
	if v1 > 1 {
		return true
	}
	if v1 == 1 && v2 > 4 {
		return true
	}
	if v1 == 1 && v2 == 4 && v3 >= 11 {
		return true
	}
	return false
}

// Checks if an iptables version is after 1.4.20, when --wait was added
func iptablesHasWaitCommand(v1 int, v2 int, v3 int) bool {
	if v1 > 1 {
		return true
	}
	if v1 == 1 && v2 > 4 {
		return true
	}
	if v1 == 1 && v2 == 4 && v3 >= 20 {
		return true
	}
	return false
}

// Checks if an iptables version is after 1.6.2, when --random-fully was added
func iptablesHasRandomFully(v1 int, v2 int, v3 int) bool {
	if v1 > 1 {
		return true
	}
	if v1 == 1 && v2 > 6 {
		return true
	}
	if v1 == 1 && v2 == 6 && v3 >= 2 {
		return true
	}
	return false
}

// Checks if a rule specification exists for a table
func (ipt *IPTables) existsForOldIptables(table, chain string, rulespec []string) (bool, error) {
	rs := strings.Join(append([]string{"-A", chain}, rulespec...), " ")
	args := []string{"-t", table, "-S"}
	var stdout bytes.Buffer
	err := ipt.runWithOutput(args, &stdout)
	if err != nil {
		return false, err
	}
	return strings.Contains(stdout.String(), rs), nil
}

// counterRegex is the regex used to detect nftables counter format
var counterRegex = regexp.MustCompile(`^\[([0-9]+):([0-9]+)\] `)

// filterRuleOutput works around some inconsistencies in output.
// For example, when iptables is in legacy vs. nftables mode, it produces
// different results.
func filterRuleOutput(rule string) string {
	out := rule

	// work around an output difference in nftables mode where counters
	// are output in iptables-save format, rather than iptables -S format
	// The string begins with "[0:0]"
	//
	// Fixes #49
	if groups := counterRegex.FindStringSubmatch(out); groups != nil {
		// drop the brackets
		out = out[len(groups[0]):]
		out = fmt.Sprintf("%s -c %s %s", out, groups[1], groups[2])
	}

	return out
}


text:
<?php

namespace mageekguy\atoum\asserters\adapter\exceptions;

use mageekguy\atoum\exceptions;

class logic extends exceptions\logic
{
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _link = require("next/dist/lib/link.js");

var _link2 = _interopRequireDefault(_link);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _jsxFileName = "/Users/kidchenko/kidchenko/playground/next-hi/pages/index.js?entry";

exports.default = function () {
  return _react2.default.createElement("p", {
    __source: {
      fileName: _jsxFileName,
      lineNumber: 4
    }
  }, "Next is awesome!", _react2.default.createElement(_link2.default, { href: "/about", __source: {
      fileName: _jsxFileName,
      lineNumber: 6
    }
  }, _react2.default.createElement("a", {
    __source: {
      fileName: _jsxFileName,
      lineNumber: 7
    }
  }, " Learn more")));
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBhZ2VzL2luZGV4LmpzIl0sIm5hbWVzIjpbIkxpbmsiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxBQUFPLEFBRVA7Ozs7Ozs7O2tCQUFlLFlBQUE7eUJBQ2IsY0FBQTs7Z0JBQUE7a0JBQUE7QUFBQTtBQUFBLEdBQUEsRUFFRSxvQ0FBQSxBQUFDLGdDQUFLLE1BQU4sQUFBVztnQkFBWDtrQkFBQSxBQUNFO0FBREY7cUJBQ0UsY0FBQTs7Z0JBQUE7a0JBQUE7QUFBQTtBQUFBLEtBSlMsQUFDYixBQUVFLEFBQ0U7QUFKTiIsImZpbGUiOiJpbmRleC5qcz9lbnRyeSIsInNvdXJjZVJvb3QiOiIvVXNlcnMva2lkY2hlbmtvL2tpZGNoZW5rby9wbGF5Z3JvdW5kL25leHQtaGkifQ==


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">
        <TextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/language_apology_box_text"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:autoLink="web"
            style="@style/text"
            android:text="@string/language_apology_text"/>
        <TextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/eula_box_text"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:autoLink="web"
            style="@style/text"
            android:text="EULA TEXT"/>
    </LinearLayout>
</ScrollView>


text:
/*
 * ob_ami_handler.c
 *
 *  Created on: Feb 15, 2017
 *      Author: pchero
 */

#define _GNU_SOURCE

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <jansson.h>

#include "common.h"
#include "slog.h"
#include "utils.h"
#include "ami_handler.h"
#include "action_handler.h"
#include "ob_ami_handler.h"
#include "ob_dialing_handler.h"

/**
 *
 * @param j_msg
 */
ACTION_RES ob_ami_response_handler_originate(json_t* j_action, json_t* j_msg)
{
  char* tmp;
  const char* response;
  const char* event;
  const char* action_id;
  const char* uuid;
  const char* channel;
  const char* tmp_const;
  json_t* j_dialing;
  int ret;
  int res_dial;
  bool success;

  if((j_action == NULL) || (j_msg == NULL)) {
    slog(LOG_WARNING, "Wrong input parameter.");
    return ACTION_RES_ERROR;
  }
  slog(LOG_DEBUG, "Fired ob_ami_response_handler_originate.");

  // for debug
  tmp = json_dumps(j_msg, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Received message. tmp[%s]", tmp);
  sfree(tmp);

  // get action id
  action_id = json_string_value(json_object_get(j_msg, "ActionID"));
  if(action_id == NULL) {
    slog(LOG_ERR, "Could not get action id.");
    return ACTION_RES_ERROR;
  }

  // get event
  // if there's no event, consider response message
  event = json_string_value(json_object_get(j_msg, "Event"));
  if(event == NULL) {

    // get dialing info using action id.
    j_dialing = ob_get_dialing_by_action_id(action_id);
    if(j_dialing == NULL) {
      slog(LOG_ERR, "Could not get ob_dialing info. action_id[%s]", action_id);
      return ACTION_RES_ERROR;
    }

    // get response
    response = json_string_value(json_object_get(j_msg, "Response"));
    if(response == NULL) {
      json_decref(j_dialing);
      return ACTION_RES_ERROR;
    }

    ret = strcasecmp(response, "Success");
    if(ret != 0) {
      // update dialing status to dialing failed
      slog(LOG_INFO, "Could not success ob dialing. message[%s]",
          json_string_value(json_object_get(j_msg, "Message"))
          );
      ob_update_dialing_status(json_string_value(json_object_get(j_dialing, "uuid")), E_DIALING_ERROR_ORIGINATE_QUEUED_FAILED);
      json_decref(j_dialing);
      return ACTION_RES_COMPLETE;
    }

    // update dialing status to dialing ok
    ob_update_dialing_status(json_string_value(json_object_get(j_dialing, "uuid")), E_DIALING_ORIGINATE_QUEUED);
    json_decref(j_dialing);
    return ACTION_RES_CONTINUE;
  }

  if(strcasecmp(event, "OriginateResponse") == 0) {
    // Event: OriginateResponse

    // get uuid
    uuid = json_string_value(json_object_get(j_msg, "Uniqueid"));

    // get channel
    channel = json_string_value(json_object_get(j_msg, "Channel"));

    // get res_dial
    tmp_const = json_string_value(json_object_get(j_msg, "Response"));
    if(tmp_const == NULL) {
      slog(LOG_ERR, "Could not get originate response.");
      return ACTION_RES_ERROR;
    }
    success = true;
    if(strcasecmp(tmp_const, "Failure") == 0) {
      success = false;
    }

    // get reason
    tmp_const = json_string_value(json_object_get(j_msg, "Reason"));
    if(tmp_const == NULL) {
      slog(LOG_ERR, "Could not get originate response reason code.");
      return ACTION_RES_ERROR;
    }
    res_dial = atoi(tmp_const);

    // update ob_dialing
    ob_update_dialing_res_dial(uuid, success, res_dial, channel);
    return ACTION_RES_COMPLETE;
  }

  // should not reach to here.
  slog(LOG_ERR, "Something was wrong. Should not reach to here.");
  return ACTION_RES_ERROR;
}

/**
 *
 * @param j_msg
 */
ACTION_RES ob_ami_response_handler_status(json_t* j_action, json_t* j_msg)
{
  char* tmp;
  const char* event;
  const char* response;
  const char* unique_id;
  int ret;

  if((j_action == NULL) || (j_msg == NULL)) {
    slog(LOG_WARNING, "Wrong input parameter.");
    return ACTION_RES_ERROR;
  }
  slog(LOG_DEBUG, "Fired ob_ami_response_handler_status.");

  // for debug
  tmp = json_dumps(j_msg, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Received message. tmp[%s]", tmp);
  sfree(tmp);

  // get event
  // if could not get event, consider it's the event
  event = json_string_value(json_object_get(j_msg, "Event"));
  if(event == NULL) {
    // get response
    response = json_string_value(json_object_get(j_msg, "Response"));
    if(response == NULL) {
      slog(LOG_ERR, "Could not get response.");
      return ACTION_RES_ERROR;
    }

    ret = strcasecmp(response, "Success");
    if(ret != 0) {
      slog(LOG_ERR, "Could not get correct response.");
      return ACTION_RES_ERROR;
    }
    return ACTION_RES_CONTINUE;
  }

  // check complete
  ret = strcasecmp(event, "StatusComplete");
  if(ret == 0) {
    return ACTION_RES_COMPLETE;
  }

  // get unique id
  unique_id = json_string_value(json_object_get(j_msg, "Uniqueid"));
  if(unique_id == NULL) {
    slog(LOG_ERR, "Could not get unique id.");
    return ACTION_RES_CONTINUE;
  }

  // update update time
  ret = ob_update_dialing_timestamp(unique_id);
  slog(LOG_DEBUG, "Updated dialing timestamp. uuid[%s], ret[%d]", unique_id, ret);

  return ACTION_RES_CONTINUE;
}

/**
 * Originate the call and send to extension.
 * @param name
 * @return
 */
bool ob_originate_to_exten_preview(json_t* j_dialing)
{
  json_t* j_cmd;
  int ret;
  char* tmp;
  char* channel;

  if(j_dialing == NULL) {
    slog(LOG_WARNING, "Wrong input parameter.");
    return NULL;
  }
  slog(LOG_DEBUG, "Fired originate_to_exten_preview.");

  // create channel
  asprintf(&channel, "Local/%s@%s",
      json_string_value(json_object_get(j_dialing, "dial_exten")),
      json_string_value(json_object_get(j_dialing, "dial_context"))
      );

  //  Action: Originate
  //  ActionID: <value>
  //  Channel: <value>
  //  Exten: <value>
  //  Context: <value>
  //  Priority: <value>
  //  Application: <value>
  //  Data: <value>
  //  Timeout: <value>
  //  CallerID: <value>
  //  Variable: <value>
  //  Account: <value>
  //  EarlyMedia: <value>
  //  Async: <value>
  //  Codecs: <value>
  //  ChannelId: <value>
  //  OtherChannelId: <value>
  j_cmd = json_pack("{s:s, s:s, s:s, s:s, s:s, s:s}",
      "Action",       "Originate",
      "ActionID",     json_string_value(json_object_get(j_dialing, "action_id"))? : "",
      "Async",        "true",
      "Channel",      channel,
      "Application",  "Dial",
      "Data",         json_string_value(json_object_get(j_dialing, "dial_channel"))
      );
  sfree(channel);

  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create default originate request info.");
    return false;
  }

  if(json_object_get(j_dialing, "dial_timeout") != NULL) {
    json_object_set(j_cmd, "Timeout", json_object_get(j_dialing, "dial_timeout"));
  }

  if(json_object_get(j_dialing, "callerid") != NULL) {
    json_object_set(j_cmd, "CallerID", json_object_get(j_dialing, "callerid"));
  }

  if(json_object_get(j_dialing, "account") != NULL) {
    json_object_set(j_cmd, "Account", json_object_get(j_dialing, "account"));
  }

  if(json_object_get(j_dialing, "early_media") != NULL) {
    json_object_set(j_cmd, "EarlyMedia", json_object_get(j_dialing, "early_media"));
  }

  if(json_object_get(j_dialing, "codecs") != NULL) {
    json_object_set(j_cmd, "Codecs", json_object_get(j_dialing, "codecs"));
  }

  if(json_object_get(j_dialing, "channelid") != NULL) {
    json_object_set(j_cmd, "ChannelId", json_object_get(j_dialing, "channelid"));
  }

  if(json_object_get(j_dialing, "otherchannelid") != NULL) {
    json_object_set(j_cmd, "OtherChannelId", json_object_get(j_dialing, "otherchannelid"));
  }

  // Variables
  if(json_object_get(j_dialing, "variables") != NULL) {
    json_object_set(j_cmd, "Variables", json_object_get(j_dialing, "variables"));
  }

  // dump command string
  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create ami json.");
    return NULL;
  }
  tmp = json_dumps(j_cmd, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Dialing. tmp[%s]\n", tmp);
  sfree(tmp);

  ret = ami_send_cmd(j_cmd);
  json_decref(j_cmd);
  if(ret == false) {
    slog(LOG_ERR, "Could not send originate extension request.");
    return false;
  }
  action_insert(json_string_value(json_object_get(j_dialing, "action_id")), "ob.originate", NULL);

  return true;
}

/**
 * Originate the call and send to extension.
 * @param name
 * @return
 */
bool ob_originate_to_exten(json_t* j_dialing)
{
  json_t* j_cmd;
  int ret;
  char* tmp;

  if(j_dialing == NULL) {
    slog(LOG_WARNING, "Wrong input parameter.");
    return NULL;
  }
  slog(LOG_DEBUG, "Fired originate_to_exten.");

  //  Action: Originate
  //  ActionID: <value>
  //  Channel: <value>
  //  Exten: <value>
  //  Context: <value>
  //  Priority: <value>
  //  Application: <value>
  //  Data: <value>
  //  Timeout: <value>
  //  CallerID: <value>
  //  Variable: <value>
  //  Account: <value>
  //  EarlyMedia: <value>
  //  Async: <value>
  //  Codecs: <value>
  //  ChannelId: <value>
  //  OtherChannelId: <value>
  j_cmd = json_pack("{s:s, s:s, s:s, s:s, s:s, s:s, s:s, s:s}",
      "Action",     "Originate",
      "ActionID",   json_string_value(json_object_get(j_dialing, "action_id"))? : "",
      "Async",      "true",
      "Channel",    json_string_value(json_object_get(j_dialing, "dial_channel"))? : "",
      "Exten",      json_string_value(json_object_get(j_dialing, "dial_exten"))? : "",
      "Context",    json_string_value(json_object_get(j_dialing, "dial_context"))? : "",
      "Priority",   json_string_value(json_object_get(j_dialing, "dial_priority"))? : "",
      "ChannelId",  json_string_value(json_object_get(j_dialing, "uuid"))
      );
  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create default originate request info.");
    return false;
  }

  if(json_object_get(j_dialing, "dial_timeout") != NULL) {
    json_object_set(j_cmd, "Timeout", json_object_get(j_dialing, "dial_timeout"));
  }

  if(json_object_get(j_dialing, "callerid") != NULL) {
    json_object_set(j_cmd, "CallerID", json_object_get(j_dialing, "callerid"));
  }

  if(json_object_get(j_dialing, "account") != NULL) {
    json_object_set(j_cmd, "Account", json_object_get(j_dialing, "account"));
  }

  if(json_object_get(j_dialing, "early_media") != NULL) {
    json_object_set(j_cmd, "EarlyMedia", json_object_get(j_dialing, "early_media"));
  }

  if(json_object_get(j_dialing, "codecs") != NULL) {
    json_object_set(j_cmd, "Codecs", json_object_get(j_dialing, "codecs"));
  }

  if(json_object_get(j_dialing, "channelid") != NULL) {
    json_object_set(j_cmd, "ChannelId", json_object_get(j_dialing, "channelid"));
  }

  if(json_object_get(j_dialing, "otherchannelid") != NULL) {
    json_object_set(j_cmd, "OtherChannelId", json_object_get(j_dialing, "otherchannelid"));
  }

  // Variables
  if(json_object_get(j_dialing, "variables") != NULL) {
    json_object_set(j_cmd, "Variables", json_object_get(j_dialing, "variables"));
  }

  // dump command string
  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create ami json.");
    return NULL;
  }
  tmp = json_dumps(j_cmd, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Dialing. tmp[%s]\n", tmp);
  sfree(tmp);

  ret = ami_send_cmd(j_cmd);
  json_decref(j_cmd);
  if(ret == false) {
    slog(LOG_ERR, "Could not send originate extension request.");
    return false;
  }
  action_insert(json_string_value(json_object_get(j_dialing, "action_id")), "ob.originate", NULL);

  return true;
}

/**
 * Originate the call and send to application.
 * @param name
 * @return
 */
bool ob_originate_to_application(json_t* j_dialing)
{
  json_t* j_cmd;
  int ret;
  char* tmp;

  if(j_dialing == NULL) {
    slog(LOG_WARNING, "Wrong input parameter.");
    return false;
  }
  slog(LOG_DEBUG, "Fired originate_to_application.");

  tmp = json_dumps(j_dialing, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Dialing info. tmp[%s]", tmp);
  sfree(tmp);

  //  Action: Originate
  //  ActionID: <value>
  //  Channel: <value>
  //  Exten: <value>
  //  Context: <value>
  //  Priority: <value>
  //  Application: <value>
  //  Data: <value>
  //  Timeout: <value>
  //  CallerID: <value>
  //  Variable: <value>
  //  Account: <value>
  //  EarlyMedia: <value>
  //  Async: <value>
  //  Codecs: <value>
  //  ChannelId: <value>
  //  OtherChannelId: <value>
  j_cmd = json_pack("{s:s, s:s, s:s, s:s, s:s, s:s, s:s}",
      "Action",       "Originate",
      "ActionID",     json_string_value(json_object_get(j_dialing, "action_id")),
      "Async",        "true",
      "Channel",      json_string_value(json_object_get(j_dialing, "dial_channel")),
      "Application",  json_string_value(json_object_get(j_dialing, "dial_application"))? : "",
      "Data",         json_string_value(json_object_get(j_dialing, "dial_data"))? : "",
      "ChannelId",    json_string_value(json_object_get(j_dialing, "uuid"))
      );
  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create default originate request info.");
    return false;
  }

  if(json_object_get(j_dialing, "dial_timeout") != NULL) {
    json_object_set(j_cmd, "Timeout", json_object_get(j_dialing, "dial_timeout"));
  }

  if(json_object_get(j_dialing, "callerid") != NULL) {
    json_object_set(j_cmd, "CallerID", json_object_get(j_dialing, "callerid"));
  }

  if(json_object_get(j_dialing, "dial_variables") != NULL) {
    json_object_set(j_cmd, "Variables", json_object_get(j_dialing, "dial_variables"));
  }

  if(json_object_get(j_dialing, "account") != NULL) {
    json_object_set(j_cmd, "Account", json_object_get(j_dialing, "account"));
  }

  if(json_object_get(j_dialing, "early_media") != NULL) {
    json_object_set(j_cmd, "EarlyMedia", json_object_get(j_dialing, "early_media"));
  }

  if(json_object_get(j_dialing, "codecs") != NULL) {
    json_object_set(j_cmd, "Codecs", json_object_get(j_dialing, "codecs"));
  }

  if(json_object_get(j_dialing, "channelid") != NULL) {
    json_object_set(j_cmd, "ChannelId", json_object_get(j_dialing, "channelid"));
  }

  if(json_object_get(j_dialing, "otherchannelid") != NULL) {
    json_object_set(j_cmd, "OtherChannelId", json_object_get(j_dialing, "otherchannelid"));
  }

  if(j_cmd == NULL) {
    slog(LOG_ERR, "Could not create ami json.");
    return false;
  }
  tmp = json_dumps(j_cmd, JSON_ENCODE_ANY);
  slog(LOG_DEBUG, "Dialing. tmp[%s]\n", tmp);
  sfree(tmp);

  ret = ami_send_cmd(j_cmd);
  json_decref(j_cmd);
  if(ret == false) {
    slog(LOG_ERR, "Could not send originate application request.");
    return false;
  }
  action_insert(json_string_value(json_object_get(j_dialing, "action_id")), "ob.originate", NULL);

  return true;
}


text:
import alt from 'app/utils/Alt';

class Actions {
  fetchAsyncInProgress() {
    this.dispatch();
  }

  fetchAsyncSuccess(survey) {
    this.dispatch(survey);
  }

  fetchAsyncFailed(errorMessage) {
    this.dispatch(errorMessage);
  }

  dummyAction() {
    this.dispatch();
  }

  nextQuestion() {
    this.dispatch();
  }
}

export default alt.createActions(Actions);


text:
'use strict';

//Setting up route
angular.module('ggDiary').config(['$stateProvider',
	function($stateProvider) {
		// Diaries state routing
		$stateProvider.
		state('listDiaries', {
			url: '/ggDiary/diaries',
			templateUrl: 'modules/ggDiary/views/list-diaries.client.view.html'
		}).
		state('createDiary', {
			url: '/ggDiary/diaries/create',
			templateUrl: 'modules/ggDiary/views/create-diary.client.view.html'
		}).
		state('viewDiary', {
			url: '/ggDiary/diaries/:diaryId',
			templateUrl: 'modules/ggDiary/views/view-diary.client.view.html'
		}).
		state('editDiary', {
			url: '/ggDiary/diaries/:diaryId/edit',
			templateUrl: 'modules/ggDiary/views/edit-diary.client.view.html'
		}).
		state('listReplays', {
			url: '/ggDiary/replays',
			templateUrl: 'modules/ggDiary/views/list-replays.client.view.html'
		}).
		state('createReplay', {
			url: '/ggDiary/replays/create',
			templateUrl: 'modules/ggDiary/views/create-replay.client.view.html'
		});
	}
]);


text:
from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('ebooks', '0042_section_category'),
    ]

    operations = [
        migrations.AddField(
            model_name='sectioncategory',
            name='title_en',
            field=models.CharField(max_length=60, null=True, unique=True),
        ),
        migrations.AddField(
            model_name='sectioncategory',
            name='title_it',
            field=models.CharField(max_length=60, null=True, unique=True),
        ),
        migrations.AlterField(
            model_name='section',
            name='category',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='ebooks.SectionCategory', verbose_name='category'),
        ),
    ]


text:
@protocol EditEntityDelegate <NSObject>

// By default, methods are "required"; you can change this by prefacing methods with "@optional"
- (void) EditEntityController:(id)controller didEditItem:(id)item;

@end

#import <UIKit/UIKit.h>

@interface EntityEdit : UIViewController <UITextFieldDelegate>

// This class needs a delegate property
@property (nonatomic, assign) id <EditEntityDelegate> delegate;

@property (nonatomic, strong) Model *model;
@property (nonatomic, strong) NSDictionary *detailItem;

// User interface
@property (weak, nonatomic) IBOutlet UITextField *itemTitle;
@property (weak, nonatomic) IBOutlet UITextField *itemDescription;
@property (weak, nonatomic) IBOutlet UISegmentedControl *itemType;
@property (weak, nonatomic) IBOutlet UISlider *itemValue;
@property (weak, nonatomic) IBOutlet UILabel *valueLabel;
@property (weak, nonatomic) IBOutlet UIDatePicker *itemDueDate;

// User actions
- (IBAction)save:(UIBarButtonItem *)sender;
- (IBAction)cancel:(UIBarButtonItem *)sender;

- (IBAction)changedSlider:(UISlider *)sender;
- (IBAction)changedSegment:(UISegmentedControl *)sender;
- (IBAction)changedDatePicker:(UIDatePicker *)sender;

@end


text:
<readable><title>2866696346_4dcccbd3a5</title><content>
A skateboarder wearing an orange shirt and orange helmet .
Men riding skateboards .
Two men , both wearing helmets , on skateboards with large wheels .
Two men on skateboards , and one has an orange helmet .
Two men skateboards at high speed .
</content></readable>


text:
using WinRTUtils.Sample.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// Die Elementvorlage "Standardseite" ist unter "http://go.microsoft.com/fwlink/?LinkID=390556" dokumentiert.

namespace WinRTUtils.Sample.View
{
    /// <summary>
    /// Eine leere Seite, die eigenständig verwendet werden kann oder auf die innerhalb eines Frames navigiert werden kann.
    /// </summary>
    public sealed partial class IndeterminateProgressIndicatorView : Page
    {
        private NavigationHelper navigationHelper;
        private ObservableDictionary defaultViewModel = new ObservableDictionary();

        public IndeterminateProgressIndicatorView()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
        }

        /// <summary>
        /// Ruft den <see cref="NavigationHelper"/> ab, der mit dieser <see cref="Page"/> verknüpft ist.
        /// </summary>
        public NavigationHelper NavigationHelper
        {
            get { return this.navigationHelper; }
        }

        /// <summary>
        /// Ruft das Anzeigemodell für diese <see cref="Page"/> ab.
        /// Dies kann in ein stark typisiertes Anzeigemodell geändert werden.
        /// </summary>
        public ObservableDictionary DefaultViewModel
        {
            get { return this.defaultViewModel; }
        }

        /// <summary>
        /// Füllt die Seite mit Inhalt auf, der bei der Navigation übergeben wird.  Gespeicherte Zustände werden ebenfalls
        /// bereitgestellt, wenn eine Seite aus einer vorherigen Sitzung neu erstellt wird.
        /// </summary>
        /// <param name="sender">
        /// Die Quelle des Ereignisses, normalerweise <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Ereignisdaten, die die Navigationsparameter bereitstellen, die an
        /// <see cref="Frame.Navigate(Type, Object)"/> als diese Seite ursprünglich angefordert wurde und
        /// ein Wörterbuch des Zustands, der von dieser Seite während einer früheren
        /// beibehalten wurde.  Der Zustand ist beim ersten Aufrufen einer Seite NULL.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
        }

        /// <summary>
        /// Behält den dieser Seite zugeordneten Zustand bei, wenn die Anwendung angehalten oder
        /// die Seite im Navigationscache verworfen wird.  Die Werte müssen den Serialisierungsanforderungen
        /// von <see cref="SuspensionManager.SessionState"/> entsprechen.
        /// </summary>
        /// <param name="sender">Die Quelle des Ereignisses, normalerweise <see cref="NavigationHelper"/></param>
        /// <param name="e">Ereignisdaten, die ein leeres Wörterbuch zum Auffüllen bereitstellen
        /// serialisierbarer Zustand.</param>
        private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e)
        {
        }

        #region NavigationHelper-Registrierung

        /// <summary>
        /// Die in diesem Abschnitt bereitgestellten Methoden werden einfach verwendet, um
        /// damit NavigationHelper auf die Navigationsmethoden der Seite reagieren kann.
        /// <para>
        /// Platzieren Sie seitenspezifische Logik in Ereignishandlern für
        /// <see cref="NavigationHelper.LoadState"/>
        /// und <see cref="NavigationHelper.SaveState"/>.
        /// Der Navigationsparameter ist in der LoadState-Methode verfügbar
        /// zusätzlich zum Seitenzustand, der während einer früheren Sitzung beibehalten wurde.
        /// </para>
        /// </summary>
        /// <param name="e">Stellt Daten für Navigationsmethoden und -ereignisse bereit.
        /// Handler, bei denen die Navigationsanforderung nicht abgebrochen werden kann.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedFrom(e);
        }

        #endregion
    }
}