text:
package org.batfish.grammar.recovery_inline_alts;

import org.batfish.grammar.BatfishANTLRErrorStrategy;
import org.batfish.grammar.BatfishANTLRErrorStrategy.BatfishANTLRErrorStrategyFactory;
import org.batfish.grammar.BatfishCombinedParser;
import org.batfish.grammar.BatfishLexerRecoveryStrategy;
import org.batfish.grammar.GrammarSettings;
import org.batfish.grammar.flattener.FlattenerLineMap;
import org.batfish.grammar.recovery_inline_alts.RecoveryInlineAltsParser.Recovery_inline_alts_configurationContext;

public class RecoveryInlineAltsCombinedParser
    extends BatfishCombinedParser<RecoveryInlineAltsParser, RecoveryInlineAltsLexer> {

  private static final BatfishANTLRErrorStrategyFactory NEWLINE_BASED_RECOVERY =
      new BatfishANTLRErrorStrategy.BatfishANTLRErrorStrategyFactory(
          RecoveryInlineAltsLexer.NEWLINE, "\n");

  public RecoveryInlineAltsCombinedParser(String input, GrammarSettings settings) {
    super(
        RecoveryInlineAltsParser.class,
        RecoveryInlineAltsLexer.class,
        input,
        settings,
        NEWLINE_BASED_RECOVERY,
        BatfishLexerRecoveryStrategy.WHITESPACE_AND_NEWLINES);
  }

  public RecoveryInlineAltsCombinedParser(
      String input, GrammarSettings settings, FlattenerLineMap lineMap) {
    super(
        RecoveryInlineAltsParser.class,
        RecoveryInlineAltsLexer.class,
        input,
        settings,
        NEWLINE_BASED_RECOVERY,
        BatfishLexerRecoveryStrategy.WHITESPACE_AND_NEWLINES,
        lineMap);
  }

  @Override
  public Recovery_inline_alts_configurationContext parse() {
    return _parser.recovery_inline_alts_configuration();
  }
}


text:
This installation guide was created for Debian/Ubuntu and tested on it.

Please read doc/install/requirements.md for hardware andplatform requirements.

**Important Note**
The following steps have been known to work.
If you deviate from this guide, do it with caution and make sure you don't
violate any assumptions GitLab makes about its environment.
If you find a bug/error in this guide please an issue or pull request following
the contribution guide (see CONTRIBUTING.md).

- - -

# Overview

The GitLab installation consists of setting up th following components:

1. Packages / Dependencies
2. Ruby
3. System Users
4. Gitolite
5. Database
6. GitLab
7. Nginx

# 1. Packages / Dependencies

*Keep in mind that `sudo` is not installed on Debian by default. You should install it as root:*

    apt-get update && apt-get upgrade && apt-get install sudo

Make sure your system is up-to-date:

    sudo apt-get update
    sudo apt-get upgrade

Install the required packages:

    sudo apt-get install -y wget curl build-essential checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev zlib1g-dev libicu-dev redis-server openssh-server git-core libyaml-dev postfix

Make sure you have the right version of Python installed.

    # Install Python
    sudo apt-get install python

    # Make sure that Python is 2.x (3.x is not supported at the moment)
    python --version

    # If it's Python 3 you might need to install Python 2 separately
    sudo apt-get install python2.7

    # Make sure you can access Python via `python2`
    python2 --version

    # If you get a "command not found" error create a link to the python binary
    sudo ln -s /usr/bin/python /usr/bin/python2

# 2. Ruby

    wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
    tar xfvz ruby-1.9.3-p327.tar.gz
    cd ruby-1.9.3-p327
    ./configure
    make
    sudo make install

# 3. System Users

Create a user for Git and Gitolite:

    sudo adduser \
      --system \
      --shell /bin/sh \
      --gecos 'Git Version Control' \
      --group \
      --disabled-password \
      --home /home/git \
      git

Create a user for GitLab:

    sudo adduser --disabled-login --gecos 'GitLab' gitlab

    # Add it to the git group
    sudo addmod -a -G git gitlab

    # Generate the SSH key
    sudo -u gitlab -H ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa

# 4. Gitolite

Clone GitLab's fork of the Gitolite source code:

    sudo -u git -H git clone -b gl-v304 https://github.com/gitlabhq/gitolite.git /home/git/gitolite

Setup Gitolite with GitLab as its admin:

**Important Note**
GitLab assumes *full and unshared* control over this Gitolite installation.

    # Add Gitolite scripts to $PATH
    cd /home/git
    sudo -u git -H mkdir bin
    sudo -u git -H sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile'
    sudo -u git -H sh -c 'gitolite/install -ln /home/git/bin'

    # Copy the gitlab user's (public) SSH key ...
    sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
    sudo chmod 0444 /home/git/gitlab.pub

    # ... and use it as the Gitolite admin key for setup
    sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub"

Fix the directory permissions for the repository:

    # Make sure the repositories dir is owned by git and it stays that way
    sudo chmod -R ug+rwXs /home/git/repositories/
    sudo chown -R git:git /home/git/repositories/

## Test if everything works so far

    # Clone the admin repo so SSH adds localhost to known_hosts ...
    # ... and to be sure your users have access to Gitolite
    sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin

    # If it succeeded without errors you can remove the cloned repo
    sudo rm -rf /tmp/gitolite-admin

**Impornant Note**
If you can't clone the `gitolite-admin` repository: **DO NOT PROCEED WITH INSTALLATION**
Check the [Trouble Shooting Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide)
and make sure you have followed all of the above steps carefully.

# 5. Database

See doc/install/databases.md

# 6. GitLab

    We'll install GitLab into the gitlab user's home directory
    cd /home/gitlab

## Clone the Source

    # Clone the latest stable release
    sudo -u gitlab -H git clone -b stable https://github.com/gitlabhq/gitlabhq.git gitlab

**Note***
You can change `stable` to `master` if you want the *bleeding edge* version, but
do so with caution!

## Configure it

    cd /home/gitlab/gitlab

    # Copy the example GitLab config
    sudo -u gitlab -H cp config/gitlab.yml.example config/gitlab.yml

    # Make sure to change "localhost" to the fully-qualified domain name of your
    # host serving GitLab where necessary
    sudo -u gitlab -H vim config/gitlab.yml

    # Copy the example Unicorn config
    sudo -u gitlab -H cp config/unicorn.rb.example config/unicorn.rb

**Important Note**
Make sure to edit both files to match your setup.

## Install Gems

    cd /home/gitlab/gitlab

    sudo gem install charlock_holmes --version '0.6.9'
    sudo gem install bundler
    sudo -u gitlab -H bundle install --deployment --without development test

## Configure Git

GitLab needs to be able to commit and push changes to Gitolite. In order to do
that Git requires a username and email. (Please use the `email.from` address
for the email)

    sudo -u gitlab -H git config --global user.name "GitLab"
    sudo -u gitlab -H git config --global user.email "gitlab@localhost"

## Setup GitLab hooks

    sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
    sudo chown git:git /home/git/.gitolite/hooks/common/post-receive

## Initialise Database and Activate Advanced Features

    sudo -u gitlab -H bundle exec rake gitlab:app:setup RAILS_ENV=production

## Check Application Status

Check if GitLab  and its environment is configured correctly:

    sudo -u gitlab -H bundle exec rake gitlab:env:info RAILS_ENV=production

To make sure you didn't miss anything run a more thorough check with:

    sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production

```
# OUTPUT EXAMPLE
Starting diagnostic
config/database.yml............exists
config/gitlab.yml............exists
/home/git/repositories/............exists
/home/git/repositories/ is writable?............YES
remote: Counting objects: 603, done.
remote: Compressing objects: 100% (466/466), done.
remote: Total 603 (delta 174), reused 0 (delta 0)
Receiving objects: 100% (603/603), 53.29 KiB, done.
Resolving deltas: 100% (174/174), done.
Can clone gitolite-admin?............YES
UMASK for .gitolite.rc is 0007? ............YES
/home/git/share/gitolite/hooks/common/post-receive exists? ............YES
```

If you are all green - congratulations! You run a GitLab now.
But there are still a few steps to go.

## Install Init Script

Download the init script (will be /etc/init.d/gitlab):

    sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
    sudo chmod +x /etc/init.d/gitlab

Make GitLab start on boot:

    sudo update-rc.d gitlab defaults 21

Start your GitLab instance:

    sudo service gitlab start

# 7. Nginx

## Installation
    sudo apt-get install nginx

## Site Configuration

Download an example site config:

    sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
    sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

Make sure to edit the config file to match your setup:

    # Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**
    # to the IP address and fully-qualified domain name
    # of your host serving GitLab
    sudo vim /etc/nginx/sites-enabled/gitlab

## Restart

    sudo /etc/init.d/nginx restart

# Done!

Visit YOUR_SERVER for your first GitLab login.
The setup has created an admin account for you. You can use it to log in:

    admin@local.host
    5iveL!fe

**Important Note**
Please go over to your profile page and immediately chage the password, so
nobody can access your GitLab by using this login information later on.

**Enjoy!**

- - -

# Advanced setup tips:

## Custom Redis connections

If you'd like Resque to connect to a Redis server on a non-standard port or on
a different host, you can configure its connection string via the
`config/resque.yml` file.

    # example
    production: redis.example.tld:6379

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <meta content="text/html; charset=UTF-8" http-equiv="content-type">
  <title>Stempel - Algorithmic Stemmer for Polish Language</title>
  <meta content="Andrzej Bialecki" name="author">
  <meta name="keywords"
 content="stemming, stemmer, algorithmic stemmer, Polish stemmer">
  <meta
 content="This page describes a software package consisting of high-quality stemming tables for Polish, and a universal algorithmic stemmer, which operates using these tables."
 name="description">

Stempel - Algorithmic Stemmer for Polish Language

Introduction

A method for conflation of different inflected word forms is an
important component of many Information Retrieval systems. It helps to
improve the system's recall and can significantly reduce the index
size. This is especially true for highly-inflectional languages like
those from the Slavic language family (Czech, Slovak, Polish, Russian,
Bulgarian, etc).

