text:
<?xml version="1.0" encoding="utf-8"?>
<com.chenxk.www.imitateqq.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipelayout"
    android:layout_width="fill_parent"
    android:layout_height="70dp"
    android:layout_gravity="center_vertical"
    android:minHeight="70dp">

    <com.chenxk.www.imitateqq.swipe.FrontLayout
        android:id="@+id/front"
        android:layout_width="fill_parent"
        android:layout_height="70dp"
        android:background="#ffffff">

        <ImageView
            android:id="@+id/iv_head"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="20dp"
            android:src="@drawable/ic_launcher" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@id/iv_head">

            <TextView
                android:id="@+id/tv_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/tv_message"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="12sp"
                android:textColor="@android:color/darker_gray" />
        </LinearLayout>

        <TextView
            android:id="@+id/point"
            android:layout_width="wrap_content"
            android:layout_height="18dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="20dp"
            android:background="@drawable/red_bg"
            android:gravity="center"
            android:singleLine="true"
            android:textColor="@android:color/white"
            android:textSize="12sp" />
    </com.chenxk.www.imitateqq.swipe.FrontLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="70dp"
        android:orientation="horizontal">

        <Button
            android:id="@+id/bt_call"
            android:layout_width="70dp"
            android:layout_height="fill_parent"
            android:background="#888888"
            android:gravity="center"
            android:text="@string/call"
            android:textColor="@android:color/white" />

        <Button
            android:id="@+id/bt_delete"
            android:layout_width="70dp"
            android:layout_height="fill_parent"
            android:background="#ff0000"
            android:gravity="center"
            android:text="@string/delete"
            android:textColor="@android:color/white" />
    </LinearLayout>

</com.chenxk.www.imitateqq.swipe.SwipeLayout>


text:
package br.com.halyson.materialdesign.activity;

import android.os.Bundle;

import br.com.halyson.materialdesign.R;
import br.com.halyson.materialdesign.activity.api.BaseActivity;
import br.com.halyson.materialdesign.constants.FragmentNames;
import br.com.halyson.materialdesign.fragment.HomeFragment;

public class HomeActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction().add(R.id.screen_default_container, HomeFragment.newInstance(), FragmentNames.FRAGMENT_HOME_).commit();
        }
    }

    @Override
    protected int getLayoutResourceIdentifier() {
        return R.layout.material_screen_default;
    }

    @Override
    protected String getTitleToolBar() {
        return "HomeActivity";
    }

    @Override
    protected boolean getDisplayHomeAsUp() {
        return true;
    }

    @Override
    protected boolean getHomeButtonEnabled() {
        return true;
    }
}

redpajama_set_name: RedPajamaGithub