This page describes a software package consisting of high-quality
stemming tables for Polish, and a universal algorithmic stemmer, which
operates using these tables. The stemmer code is taken virtually
unchanged from the Egothor project.

The software distribution includes stemmer
tables prepared using an extensive corpus of Polish language (see
details below).

This work is available under Apache-style Open Source license - the
stemmer code is covered by Egothor License, the tables and other
additions are covered by Apache License 2.0. Both licenses allow to use
the code in Open Source as well as commercial (closed source) projects.

Terminology

A short explanation is in order about the terminology used in this
text.

In the following sections I make a distinction between stem
and lemma.

Lemma is a base grammatical form (dictionary form, headword) of a
word. Lemma is an existing, grammatically correct word in some human
language.

Stem on the other hand is just a unique token, not necessarily
making any sense in any human language, but which can serve as a unique
label instead of lemma for the same set of inflected forms. Quite often
stem is referred to as a "root" of the word - which is incorrect and
misleading (stems sometimes have very little to do with the linguistic
root of a word, i.e. a pattern found in a word which is common to all
inflected forms or within a family of languages).

For an IR system stems are usually sufficient, for a morphological
analysis system obviously lemmas are a must. In practice, various
stemmers produce a mix of stems and lemmas, as is the case with the
stemmer described here. Additionally, for some languages, which use
suffix-based inflection rules many stemmers based on suffix-stripping
will produce a large percentage of stems equivalent to lemmas. This is
however not the case for languages with complex, irregular inflection
rules (such as Slavic languages) - here simplistic suffix-stripping
stemmers produce very poor results.

Background

Lemmatization is a process of finding the base, non-inflected form
of a word. The result of lemmatization is a correct existing word,
often in nominative case for nouns and infinitive form for verbs. A
given inflected form may correspond to several lemmas (e.g. "found"
-> find, found) - the correct choice depends on the context.

Stemming is concerned mostly with finding a unique "root" of a word,
which not necessarily results in any existing word or lemma. The
quality of stemming is measured by the rate of collisions (overstemming
- which causes words with different lemmas to be incorrectly conflated
into one "root"), and the rate of superfluous word "roots"
(understemming - which assigns several "roots" to words with the same
lemma).

Both stemmer and lemmatizer can be implemented in various ways. The two
most common approaches are:

dictionary-based: where the stemmer uses an extensive dictionary
of morphological forms in order to find the corresponding stem or lemma

algorithmic: where the stemmer uses an algorithm, based on
general morphological properties of a given language plus a set of
heuristic rules

There are many existing and well-known implementations of stemmers for
English (Porter, Lovins, Krovetz) and other European languages
(Snowball). There are also
good quality commercial lemmatizers for Polish. However, there is only
one
freely available Polish stemmer, implemented by
Dawid
Weiss, based on the "ispell" dictionary and Jan Daciuk's FSA package. That
stemmer is dictionary-based. This means that even
though it can achieve
perfect accuracy for previously known word forms found in its
dictionary, it
completely fails in case of all other word forms. This deficiency is
somewhat mitigated by the comprehensive dictionary distributed with
this stemmer (so there is a high probability that most of the words in
the input text will be found in the dictionary), however the problem
still remains (please see the page above for more detailed description).

The implementation described here uses an algorithmic method. This
method
and particular algorithm implementation are described in detail in
[1][2].
The main advantage of algorithmic stemmers is their ability to process
previously
unseen word forms with high accuracy. This particular algorithm uses a
set
of
transformation rules (patch commands), which describe how a word with a
given pattern should be transformed to its stem. These rules are first
learned from a training corpus. They don't
cover
all possible cases, so there is always some loss of precision/recall
(which
means that even the words from the training corpus are sometimes
incorrectly stemmed).

Algorithm and implementation

The algorithm and its Java implementation is described in detail in the
publications cited below. Here's just a short excerpt from [2]:

"The aim is separation of the
stemmer execution code from the data
structures [...]. In other words, a static algorithm configurable by
data must be developed. The word transformations that happen in the
stemmer must be then encoded to the data tables.

The tacit input of our method is a sample set (a so-called dictionary)
of words (as keys) and their stems. Each record can be equivalently
stored as a key and the record of key's transformation to its
respective stem. The transformation record is termed a patch command
(P-command). It must be ensured that P-commands are universal, and that
P-commands can transform any word to its stem. Our solution[6,8] is
based on the Levenstein metric [10], which produces P-command as the
minimum cost path in a directed graph.

One can imagine the P-command as an algorithm for an operator (editor)
that rewrites a string to another string. The operator can use these
instructions (PP-command's): removal -
deletes a sequence of characters starting at the current cursor
position and moves the cursor to the next character. The length of this
sequence is the parameter; insertion -
inserts a character ch, without moving the cursor. The character ch is
a parameter; substitution
- rewrites a character at the current cursor position to the character
ch and moves the cursor to the next character. The character ch is a
parameter; no operation (NOOP)
- skip a sequence of characters starting at the current cursor
position. The length of this sequence is the parameter.

The P-commands are applied from the end of a word (right to left). This
assumption can reduce the set of P-command's, because the last NOOP,
moving the cursor to the end of a string without any changes, need not
be stored."

Data structure used to keep the dictionary (words and their P-commands)
is a trie. Several optimization steps are applied in turn to reduce and
optimize the initial trie, by eliminating useless information and
shortening the paths in the trie.

Finally, in order to obtain a stem from the input word, the word is
passed once through a matching path in the trie (applying at each node
the P-commands stored there). The result is a word stem.

Corpus

(to be completed...)

The following Polish corpora have been used:

Polish
dictionary
from ispell distribution

Wzbogacony korpus
słownika frekwencyjnego

The
Bible (so called "TysiÄ…clecia") - unauthorized electronic version

Analizator
morfologiczny SAM v. 3.4 - this was used to recover lemmas
missing from other texts

This step was the most time-consuming - and it would probably be
even more tedious and difficult if not for the
help of
Python. The source texts had to be
brought to a common encoding (UTF-8) - some of them used quite ancient
encodings like Mazovia or DHN - and then scripts were written to
collect all lemmas and
inflected forms from the source texts. In cases when the source text
was not
tagged,
I used the SAM analyzer to produce lemmas. In cases of ambiguous
lemmatization I decided to put references to inflected forms from all
base forms.

All grammatical categories were allowed to appear in the corpus,
i.e. nouns, verbs, adjectives, numerals, and pronouns. The resulting
corpus consisted of roughly 87,000+ inflection sets, i.e. each set
consisted of one base form (lemma) and many inflected forms. However,
because of the nature of the training method I restricted these sets to
include only those where there were at least 4 inflected forms. Sets
with 3 or less inflected forms were removed, so that the final corpus
consisted of ~69,000 unique sets, which in turn contained ~1.5 mln
inflected forms.

Testing

I tested the stemmer tables produced using the implementation
described above. The following sections give some details about
the testing setup.

Testing procedure

The testing procedure was as follows:

the whole corpus of ~69,000 unique sets was shuffled, so that the
input sets were in random order.

the corpus was split into two parts - one with 30,000 sets (Part
1), the other with ~39,000 sets (Part 2).

Training samples were drawn in sequential order from the Part 1.
Since the sets were already randomized, the training samples were also
randomized, but this procedure ensured that each larger training sample
contained all smaller samples.

Part 2 was used for testing. Note: this means that the testing
run used only words previously unseen during the training
phase. This is the worst scenario, because it means that stemmer must
extrapolate the learned rules to unknown cases. This also means that in
a real-life case (where the input is a mix between known and unknown
words) the F-measure of the stemmer will be even higher than in the
table below.

Test results

The following table summarizes test results for varying sizes
of training samples. The meaning of the table columns is
described below:

training sets: the number of training sets. One set
consists of one lemma and at least 4 and up to ~80 inflected forms
(including pre- and suffixed forms).

testing forms: the number of testing forms. Only inflected
forms were used in testing.

stem OK: the number of cases when produced output was a
correct (unique) stem. Note: quite often correct stems were also
correct lemmas.

lemma OK: the number of cases when produced output was a
correct lemma.

missing: the number of cases when stemmer was unable to
provide any output.

stem bad: the number of cases when produced output was a
stem, but already in use identifying a different set.

lemma bad: the number of cases when produced output was an
incorrect lemma. Note: quite often in such case the output was a
correct stem.

table size: the size in bytes of the stemmer table.

      Training sets
      Testing forms
      Stem OK
      Lemma OK
      Missing
      Stem Bad
      Lemma Bad
      Table size [B]

      100
      1022985
      842209
      593632
      172711
      22331
      256642
      28438

      200
      1022985
      862789
      646488
      153288
      16306
      223209
      48660

      500
      1022985
      885786
      685009
      130772
      14856
      207204
      108798

      700
      1022985
      909031
      704609
      107084
      15442
      211292
      139291

      1000
      1022985
      926079
      725720
      90117
      14941
      207148
      183677

      2000
      1022985
      942886
      746641
      73429
      14903
      202915
      313516

      5000
      1022985
      954721
      759930
      61476
      14817
      201579
      640969

      7000
      1022985
      956165
      764033
      60364
      14620
      198588
      839347

      10000
      1022985
      965427
      775507
      50797
      14662
      196681
      1144537

      12000
      1022985
      967664
      782143
      48722
      14284
      192120
      1313508

      15000
      1022985
      973188
      788867
      43247
      14349
      190871
      1567902

      17000
      1022985
      974203
      791804
      42319
      14333
      188862
      1733957

      20000
      1022985
      976234
      791554
      40058
      14601
      191373
      1977615

I also measured the time to produce a stem (which involves
traversing a trie,
retrieving a patch command and applying the patch command to the input
string).
On a machine running Windows XP (Pentium 4, 1.7 GHz, JDK 1.4.2_03
HotSpot),
for tables ranging in size from 1,000 to 20,000 cells, the time to
produce a
single stem varies between 5-10 microseconds.

This means that the stemmer can process up to 200,000 words per second, an
outstanding result when compared to other stemmers (Morfeusz - ~2,000
w/s, FormAN (MS Word analyzer) - ~1,000 w/s).

The package contains a class org.getopt.stempel.Benchmark,
which you can use to produce reports
like the one below:

--------- Stemmer benchmark report: -----------
Stemmer table:  /res/tables/stemmer_2000.out
Input file:     ../test3.txt
Number of runs: 3

 RUN NUMBER:            1       2       3
 Total input words      1378176 1378176 1378176
 Missed output words    112     112     112
 Time elapsed [ms]      6989    6940    6640
 Hit rate percent       99.99%  99.99%  99.99%
 Miss rate percent      00.01%  00.01%  00.01%
 Words per second       197192  198584  207557
 Time per word [us]     5.07    5.04    4.82

Summary

The results of these tests are very encouraging. It seems that using
the
training corpus and the stemming algorithm described above results in a
high-quality stemmer useful for most applications. Moreover, it can
also
be used as a better than average lemmatizer.

Both the author of the implementation
(Leo Galambos, <leo.galambos AT egothor DOT org>) and the author
of this
compilation (Andrzej Bialecki <ab AT getopt DOT org>) would
appreciate any
feedback and suggestions for further improvements.

Bibliography

Galambos, L.: Multilingual Stemmer in Web Environment, PhD
Thesis,
Faculty of Mathematics and Physics, Charles University in Prague, in
press.

Galambos, L.: Semi-automatic Stemmer Evaluation. International
Intelligent Information Processing and Web Mining Conference, 2004,
Zakopane, Poland.

Galambos, L.: Lemmatizer for Document Information Retrieval
Systems in JAVA. <http://www.informatik.uni-trier.de/%7Eley/db/conf/sofsem/sofsem2001.html#Galambos01>
SOFSEM 2001, Piestany, Slovakia.


text:
package com.seovic.maven.plugins.npm;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.File;
import java.io.IOException;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * Simple wrapper around package.json.
 *
 * @author Aleksandar Seovic  2015.09.22
 */
public class Package
        extends LinkedHashMap<String, Object>
    {
    // ---- factory method --------------------------------------------------

    /**
     * Parse package.json.
     *
     * @param file  the file to parse
     *
     * @return a new Package instance for the specified file
     *
     * @throws IOException  if an error occurs
     */
    public static Package parse(File file) throws IOException
        {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(file, Package.class);
        }

    // ---- accessors -------------------------------------------------------

    public String getName()
        {
        return (String) get("name");
        }

    public String getVersion()
        {
        return (String) get("version");
        }

    public String getDescription()
        {
        return (String) get("description");
        }

    public Map<String, Object> getScripts()
        {
        Map<String, Object> scripts = (Map<String, Object>) get("scripts");
        return scripts == null
               ? Collections.<String, Object>emptyMap()
               : scripts;
        }

    public String getScript(String sName)
        {
        return (String) getScripts().get(sName);
        }

    public boolean hasScript(String script)
        {
        return getScripts().containsKey(script);
        }
    }


text:
import numpy as np

from intuition.api.portfolio import PortfolioFactory
import insights.managers.utils as utils

class OLMAR(PortfolioFactory):
    '''
    On-Line Portfolio Moving Average Reversion

    More info can be found in the corresponding paper:
    http://icml.cc/2012/papers/168.pdf
    '''

    initialized = False

    def initialize(self, configuration):
        self.log.debug(configuration)
        self.eps = configuration.get('eps', 1)

    def warm(self, data):
        self.m = len(data.keys())
        self.b_t = np.ones(self.m) / self.m

    def _rebalance_portfolio(self, data, desired_port):
        # rebalance portfolio
        allocations = {}
        desired_amount = np.zeros_like(desired_port)
        current_amount = np.zeros_like(desired_port)
        prices = np.zeros_like(desired_port)

        if not self.initialized:
            positions_value = self.portfolio.starting_cash
            self.initialized = True
        else:
            positions_value = self.portfolio.positions_value + \
                self.portfolio.cash

        for i, stock in enumerate(data):
            current_amount[i] = self.portfolio.positions[stock].amount
            prices[i] = data[stock].price

        desired_amount = np.round(desired_port * positions_value / prices)

        diff_amount = desired_amount - current_amount

        for i, stock in enumerate(data):
            # Remove nan values
            if not np.isnan(diff_amount[i]):
                allocations[stock] = int(diff_amount[i])
        return allocations

    def optimize(self, date, to_buy, to_sell, parameters):
        # This implementation only process buy signals
        allocations = {}
        for sid in to_sell:
            allocations[sid] = to_sell[sid].amount

        data = to_buy

        #if not self.initialized:
            #self._warm(data)

        x_tilde = np.zeros(self.m)
        b = np.zeros(self.m)

        # find relative moving average price for each security
        for i, stock in enumerate(data):
            price = data[stock].price
            # Relative mean deviation
            if 'mavg' in data[stock]:
                x_tilde[i] = data[stock]['mavg']['price'] / price

        ###########################
        # Inside of OLMAR (algo 2)
        x_bar = x_tilde.mean()

        # market relative deviation
        mark_rel_dev = x_tilde - x_bar

        # Expected return with current portfolio
        exp_return = np.dot(self.b_t, x_tilde)
        weight = self.eps - exp_return
        variability = (np.linalg.norm(mark_rel_dev)) ** 2

        # test for divide-by-zero case
        if variability == 0.0:
            step_size = 0
        else:
            step_size = max(0, weight / variability)

        b = self.b_t + step_size * mark_rel_dev
        b_norm = utils.simplex_projection(b)
        np.testing.assert_almost_equal(b_norm.sum(), 1)

        allocations.update(self._rebalance_portfolio(data, b_norm))

        # update portfolio
        self.b_t = b_norm

        #e_ret = 0
        #e_risk = 1
        e_ret = exp_return
        e_risk = variability
        return allocations, e_ret, e_risk


text:
Requires the following perl modules:
```
Scalar::Util
```

Get input files
```
wget https://s3-us-west-2.amazonaws.com/mayo-bic-tools/variant_miner/vcfs/1KG.chr22.anno.infocol.vcf.gz
wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/README.sample_cryptic_relations
wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/phase1_integrated_calls.20101123.ALL.panel
```
Transform the VCF sampleFormat and INFO data into JSON for uploading to the database
##### Some important notes:
* If values are strings, then they get quotes
* I skipped any data point that had a null value (`'.'`)
* The INFO field has some HTML links with some funky characters, so be careful when parsing
* I transformed the AD field from an array [in the VCF] to AD_1 and AD_2 so I could query and index it easier
* I gave the VCF a study name to merge with the sample names so I can prevent conflicts in the namespace when adding new samples
* I created a varID key by combining "chrom:pos:ref:alt" so I know what variant position I am talking about
```
time zcat 1KG.chr22.anno.infocol.vcf.gz |perl scripts/VCF2Arango.pl -VCF - -study 1000Genomes
#Line Number 348000 of 348234 (100%)
#real    34m34.806s
#user    34m11.020s
#sys     0m29.268s

```

Transform the cryptic relatedness file into JSON
##### Some important notes:
* I had to skip several lines that didn't have any information

```
time perl scripts/parseRelatedness.pl -i README.sample_cryptic_relations
#real    0m0.052s
#user    0m0.016s
#sys     0m0.000s

```

The last transformation is for the population descriptions
##### Some important notes:
* This file was supposed to have 4 columns, but someone got a little liberal with the comma usage
 * replacing `ABI_SOLID,` with `ABI_SOLID` fixes the issue

```
time perl scripts/parsePopulations.pl -i phase1_integrated_calls.20101123.ALL.panel
#real    0m0.021s
#user    0m0.012s
#sys     0m0.004s

```

I now have 4 different json files to import into ArangoDB

```
#Start Arango arangodb3 (3.0.8)
arangod
#change terminal and start the import process

```

#create single entries to prime the indexes
```
time for x in *json
do
 echo $x
 head -1 $x > ${x}.2
 arangoimp --file ${x}.2 --type json --collection ${x/.json/} --create-collection true --server.password $PASSWORD
 rm ${x}.2
done

#real    0m0.041s
#user    0m0.016s
#sys     0m0.000s

```

# add indexes to collections
```
arangosh --server.password $PASSWORD
db.info.ensureIndex({ type: "hash", fields: [ "Effect_Impact"], sparse: true });
db.info.ensureIndex({ type: "skiplist", fields: [ "ExAC_Info_AF" ] });
db.info.ensureIndex({ type: "hash", fields: [ "SAVANT_IMPACT" ], sparse: true });
db.sampleFormat.ensureIndex({ type: "hash", fields: [ "sampleID" ] });
exit
```

#Load full collections
```
time arangoimp --file "cryptic.json" --type json --collection cryptic --progress true --server.password $PASSWORD
#real    0m0.007s
#user    0m0.004s
#sys     0m0.000s

time arangoimp --file "populations.json" --type json --collection populations --progress true --server.password $PASSWORD
#real    0m0.048s
#user    0m0.004s
#sys     0m0.000s

time arangoimp --file "info.json" --type json --collection info --progress true --server.password $PASSWORD
#real    0m7.278s
#user    0m0.072s
#sys     0m0.100s

time arangoimp --file "sampleFormat.json" --type json --collection sampleFormat --progress true --server.password $PASSWORD
#real    57m11.646s
#user    0m7.968s
#sys     0m15.384s

arangosh
```
#Formulate Queries in the Web interface

```
 time curl --data @- -X POST --dump - http://localhost:8529/_api/cursor
        LET samples =(FOR sample IN cryptic
    FILTER sample.Population != "ASW" && sample.Relationship != "Sibling"
    COLLECT s1 = sample.Sample_1, s2 = sample.Sample_2
    RETURN [s1,s2]
    )
        RETURN(FLATTEN(samples,2))
)

LET sampleCounts = (
FOR format IN sampleFormat
    FILTER format.GQ >= 30 && format.GT IN ['0|1', '0/1'] && format.sampleID IN sampleLIST[0]
        FOR info in info
            FILTER format.varID == info._key
            FILTER info.Effect_Impact IN ["HIGH","MODERATE"]
            FILTER info.AF < 0.1
            RETURN format.sampleID
)

LET sampleSummaryCounts = (
    for u in sampleCounts
        COLLECT sample = u WITH COUNT INTO length
        RETURN { sample: sample, length: length }
)

LET majorPop = (
    FOR pop IN populations
        RETURN DISTINCT pop.Pop2
 )

LET popCounts = (
    FOR u IN sampleSummaryCounts
        FOR pop IN populations
            FILTER u.sample == pop.SAMPLE
            COLLECT sample = u.sample, length = u.length, Pop = pop.Pop2
            RETURN {length:length, pop:Pop}
)

FOR x IN majorPop
    FOR y IN popCounts
        FILTER x == y.pop
        COLLECT  pop = x
        AGGREGATE len = SUM(y.length)
        RETURN {"P":pop,"c":len}
"}

# Did not complete after 20 hours
```


text:
from urllib2 import Request, urlopen, URLError
from time import sleep          # we need sleep for a delay between readings
import sys                      # we use sys for command line arguments
                                # insert the path to your log file
#file_path = '/home/kstrack/'   # without it's name e.g. /home/pi/
file_path = ''                  # not really needed unless running from cron

# Here we list the urls of the KS campaigns we want to track
urls =['https://www.kickstarter.com/projects/raspitv/raspio-duino-affordable-arduino-programming-on-ras',
       'https://www.kickstarter.com/projects/ryanteckltd/raspberry-pi-debug-clip']

if 'nolog' in sys.argv:
    logging_enabled = 0
else:
    logging_enabled = 1         # change to 0 to switch off logging
if 'nodis' in sys.argv:
    display_enabled = 0
else:
    display_enabled = 1         # change to 0 to switch off screen output
if 'noloop' in sys.argv:
    loop_forever = 0
else:
    loop_forever = 1            # change to 0 to just scan once and not loop

pc='%'                          # defining % as a variable avoids confusion

def last_entry(project_name):                   # helps handle when a KS finishes
    logfile = file_path + project_name + '.txt'
    read_log = open(logfile, 'r') # open file for appending
    log_contents = read_log.readlines()
    read_log.close()
    last_line = log_contents[-1]
    time_left = int(last_line.split(',')[4])
    if time_left == 0:
        return 1
    else:
        return 0

def log(project_name, target, percent, amount_raised, campaign_duration,
        time_left, time_left_unit, backers, amount_per_hour, hours_into_campaign,
        project_currency):
    # convert non-string variables to strings for writing to file
    percent = "%.2f" % percent
    hours_into_campaign = "%.3f" % hours_into_campaign
    if len(str(campaign_duration)) > 4:                   # restrict length stored
        campaign_duration = "{:.4f}".format(campaign_duration)
    else:
        campaign_duration = str(campaign_duration)
    backers = str(backers)
    amount_per_hour = "%.2f" % amount_per_hour
    logfile = file_path + project_name + ".txt"

    write_list = [target, percent, amount_raised, campaign_duration, time_left,
                  time_left_unit, backers, amount_per_hour, hours_into_campaign,
                  project_currency]
    write_string = ','.join(write_list) + '\n'
    log_data = open(logfile, 'a') # open file for appending
    log_data.write(write_string)
    log_data.close()

def scan(someurl):                # page scanning function
    global logging_enabled
    req = Request(someurl)
    try:
        response = urlopen(req)
    except URLError as e:
        if hasattr(e, 'reason'):
            print 'We failed to reach a server.'
            print 'Reason: ', e.reason
        elif hasattr(e, 'code'):
            print 'The server couldn\'t fulfill the request.'
            print 'Error code: ', e.code
    else:
        the_page = response.readlines()
        project_name = someurl.split('/')[5].split('-')[0] # take project name from URL
        for line in the_page:
            if 'data-duration' in line:  # line 457
                time_left = float(line.split('"')[5])
                campaign_duration = float(line.split('"')[1])
                hours_into_campaign = (24 * campaign_duration) - time_left
                if time_left >= 72:
                    time_left_unit = "days"
                    time_left = str(int(time_left / 24))
                elif time_left >= 1:
                    time_left_unit = "hours"
                    time_left = str(int(time_left))
                elif 0 < time_left < 1:
                    time_left_unit = "minutes"
                    time_left = str(int(time_left * 60))
                else:
                    time_left_unit = "seconds"
                    time_left = str(int(time_left))
                    if last_entry(project_name):
                        logging_enabled = 0          # stop logging if campaign finished

            if 'data-backers-count' in line:
                backers = int(line.split('"')[3])
            if 'data-goal' in line:       # line 449
                words = line.split(" ")
                for word in words:
                    if 'data-goal' in word:
                        target = word.split('"')
                            # bold and yellow for labels, bold and white for figures
                    if 'data-percent-raised' in word:
                        percent = word.split('"')
                    if 'data-pledged' in word:
                        amount_raised = word.split('"')
            if 'project_currency_code' in line:
                project_currency = line.split('"')[1]
                project_currency = project_currency.split(' ')[1]
                if project_currency == 'usd':
                    project_currency_symbol = '$'
                elif project_currency == 'gbp':
                    project_currency_symbol = '£'
                else:
                    project_currency_symbol = '£' # we can add more currencies as needed

        amount_per_hour = float(amount_raised[1]) / hours_into_campaign

        if display_enabled:
            print '\033[34m\033[1m' + project_name + '\033[0m' # bold and blue title
            print '\033[33m\033[1mtarget:\033[0m \033[1m\033[37m%s%.2f\033[0m' % (project_currency_symbol,float(target[1]))
            print '\033[33m\033[1mpercentage raised:\033[0m \033[1m\033[37m%.2f%s\033[0m' % ((float(percent[1]) * 100) , pc)
            print '\033[33m\033[1mTotal so far:\033[0m \033[1m\033[37m%s%.2f\033[0m' % (project_currency_symbol, float(amount_raised[1]))
            print '\033[33m\033[1mTime left:\033[0m \033[1m\033[37m%s %s\033[0m' % (time_left, time_left_unit)
            print '\033[33m\033[1mBackers:\033[0m \033[1m\033[37m%d \033[0m' % backers
            print '\033[33m\033[1m%s/hr:\033[0m \033[1m\033[37m%s%.2f \033[0m \n' % (project_currency_symbol, project_currency_symbol, amount_per_hour)

        if (logging_enabled and counter % log_interval == 0):
            log(project_name, target[1], (float(percent[1]) * 100), amount_raised[1],
                campaign_duration, time_left, time_left_unit, backers, amount_per_hour,
                hours_into_campaign, project_currency)
counter = 0
log_interval = 10
while True:          # continuous loop scans each URL we define
    for url in urls:
        scan(url)
        sleep(15)
    counter += 1     # to be able to limit logging frequency
    if not loop_forever:
        break

# Instructions for ks4.py
# To use this script, edit lines 12-13 to include the KS URLs you want to track,
# save, then type...
# python ks4.py

# By default, it will display on-screen output, loop continuously until you
# CTRL+C out of it (or it errors out), and log every tenth cycle to a file

# python ks4.py [nolog | nodis | noloop]
# You can add nolog and/or nodis and/or noloop to the command
#
# These will disable logging | display | looping respectively
# You can use any, all or none of the above, but if you use...
# nolog nodis noloop, the program won't do anything with the KS page it scans.

# If you want to run it from cron, you'll need to add the file_path (line 8)
# e.g. /home/pi (but not the filename itself, just the path)


text:
local function is_banned(user_id, chat_id)
  local hash = 'banned:'..chat_id..':'..user_id
  local banned = redis:get(hash)
  return banned or false
end

local function is_super_banned(user_id)
  local hash = 'superbanned:'..user_id
  local superbanned = redis:get(hash)
  return superbanned or false
end

local function why_real(user, receiver)
  local chat_id = string.gsub(receiver, "chat#id", "")
  chat_id = string.gsub(receiver, "channel#id", "")
  local banned = is_banned(user.peer_id, chat_id)
  local superbanned = is_super_banned(user.peer_id)

  local text = str2emoji(':information_source:').." User "
  if user.username ~= nil then
    text = text.."@"..user.username
  else
    text = text..user.print_name
  end

  text = text.." ["..user.peer_id.."]\n"
  if banned then
    text = text..str2emoji(":exclamation:").." Is currently banned from this group.\n"
    if superbanned then
      text = text..str2emoji(":no_entry_sign:").." This ID is also superbanned.\n\n"
      text = text..str2emoji(":point_right:").." You can let this user in by disabling the superban list with the !superban disable command"
      text = text.."and then by unbanning with !ban delete "..user.peer_id
    else
      text = text.."\n"..str2emoji(":point_right:").." You can unban the user with !ban delete "..user.peer_id
    end
  else
    if superbanned then
      text = text..str2emoji(":no_entry_sign:").." This ID is currently superbanned.\n\n"
      text = text..str2emoji(":point_right:").." You can let this user in by disabling the superban list with the !superban disable command."
    else
      text = text..str2emoji(":thumbsup:").." This ID is not banned nor superbanned.\n"
    end
  end
  send_large_msg(receiver, text)

end

local function why_id(peer_id, chat_id)
  local banned = is_banned(peer_id, chat_id)
  local superbanned = is_super_banned(peer_id)

  local text = str2emoji(':information_source:').." User with ID "..peer_id.."\n"

  if banned then
    text = text..str2emoji(":exclamation:").." Is currently banned from this group.\n"
    if superbanned then
      text = text..str2emoji(":no_entry_sign:").." This ID is also superbanned.\n\n"
      text = text..str2emoji(":point_right:").." You can let this user in by disabling the superban list with the !superban disable command"
      text = text.."and then by unbanning with !ban delete "..peer_id
    else
      text = text.."\n"..str2emoji(":point_right:").." You can unban the user with !ban delete "..peer_id
    end
  else
    if superbanned then
      text = text..str2emoji(":no_entry_sign:").." Is currently superbanned.\n\n"
      text = text..str2emoji(":point_right:").." You can let this user in by disabling the superban list with the !superban disable command."
    else
      text = text..str2emoji(":thumbsup:").." This ID is not banned nor superbanned.\n"
    end
  end

  return text

end

local function why(cb_extra, success, result)
  if result.from ~= nil then
    why_real(result.from, cb_extra.receiver)
  else
    why_real(result, cb_extra.receiver)
  end
end

local function run(msg, matches)
  local receiver = get_receiver(msg)
  if msg.reply_id then
    get_message(msg.reply_id, why, {receiver=receiver})
    return nil
  end
  if matches[1] == '#why' then
    return str2emoji(":point_right:").." You must reply to a message to get informations about that."
  end
  if matches[1]:match("^%d+$") then
    return why_id(matches[1], msg.to.id)
  else
    return resolve_username(matches[1]:gsub("@", ""), why, {receiver=receiver})
  end
end

return {
  description = "Get informations about a username/ID",
  usage = {
    "!why <username>/<user_id> : Returns informations about that user",
    "#why (by reply) : Returns informations about that user",
  },
  patterns = {
    "^!why (%d+)$",
    "^!why (@?%a%S+)$",
    "^#why$"
  },
  run = run
}


text:
Disk tools
---

- df
- dd
- diskutil

## more
- mount - check mounted disk
- drutil - dvd tools


text:
#pragma once

#include <qrgui/plugins/toolPluginInterface/usedInterfaces/mainWindowDockInterface.h>
#include <qrgui/plugins/toolPluginInterface/systemEvents.h>
#include <kitBase/robotModel/robotModelManagerInterface.h>
#include <kitBase/eventsForKitPluginInterface.h>

namespace qReal {
namespace ui {
class ConsoleDock;
}
}

namespace interpreterCore {

/// Manages docks shown in the main window depending on mode user currently works in.
class UiManager : public QObject
{
	Q_OBJECT

public:
	/// Represents the mode user currently works in.
	enum class Mode {
		/// Neither editing, nor debugging, a value just to store there initial docks dummy state.
		Dummy = 0x000000
		/// User edits code or diagram or just staring at the start tab or something like this.
		, Editing = 0x100000
		/// User debugs the program: interpretation going or 2D model world is constructed.
		, Debugging = 0x200000
	};  // Do not change the values of the elements - it will break backward compability.

	UiManager(QAction &debugModeAction
			, QAction &editModeAction
			, qReal::gui::MainWindowDockInterface &mainWindow
			, qReal::SystemEvents &systemEvents
			, kitBase::EventsForKitPluginInterface &kitPluginEvents
			, kitBase::robotModel::RobotModelManagerInterface &robotModelManager);

	/// Embeds the given widget into main window`s left dock panel
	void placeDevicesConfig(QWidget *devicesWidget);

	/// Embeds the given widgets into main window`s left dock panel tabifying them together.
	void placeWatchPlugins(QDockWidget *watchWindow, QWidget *graphicsWatch);

	/// Returns a pointer to widget where robot standard output is displayed.
	qReal::ui::ConsoleDock &robotConsole();

private slots:
	void onActiveTabChanged(const qReal::TabInfo &tab);
	void onRobotModelChanged(const kitBase::robotModel::RobotModelInterface &model);
	void switchToEditorMode();
	void switchToDebuggerMode();
	void switchToMode(Mode mode);
	void toggleModeButtons();

	void saveDocks() const;
	void reloadDocks() const;
	void reloadDocksSavingToolbarsAndErrors() const;
	void resetMainWindowCorners() const;

private:
	QDockWidget *produceDockWidget(const QString &title, QWidget *content) const;
	void produceModeButton(Mode mode, QAction &action, QStatusBar *statusBar) const;

	int currentMode() const;
	QString currentSettingsKey() const;

	void hack2dModelDock() const;
	void enableDocksSnapshotter() const;

	QAction &mDebugModeAction;
	QAction &mEditModeAction;
	qReal::gui::MainWindowDockInterface &mMainWindow;
	qReal::TabInfo::TabType mCurrentTab = static_cast<qReal::TabInfo::TabType>(-1);
	Mode mCurrentMode = Mode::Dummy;
	qReal::ui::ConsoleDock *mRobotConsole;  // Transfers ownership to main window.
};

}


text:
<?php

namespace Zotlabs\Module\Admin;

class Site {

	/**
	 * @brief POST handler for Admin Site Page.
	 *
	 * @param App &$a
	 */
	function post(){
		if (!x($_POST, 'page_site')) {
			return;
		}

		check_form_security_token_redirectOnErr('/admin/site', 'admin_site');

		$sitename 			=	((x($_POST,'sitename'))			? notags(trim($_POST['sitename']))			: '');
		$server_role 		=	((x($_POST,'server_role'))		? notags(trim($_POST['server_role']))		: 'standard');

		$banner				=	((x($_POST,'banner'))      		? trim($_POST['banner'])				: false);

		$admininfo			=	((x($_POST,'admininfo'))		? trim($_POST['admininfo'])				: false);
		$language			=	((x($_POST,'language'))			? notags(trim($_POST['language']))			: '');
		$theme				=	((x($_POST,'theme'))			? notags(trim($_POST['theme']))				: '');
		$theme_mobile			=	((x($_POST,'theme_mobile'))		? notags(trim($_POST['theme_mobile']))			: '');
	//	$site_channel			=	((x($_POST,'site_channel'))	? notags(trim($_POST['site_channel']))				: '');
		$maximagesize		=	((x($_POST,'maximagesize'))		? intval(trim($_POST['maximagesize']))				:  0);

		$register_policy	=	((x($_POST,'register_policy'))	? intval(trim($_POST['register_policy']))	:  0);

		$access_policy	=	((x($_POST,'access_policy'))	? intval(trim($_POST['access_policy']))	:  0);
		$invite_only        = ((x($_POST,'invite_only'))		? True	: False);
		$abandon_days	    =	((x($_POST,'abandon_days'))	    ? intval(trim($_POST['abandon_days']))	    :  0);

		$register_text		=	((x($_POST,'register_text'))	? notags(trim($_POST['register_text']))		: '');
		$frontpage		    =	((x($_POST,'frontpage'))	? notags(trim($_POST['frontpage']))		: '');
		$mirror_frontpage   =	((x($_POST,'mirror_frontpage'))	? intval(trim($_POST['mirror_frontpage']))		: 0);
		$directory_server   =   ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : '');
		$allowed_sites        = ((x($_POST,'allowed_sites'))	? notags(trim($_POST['allowed_sites']))		: '');
		$force_publish        = ((x($_POST,'publish_all'))		? True	: False);
		$disable_discover_tab = ((x($_POST,'disable_discover_tab'))		? False	:	True);
		$login_on_homepage    = ((x($_POST,'login_on_homepage'))		? True	:	False);
		$enable_context_help    = ((x($_POST,'enable_context_help'))		? True	:	False);
		$global_directory     = ((x($_POST,'directory_submit_url'))	? notags(trim($_POST['directory_submit_url']))	: '');
		$no_community_page    = !((x($_POST,'no_community_page'))	? True	:	False);
		$default_expire_days  = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0);

		$verifyssl         = ((x($_POST,'verifyssl'))        ? True : False);
		$proxyuser         = ((x($_POST,'proxyuser'))        ? notags(trim($_POST['proxyuser']))  : '');
		$proxy             = ((x($_POST,'proxy'))            ? notags(trim($_POST['proxy']))      : '');
		$timeout           = ((x($_POST,'timeout'))          ? intval(trim($_POST['timeout']))    : 60);
		$delivery_interval = ((x($_POST,'delivery_interval'))? intval(trim($_POST['delivery_interval'])) : 0);
		$delivery_batch_count = ((x($_POST,'delivery_batch_count') && $_POST['delivery_batch_count'] > 0)? intval(trim($_POST['delivery_batch_count'])) : 1);
		$poll_interval     = ((x($_POST,'poll_interval'))    ? intval(trim($_POST['poll_interval'])) : 0);
		$maxloadavg        = ((x($_POST,'maxloadavg'))       ? intval(trim($_POST['maxloadavg'])) : 50);
		$feed_contacts     = ((x($_POST,'feed_contacts'))    ? intval($_POST['feed_contacts'])    : 0);
		$verify_email      = ((x($_POST,'verify_email'))     ? 1 : 0);
		$techlevel_lock    = ((x($_POST,'techlock'))   ? intval($_POST['techlock'])   : 0);

		$techlevel         = null;
		if(array_key_exists('techlevel',$_POST))
			$techlevel = intval($_POST['techlevel']);

		set_config('system', 'server_role', $server_role);
		set_config('system', 'feed_contacts', $feed_contacts);
		set_config('system', 'delivery_interval', $delivery_interval);
		set_config('system', 'delivery_batch_count', $delivery_batch_count);
		set_config('system', 'poll_interval', $poll_interval);
		set_config('system', 'maxloadavg', $maxloadavg);
		set_config('system', 'frontpage', $frontpage);
		set_config('system', 'mirror_frontpage', $mirror_frontpage);
		set_config('system', 'sitename', $sitename);
		set_config('system', 'login_on_homepage', $login_on_homepage);
		set_config('system', 'enable_context_help', $enable_context_help);
		set_config('system', 'verify_email', $verify_email);
		set_config('system', 'default_expire_days', $default_expire_days);
		set_config('system', 'techlevel_lock', $techlevel_lock);

		if(! is_null($techlevel))
			set_config('system', 'techlevel', $techlevel);

		if($directory_server)
			set_config('system','directory_server',$directory_server);

		if ($banner == '') {
			del_config('system', 'banner');
		} else {
			set_config('system', 'banner', $banner);
		}

		if ($admininfo == ''){
			del_config('system', 'admininfo');
		} else {
			require_once('include/text.php');
			linkify_tags($a, $admininfo, local_channel());
			set_config('system', 'admininfo', $admininfo);
		}
		set_config('system', 'language', $language);
		set_config('system', 'theme', $theme);
		if ( $theme_mobile === '---' ) {
			del_config('system', 'mobile_theme');
		} else {
			set_config('system', 'mobile_theme', $theme_mobile);
		}
	//	set_config('system','site_channel', $site_channel);
		set_config('system','maximagesize', $maximagesize);

		set_config('system','register_policy', $register_policy);
		set_config('system','invitation_only', $invite_only);
		set_config('system','access_policy', $access_policy);
		set_config('system','account_abandon_days', $abandon_days);
		set_config('system','register_text', $register_text);
		set_config('system','allowed_sites', $allowed_sites);
		set_config('system','publish_all', $force_publish);
		set_config('system','disable_discover_tab', $disable_discover_tab);
		if ($global_directory == '') {
			del_config('system', 'directory_submit_url');
		} else {
			set_config('system', 'directory_submit_url', $global_directory);
		}

		set_config('system','no_community_page', $no_community_page);
		set_config('system','no_utf', $no_utf);
		set_config('system','verifyssl', $verifyssl);
		set_config('system','proxyuser', $proxyuser);
		set_config('system','proxy', $proxy);
		set_config('system','curl_timeout', $timeout);

		info( t('Site settings updated.') . EOL);
		goaway(z_root() . '/admin/site' );
	}

	/**
	 * @brief Admin page site.
	 *
	 * @return string
	 */

	function get() {

		/* Installed langs */
		$lang_choices = array();
		$langs = glob('view/*/hstrings.php');

		if(is_array($langs) && count($langs)) {
			if(! in_array('view/en/hstrings.php',$langs))
				$langs[] = 'view/en/';
			asort($langs);
			foreach($langs as $l) {
				$t = explode("/",$l);
				$lang_choices[$t[1]] = $t[1];
			}
		}

		/* Installed themes */
		$theme_choices_mobile["---"] = t("Default");
		$theme_choices = array();
		$files = glob('view/theme/*');
		if($files) {
			foreach($files as $file) {
				$vars = '';
				$f = basename($file);
				if (file_exists($file . '/library'))
					continue;
				if (file_exists($file . '/mobile'))
					$vars = t('mobile');
				if (file_exists($file . '/experimental'))
					$vars .= t('experimental');
				if (file_exists($file . '/unsupported'))
					$vars .= t('unsupported');
				if ($vars) {
					$theme_choices[$f] = $f . ' (' . $vars . ')';
					$theme_choices_mobile[$f] = $f . ' (' . $vars . ')';
				}
				else {
					$theme_choices[$f] = $f;
					$theme_choices_mobile[$f] = $f;
				}
			}
		}

		$dir_choices = null;
		$dirmode = get_config('system','directory_mode');
		$realm = get_directory_realm();

		// directory server should not be set or settable unless we are a directory client

		if($dirmode == DIRECTORY_MODE_NORMAL) {
			$x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s'",
				intval(DIRECTORY_MODE_SECONDARY),
				intval(DIRECTORY_MODE_PRIMARY),
				dbesc($realm)
			);
			if($x) {
				$dir_choices = array();
				foreach($x as $xx) {
					$dir_choices[$xx['site_url']] = $xx['site_url'];
				}
			}
		}

		/* Banner */

		$banner = get_config('system', 'banner');
		if($banner === false)
			$banner = get_config('system','sitename');

		$banner = htmlspecialchars($banner);

		/* Admin Info */
		$admininfo = get_config('system', 'admininfo');

		/* Register policy */
		$register_choices = Array(
			REGISTER_CLOSED  => t("No"),
			REGISTER_APPROVE => t("Yes - with approval"),
			REGISTER_OPEN    => t("Yes")
		);

		/* Acess policy */
		$access_choices = Array(
			ACCESS_PRIVATE => t("My site is not a public server"),
			ACCESS_PAID => t("My site has paid access only"),
			ACCESS_FREE => t("My site has free access only"),
			ACCESS_TIERED => t("My site offers free accounts with optional paid upgrades")
		);

		$discover_tab = get_config('system','disable_discover_tab');
		// $disable public streams by default
		if($discover_tab === false)
			$discover_tab = 1;
		// now invert the logic for the setting.
		$discover_tab = (1 - $discover_tab);

		$server_roles = [
			'basic'    => t('Basic/Minimal Social Networking'),
			'standard' => t('Standard Configuration (default)'),
			'pro'      => t('Professional')
		];

		$techlevels = [
			'0' => t('Beginner/Basic'),
			'1' => t('Novice - not skilled but willing to learn'),
			'2' => t('Intermediate - somewhat comfortable'),
			'3' => t('Advanced - very comfortable'),
			'4' => t('Expert - I can write computer code'),
			'5' => t('Wizard - I probably know more than you do')
		];

		$homelogin = get_config('system','login_on_homepage');
		$enable_context_help = get_config('system','enable_context_help');

		$t = get_markup_template("admin_site.tpl");
		return replace_macros($t, array(
			'$title' => t('Administration'),
			'$page' => t('Site'),
			'$submit' => t('Submit'),
			'$registration' => t('Registration'),
			'$upload' => t('File upload'),
			'$corporate' => t('Policies'),
			'$advanced' => t('Advanced'),

			'$baseurl' => z_root(),
			// name, label, value, help string, extra data...
			'$sitename' 		=> array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),

			'$server_role' 		=> array('server_role', t("Server Configuration/Role"), get_config('system','server_role'),'',$server_roles),

			'$techlevel' => [ 'techlevel', t('Site default technical skill level'), get_config('system','techlevel'), t('Used to provide a member experience matched to technical comfort level'), $techlevels ],

			'$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ],

			'$banner'			=> array('banner', t("Banner/Logo"), $banner, ""),
			'$admininfo'		=> array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators.  Displayed on siteinfo page.  BBCode can be used here")),
			'$language' 		=> array('language', t("System language"), get_config('system','language'), "", $lang_choices),
			'$theme' 			=> array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices),
			'$theme_mobile' 	=> array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
	//		'$site_channel' 	=> array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
			'$feed_contacts'    => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
			'$maximagesize'		=> array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
			'$register_policy'	=> array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices),
			'$invite_only'		=> array('invite_only', t("Invitation only"), get_config('system','invitation_only'), t("Only allow new member registrations with an invitation code. Above register policy must be set to Yes.")),
			'$access_policy'	=> array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices),
			'$register_text'	=> array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")),
			'$frontpage'	=> array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
			'$mirror_frontpage'	=> array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')),
			'$abandon_days'     => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
			'$allowed_sites'	=> array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
			'$verify_email'		=> array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")),
			'$force_publish'	=> array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
			'$disable_discover_tab'	=> array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')),
			'$login_on_homepage'	=> array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
			'$enable_context_help'	=> array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),

			'$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),

			'$proxyuser'		=> array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
			'$proxy'			=> array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
			'$timeout'			=> array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
			'$delivery_interval'			=> array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
			'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
			'$poll_interval'			=> array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
			'$maxloadavg'			=> array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
			'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
			'$form_security_token' => get_form_security_token("admin_site"),
		));
	}

}