text:
*     { margin: 0; padding: 0; }
body  { font-family: Ubuntu; background-color: $fff; color: #333; margin: 0; padding: 0;}
h1    { font-family: Ubuntu; color: #446; }
h2    { font-family: Ubuntu; color: #002; padding: 5px 0; }
h3    { font-family: Ubuntu; color: #668; padding: 5px 0; }
h4    { font-family: Ubuntu; color: #335; }
div   { padding: 0; margin: 0; }
p     { color: #333; padding-top: 10px; }
a     { text-decoration: none; font-weight: bold; color: #335; }
table { font-size: 85%; }
tr:nth-child(odd)  { background-color: #f5f5f5; }
tr:nth-child(even) { background-color: #fff; }
tr.groupheader     { background-color: #ccc; color: #333; padding: 5px; }
tr.groupheader td  { font-weight: bold; }
td { padding: 1px 3px; }
dl { font-size: 85%; }
dl dt { float: left; width: 150px; background-color: #eee; font-weight: bold; height: 1.3em; }
dl dd { height: 1.3em; }

#container { }

#header                       { background: #ccc url('../img/clubman.png') no-repeat left center; padding: 0; margin: 0; }
#header div#maintitle         { padding: 0px 5px; margin-left: 250px; font-size: 250%; }
#header div#maintitle a       { color: #fff; font-weight: bold; text-decoration: none; }
#header div#maintitle a:hover { color: #eee; text-decoration: none; }
#header div#subtitle          { padding: 0px 5px; margin-left: 250px; font-size: 125%; }
#header div#usbtitle a        { color: #eee; font-weight: bold; text-decoration: none; }
#header div#subtitle a:hover  { color: #fff; text-decoration: none; }

#content { background: #fff url('../img/cmstyle/main_bg.png') repeat-x center top; padding: 10px; }

#footer   { clear: both; padding: 0 5px; margin-top: 5px; background-color: #eee; font-size: 75%; }
#footer a { font-weight: normal; }

.message { padding: 10px; font-size: 120%; border-radius: 4px 4px 4px 4px; background-color: #900; background-image: -webkit-linear-gradient(top, #e65, #c33); color: #fff; }
.error-message { clear: both; padding: 0 0 10px 20px; }
.paging .current, .paging .disabled, .paging a { padding: 5px 8px; display: inline-block }

div.teamindex     { padding: 1px; margin-top: 0px; margin-bottom: 0;}
div.teamindex div.oneteam  { float: left; border: solid 1px #eee; margin: 5px; }
div.teamindex div.oneteam:hover { border: solid 1px #ccc; }
div.teamindex div.oneteam div.oneteampicture { width: 240px; height: 180px; opacity: 0.9; }
div.teamindex div.oneteam div.oneteampicture:hover { opacity: 1; }
.oneteampicture p { text-align: center; margin: 0; padding: 0; }
.oneteampicture img { height: 180px; max-width: 100%; }

ul.memberindex            { list-style-type: none; }
ul.memberindex li         { font-size: 100%; padding: 0 1px; }
ul.memberindex li p       { background: #999; color: #fff; padding: 0 10px; }
ul.memberindex li a       { font-weight: normal; padding: 0 10px; }
ul.memberindex li a:hover { background: #f90; color: #fff; }
ul.memberindex li span.inactive a  { color: #ccc; }

.crlf          { clear: both; }
.imgright      { float: right; margin-left: 5px; }
.smallthumbdiv { float: left; height: 18px; width: 24px; margin-left: auto; margin-right: auto;}
.smallthumb    { float: left; height: 18px; display: block; margin-left: auto; margin-right: auto; }
.lastmodified  { clear: both; padding: 0 5px; background-color: #eee; font-size: 75%; }

.blockview       { float: left; border-bottom: solid 1px #ccc; margin-right: 4px; }
.blockview h4    { padding: 3px 10px 3px 10px; background-color: #ddd; border-radius: 10px 10px 0px 0px; margin-top: 7px;}
.blockview p     { font-size: 90%; background-color: #fcfcfc; padding: 0 0 1px 3px; }
.blockview dl    { font-size: 90%; }
.blockview dl dt { width: 150px; background-color: #eee; font-weight: bold; padding-left: 3px; }
.blockview dl dd { background-color: #fcfcfc; padding-bottom: 1px; padding-left: 3px; }

#teamimage       { float: right; }
#teamgeneralinfo { width: 400px; }
#teammomentsinfo { width: 400px; }
#teammemberinfo  { width: 400px; }
#teamotherinfo   { width: 100%;  }

.memberview dl dt  { width: 100px; }
#memberimages      { float: right; }
#membergeneralinfo { width: 385px; }
#memberteaminfo    { width: 385px; }
#membercontactinfo { width: 385px; }
#memberfinanceinfo { width: 385px; }
#memberotherinfo   { width: 100%;  }

.teammemberview dl dt  { width: 100px; }
#teammemberimages      { float: right; }
#teammembergeneralinfo { width: 385px; }
#teammemberteaminfo    { width: 385px; }
#teammembercontactinfo { width: 385px; }
#teammemberfinanceinfo { width: 385px; }
#teammemberotherinfo   { width: 100%;  }

.effortview dl dt  { width: 100px; }
#effortgeneralinfo { width: 385px; }
#effortteaminfo    { width: 385px; }
#effortotherinfo   { width: 100%;  }

.profileview dl dt  { width: 130px; }
#profileimages      { float: right; }
#profilegeneralinfo { width: 355px; }
#profileaclinfo     { width: 355px; }
#profileotherinfo   { width: 100%;  }

.pictureview img    { border: solid 2px #666; }
.pictureview dl dt  { width: 130px; }
#pictureimage       { }
#picturegeneralinfo { width: 555px; }
#profileotherinfo   { width: 100%;  }

.uploadview img    {  }
.uploadview dl dt  { width: 130px; }
.uploadview dl dd  { }
#uploadimage p     { background-color: #eee; text-align: center; padding: 5px; }
#uploadgeneralinfo { width: 655px; }
#uploadotherinfo   { width: 100%;  }

.newsitemview dl     { }
.newsitemview dl dt  {  }
.newsitemview dl dd  { }

.floatright     { float: right; padding-right: 10px; }
.actionright    { float: right; }
.actionright a:hover { color: #fff; }

/*-boxes-------------------------------------------------------------------*/
div.box {
 margin: 0 0;
 padding: 10px;
 -webkit-border-radius: 4px;
 -moz-border-radius: 4px;
 border-radius: 4px;
}
div.box ul li { margin-left: 20px; margin-top: 5px;}

div.simplebox {
 border: solid 1px #eee;
 background: #f3f3f3;
 background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f3f3f3), to(#fefefe));
 background: -moz-linear-gradient(#f3f3f3, #fefefe);
}

div.coolbluebox {
 width: 650px;
 margin: 15px;
 padding: 15px 15px 15px 15px;
 border: solid 1px #696;
 -webkit-box-shadow: #666 5px 5px 3px;
 -moz-box-shadow: #666 5px 5px 3px;
 box-shadow: #666 5px 5px 3px;
 background: #09f;
 background: -webkit-gradient(linear, 0 0, 0 bottom, from(#2bf), to(#fefefe));
 background: -moz-linear-gradient(#2bf, #fefefe);
}

/*-tables-------------------------------------------------------------------*/
table.wedstrijdlijst        { border-collapse: collapse; width: 100%; border-spacing: 0px; font-size: 90%; }
table.wedstrijdlijst tr th  { background: #eee; padding: 5px; border: solid 1px #09c; }
table.wedstrijdlijst tr td  { background: #fbfbfb; padding: 5px; border: solid 1px #09c; }
table.wedstrijdlijst tr.gamechange       { color: #080; }
table.wedstrijdlijst tr.gamecancel       { color: #800; text-decoration: line-through; }
table.wedstrijdlijst tr.gametochange     { color: #080; text-decoration: line-through; }
table.wedstrijdlijst tr td.afspraak      { font-weight: bold; }
table.wedstrijdlijst tr th.spelersheader { background: #fff; width: 20%; text-align: right; padding: 5px; border: solid 1px #09c; }
table.wedstrijdlijst tr td.spelerslijst  { background: #fff; padding: 5px; border: solid 1px #09c; font-size: 90%; }

td.status         { color: #333; }
td.status.draft   { color: #3c3; }
td.status.private { color: #c33; }
td.status.archive { color: #999; }
td.status.public  { color: #09f; }

.txttoright      { text-align: right; }


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="android.support.test.rule">

    <uses-sdk
            android:minSdkVersion="8" android:targetSdkVersion= "23"/>

</manifest>


text:
<?php

namespace Kata;

trait OperationalTrait
{
    protected function _getMessage(string $message = null, float $money = null): string
    {
        if (!$message && !$money) {
            if ($this->_balance == 0) {
                return 'INSERT COIN';
            }

            return sprintf('$%.2f', $this->_balance);
        }

        if ($money) {
            $message .= sprintf('$%.2f', $money);
        }

        return $message;
    }

    protected function _removeItemFromInventory(float $product)
    {
        $this->_state = self::STATE_DISPENSE;
        $item         = array_search($product, $this->_inventory);

        unset($this->_inventory[$item]);
    }

    protected function _soldOut(): array
    {
        return $this->checkDisplay('SOLD OUT');
    }

    protected function _vendProduct(float $product): array
    {
        $this->_removeConsumedCoins($product);
        $this->_removeItemFromInventory($product);

        if ($this->_balance == 0.0) {
            return $this->checkDisplay('THANK YOU');
        }

        $balance = $this->_makeChange($product)['balance'];
        $change  = $this->_makeChange($product)['change'];
        $display = $this->checkDisplay('THANK YOU');

        $display['change']  = $display['balance'];
        $display['balance'] = '$0.00';

        return $display;
    }
}


text:
<?php
return array(
    'bjyauthorize' => array(

        'default_role' => 'guest',
        'identity_provider' => 'BjyAuthorize\Provider\Identity\ZfcUserDoctrine',

        'role_providers' => array(
            'BjyAuthorize\Provider\Role\Doctrine' => array(
                'table'             => 'user_role',
                'role_id_field'     => 'role_id',
                'parent_role_field' => 'parent',
            ),
        ),

        'guards' => array(
            'BjyAuthorize\Guard\Route' => array(
                array('route' => 'home', 'roles' => array('guest', 'user')),

                array('route' => 'zfcuser', 'roles' => array('user')),
                array('route' => 'zfcuser/logout', 'roles' => array('user')),
                array('route' => 'zfcuser/login', 'roles' => array('guest','user')),
                array('route' => 'zfcuser/register', 'roles' => array('guest')),
                array('route' => 'zfcuser/authenticate', 'roles' => array('guest')),
                array('route' => 'zfcuser/changepassword', 'roles' => array('user')),
                array('route' => 'zfcuser/changeemail', 'roles' => array('user')),

                array('route' => 'articles', 'roles' => array('guest','user')),
                array('route' => 'article', 'roles' => array('guest','user')),
                array('route' => 'pdf', 'roles' => array('guest','user')),
                array('route' => 'page', 'roles' => array('guest','user')),

                array('route' => 'zfcadmin/articles-administration', 'roles' => array('user')),
                array('route' => 'zfcadmin/pages-administration', 'roles' => array('user')),
                array('route' => 'zfcadmin/categories-administration', 'roles' => array('user')),

                array('route' => 'doctrine_orm_module_yuml', 'roles' => array('guest','user')),
            ),
        ),
    ),
);


text:
import { Option, OptionCfg } from './Option';

interface TextOptionCfg extends OptionCfg {
    size?: number;
    defaultValue?: string;
}

/**
 * @class TextOption
 *
 * A text field option for the live example.
 */
export class TextOption extends Option {
    /**
     * @cfg {Number} [size=10]
     *
     * The `size` attribute of the text field.
     */
    private size: number = 10;

    /**
     * @cfg {Boolean} [defaultValue='']
     *
     * The default value for the option.
     */
    private defaultValue: string = '';

    private $textEl: JQuery;

    /**
     * @method constructor
     * @param {TextOptionCfg} cfg The configuration options for this class,
     *   specified in an Object (map).
     */
    constructor(cfg: TextOptionCfg) {
        super(cfg);

        this.size = cfg.size || 10;
        this.defaultValue = cfg.defaultValue || '';

        this.$containerEl.html(this.generateHtml());
        this.$textEl = this.$containerEl
            .find('input')
            .on('keyup change', this.fireChange.bind(this));
    }

    /**
     * @private
     * @return {string}
     */
    generateHtml() {
        var containerId = this.containerId,
            optionDescription = this.optionDescription,
            size = this.size,
            defaultValue = this.defaultValue,
            textFieldId = containerId + '-textField';

        return `
			${optionDescription}
			<input type="text" id="${textFieldId}" value="${defaultValue}" size="${size}" class="textfield">
			(${this.getApiDocAnchor()})
		`;
    }

    /**
     * @return {String}
     */
    getValue() {
        return this.$textEl.val();
    }
}


text:
layout: postag
title: 'DET'
shortdef: 'determiner'
udver: '2'
---

### Description

Determiners are words that modify nouns or noun phrases. Determiners are
scarcely used in Uralic grammar tradition, however, Hungarian has proper
 articles that are analysed as determiners. Following should be considered for
 determiners in Uralic:

* Demonstrative pronouns
* numerals, especially one

when used like a determiner.

#### Examples

* [fi] _se_ "that", _yksi_ "one"
* [fi] _mikä_ "what"

<!-- Interlanguage links updated Po lis 14 15:34:32 CET 2022 -->


text:
<?php

class Question extends BaseModel
{

    /**
     *
     * @var integer
     */
    public $id;

    /**
     *
     * @var string
     */
    public $question;

    /**
     *
     * @var string
     */
    public $img;

    /**
     *
     * @var string
     */
    public $video;

    /**
     *
     * @var string
     */
    public $note;

    /**
     *
     * @var string
     */
    public $explanation;

    /**
     *
     * @var string
     */
    public $reference;

    public function initialize()
    {
        $this->hasMany("id", "Answer", "question_id");
        $this->hasMany("id", "LevelQuestion", "question_id");
    }

    public function beforeSave()
    {
        //if( empty($this->question) ) return false;
        $this->question = $this->getDI()->getFilter()->sanitize($this->question, "trim");
        $this->question = $this->getDI()->getFilter()->sanitize($this->question, "string");

    }

    public function beforeDelete()
    {
        //delete question also need to delete answers belong to its
        $this->getDI()->getDb()->delete("bible_answer", "question_id = " . $this->id);
        $this->getDI()->getDb()->delete("bible_level_question", "question_id = " . $this->id);
        return true;
    }

}


text:
N=10
inv_acwt=12
cmd=run.pl
use_phi=false  # This is kind of an obscure option.  If true, we'll remove the old
  # LM weights (times 1-RNN_scale) using a phi (failure) matcher, which is
  # appropriate if the old LM weights were added in this way, e.g. by
  # lmrescore.sh.  Otherwise we'll use normal composition, which is appropriate
  # if the lattices came directly from decoding.  This won't actually make much
  # difference (if any) to WER, it's more so we know we are doing the right thing.
test=false # Activate a testing option.
stage=1 # Stage of this script, for partial reruns.
# End configuration section.

echo "$0 $@"  # Print the command line for logging

[ -f ./path.sh ] && . ./path.sh
. utils/parse_options.sh

if [ $# != 6 ]; then
   echo "Do language model rescoring of lattices (partially remove old LM, add new LM)"
   echo "This version applies an RNNLM and mixes it with the LM scores"
   echo "previously in the lattices., controlled by the first parameter (rnnlm-weight)"
   echo ""
   echo "Usage: utils/rnnlmrescore.sh <rnn-weight> <old-lang-dir> <rnn-dir> <data-dir> <input-decode-dir> <output-decode-dir>"
   echo "Main options:"
   echo "  --inv-acwt <inv-acwt>          # default 12.  e.g. --inv-acwt 17.  Equivalent to LM scale to use."
   echo "                                 # for N-best list generation... note, we'll score at different acwt's"
   echo "  --cmd <run.pl|queue.pl [opts]> # how to run jobs."
   echo "  --phi (true|false)             # Should be set to true if the source lattices were created"
   echo "                                 # by lmrescore.sh, false if they came from decoding."
   echo "  --N <N>                        # Value of N in N-best rescoring (default: 10)"
   exit 1;
fi

rnnweight=$1
oldlang=$2
rnndir=$3
data=$4
indir=$5
dir=$6

acwt=`perl -e "print (1.0/$inv_acwt);"` # Note: we'll actually produce lattices
 # that will be scored at a range of acoustic weights.  This acwt should be close
 # to the final one we'll pick, though, for best performance (it controls the
 # N-best list generation).

for f in $oldlang/G.fst $rnndir/rnnlm $data/feats.scp $indir/lat.1.gz; do
  [ ! -f $f ] && echo "$0: expected file $f to exist." && exit 1;
done

nj=`cat $indir/num_jobs` || exit 1;
oldlm=$oldlang/G.fst
adir=$dir/archives

mkdir -p $dir;
phi=`grep -w '#0' $oldlang/words.txt | awk '{print $2}'`

rm $dir/.error 2>/dev/null
mkdir -p $dir/log

# First convert lattice to N-best.  Be careful because this
# will be quite sensitive to the acoustic scale; this should be close
# to the one we'll finally get the best WERs with.
# Note: the lattice-rmali part here is just because we don't
# need the alignments for what we're doing.
if [ $stage -le 1 ]; then
  echo "$0: converting lattices to N-best."
  $cmd JOB=1:$nj $dir/log/lat2nbest.JOB.log \
    lattice-to-nbest --acoustic-scale=$acwt --n=$N \
    "ark:gunzip -c $indir/lat.JOB.gz|" ark:- \|  \
    lattice-rmali ark:- "ark:|gzip -c >$dir/nbest1.JOB.gz" || exit 1;
fi

# next remove part of the old LM probs.
if $use_phi; then
  if [ $stage -le 2 ]; then
    echo "$0: removing old LM scores."
    # Use the phi-matcher style of composition.. this is appropriate
    # if the old LM scores were added e.g. by lmrescore.sh, using
    # phi-matcher composition.
    $cmd JOB=1:$nj $dir/log/remove_old.JOB.log \
      lattice-compose --phi-label=$phi "ark:gunzip -c $dir/nbest1.JOB.gz|" $oldlm \
      "ark:|gzip -c >$dir/nbest2.JOB.gz"  || exit 1;
  fi
else
  if [ $stage -le 2 ]; then
    echo "$0: removing old LM scores."
    # this approach chooses the best path through the old LM FST, while
    # subtracting the old scores.  If the lattices came straight from decoding,
    # this is what we want.  Note here: each FST in "nbest1.JOB.gz" is a linear FST,
    # it has no alternatives (the N-best format works by having multiple keys
    # for each utterance).  When we do "lattice-1best" we are selecting the best
    # path through the LM, there are no alternatives to consider within the
    # original lattice.
    $cmd JOB=1:$nj $dir/log/remove_old.JOB.log \
      lattice-scale --acoustic-scale=-1 --lm-scale=-1 "ark:gunzip -c $dir/nbest1.JOB.gz|" ark:- \| \
      lattice-compose ark:- "fstproject --project_output=true $oldlm |" ark:- \| \
      lattice-1best ark:- ark:- \| \
      lattice-scale --acoustic-scale=-1 --lm-scale=-1 ark:- "ark:|gzip -c >$dir/nbest2.JOB.gz" \
      || exit 1;
  fi
fi

if [ $stage -le 3 ]; then
# Decompose the n-best lists into 4 archives.
  echo "$0: creating separate-archive form of N-best lists."
  $cmd JOB=1:$nj $dir/log/make_new_archives.JOB.log \
    mkdir -p $adir.JOB '&&' \
    nbest-to-linear "ark:gunzip -c $dir/nbest2.JOB.gz|" \
    "ark,t:$adir.JOB/ali" "ark,t:$adir.JOB/words" \
    "ark,t:$adir.JOB/lmwt.nolm" "ark,t:$adir.JOB/acwt" || exit 1;
fi

if [ $stage -le 4 ]; then
  echo "$0: doing the same with old LM scores."
# Create an archive with the LM scores before we
# removed the LM probs (will help us do interpolation).
$cmd JOB=1:$nj $dir/log/make_old_archives.JOB.log \
  nbest-to-linear "ark:gunzip -c $dir/nbest1.JOB.gz|" "ark:/dev/null" \
  "ark:/dev/null" "ark,t:$adir.JOB/lmwt.withlm" "ark:/dev/null" || exit 1;
fi

if $test; then # This branch is a sanity check that at the acwt where we generated
  # the N-best list, we get the same WER.
  echo "$0 [testing branch]: generating lattices without changing scores."
  $cmd JOB=1:$nj $dir/log/test.JOB.log \
    linear-to-nbest "ark:$adir.JOB/ali" "ark:$adir.JOB/words" "ark:$adir.JOB/lmwt.withlm" \
     "ark:$adir.JOB/acwt" ark:- \| \
    nbest-to-lattice ark:- "ark:|gzip -c >$dir/lat.JOB.gz" || exit 1;
  exit 0;
fi

if [ $stage -le 5 ]; then
  echo "$0: Creating archives with text-form of words, and LM scores without graph scores."
    # Do some small tasks; for these we don't use the queue, it will only slow us down.
  for n in `seq $nj`; do
    utils/int2sym.pl -f 2- $oldlang/words.txt < $adir.$n/words > $adir.$n/words_text || exit 1;
    mkdir -p $adir.$n/temp
    paste $adir.$n/lmwt.nolm $adir.$n/lmwt.withlm | awk '{print $1, ($4-$2);}' > \
      $adir.$n/lmwt.lmonly || exit 1;
  done
fi
if [ $stage -le 6 ]; then
  echo "$0: invoking rnnlm_compute_scores.sh which calls rnnlm, to get RNN LM scores."
  $cmd JOB=1:$nj $dir/log/rnnlm_compute_scores.JOB.log \
    utils/rnnlm_compute_scores.sh $rnndir $adir.JOB/temp $adir.JOB/words_text $adir.JOB/lmwt.rnn \
    || exit 1;
fi
if [ $stage -le 7 ]; then
  echo "$0: reconstructing total LM+graph scores including interpolation of RNNLM and old LM scores."
  for n in `seq $nj`; do
    paste $adir.$n/lmwt.nolm $adir.$n/lmwt.lmonly $adir.$n/lmwt.rnn | awk -v rnnweight=$rnnweight \
      '{ key=$1; graphscore=$2; lmscore=$4; rnnscore=$6;
     score = graphscore+(rnnweight*rnnscore)+((1-rnnweight)*lmscore);
     print $1,score; } ' > $adir.$n/lmwt.interp.$rnnweight || exit 1;
  done
fi

if [ $stage -le 8 ]; then
  echo "$0: reconstructing archives back into lattices."
  $cmd JOB=1:$nj $dir/log/reconstruct_lattice.JOB.log \
    linear-to-nbest "ark:$adir.JOB/ali" "ark:$adir.JOB/words" \
    "ark:$adir.JOB/lmwt.interp.$rnnweight" "ark:$adir.JOB/acwt" ark:- \| \
    nbest-to-lattice ark:- "ark:|gzip -c >$dir/lat.JOB.gz" || exit 1;
fi

[ ! -x local/score.sh ] && \
  echo "Not scoring because local/score.sh does not exist or not executable." && exit 1;
local/score.sh --cmd "$cmd" $data $oldlang $dir

exit 0;


text:
title: Custom Log4Net appender
summary: Illustrates customizing Log4Net by passing in a custom Appender.
tags:
- Logging
- Log4Net
related:
- nservicebus/logging
---

## Code walk-through

Illustrates customizing Log4Net by passing in a custom Appender.

### Configure Log4Net

snippet:ConfigureLog4Net

### Pass that configuration to NServiceBus

snippet:UseConfig


text:
_Full project examples including tests and configuration can be found [here](https://github.com/ing-bank/baker/tree/master/examples)._

The _Development Life Cycle_ section provides a "top-down"/"by-example" guide to baker, all of the concepts
are introduced through exemplification on hypothetical development situations.

## Modeling the order placement process for a webshop using Ingredients, Events and Recipes.

The recipe DSL allows you to declaratively describe your business process. The design always starts with the
business requirements, lets say you are developing a webshop which will have many different microservices on
the backend. The initial requirements for the order reservation process reads:

_"An order contains an order id and a list of store item identifiers, when an order is placed it must first
be validated by reserving the items from the warehouse service, a success scenario yields the ids of the
reserved items, but if at least one item is unavailable at the warehouse a failure yields the list of unavailable items
and the process stops"_

When developing with Baker we must first translate the requirements into our 3 essential building blocks,
`Ingredients` for raw data, `Events` for happenings (that might contain ingredients), and `Interactions` which
have ingredients as input, execute actions with other systems, and yield more events. We will do this so that the
baker runtime can orchestrate the execution of our process through the underlying microservices.

## Ingredients and Events

A recipe always starts with initial events, also called `Sensory Events`, in the case of our first requirement
we could model the placing of an order as an event, which will provide 2 ingredients: the order id and the list
of items.

=== "Scala"

    ```scala

    import com.ing.baker.recipe.scaladsl._

    object Ingredients {

        val OrderId: Ingredient[String] =
          Ingredient[String]("orderId")

        val Items: Ingredient[List[String]] =
          Ingredient[List[String]]("items")
    }

    object Events {

        val OrderPlaced: Event = Event(
          name = "OrderPlaced",
          providedIngredients = Seq(
            Ingredients.OrderId,
            Ingredients.Items
          ),
          maxFiringLimit = Some(1)
        )
    }

    ```

=== "Java"

    ```java

    // In Java the data structures to represent Events and Ingredients
    // will be extraxted from a class by the reflection API when building
    // the Recipe. (see below for full example)

    public class JWebshopRecipe {

        public static class OrderPlaced {

            public final String orderId;
            public final List<String> items;

            public OrderPlaced(String orderId, List<String> items) {
                this.orderId = orderId;
                this.items = items;
            }
        }
    }

    ```

Depending on your programming language, you might want to import the corresponding dsl, i.e. `scaladsl` vs `javadsl`.

Ingredients and events are just data structures that describe your process data, carrying not just the names, but
also the type information, for example `Ingredient[String]("order-id")` creates an ingredient of name "order-id"
of type "String", for more information about Baker types please refer to [this section](../../reference/baker-types-and-values/).
As shown in the code, events might carry ingredients, and have a maximum about of times they are allowed to fire, the
runtime will enforce this limit. For more information about this and other features of events please refer to [this section](../../reference/dsls/#events).

## Interactions

Then, the desired actions can be modeled as `interactions`, in our case we are told that it exists a warehouse service
which we need to call to reserve the items, but this might either succeed or fail.

_Note: Notice that when using the reflection API, the Java interface or Scala trait that will represent your interaction
must have a method named `apply`, this is the method that the reflection API will convert into Baker types/ingredients/events._

=== "Scala"

    ```scala

    object Interactions {

        val ReserveItems: Interaction = Interaction(
              name = "ReserveItems",
              inputIngredients = Seq(
                Ingredients.OrderId,
                Ingredients.Items,
              ),
              output = Seq(
                Events.OrderHadUnavailableItems,
                Events.ItemsReserved
              )
            )
    }

    object Ingredients {

        // ... previous ingredients

        val ReservedItems: Ingredient[List[String]] =
          Ingredient[List[String]]("reservedItems")

        val UnavailableItems: Ingredient[List[String]] =
          Ingredient[List[String]]("unavailableItems")
    }

    object Events {

        // ... previous events

        val OrderHadUnavailableItems: Event = Event(
          name = "OrderHadUnavailableItems",
          providedIngredients = Seq(
            Ingredients.UnavailableItems
          ),
          maxFiringLimit = Some(1)
        )

        val ItemsReserved: Event = Event(
          name = "ItemsReserved",
          providedIngredients = Seq(
            Ingredients.ReservedItems
          ),
          maxFiringLimit = Some(1)
        )
    }

    ```

=== "Java (Reflection API)"

    ```java

    public class JWebshopRecipe {

        // ... previous event

        // Interface that will represent our Interaction, notice that it is declaring inner events.

        public interface ReserveItems extends Interaction {

            interface ReserveItemsOutcome {
            }

            class OrderHadUnavailableItems implements ReserveItemsOutcome {

                public final List<String> unavailableItems;

                public OrderHadUnavailableItems(List<String> unavailableItems) {
                    this.unavailableItems = unavailableItems;
                }
            }

            class ItemsReserved implements ReserveItemsOutcome {

                public final List<String> reservedItems;

                public ItemsReserved(List<String> reservedItems) {
                    this.reservedItems = reservedItems;
                }
            }

            // The @FireEvent annotation communicates the reflection API about several possible outcome events.
            @FiresEvent(oneOf = {OrderHadUnavailableItems.class, ItemsReserved.class})
            // The @RequiresIngredient annotation communicates the reflection API about the ingredient names that other events
            // must provide to execute this interaction.
            // The method MUST be named `apply`
            ReserveItemsOutcome apply(@RequiresIngredient("orderId") String id, @RequiresIngredient("items") List<String> items);
        }

    }

    ```

An interaction resembles a function, it takes input ingredients and outputs 1 of several possible events. At runtime, when
an event fires, baker tries to match the provided ingredients of 1 or several events to the input of awaiting interactions,
as soon as there is a match on data, baker will execute the interactions, creating a cascading effect that will execute
your business process in an asynchronous manner.

This was a simple example, but you might have already concluded that this can be further composed into bigger processes by
making new interactions that require events and ingredients which are output of previous interactions.

You can create also interactions which take no input ingredients but are executed after events (with or without provided
ingredients) are fired, for this and other features please refer to the conceptual documentation found [here](../../reference/dsls/#events).

## The Recipe

The final step is to create an object that will hold all of these descriptions into what we call a Recipe, this becomes
the "blueprint" of your process, it can define failure handling strategies, and will "auto-bind" the interactions, that
means it detects the composition between interactions by matching the ingredients provided by events to the input ingredients
required by interactions.

=== "Scala"

    ```scala

    object WebshopRecipe {
      val recipe: Recipe = Recipe("Webshop")
        .withSensoryEvents(
          Events.OrderPlaced
        )
        .withInteractions(
          Interactions.ReserveItems,
        )
    }
    ```

=== "Java"

    ```java

    public class JWebshopRecipe {

        // ... previous events and interactions.

        public final static Recipe recipe = new Recipe("WebshopRecipe")
                .withSensoryEvents(OrderPlaced.class)
                .withInteractions(of(ReserveItems.class));
    }
    ```

Let us remember that this is just a _description_ of what our program across multiple services should do, on the next
sections we will see how to visualize it, create runtime `instances` of our recipes and their parts, what common practices
are there for testing, everything you need to know to deploy and monitor a baker cluster, and how Baker helps you handle
and resolve failure which is not modeled in the domain (in the recipe).

As you might have realised `Ingredients`, `Events` and `Interactions` could be reused on different Recipes, giving common
business verbs that your programs and organisation can use across teams, the same way different cooking recipes share
same processes (simmering, boiling, cutting) you should reuse interactions across your different business recipes.

As a bonus; you might have though that this API is verbose, we agree and that is why we developed an alternative
API which uses Java and Scala reflection.

=== "Scala (Reflection API)"

    ```scala

    package webshop

    import com.ing.baker.recipe.scaladsl.{Event, Ingredient, Interaction, Recipe}

    object WebshopRecipeReflection {

      case class OrderPlaced(orderId: String, items: List[String])

      sealed trait ReserveItemsOutput

      case class OrderHadUnavailableItems(unavailableItems: List[String]) extends ReserveItemsOutput

      case class ItemsReserved(reservedItems: List[String]) extends ReserveItemsOutput

      val ReserveItems = Interaction(
        name = "ReserveItems",
        inputIngredients = Seq(
          Ingredient[String]("orderId"),
          Ingredient[List[String]]("items")
        ),
        output = Seq(
          Event[OrderHadUnavailableItems],
          Event[ItemsReserved]
        )
      )

      val recipe: Recipe = Recipe("Webshop")
        .withSensoryEvents(
          Event[OrderPlaced])
        .withInteractions(
          ReserveItems)
    }

    ```

=== "Java (Reflection API)"

    ```java

    package webshop;

    import com.ing.baker.recipe.annotations.FiresEvent;
    import com.ing.baker.recipe.annotations.RequiresIngredient;
    import com.ing.baker.recipe.javadsl.Interaction;
    import com.ing.baker.recipe.javadsl.Recipe;

    import static com.ing.baker.recipe.javadsl.InteractionDescriptor.of;

    public class JWebshopRecipe {

        public static class OrderPlaced {

            public final String orderId;
            public final List<String> items;

            public OrderPlaced(String orderId, List<String> items) {
                this.orderId = orderId;
                this.items = items;
            }
        }

        public interface ReserveItems extends Interaction {

            interface ReserveItemsOutcome {
            }

            class OrderHadUnavailableItems implements ReserveItemsOutcome {

                public final List<String> unavailableItems;

                public OrderHadUnavailableItems(List<String> unavailableItems) {
                    this.unavailableItems = unavailableItems;
                }
            }

            class ItemsReserved implements ReserveItemsOutcome {

                public final List<String> reservedItems;

                public ItemsReserved(List<String> reservedItems) {
                    this.reservedItems = reservedItems;
                }
            }

            // The @FireEvent annotation communicates the reflection API about several possible outcome events.
            @FiresEvent(oneOf = {OrderHadUnavailableItems.class, ItemsReserved.class})
            // The @RequiresIngredient annotation communicates the reflection API about the ingredient names that other events
            // must provide to execute this interaction.
            ReserveItemsOutcome apply(@RequiresIngredient("orderId") String id, @RequiresIngredient("items") List<String> items);
        }

        public final static Recipe recipe = new Recipe("WebshopRecipe")
                .withSensoryEvents(OrderPlaced.class)
                .withInteractions(of(ReserveItems.class));
    }
    ```


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/ads/googleads/v12/errors/errors.proto

package com.google.ads.googleads.v12.errors;

public interface PolicyViolationDetailsOrBuilder extends
    // @@protoc_insertion_point(interface_extends:google.ads.googleads.v12.errors.PolicyViolationDetails)
    com.google.protobuf.MessageOrBuilder {

  /**
   *

   * Human readable description of policy violation.
   *

   *
   * string external_policy_description = 2;
   * @return The externalPolicyDescription.
   */
  java.lang.String getExternalPolicyDescription();
  /**
   *

   * Human readable description of policy violation.
   *

   *
   * string external_policy_description = 2;
   * @return The bytes for externalPolicyDescription.
   */
  com.google.protobuf.ByteString
      getExternalPolicyDescriptionBytes();

  /**
   *

   * Unique identifier for this violation.
   * If policy is exemptible, this key may be used to request exemption.
   *

   *
   * .google.ads.googleads.v12.common.PolicyViolationKey key = 4;
   * @return Whether the key field is set.
   */
  boolean hasKey();
  /**
   *

   * Unique identifier for this violation.
   * If policy is exemptible, this key may be used to request exemption.
   *

   *
   * .google.ads.googleads.v12.common.PolicyViolationKey key = 4;
   * @return The key.
   */
  com.google.ads.googleads.v12.common.PolicyViolationKey getKey();
  /**
   *

   * Unique identifier for this violation.
   * If policy is exemptible, this key may be used to request exemption.
   *

   *
   * .google.ads.googleads.v12.common.PolicyViolationKey key = 4;
   */
  com.google.ads.googleads.v12.common.PolicyViolationKeyOrBuilder getKeyOrBuilder();

  /**
   *

   * Human readable name of the policy.
   *

   *
   * string external_policy_name = 5;
   * @return The externalPolicyName.
   */
  java.lang.String getExternalPolicyName();
  /**
   *

   * Human readable name of the policy.
   *

   *
   * string external_policy_name = 5;
   * @return The bytes for externalPolicyName.
   */
  com.google.protobuf.ByteString
      getExternalPolicyNameBytes();

  /**
   *

   * Whether user can file an exemption request for this violation.
   *

   *
   * bool is_exemptible = 6;
   * @return The isExemptible.
   */
  boolean getIsExemptible();
}


text:
package org.apache.phoenix.schema;

/**
 * Definition of a Phoenix column
 *
 *
 * @since 0.1
 */
public interface PColumn extends PDatum {

    /**
     * @return the name of the column qualifier
     */
    PName getName();

    /**
     * @return the name of the column family
     */
    PName getFamilyName();

    /**
     * @return the zero-based ordinal position of the column
     */
    int getPosition();

    /**
     * @return the declared array size or zero if this is not an array
     */
    Integer getArraySize();

    byte[] getViewConstant();

    boolean isViewReferenced();

    int getEstimatedSize();
}


text:
class Config(object):
    SECRET_KEY = ''
    SITE_NAME = 'reformedconfessions.com'
    MEMCACHED_SERVERS = ['localhost:11211']
    SYS_ADMINS = ['feedback@reformedconfessions.com']

class ProductionConfig(Config):
    DEBUG = True

class DevelopmentConfig(Config):
    '''Use "if app.debug" anywhere in your code, that code will run in development code.'''
    DEBUG = True


text:
See [LICENSE.md](./LICENSE.md) for license terms and conditions.

This template can be used for creating an Intel XDK game app using Pixi rendering engine. It is a blank Pixi.js project, which contains the required files. To get start, please see the key file `app.js`.

Intel(R) XDK
-------------------------------------------
This template is part of the Intel(R) XDK.
Download the Intel XDK at http://xdk.intel.com.

Application Files
-----------------
* LICENSE.md
* README.md
* app.json
* index.html
* asset/
* lib/pixi.js
* lib/pixi.min.js
* lib/LICENSE
* src/app.js


text:
// Code generated by go-swagger; DO NOT EDIT.

// Copyright 2017-2020 Authors of Cilium
// SPDX-License-Identifier: Apache-2.0

package endpoint

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"net/http"

	"github.com/go-openapi/runtime"

	"github.com/cilium/cilium/api/v1/models"
)

// PatchEndpointIDConfigOKCode is the HTTP code returned for type PatchEndpointIDConfigOK
const PatchEndpointIDConfigOKCode int = 200

/*PatchEndpointIDConfigOK Success

swagger:response patchEndpointIdConfigOK
*/
type PatchEndpointIDConfigOK struct {
}

// NewPatchEndpointIDConfigOK creates PatchEndpointIDConfigOK with default headers values
func NewPatchEndpointIDConfigOK() *PatchEndpointIDConfigOK {

	return &PatchEndpointIDConfigOK{}
}

// WriteResponse to the client
func (o *PatchEndpointIDConfigOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses

	rw.WriteHeader(200)
}

// PatchEndpointIDConfigInvalidCode is the HTTP code returned for type PatchEndpointIDConfigInvalid
const PatchEndpointIDConfigInvalidCode int = 400

/*PatchEndpointIDConfigInvalid Invalid configuration request

swagger:response patchEndpointIdConfigInvalid
*/
type PatchEndpointIDConfigInvalid struct {
}

// NewPatchEndpointIDConfigInvalid creates PatchEndpointIDConfigInvalid with default headers values
func NewPatchEndpointIDConfigInvalid() *PatchEndpointIDConfigInvalid {

	return &PatchEndpointIDConfigInvalid{}
}

// WriteResponse to the client
func (o *PatchEndpointIDConfigInvalid) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses

	rw.WriteHeader(400)
}

// PatchEndpointIDConfigNotFoundCode is the HTTP code returned for type PatchEndpointIDConfigNotFound
const PatchEndpointIDConfigNotFoundCode int = 404

/*PatchEndpointIDConfigNotFound Endpoint not found

swagger:response patchEndpointIdConfigNotFound
*/
type PatchEndpointIDConfigNotFound struct {
}

// NewPatchEndpointIDConfigNotFound creates PatchEndpointIDConfigNotFound with default headers values
func NewPatchEndpointIDConfigNotFound() *PatchEndpointIDConfigNotFound {

	return &PatchEndpointIDConfigNotFound{}
}

// WriteResponse to the client
func (o *PatchEndpointIDConfigNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses

	rw.WriteHeader(404)
}

// PatchEndpointIDConfigFailedCode is the HTTP code returned for type PatchEndpointIDConfigFailed
const PatchEndpointIDConfigFailedCode int = 500

/*PatchEndpointIDConfigFailed Update failed. Details in message.

swagger:response patchEndpointIdConfigFailed
*/
type PatchEndpointIDConfigFailed struct {

	/*
	  In: Body
	*/
	Payload models.Error `json:"body,omitempty"`
}

// NewPatchEndpointIDConfigFailed creates PatchEndpointIDConfigFailed with default headers values
func NewPatchEndpointIDConfigFailed() *PatchEndpointIDConfigFailed {

	return &PatchEndpointIDConfigFailed{}
}

// WithPayload adds the payload to the patch endpoint Id config failed response
func (o *PatchEndpointIDConfigFailed) WithPayload(payload models.Error) *PatchEndpointIDConfigFailed {
	o.Payload = payload
	return o
}

// SetPayload sets the payload to the patch endpoint Id config failed response
func (o *PatchEndpointIDConfigFailed) SetPayload(payload models.Error) {
	o.Payload = payload
}

// WriteResponse to the client
func (o *PatchEndpointIDConfigFailed) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.WriteHeader(500)
	payload := o.Payload
	if err := producer.Produce(rw, payload); err != nil {
		panic(err) // let the recovery middleware deal with this
	}
}


text:
A node.js module for CAS
========================

Hello, my name is James
=======================

-   Transportation engineering PhD
-   Research scientist with UCI ITS
-   https://github.com/jmarca
-   http://contourline.wordpress.com
-   james@activimetrics.com

------------------------------

![](figs/lavender_2.jpg)\

------------------------------

CAS
===

I don't know anything about CAS internals.

This talk is about *using* CAS

Use case: CAS + ldap
====================

-   Used to use Drupal
-   Drupal was set up to use ldap and CAS
-   So we used ldap and CAS

Single sign on, single sign off
===============================

-   Caltrans sponsors liked the website, but
-   They didn't like signing in again to project sites
-   Need single sign on, sign off

I use node.js
=============

-   JavaScript on the server.
-   Fast because V8 is fast
-   Clean, single-threaded non-blocking design
-   What's not to like?

CAS support in node.js
======================

-   The node.js packaging system is npm.
-   `npm search cas`: lots of options
-   but none supported single sign out

CAS Validate
============

-   repository: https://github.com/jmarca/cas\_validate
-   installation: npm install cas\_validate
-   a plugin to [Express](http://www.expressjs.com/) and
    [Connect](http://senchalabs.github.com/connect/)

Node.js idioms
==============

A brief digression
------------------

Non-blocking by design
======================

-   file i/o
-   web operations
-   db access
-   etc

Async needs callbacks
=====================

`fs.readFile(filename, [encoding], [callback])`

Asynchronously reads the entire contents of a file:

~~~~ {.language-javascript}
fs.readFile('/etc/passwd', function (err, data) {
  if (err) throw err;
  console.log(data);
});
~~~~

function(err, data)
===================

The callback is passed two arguments `(err, data)`. Check for errors,
then handle `data`.

callback is the last argument
=============================

example from node-redis code

------------------------------

~~~~ {.language-javascript}
RedisClient.prototype.send_command =
       function (command, args, callback) {
    if (Array.isArray(args)) {
        if (typeof callback === "function") {
        } else if (! callback) {
            last_arg_type = typeof args[args.length-1];
            if (last_arg_type === "function"
                || last_arg_type === "undefined") {
                callback = args.pop();
            }
        } else { throw new Error("...");}
    } else { throw new Error("..."); }
}
~~~~

Closures are used
=================

~~~~ {.language-javascript}
var fs = require('fs')
function doSomething(done){
    function callback(err, data) {
        if (err) throw err
        return done(null,data)
    })
    fs.readFile('hpms/data.txt','utf8',
                callback)
}
~~~~

End of digression
=================

Except:

-   semicolons are optional
-   comma first notation is popular

Program requirements
====================

-   Express is route based
-   public routes:
    -   check if logged in,
    -   but don't *require* a login.

-   restricted routes:
    -   require a login,
    -   check permissions, etc

Single Sign On/Off
==================

-   A login here=login everywhere
    -   and vice versa

-   A logout here=logout everywhere
    -   and vice versa

CAS documentation is excellent
==============================

Thanks

Basic login task
================

1.  establish a session with the client
2.  ask the client to redirect to the CAS server
3.  expect a reply back from the CAS server with a ticket
4.  check the ticket's validity directly with the CAS server

Establish a session with a client
=================================

-   use standard connect/express middleware

------------------------------

~~~~ {.language-javascript}
var express = require('express')
var RedisStore =
     require('connect-redis')(express);
var app = express()
app
 .use(express.logger({buffer:5000}))
 .use(express.bodyParser())
 .use(express.cookieParser('tall barley at Waterloo'))
 .use(express.session({ store: new RedisStore }))
~~~~

Redirect to CAS server
======================

-   more complicated, but still easy

------------------------------

Prerequisites:
--------------

~~~~ {.language-javascript}
var querystring = require('querystring')
// configurable
var cas_host = 'https://my.cas.host'
var login_service = '/cas/login'
~~~~

------------------------------

~~~~ {.language-javascript}
var redirecter = function (req,res,next){
    // decide endpoint where CAS server
    // will return to
    var service = determine_service(req)
    var queryopts = {'service':service}
    res.writeHead(307,
        { 'location': cas_host+login_service +'?'
               +querystring.stringify(queryopts)
        })
    return res.end()
}
~~~~

Listen for CAS reply
====================

-   parse incoming query for `ticket` parameter

------------------------------

~~~~ {.language-javascript}
function ticket_check(req,res,next){
    var url = parseUrl(req.url,true);
    if( url.query === undefined
       || url.query.ticket === undefined){
        logger.debug('moving along, no ticket');
        return next(); // next route
    }
    logger.debug('have ticket')
    ...
~~~~

Check ticket validity
=====================

> The request MUST include a valid service ticket, passed as the HTTP
> request parameter, "ticket".

-   Directly connect with CAS server to check validity of ticket
-   Using the Request library

------------------------------

Prerequisites:
--------------

~~~~ {.language-javascript}
var redis = require("redis")
var redclient = redis.createClient();
redclient.on("error", function (err) {
    logger.error("Redis Client Error: " + err);
});
~~~~

------------------------------

~~~~ {.language-javascript}
function ticket_check(req,res,next){
    ...
    var ticket = url.query.ticket;
    var service = opt_service ?
        opt_service : determine_service(req)
    var cas_uri =
       cas_host+validation_service +'?'
       +querystring.stringify({'service':service,
                               'ticket':ticket});
    request({uri:cas_uri}, callback);
    return null;
});
~~~~

Define the request callback
===========================

-   current version uses a regular expression
-   development version actually parses the XML
-   callback is a defined in ticket\_check, can see `ticket` and `next`
-   Redis: use Redis to link CAS session ticket and local session

------------------------------

~~~~ {.language-javascript}
function callback(err, resp, body) {
    if (!err && resp.statusCode === 200) {
        if(/cas:authenticationSuccess/.exec(body)){
            if(/<cas:user>(\w+)<\/cas:user>/.exec(body)){
                req.session.name = RegExp.$1;
            }
            req.session.st = ticket;
            redclient.set(ticket,req.sessionID);
            return next();
        }else{  next(new Error('authentication failed')); }
    }else{ next(new Error('authentication failed')); }
}
~~~~

That's it
=========

-   We redirected to CAS
-   consumed the service ticket
-   verified the service ticket
-   established a session
-   stored the session in Redis with the ticket as the key

------------------------------

# Example server

------------------------------

~~~~ {.language-javascript}
var app = express()
.use(express.cookieParser('barley Waterloo Napoleon'))
.use(express.session({ store: new RedisStore }))
.use(cas_validate.ticket({'cas_host':cas_host}))
.use(cas_validate.check_or_redirect({'cas_host':cas_host}))
.use(function(req, res, next){
         res.end('hello world')
         return null
     });
var server =app.listen(testport,testhost,done)
~~~~

------------------------------

Single Sign Off
===============

-   very easy
-   listen for a `POST` from the CAS server
-   invalidate the session

------------------------------

~~~~ {.language-javascript}
function ssoff(req,res,next){
   var method = req.method.toLowerCase();
   if (method == 'post'){
       return invalidate(req,res,next);
   }
   return next()
}
~~~~

------------------------------

~~~~ {.language-javascript}
function invalidate(req,res,next){
      var st = get_session_ticket(req)
      redclient.get(st,function(err,sid){
          req.sessionStore.destroy(sid
          ,function(err){
              redclient.del(st);
              return null
          }});
      res.end();
      return null;
  }
}
~~~~

------------------------------

# Demo 1

Sign on

------------------------------

# Demo 2

Sign off

------------------------------

# CTMLabs banner

* Using this library to create a dynamic banner for our sites
* Researchers need only write

``` html
<script src='http://menu.ctmlabs.net/menu.js?resetgateway=true&service=http%3a%2f%2fara.ctmlabs.net%2findex.html'></script>
```

<http://ara.ctmlabs.net>

------------------------------

# Thank you

Questions?  Comments?   Rotten tomatoes?

------------------------------

# Gripe

Is user agent parsing still horribly broken in default CAS server?


text:
<?php

namespace Sonata\DoctrinePHPCRAdminBundle\Tests\Filter;

use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder;
use Doctrine\ODM\PHPCR\Tools\Test\QueryBuilderTester;

class BaseTestCase extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $this->qb = new QueryBuilder;
        $this->qbTester = new QueryBuilderTester($this->qb);

        $this->proxyQuery = $this->getMockBuilder('Sonata\DoctrinePHPCRAdminBundle\Datagrid\ProxyQuery')
            ->disableOriginalConstructor()
            ->getMock();
        $this->proxyQuery->expects($this->any())
            ->method('getQueryBuilder')
            ->will($this->returnValue($this->qb));
    }
}


text:
require 'chef/resource_collection'

module Poise
  module Subcontext
    # A subclass of the normal Chef ResourceCollection that creates a partially
    # isolated set of resources. Notifications and other resources lookups can
    # propagate out to parent contexts but not back in. This is used to allow
    # black-box resources that are still aware of things in upper contexts.
    #
    # @api private
    # @since 1.0.0
    class ResourceCollection < Chef::ResourceCollection
      attr_accessor :parent

      def initialize(parent)
        @parent = parent
        super()
      end

      def lookup(resource)
        super
      rescue Chef::Exceptions::ResourceNotFound
        @parent.lookup(resource)
      end

      # Iterate over all resources, expanding parent context in order.
      #
      # @param block [Proc] Iteration block
      # @return [void]
      def recursive_each(&block)
        if @parent
          if @parent.respond_to?(:recursive_each)
            @parent.recursive_each(&block)
          else
            @parent.each(&block)
          end
        end
        each(&block)
      end

      # Iterate over all resources in reverse order.
      #
      # @since 2.3.0
      # @param block [Proc] Iteration block
      # @return [void]
      def reverse_recursive_each(&block)
        reverse_each(&block)
        if @parent
          if @parent.respond_to?(:recursive_each)
            @parent.reverse_recursive_each(&block)
          else
            @parent.reverse_each(&block)
          end
        end
      end
    end
  end
end


text:
namespace Sleemon.Data
{
    using Newtonsoft.Json;
    using System.Configuration;

    public class MessageViewModel
    {
        public int Id { get; set; }

        public int Type { get; set; }

        public Receiver Receivers { get; set; }

        public News News { get; set; }
    }

    public class Receiver
    {
        public string ToUsers { get; set; }

        public string ToDepts { get; set; }
    }

    public class News
    {
        protected readonly string STATIC_RESOURCES_DOMAIN = ConfigurationManager.AppSettings["STATIC_RESOURCES_DOMAIN"];

        public string Title { get; set; }

        public string Description { get; set; }

        public int Url { get; set; }

        private string _picUrl;

        public string PicUrl
        {
            get
            {
                if (!string.IsNullOrEmpty(_picUrl))
                {
                    _picUrl = STATIC_RESOURCES_DOMAIN + _picUrl;
                }
                return _picUrl;
            }
            set
            {
                _picUrl = value;
            }
        }
    }
}


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

<title>FileView (Java Platform SE 8 )</title>
<meta name="date" content="2014-12-17">
<meta name="keywords" content="javax.swing.filechooser.FileView class">
<meta name="keywords" content="getName()">
<meta name="keywords" content="getDescription()">
<meta name="keywords" content="getTypeDescription()">
<meta name="keywords" content="getIcon()">
<meta name="keywords" content="isTraversable()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

javax.swing.filechooser

Class FileView

java.lang.Object

javax.swing.filechooser.FileView

Direct Known Subclasses:

BasicFileChooserUI.BasicFileView

public abstract class FileView
extends Object

FileView defines an abstract class that can be implemented
 to provide the filechooser with UI information for a File.
 Each L&F JFileChooserUI object implements this
 class to pass back the correct icons and type descriptions specific to
 that L&F. For example, the Microsoft Windows L&F returns the
 generic Windows icons for directories and generic files.
 Additionally, you may want to provide your own FileView to
 JFileChooser to return different icons or additional
 information using JFileChooser.setFileView(javax.swing.filechooser.FileView).

 JFileChooser first looks to see if there is a user defined
 FileView, if there is, it gets type information from
 there first. If FileView returns null for
 any method, JFileChooser then uses the L&F specific
 view to get the information.
 So, for example, if you provide a FileView class that
 returns an Icon for JPG files, and returns null
 icons for all other files, the UI's FileView will provide
 default icons for all other files.

 For an example implementation of a simple file view, see
 yourJDK/demo/jfc/FileChooserDemo/ExampleFileView.java.
 For more information and examples see
 How to Use File Choosers,
 a section in The Java Tutorial.

See Also:

JFileChooser

Constructor Summary

Constructors

Constructor and Description

FileView()

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

String
getDescription(File f)

A human readable description of the file.

Icon
getIcon(File f)

The icon that represents this file in the JFileChooser.

String
getName(File f)

The name of the file.

String
getTypeDescription(File f)

A human readable description of the type of the file.

Boolean
isTraversable(File f)

Whether the directory is traversable or not.

Methods inherited from class java.lang.Object

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

Constructor Detail

FileView

public FileView()

Method Detail

getName

public String getName(File f)

The name of the file. Normally this would be simply
 f.getName().

getDescription

public String getDescription(File f)

A human readable description of the file. For example,
 a file named jag.jpg might have a description that read:
 "A JPEG image file of James Gosling's face".

getTypeDescription

public String getTypeDescription(File f)

A human readable description of the type of the file. For
 example, a jpg file might have a type description of:
 "A JPEG Compressed Image File"

getIcon

public Icon getIcon(File f)

The icon that represents this file in the JFileChooser.

isTraversable

public Boolean isTraversable(File f)

Whether the directory is traversable or not. This might be
 useful, for example, if you want a directory to represent
 a compound document and don't want the user to descend into it.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
<?php

namespace Chamilo\Application\Weblcms\Tool\Implementation\Teams\DependencyInjection;

use Chamilo\Application\Weblcms\Tool\Implementation\Teams\Manager;
use Chamilo\Libraries\File\Path;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

/**
 * @inheritdoc
 */
class DependencyInjectionExtension extends Extension implements ExtensionInterface
{

    /**
     * @inheritdoc
     */
    public function load(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader(
            $container, new FileLocator(
                Path::getInstance()->namespaceToFullPath(Manager::context()) .
                'Resources/Configuration/DependencyInjection'
            )
        );

        $loader->load('services.xml');
    }

    /**
     * Returns the recommended alias to use in XML.
     *
     * This alias is also the mandatory prefix to use when using YAML.
     *
     * @return string The alias
     *
     * @api
     */
    public function getAlias()
    {
        return 'chamilo.application.weblcms.tool.implementation.teams';
    }
}


text:
<?php

namespace Mwltr\Robo\Magento2\Task;

use Robo\Common\ExecOneCommand;
use Robo\Task\BaseTask;

/**
 * AbstractTask
 */
abstract class AbstractTask extends BaseTask
{
    use ExecOneCommand;

    protected $taskInfo = '';

    protected $command;

    protected $action = null;

    protected $ansi = null;

    public function __construct($magentoBin = 'bin/magento')
    {
        $phpbin = PHP_BINARY;
        $this->command = "$phpbin $magentoBin";
    }

    /**
     * {@inheritdoc}
     */
    public function getCommand()
    {
        if (!isset($this->ansi) && $this->getConfig()->isDecorated()) {
            $this->ansi();
        }
        $this->option($this->ansi);

        return "{$this->command} {$this->action}{$this->arguments}";
    }

    /**
     * {@inheritdoc}
     */
    public function run()
    {
        $command = $this->getCommand();

        $this->printTaskInfo("$this->taskInfo : {command}", ['command' => $command]);

        return $this->executeCommand($command);
    }

    /**
     * adds `ansi` option to composer
     *
     * @return $this
     */
    public function ansi()
    {
        $this->ansi = '--ansi';

        return $this;
    }

}


text:
module DatalogHelper
end


text:
/**
 * Refreshable
 *
 * runs component refreshing process in given interval
 *
 * @class Hatimeria.core.mixins.Refreshable
 * @extend Ext.Base
 */
(function() {

    Ext.define('Hatimeria.core.mixins.Refreshable', {
        extend: 'Ext.Base',
        refresherId: null,
        refreshInterval: null,
        refreshMinutesInterval: 1,
        automateRefreshFn: null,

        restartRefresher: function() {
            // stop previous updater process
            if(this.refresherId) {
                clearInterval(this.refresherId);
            }

            this.startRefresher();
        },

        startRefresher: function() {

            this.refreshInterval = this.refreshMinutesInterval*60*1000;
            var store = this.store;
            if(this.automateRefreshFn == null && store != null) {
                this.automateRefreshFn = function() {
                    store.load();
                }
            }

            this.refresherId = setInterval(Ext.bind(this.automateRefreshFn, this), this.refreshInterval);
        }
    });
})();


text:
#include "analog_in.h"
#include "board.h"

using namespace slab;

bool AnalogIn::s_adcInited[] = {0};

Ar::TypedChannel<uint32_t> g_adc0Result("adc0");
Ar::TypedChannel<uint32_t> g_adc1Result("adc1");

//------------------------------------------------------------------------------
// Code
//------------------------------------------------------------------------------

AnalogIn::AnalogIn(uint32_t instance, uint32_t channel)
:   m_instance(instance),
    m_channel(channel)
{
    if (instance == 0)
    {
        m_base = ADC0;
    }
    else if (instance == 1)
    {
        m_base = ADC1;
    }
}

AnalogIn::~AnalogIn()
{
    if (s_adcInited[m_instance])
    {
        ADC16_Deinit(m_base);
        DisableIRQ(m_instance == 0 ? ADC0_IRQn : ADC1_IRQn);
        s_adcInited[m_instance] = false;
    }
}

void AnalogIn::init(const adc16_config_t & config)
{
    if (!s_adcInited[m_instance])
    {
        ADC16_Init(m_base, &config);
        ADC16_SetHardwareAverage(m_base, kADC16_HardwareAverageCount32);
        ADC16_DoAutoCalibration(m_base);
        EnableIRQ(m_instance == 0 ? ADC0_IRQn : ADC1_IRQn);

        s_adcInited[m_instance] = true;
    }
}

extern "C" void ADC0_IRQHandler()
{
    uint32_t result = ADC16_GetChannelConversionValue(ADC0, 0);
    g_adc0Result.send(result, kArNoTimeout);
}

extern "C" void ADC1_IRQHandler()
{
    uint32_t result = ADC16_GetChannelConversionValue(ADC1, 0);
    g_adc1Result.send(result, kArNoTimeout);
}

uint32_t AnalogIn::read()
{
    adc16_channel_config_t channelConfig;
    channelConfig.channelNumber = m_channel;
    channelConfig.enableInterruptOnConversionCompleted = true;
    channelConfig.enableDifferentialConversion = false;

    ADC16_SetChannelConfig(m_base, 0, &channelConfig);

    uint32_t result;
    if (m_instance == 0)
    {
        result = g_adc0Result.receive();
    }
    else if (m_instance == 1)
    {
        result = g_adc1Result.receive();
    }
    return result;
}

//------------------------------------------------------------------------------
// EOF
//------------------------------------------------------------------------------


text:
#pragma once
#include <aws/macie2/Macie2_EXPORTS.h>
#include <aws/macie2/model/JobComparator.h>
#include <aws/macie2/model/SimpleCriterionKeyForJob.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Macie2
{
namespace Model
{

  /**
   *
Specifies a property-based condition that determines whether an S3 bucket is
   * included or excluded from a classification job.

See Also:
   AWS
   * API Reference

   */
  class AWS_MACIE2_API SimpleCriterionForJob
  {
  public:
    SimpleCriterionForJob();
    SimpleCriterionForJob(Aws::Utils::Json::JsonView jsonValue);
    SimpleCriterionForJob& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline const JobComparator& GetComparator() const{ return m_comparator; }

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline bool ComparatorHasBeenSet() const { return m_comparatorHasBeenSet; }

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline void SetComparator(const JobComparator& value) { m_comparatorHasBeenSet = true; m_comparator = value; }

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline void SetComparator(JobComparator&& value) { m_comparatorHasBeenSet = true; m_comparator = std::move(value); }

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline SimpleCriterionForJob& WithComparator(const JobComparator& value) { SetComparator(value); return *this;}

    /**
     *
The operator to use in the condition. Valid values are EQ (equals) and NE
     * (not equals).

     */
    inline SimpleCriterionForJob& WithComparator(JobComparator&& value) { SetComparator(std::move(value)); return *this;}

    /**
     *
The property to use in the condition.

     */
    inline const SimpleCriterionKeyForJob& GetKey() const{ return m_key; }

    /**
     *
The property to use in the condition.

     */
    inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; }

    /**
     *
The property to use in the condition.

     */
    inline void SetKey(const SimpleCriterionKeyForJob& value) { m_keyHasBeenSet = true; m_key = value; }

    /**
     *
The property to use in the condition.

     */
    inline void SetKey(SimpleCriterionKeyForJob&& value) { m_keyHasBeenSet = true; m_key = std::move(value); }

    /**
     *
The property to use in the condition.

     */
    inline SimpleCriterionForJob& WithKey(const SimpleCriterionKeyForJob& value) { SetKey(value); return *this;}

    /**
     *
The property to use in the condition.

     */
    inline SimpleCriterionForJob& WithKey(SimpleCriterionKeyForJob&& value) { SetKey(std::move(value)); return *this;}

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline const Aws::Vector<Aws::String>& GetValues() const{ return m_values; }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline bool ValuesHasBeenSet() const { return m_valuesHasBeenSet; }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline void SetValues(const Aws::Vector<Aws::String>& value) { m_valuesHasBeenSet = true; m_values = value; }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline void SetValues(Aws::Vector<Aws::String>&& value) { m_valuesHasBeenSet = true; m_values = std::move(value); }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline SimpleCriterionForJob& WithValues(const Aws::Vector<Aws::String>& value) { SetValues(value); return *this;}

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline SimpleCriterionForJob& WithValues(Aws::Vector<Aws::String>&& value) { SetValues(std::move(value)); return *this;}

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline SimpleCriterionForJob& AddValues(const Aws::String& value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline SimpleCriterionForJob& AddValues(Aws::String&& value) { m_valuesHasBeenSet = true; m_values.push_back(std::move(value)); return *this; }

    /**
     *
An array that lists one or more values to use in the condition. If you
     * specify multiple values, Amazon Macie uses OR logic to join the values. Valid
     * values for each supported property (key) are:

ACCOUNT_ID - A
     * string that represents the unique identifier for the Amazon Web Services account
     * that owns the bucket.

S3_BUCKET_EFFECTIVE_PERMISSION - A string
     * that represents an enumerated value that Macie defines for the BucketPublicAccess.effectivePermission
     * property of a bucket.

S3_BUCKET_NAME - A string that represents
     * the name of a bucket.

S3_BUCKET_SHARED_ACCESS - A string that
     * represents an enumerated value that Macie defines for the BucketMetadata.sharedAccess
     * property of a bucket.

Values are case sensitive. Also, Macie
     * doesn't support use of partial values or wildcard characters in these
     * values.

     */
    inline SimpleCriterionForJob& AddValues(const char* value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }

  private:

    JobComparator m_comparator;
    bool m_comparatorHasBeenSet;

    SimpleCriterionKeyForJob m_key;
    bool m_keyHasBeenSet;

    Aws::Vector<Aws::String> m_values;
    bool m_valuesHasBeenSet;
  };

} // namespace Model
} // namespace Macie2
} // namespace Aws


text:
using System.IO;
using UnityEngine;

namespace LmpClient.Windows
{
    public class WindowUtil
    {
        public static Texture2D LoadIcon(string path, int width, int height)
        {
            var image = new Texture2D(width, height);
            if (File.Exists(path))
            {
                var data = File.ReadAllBytes(path);
                image.LoadImage(data);
            }

            return image;
        }
    }
}


text:
from __future__ import annotations

import time
from typing import TYPE_CHECKING, Any, Optional
from urllib.parse import urljoin

from securicad.model import es_serializer

from securicad.enterprise.deprecation import deprecated
from securicad.enterprise.exceptions import StatusCodeException

if TYPE_CHECKING:
    from securicad.model import Model

    from securicad.enterprise.client import Client
    from securicad.enterprise.scenarios import Scenario
    from securicad.enterprise.tunings import Tuning

class Simulation:
    def __init__(
        self, client: Client, pid: str, tid: str, simid: str, name: str, progress: int
    ) -> None:
        self.client = client
        self.pid = pid
        self.tid = tid
        self.simid = simid
        self.name = name
        self.progress = progress
        self.result: Optional[dict[str, Any]] = None

    @staticmethod
    def from_dict(client: Client, dict_simulation: dict[str, Any]) -> Simulation:
        return Simulation(
            client=client,
            pid=dict_simulation["pid"],
            tid=str(dict_simulation["basemodel"]),
            simid=dict_simulation["mid"],
            name=dict_simulation["name"],
            progress=dict_simulation["progress"],
        )

    def __update_progress(self) -> None:
        dict_simulation = self.client.simulations._get_dict_simulation_by_simid(
            self.pid, self.simid
        )
        self.progress = dict_simulation["progress"]

    def __wait_for_results(self) -> None:
        if self.progress == 100:
            return
        while True:
            self.__update_progress()
            if self.progress < 0 or self.progress == 100:  # failed or finished
                break
            time.sleep(1)

    def delete(self) -> None:
        data: dict[str, Any] = {"pid": self.pid, "simids": [self.simid]}
        self.client._delete("simulations", data)

    def get_results(self) -> dict[str, Any]:
        self.__wait_for_results()
        data: dict[str, Any] = {"pid": self.pid, "simid": self.simid}
        result: dict[str, Any] = self.client._post("simulation/data", data)
        result["report_url"] = urljoin(
            self.client._base_url,
            f"project/{self.pid}/scenario/{self.tid}/report/{self.simid}",
        )
        self.result = result
        return result

    def get_raw_results(self) -> str:
        def cleanup(result: str) -> str:  # because of our not quite csv format
            lines = result.split("\n")
            if lines[2].startswith('"samplecount=') and lines[3].startswith('"build='):
                return "\n".join(lines[4:])
            return result

        self.__wait_for_results()
        data: dict[str, Any] = {"pid": self.pid, "simid": self.simid}
        result = self.client._post("simulation/raw_data", data)
        self.raw_result = cleanup(result["csv_data"])
        return self.raw_result

    def get_critical_paths(
        self, hvas: Optional[list[str]] = None
    ) -> dict[str, dict[str, Any]]:
        """
        Returns some or all critial paths for this simulation.

        Parameters:
            hvas: A list of strings on the form "<object_id>.<attackstep>", e.g. "1.Compromise".
                  If hvas is None all critical paths are returned.

        Returns:
            A dict of the form data["1.Compromise"] = { critical path }
        """
        if not self.result:
            self.get_results()

        if hvas is None:
            if not self.result:
                raise ValueError(
                    "No result stored, unable to retrieve high value assets, please specify"
                )
            hvas = []
            for risk in self.result["results"]["risks"]:
                hvas.append(risk["attackstep_id"])

        attackpaths: dict[str, dict[str, Any]] = {}
        for hva in hvas:
            try:
                data = {"simid": self.simid, "attackstep": hva}
                resp = self.client._post("simulation/attackpath", data)
                attackpaths[hva] = resp["data"]
            except StatusCodeException as ex:
                if (
                    ex.status_code != 500
                    or ex.json is None
                    or ex.json.get("error") != "no attackpath found"
                ):
                    raise
        return attackpaths

class Simulations:
    def __init__(self, client: Client) -> None:
        self.client = client

    def _get_dict_simulation_by_simid(self, pid: str, simid: str) -> dict[str, Any]:
        data: dict[str, Any] = {"pid": pid, "simids": [simid]}
        dict_simulation: dict[str, Any] = self.client._post("simulations/data", data)[
            simid
        ]
        return dict_simulation

    def _list_simulations(self, scenario: Scenario) -> list[Simulation]:
        dict_scenario = self.client.scenarios._get_dict_scenario_by_tid(
            scenario.pid, scenario.tid
        )
        simulations: list[Simulation] = []
        for dict_simulation in dict_scenario["results"].values():
            simulations.append(
                Simulation.from_dict(
                    client=self.client, dict_simulation=dict_simulation
                )
            )
        return simulations

    @deprecated("Use Scenario.list_simulations()")
    def list_simulations(self, scenario: Scenario) -> list[Simulation]:
        return scenario.list_simulations()

    def _get_simulation_by_simid(self, scenario: Scenario, simid: str) -> Simulation:
        dict_simulation = self._get_dict_simulation_by_simid(scenario.pid, simid)
        return Simulation.from_dict(client=self.client, dict_simulation=dict_simulation)

    @deprecated("Use Scenario.get_simulation_by_simid()")
    def get_simulation_by_simid(self, scenario: Scenario, simid: str) -> Simulation:
        return scenario.get_simulation_by_simid(simid=simid)

    def _get_simulation_by_name(self, scenario: Scenario, name: str) -> Simulation:
        simulations = scenario.list_simulations()
        for simulation in simulations:
            if simulation.name == name:
                return simulation
        for simulation in simulations:
            if simulation.name.lower() == name.lower():
                return simulation
        raise ValueError(f"Invalid simulation {name}")

    @deprecated("Use Scenario.get_simulation_by_name()")
    def get_simulation_by_name(self, scenario: Scenario, name: str) -> Simulation:
        return scenario.get_simulation_by_name(name=name)

    def _create_simulation(
        self,
        scenario: Scenario,
        name: Optional[str] = None,
        model: Optional[Model] = None,
        tunings: Optional[list[Tuning]] = None,
        raw_tunings: Optional[list[dict[str, Any]]] = None,
        filter_results: bool = True,
    ) -> Simulation:
        data: dict[str, Any] = {
            "pid": scenario.pid,
            "tid": scenario.tid,
            "filter_results": filter_results,
        }
        if name is not None:
            data["name"] = name
        if model is not None:
            data["blob"] = es_serializer.serialize_model(model)
        if tunings is not None:
            data["cids"] = [t.tuning_id for t in tunings]
        if raw_tunings is not None:
            data["tunings"] = raw_tunings
        response = self.client._put("simulation", data)
        return self._get_simulation_by_simid(scenario, response["simid"])

    @deprecated("Use Scenario.create_simulation()")
    def create_simulation(
        self,
        scenario: Scenario,
        name: Optional[str] = None,
        model: Optional[Model] = None,
        tunings: Optional[list[Tuning]] = None,
        raw_tunings: Optional[list[dict[str, Any]]] = None,
        filter_results: bool = True,
    ) -> Simulation:
        return scenario.create_simulation(
            name=name,
            model=model,
            tunings=tunings,
            raw_tunings=raw_tunings,
            filter_results=filter_results,
        )


text:
'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

require('../styles/components/titlebar.scss');

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

var TitleBar = function TitleBar(props) {
  var isSelectedProject = props.project.title === props.selectedProject ? true : false;

  return _react2.default.createElement(
    'div',
    { className: 'titlebar' + (isSelectedProject ? ' titlebar--selected' : '') },
    _react2.default.createElement('img', { className: 'titlebar__icon', src: 'assets/os-icons/openfolder-icon.png', alt: 'open folder icon' }),
    _react2.default.createElement(
      'span',
      { className: 'titlebar__text' },
      props.project.title
    )
  );
};

exports.default = TitleBar;