text:
.oo-ui-dialog-content > .oo-ui-window-head,
.oo-ui-dialog-content > .oo-ui-window-body,
.oo-ui-dialog-content > .oo-ui-window-foot {
  position: absolute;
  right: 0;
  left: 0;
  overflow: hidden;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
.oo-ui-dialog-content > .oo-ui-window-head {
  z-index: 1;
  top: 0;
}
.oo-ui-dialog-content > .oo-ui-window-body {
  z-index: 2;
  top: 0;
  bottom: 0;
}
.oo-ui-dialog-content > .oo-ui-window-foot {
  z-index: 1;
  bottom: 0;
}
.oo-ui-dialog-content > .oo-ui-window-overlay {
  z-index: 3;
}

.oo-ui-windowManager-modal > .oo-ui-dialog {
  background-color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  -webkit-transition: opacity 250ms ease-in-out;
  -moz-transition: opacity 250ms ease-in-out;
  -ms-transition: opacity 250ms ease-in-out;
  -o-transition: opacity 250ms ease-in-out;
  transition: opacity 250ms ease-in-out;
}
.oo-ui-windowManager-modal > .oo-ui-dialog > .oo-ui-window-frame {
  top: 0;
  bottom: 0;
  background-color: #fff;
  -webkit-transform: translate3d(0, -200%, 0);
  -moz-transform: translate3d(0, -200%, 0);
  -ms-transform: translate3d(0, -200%, 0);
  -o-transform: translate3d(0, -200%, 0);
  transform: translate3d(0, -200%, 0);
  -webkit-transition: transform 250ms ease-in-out;
  -moz-transition: transform 250ms ease-in-out;
  -ms-transition: transform 250ms ease-in-out;
  -o-transition: transform 250ms ease-in-out;
  transition: transform 250ms ease-in-out;
}
.oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-ready {
  opacity: 1;
}
.oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-ready > .oo-ui-window-frame {
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}
.oo-ui-windowManager-modal.oo-ui-windowManager-floating > .oo-ui-dialog > .oo-ui-window-frame {
  border: solid 1px #ccc;
  border-radius: 0.5em;
  box-shadow: 0 0.2em 1em rgba(0, 0, 0, 0.3);
}

.oo-ui-messageDialog-title,
.oo-ui-messageDialog-message {
  display: block;
  text-align: center;
  padding-top: 0.5em;
}
.oo-ui-messageDialog-title {
  font-size: 1.5em;
  line-height: 1em;
  color: #000;
}
.oo-ui-messageDialog-message {
  font-size: 0.9em;
  line-height: 1.25em;
  color: #666;
}
.oo-ui-messageDialog-message-verbose {
  font-size: 1.1em;
  line-height: 1.5em;
  text-align: right;
}
.oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget {
  border-left: solid 1px #e5e5e5;
}
.oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget:last-child {
  border-left-width: 0;
}
.oo-ui-messageDialog-actions-vertical .oo-ui-actionWidget {
  border-bottom: solid 1px #e5e5e5;
}
.oo-ui-messageDialog-actions-vertical .oo-ui-actionWidget:last-child {
  border-bottom-width: 0;
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget .oo-ui-labeledElement-label {
  text-align: center;
  line-height: 3.4em;
  padding: 0 2em;
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget:active {
  background-color: rgba(0, 0, 0, 0.1);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-primary:hover {
  background-color: rgba(8, 126, 204, 0.05);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-primary:active {
  background-color: rgba(8, 126, 204, 0.1);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-primary .oo-ui-labeledElement-label {
  font-weight: bold;
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-constructive:hover {
  background-color: rgba(118, 171, 54, 0.05);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-constructive:active {
  background-color: rgba(118, 171, 54, 0.1);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-destructive:hover {
  background-color: rgba(212, 83, 83, 0.05);
}
.oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggableElement-destructive:active {
  background-color: rgba(212, 83, 83, 0.1);
}

.oo-ui-processDialog-content .oo-ui-window-head {
  height: 3.35em;
  border-bottom: 1px solid #dddddd;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
.oo-ui-processDialog-content .oo-ui-window-body {
  top: 3.35em;
  padding: 2em 0;
}
.oo-ui-processDialog-navigation {
  position: relative;
  height: 3.35em;
  padding: 0 1em;
}
.oo-ui-processDialog-location {
  padding: 0.25em 0;
  height: 3.35em;
  cursor: default;
  text-align: center;
}
.oo-ui-processDialog-title {
  font-weight: bold;
  line-height: 1.85em;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget .oo-ui-buttonedElement-button {
  padding: 0.35em 0.75em;
  min-width: 1.85em;
  min-height: 1.85em;
  border: 1px solid #dddddd;
  border-radius: 4px;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget .oo-ui-labeledElement-label,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget .oo-ui-labeledElement-label,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget .oo-ui-labeledElement-label {
  line-height: 1.85em;
  padding: 0 1em;
  font-weight: bold;
  color: #777777;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget .oo-ui-iconedElement-icon,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget .oo-ui-iconedElement-icon,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget .oo-ui-iconedElement-icon {
  position: absolute;
  margin-top: -0.125em;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonedElement-framed .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonedElement-framed .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonedElement-framed .oo-ui-buttonedElement-button {
  vertical-align: middle;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-buttonedElement-button {
  border: 1px solid transparent;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-labeledElement-label,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-labeledElement-label,
.oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-flaggableElement-destructive .oo-ui-labeledElement-label {
  color: #d11d13;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget .oo-ui-buttonedElement-button {
  padding: 0.75em 0.35em;
  border: none;
  border-radius: 0;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-flaggableElement-primary .oo-ui-buttonedElement-button,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-flaggableElement-primary .oo-ui-buttonedElement-button {
  background-color: #347bff;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-flaggableElement-primary .oo-ui-labeledElement-label,
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-flaggableElement-primary .oo-ui-labeledElement-label {
  color: #ffffff;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-iconedElement .oo-ui-iconedElement-icon {
  right: 0.5em;
}
.oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-iconedElement .oo-ui-labeledElement-label {
  padding-right: 2.25em;
}
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-iconedElement .oo-ui-iconedElement-icon {
  left: 0.5em;
}
.oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-iconedElement .oo-ui-labeledElement-label {
  padding-left: 2.25em;
}
.oo-ui-processDialog-actions-other {
  position: absolute;
  bottom: 1em;
}
.oo-ui-processDialog > .oo-ui-window-frame {
  min-height: 5em;
}
.oo-ui-processDialog-errors {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 3em 3em 1.5em 3em;
  text-align: center;
}
.oo-ui-processDialog-errors .oo-ui-buttonWidget {
  margin: 2em 1em 2em 1em;
}
.oo-ui-processDialog-errors-title {
  font-size: 1.5em;
  color: #000;
  margin-bottom: 2em;
}
.oo-ui-processDialog-error {
  text-align: right;
  margin: 1em;
  padding: 1em;
  border: solid 1px #ff9e9e;
  background-color: #fff7f7;
  border-radius: 0.25em;
}

.oo-ui-buttonedElement.oo-ui-indicatedElement .oo-ui-buttonedElement-button > .oo-ui-indicatedElement-indicator,
.oo-ui-buttonedElement.oo-ui-iconedElement .oo-ui-buttonedElement-button > .oo-ui-iconedElement-icon {
  width: 3.35em;
  height: 3.35em;
  background-size: 2em auto;
}

.oo-ui-bookletLayout-stackLayout .oo-ui-panelLayout {
  padding: 0 0 1em;
}

.oo-ui-panelLayout {
  padding: 1em 3.35em;
}

.oo-ui-optionWidget {
  padding: 0.8em 3.35em 0.8em 1em;
  font-weight: bold;
  border-bottom: 1px solid #dddddd;
}
.oo-ui-optionWidget.oo-ui-indicatedElement .oo-ui-labeledElement-label {
  padding-left: 1.5em;
}
.oo-ui-optionWidget-level-0 {
  padding-right: 3.5em;
}
.oo-ui-optionWidget-level-0 .oo-ui-iconedElement-icon {
  right: 1em;
}
.oo-ui-optionWidget-level-1 {
  padding-right: 5em;
}
.oo-ui-optionWidget-level-1 .oo-ui-iconedElement-icon {
  right: 2.5em;
}
.oo-ui-optionWidget-level-2 {
  padding-right: 6.5em;
}
.oo-ui-optionWidget-level-2 .oo-ui-iconedElement-icon {
  right: 4em;
}

.oo-ui-buttonOptionWidget {
  padding: 0;
}

.oo-ui-lookupWidget-menu {
  background-color: #fff;
}

.oo-ui-menuItemWidget.oo-ui-optionWidget-selected {
  background: #347bff;
  color: #ffffff;
}
.oo-ui-menuItemWidget .oo-ui-iconedElement-icon {
  background-size: 24px auto;
}

.oo-ui-menuSectionItemWidget {
  font-weight: normal;
  color: #777777;
  border: none;
}

.oo-ui-textInputWidget input,
.oo-ui-textInputWidget textarea {
  padding: .8em 1em;
}

.oo-ui-icon-check {
  background-image: /* @embed */ url(themes/agora/images/icons/check.png);
  background: #347bff;
}


text:
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var EventWrapper = function (_React$Component) {
  _inherits(EventWrapper, _React$Component);

  function EventWrapper() {
    _classCallCheck(this, EventWrapper);

    return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
  }

  EventWrapper.prototype.render = function render() {
    return this.props.children;
  };

  return EventWrapper;
}(_react2.default.Component);

exports.default = EventWrapper;
module.exports = exports['default'];


text:
using System.IO;
using System.Security.Cryptography;

namespace OneView.Utility.Security
{

    public class ClientIdentity {
        public string HostName { get; set; }
        public string MachineID { get; set; }
        public string MACAddress { get; set; }
    }

    /// <summary>
    ///
    /// </summary>
    public class ClientEncryption
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="ci"></param>
        /// <returns></returns>
        public static byte[] EncryptIdentity(ClientIdentity ci)
        {
            byte[] key = System.Convert.FromBase64String("P9KcPLf+q21f9DUnI0cyP1xgALRa8+uKfZXiNIcjphM=");
            byte[] IV = System.Convert.FromBase64String("lEvSlTN0Q7gu9sAUvPTySQ==");

            byte[] encrypted;

            using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
            {
                aesAlg.Key = key;
                aesAlg.IV = IV;

                // Create a decrytor to perform the stream transform.
                ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for encryption.
                using (MemoryStream msEncrypt = new MemoryStream())
                {
                    using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                    {
                        using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                        {
                            swEncrypt.WriteLine(ci.HostName);
                            swEncrypt.WriteLine(ci.MachineID);
                            swEncrypt.WriteLine(ci.MACAddress);
                        }
                        encrypted = msEncrypt.ToArray();
                    }
                }
            }
            return encrypted;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="identity"></param>
        /// <returns></returns>
        public static ClientIdentity DecryptIdentity(byte[] identity)
        {
            byte[] key = System.Convert.FromBase64String("P9KcPLf+q21f9DUnI0cyP1xgALRa8+uKfZXiNIcjphM=");
            byte[] IV = System.Convert.FromBase64String("lEvSlTN0Q7gu9sAUvPTySQ==");

            var ci = new ClientIdentity();

            using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
            {
                aesAlg.Key = key;
                aesAlg.IV = IV;

                // Create inboxMsg decrytor to perform the stream transform.
                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for decryption.
                using (MemoryStream msDecrypt = new MemoryStream(identity))
                {
                    using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                    {
                        using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                        {
                            ci.HostName = srDecrypt.ReadLine();
                            ci.MachineID = srDecrypt.ReadLine();
                            ci.MACAddress = srDecrypt.ReadLine();
                        }
                    }
                }

            }
            return ci;
        }

        public static byte[] EncryptString(string str, byte[] IV)
        {
            byte[] key = System.Convert.FromBase64String("P9KcPLf+q21f9DUnI0cyP1xgALRa8+uKfZXiNIcjphM=");

            byte[] encrypted;

            using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
            {
                aesAlg.Key = key;
                aesAlg.IV = IV;

                // Create a decrytor to perform the stream transform.
                ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for encryption.
                using (MemoryStream msEncrypt = new MemoryStream())
                {
                    using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                    {
                        using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                        {
                            swEncrypt.Write(str);
                        }
                        encrypted = msEncrypt.ToArray();
                    }
                }
            }
            return encrypted;
        }

        public static string DecryptString(byte[] identity, byte[] IV)
        {
            byte[] key = System.Convert.FromBase64String("P9KcPLf+q21f9DUnI0cyP1xgALRa8+uKfZXiNIcjphM=");

            using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
            {
                aesAlg.Key = key;
                aesAlg.IV = IV;

                // Create inboxMsg decrytor to perform the stream transform.
                ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);

                // Create the streams used for decryption.
                using (MemoryStream msDecrypt = new MemoryStream(identity))
                {
                    using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                    {
                        using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                        {
                            return srDecrypt.ReadToEnd();
                        }
                    }
                }

            }
        }

    }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Lichenologist 18(3): 226 (1986)

#### Original name
Paulia stipitata Henssen

### Remarks
null


text:
void Init_commonmarker();

#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/historical#independence-rock-775338" xml:lang="eng" locale="eng" status="publish">
  <search-meta>
      <uri-title its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">independence-rock-775338</uri-title>
      <source>independence-rock-775338</source>
      <publication-type its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">image</publication-type>
      <media-type its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2012-04-09">2012-04-09</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">global-search</collection>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">media</collection>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">images</collection>
      </collections>
      <subjects>
          <subject>Wyoming</subject>
          <subject>Independence Rock</subject>
          <subject>historic site</subject>
          <subject>pioneers</subject>
          <subject>United States history</subject>
          <subject>wagon wheel</subject>
          <subject>Oregon Trail</subject>
          <subject>Mormon Trail</subject>
          <subject>landmarks</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/historical/independence-rock-775338-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/historical/independence-rock-775338-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>169 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/historical/independence-rock-775338-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>192 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/historical/independence-rock-775338-tablet.jpg</path>
              </download-url>
              <download-url>
                  Print
                  <size>416 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/historical/independence-rock-775338-print.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
<ldse-meta its:translate="no" xmlns="http://lds.org/code/lds-edit" xmlns:its="http://www.w3.org/2005/11/its"><document id="independence-rock-775338" locale="eng" uri="/media-library/images/historical#independence-rock-775338" status="publish" site="ldsorg" source="chq" words="107" tgp="0.3741"/><created username="lds-edit" userid=""/><last-modified date="2012-05-10T12:26:12.550235-06:00" username="lds-edit" userid=""/></ldse-meta></ldswebml>


text:
1. [](#improved)
    * Remove unneeded streams from Theme YAML
    * Delete unused composer.json
1. [](#bugfix)
    * Fix setting the page language in the html tag

# v1.2.0
## 01/06/2016

1. [](#improved)
    * Updated to Fontawesome 4.5.0
1. [](#bugfix)
	* Fix typos
	* Fixed duplicate property

# v1.1.0
## 12/18/2015

1. [](#improved)
    * use `|safe_email` filter
1. [](#bugfix)
	* Twitter widget fails to load with HTTPS
	* Closing the menu puts you back at the top
	* Fix for stuck at "Thank You" after submitting form

# v1.0.0
## 10/26/2015

1. [](#new)
    * ChangeLog started...


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>

    <title>CategoryPage.g.i.cs File Reference</title>
<para>Include dependency diagram for CategoryPage.g.i.cs</para>
<para>

        <title>Dependency diagram</title>
        <mediaobject>
            <imageobject>
                <imagedata width="50%" align="center" valign="middle" scalefit="1" fileref="../../d8/d2f/_debug_2_category_page_8g_8i_8cs__incl.png"></imagedata>
            </imageobject>
        </mediaobject>

</para>
<para>Included by dependency diagram for CategoryPage.g.i.cs</para>
<para>

        <title>Dependency diagram</title>
        <mediaobject>
            <imageobject>
                <imagedata width="50%" align="center" valign="middle" scalefit="1" fileref="../../d8/dde/_debug_2_category_page_8g_8i_8cs__dep__incl.png"></imagedata>
            </imageobject>
        </mediaobject>

</para>

            <title> Classes </title>
            <para>
                <itemizedlist>
                    <listitem>
                        <para>struct <link linkend="d2/d8e/class_app_store_1_1_category_page">AppStore::CategoryPage</link></para>
<para><emphasis><summary>
This page is the Category Page, which the app navigates to when the user selects a particular category.</emphasis></para>
                    </listitem>
                </itemizedlist>
            </para>

        <simplesect>
            <title> Namespaces </title>
            <para>
                <itemizedlist>
                    <listitem>
                        <para>struct <link linkend="d9/d6d/namespace_app_store">AppStore</link></para>
                    </listitem>
                </itemizedlist>
            </para>
        </simplesect>
    <simplesect>
        <title>Detailed Description</title>
    <para>Definition in file C:/Users/Srujan/Documents/Visual Studio 2015/Projects/BuildmLearnStore/AppStore/AppStore/obj/Debug/CategoryPage.g.i.cs</para>
    </simplesect>
    <literallayout><computeroutput>
1
2
3 <emphasis class="preprocessor">#pragma checksum "C:\Users\Srujan\Documents\Visual Studio 2015\Projects\BuildmLearnStore\AppStore\AppStore\CategoryPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "420339EE39EE53897E3511B31A6E5CA2"</emphasis>
4 <emphasis class="comment">//------------------------------------------------------------------------------</emphasis>
5 <emphasis class="comment">// <auto-generated></emphasis>
6 <emphasis class="comment">//     This code was generated by a tool.</emphasis>
7 <emphasis class="comment">//</emphasis>
8 <emphasis class="comment">//     Changes to this file may cause incorrect behavior and will be lost if</emphasis>
9 <emphasis class="comment">//     the code is regenerated.</emphasis>
10 <emphasis class="comment">// </auto-generated></emphasis>
11 <emphasis class="comment">//------------------------------------------------------------------------------</emphasis>
12
13 <emphasis class="keyword">namespace </emphasis><link linkend="d9/d6d/namespace_app_store">AppStore</link>
14 {
15     <emphasis class="keyword">partial class </emphasis>CategoryPage : global::Windows.UI.Xaml.Controls.Page
16     {
17         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
18         <emphasis class="keyword">private</emphasis> global::Windows.UI.Xaml.Controls.Grid <link linkend="d2/d8e/class_app_store_1_1_category_page_1a7713293d0b9dd44b4ab70e0e6193f925">LayoutRoot</link>;
19         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
20         <emphasis class="keyword">private</emphasis> global::Windows.UI.Xaml.Controls.Grid <link linkend="d2/d8e/class_app_store_1_1_category_page_1a6d31a0a0fe7c65bc92024c3ec2979d7a">ContentRoot</link>;
21         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
22         <emphasis class="keyword">private</emphasis> global::Windows.UI.Xaml.Controls.GridView <link linkend="d2/d8e/class_app_store_1_1_category_page_1aade097e7ec4a5325e72da550357052b7">GridApps</link>;
23         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
24         <emphasis class="keyword">private</emphasis> global::Windows.UI.Xaml.Controls.TextBlock <link linkend="d2/d8e/class_app_store_1_1_category_page_1a76d5c8934227ae67de53bfb4e3a06897">pageTitle</link>;
25         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
26         <emphasis class="keyword">private</emphasis> global::Windows.UI.Xaml.Controls.AppBarButton <link linkend="d2/d8e/class_app_store_1_1_category_page_1a0a0168dbaa9caade0ea9911ace44aa10">btnMyApps</link>;
27         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
28         <emphasis class="keyword">private</emphasis> <emphasis class="keywordtype">bool</emphasis> <link linkend="d2/d8e/class_app_store_1_1_category_page_1aeb981ce9ad1da9c37753c85d2cdd88a7">_contentLoaded</link>;
29
30         [global::System.CodeDom.Compiler.GeneratedCodeAttribute(<emphasis class="stringliteral">"Microsoft.Windows.UI.Xaml.Build.Tasks"</emphasis>,<emphasis class="stringliteral">" 4.0.0.0"</emphasis>)]
31         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
32         <emphasis class="keyword">public</emphasis> <emphasis class="keywordtype">void</emphasis> <link linkend="d2/d8e/class_app_store_1_1_category_page_1aaf99d3025c7a2e11ef6a89d9af2168ca">InitializeComponent</link>()
33         {
34             <emphasis class="keywordflow">if</emphasis> (_contentLoaded)
35                 <emphasis class="keywordflow">return</emphasis>;
36
37             _contentLoaded = <emphasis class="keyword">true</emphasis>;
38             global::Windows.UI.Xaml.Application.LoadComponent(<emphasis class="keyword">this</emphasis>, <emphasis class="keyword">new</emphasis> global::System.Uri(<emphasis class="stringliteral">"ms-appx:///CategoryPage.xaml"</emphasis>), global::Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
39
40             <link linkend="d2/d8e/class_app_store_1_1_category_page_1a7713293d0b9dd44b4ab70e0e6193f925">LayoutRoot</link> = (global::Windows.UI.Xaml.Controls.Grid)this.FindName(<emphasis class="stringliteral">"LayoutRoot"</emphasis>);
41             <link linkend="d2/d8e/class_app_store_1_1_category_page_1a6d31a0a0fe7c65bc92024c3ec2979d7a">ContentRoot</link> = (global::Windows.UI.Xaml.Controls.Grid)this.FindName(<emphasis class="stringliteral">"ContentRoot"</emphasis>);
42             <link linkend="d2/d8e/class_app_store_1_1_category_page_1aade097e7ec4a5325e72da550357052b7">GridApps</link> = (global::Windows.UI.Xaml.Controls.GridView)this.FindName(<emphasis class="stringliteral">"GridApps"</emphasis>);
43             <link linkend="d2/d8e/class_app_store_1_1_category_page_1a76d5c8934227ae67de53bfb4e3a06897">pageTitle</link> = (global::Windows.UI.Xaml.Controls.TextBlock)this.FindName(<emphasis class="stringliteral">"pageTitle"</emphasis>);
44             <link linkend="d2/d8e/class_app_store_1_1_category_page_1a0a0168dbaa9caade0ea9911ace44aa10">btnMyApps</link> = (global::Windows.UI.Xaml.Controls.AppBarButton)this.FindName(<emphasis class="stringliteral">"btnMyApps"</emphasis>);
45         }
46     }
47 }
48
49
50
    </computeroutput></literallayout>


text:
package org.boilit.bsl.core.eao;

import org.boilit.bsl.ITemplate;
import org.boilit.bsl.core.AbstractAssignOperator;
import org.boilit.bsl.core.AbstractExpression;
import org.boilit.bsl.core.Operation;

/**
 * @author Boilit
 * @see
 */
public final class LgcAndAssign extends AbstractAssignOperator {
    public LgcAndAssign(final int line, final int column, final String label,
                        final AbstractExpression expression, final ITemplate template) {
        super(line, column, label, expression, template);
    }

    @Override
    protected final Object executeFragment(final Object value1, final Object value2) throws Exception {
        return Operation.doLgcAnd(value1, value2);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false">
        <bitmap android:alpha="0.3" android:src="@drawable/ic_next" />
    </item>
    <item android:drawable="@drawable/ic_next" android:state_enabled="true" android:state_pressed="true" />
    <item android:drawable="@drawable/ic_next" android:state_enabled="true" android:state_focused="true" />
    <item android:drawable="@drawable/ic_next" android:state_enabled="true" />
</selector>


text:
                <input type="radio" name="{{htmlId}}"
                       value="{{item.value}}"
                       ng-model="model.value" />
                {{item.value}}