text:
layout: post
title:  "An Ode to Android"
date:   2017-11-06 13:00:00 +0100
categories: programming android
---
Let's face it: I'm an Android fanboy.

The Android Platform is one of my favorite, if not my most favorite, platform to develop for.

I want to tell you exactly why I think Google makes a good job regarding Android. Nevertheless, I also try to highlight some problems I have with Android, because be realistic: Nothing's perfect.

## The Development Environment

Back in the days, Android Development in Eclipse was such a paint. The IDE just wasn't meant to be used for job of developing apps. Plugin Management was painful, the UI preview didn't really work and everything crashed most of the time (at least for me).

However, Android Studio was developed to solve these problems. And it does so to an almost perfect degree. You can tell that Google keeps an eye on feedback and integrates every new tool nicely into the IDE (Kotlin, Espresso Test Recorder, ...). The development of the app's UI is just as fast and smooth as the creation of business logic. It just feels right doing all of this. Developing Android Apps is such a pleasure nowadays.

## The Language

I like Java very much. In my opinion, static typing makes much more sense in big applications than dynamic typing. But I also like the design decisions behind the syntax. The functional programming techniques, which were introduced in Java 8, are also implemented nicely into Java's ecosystem. If you want to learn more about them, check out my [other posts][blog].

Every time I read or work with Android Code, the language doesn't get in my way. It just makes sense and is easy to understand.

## The Bug Bounty System

Breaking other peoples code is a real pleasure for me ;) . Getting inside a developer's mind and exploiting common code habits can can keep me busy for a whole weekend. And [bug bounty reports][bug] are by far the most fascinating blog posts for me.

However, this task is even more rewarding now, because Google expanded it's [bug bounty program][bounty] onto some Android Apps last month. Now, you can make real money reporting issues you found and learn so much about the Android system while searching bugs.

## The Testing Environment

As a developer who cares a lot about testing, I want to make sure that every released app of mine works as intended. I don't want to release buggy software. Android makes it so easy to do achieve this goal. Espresso and Robolectric are so intuitive and they just **work**. And if you also use Kotlin in your projects, it's easy to make your tests even more readable with extension functions.

It just feels right to write tests. This is so important in an environment where few people practice TDD and just rely on luck to find bugs.

## Contributing
When I'm working on a new project, it's always easy to get started. The amazing work Google does at documenting Android features is one of the best reasons for that.

What's more, every time I have a problem, there is someone in an IRC chat or part of an email list who can give me a quick answer. When I develop for other platforms, I haven't felt this invited in their communities.

---

But of course, not everything's good about Android. There are still problems that this platform has and which simply annoy me as a developer.

## New year = New Android Version

Let's be clear: It's awesome when a platform develops over time. But maybe Google should give us the time to really embrace new features.

Not even a [quarter][Users] of the Android users use Android N at this time. Still, there is Oreo coming out right now.

However, you can't use all of the new features and upgrade the minimum SDK Version of your app. This is because most of the users don't buy a new phone with the latest Android version every year. Also, phone manufactures usually don't provide new Android versions for their older phones. And not everybody wants to use a custom OS on their device.

Google should just give the developers and users more time to adapt to a new Android Version.

## Conclusion

To sum everything up: The Android platform is an superb platform for developers. Google provides an awesome IDE and documentation which doesn't leave anyone behind. The community is amazing as well.

Still, the system's not perfect. Google should slow down the release cycle so that the developers and users can adapt better to every new Android version.

What's your opinion on all of this? Which parts of the Android ecosystem do you love or hate? Please write a comment and check out my other blog posts too!

Thanks for reading and have a nice day,

Niklas

[Users]: https://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/
[blog]: https://flyingbytes.github.io/programming/java8/functional/part0/2017/01/16/Java8-Part0.html
[bug]: https://medium.freecodecamp.org/messing-with-the-google-buganizer-system-for-15-600-in-bounties-58f86cc9f9a5
[bounty]: https://www.google.com/about/appsecurity/android-rewards/


text:
UCLASS(minimalapi)
class ATP_VehicleGameMode : public AGameMode
{
	GENERATED_BODY()

public:
	ATP_VehicleGameMode();
};

redpajama_set_name: RedPajamaGithub


text:
package com.ubergeek42.WeechatAndroid.utils;

import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.ClipboardManager;
import android.text.style.URLSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

import com.ubergeek42.WeechatAndroid.R;
import com.ubergeek42.WeechatAndroid.relay.Line;
import com.ubergeek42.WeechatAndroid.service.P;
import com.ubergeek42.weechat.Color;

import java.util.ArrayList;

public class CopyPaste implements EditText.OnLongClickListener, AdapterView.OnItemLongClickListener {

    private AppCompatActivity activity;
    private EditText input;

    public CopyPaste(AppCompatActivity activity, EditText input) {
        this.activity = activity;
        this.input = input;
    }

    // called on long click on input field
    @Override public boolean onLongClick(View v) {
        // do not do anything special if TextView has text
        if (!"".equals(((TextView) v).getText().toString())) return false;

        final ArrayList<String> list = new ArrayList<>();

        // read & trim clipboard
        // noinspection deprecation
        ClipboardManager cm = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
        final String clip = (cm.getText() == null) ? "" : cm.getText().toString().trim();

        // copy last messages if they do not equal clipboard
        // if there are no messages, do nothing
        for (String m : P.sentMessages) if (!m.equals(clip)) list.add(m);
        if (list.size() == 0) return false;

        // clean and add clipboard
        if (!"".equals(clip)) list.add(clip);

        final LayoutInflater inflater = LayoutInflater.from(activity);

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setTitle(activity.getString(R.string.dialog_paste_title)).setAdapter(
                new BaseAdapter() {
                    @Override public int getCount() {return list.size();}
                    @Override public String getItem(int position) {return list.get(position);}
                    @Override public long getItemId(int position) {return position;}
                    @Override public View getView(int position, View convertView, ViewGroup parent) {
                        if (convertView == null) convertView = inflater.inflate(R.layout.select_dialog_item_material_2_lines, parent, false);
                        TextView v = (TextView) convertView;
                        boolean isClip = (!"".equals(clip) && position == list.size() - 1);
                        v.setText(Utils.unCrLf(getItem(position)));
                        v.setBackgroundResource(isClip ? R.color.special : 0);
                        v.setCompoundDrawablesWithIntrinsicBounds(0, 0, isClip ? R.drawable.ic_paste : 0, 0);
                        return v;
                    }
                }, new DialogInterface.OnClickListener() {
                    @Override public void onClick(DialogInterface dialog, int which) {
                        input.setText(list.get(which));
                        input.setSelection(input.getText().length());
                    }
                });

        // create dialogue, remove bottom padding and scroll to the end
        AlertDialog d = builder.create();
        final ListView l = d.getListView();
        l.setPadding(l.getPaddingLeft(), l.getPaddingTop(), l.getPaddingRight(), 0);
        l.setStackFromBottom(true);
        d.show();
        return true;
    }

    // called on long click on a chat line
    @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
        TextView uiTextView = (TextView) view.findViewById(R.id.chatline_message);
        if (uiTextView == null) return false;

        Line line = (Line) uiTextView.getTag();
        final ArrayList<String> list = new ArrayList<>();

        list.add(line.getNotificationString());
        list.add(Color.stripEverything(line.message));

        for (URLSpan url: uiTextView.getUrls())
            list.add(url.getURL());

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setTitle(activity.getString(R.string.dialog_copy_title)).setAdapter(
                new ArrayAdapter<>(activity, R.layout.select_dialog_item_material_2_lines, android.R.id.text1, list),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // noinspection deprecation
                        ClipboardManager cm = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
                        cm.setText(list.get(which));
                    }
                });
        builder.create().show();

        line.clickDisabled = true;
        return true;
    }
}


text:
/**

  cache.ls()
  ##########

  This script is supposed to be called via `index.js`

**/

module.exports = function (
/* Function */    callback    // Callback
) {

  /** set in /index.js **/
  var self = this;

  var domain = require('domain').create();

  domain.on('error', function (error) {
    callback(error);
  });

  domain.run(function () {

    /** Tell Redis to fetch the keys name beginning by prefix **/
    self.client.keys(self.prefix + '*', domain.intercept(function (keys) {

      var size = 0;

      require('async').parallel(

        /** for each keys **/

        keys.map(function (key) {
          return function (cb) {

            self.get(this.key.replace(new RegExp('^' + self.prefix), ''), cb);

          }
            .bind({ key: key });
        }),

        domain.intercept(function (results) {
          results.forEach(function (result) {
            size += require('../sizeof')(result);
          });

          callback(null, size);
        }));

    }));

  });
};


text:
<?php

declare(strict_types=1);

namespace TSantos\Serializer\Event;

use TSantos\Serializer\DeserializationContext;

/**
 * Class PostDeserializationEvent.
 *
 * @author Tales Santos <tales.augusto.santos@gmail.com>
 */
class PostDeserializationEvent extends Event
{
    /**
     * @var mixed
     */
    private $object;

    /**
     * @var DeserializationContext
     */
    private $context;

    /**
     * @var string
     */
    private $type;

    /**
     * PostDeserializationEvent constructor.
     *
     * @param mixed                  $object
     * @param DeserializationContext $context
     * @param string                 $type
     */
    public function __construct($object, DeserializationContext $context, string $type)
    {
        $this->object = $object;
        $this->context = $context;
        $this->type = $type;
    }

    /**
     * @return mixed
     * @codeCoverageIgnore
     */
    public function getObject()
    {
        return $this->object;
    }

    /**
     * @param mixed $object
     * @codeCoverageIgnore
     */
    public function setObject($object): void
    {
        $this->object = $object;
    }

    /**
     * @return DeserializationContext
     * @codeCoverageIgnore
     */
    public function getContext(): DeserializationContext
    {
        return $this->context;
    }

    /**
     * @return string
     * @codeCoverageIgnore
     */
    public function getType(): string
    {
        return $this->type;
    }
}


text:
TestedInterface = "Navigation"
Tested_resultCode = "APPLICATION_NOT_REGISTERED"
Tested_wrongJSON = false

Test = require('user_modules/IsReady_Template/ATF_Interface_IsReady_available_false_SplitRPC_Template')

return Test


text:
package cassandra;

import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import common.CassandraResultV3;
import common.CassandraRowV3;

import java.util.List;
import java.util.stream.Collectors;

public class CassandraResult30 implements CassandraResultV3 {

    private ResultSet resultSet;
    private ResponseStatus result;

    public CassandraResult30(ResultSet resultSet) {
        this.resultSet = resultSet;
        this.result = new SuccessStatus();
    }

    public CassandraResult30(ResponseStatus result) {
        this.result = result;
    }

    @Override
    public List<CassandraRowV3> rows() {
        List<Row> all = resultSet.all();
        return all.stream().map(CassandraRow30::new).collect(Collectors.toList());
    }

    @Override
    public ResponseStatus status() {
        return result;
    }
}


text:
using Models.demo.BusinessBase;

namespace Models.demo.Business2
{
    public class Department : DepartmentBase
    {
        public Department()
        {
        }

        public Department(DbModels.Department department)
        {
            if (department.Father != null)
            {
                Father = new Department(department.Father);
            }
        }

        public Department Father { get; set; }
    }
}


text:
package base.game.controllers;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import base.game.controllers.input.HumanInputController;
import base.game.controllers.input.IntelligenceInputController;
import base.models.Board;
import base.models.Player;
import base.models.game.Input;

/**
 * Basic input controller that runs loop over players waiting for input.
 *
 * @author dereekb
 *
 * @param

 * @param
 * @param
 */
public abstract class InputController<P extends Player, I extends Input
, B extends Board<?>> {

	private final IntelligenceInputController
 intelligenceController;
	private final HumanInputController
 humanController;

	public InputController(HumanInputController
 humanController) {
		this(humanController, null);
	}

	public InputController(HumanInputController
 humanController,
			IntelligenceInputController
 intelligenceController) {
		this.intelligenceController = intelligenceController;
		this.humanController = humanController;
	}

	public I getInputForPlayer(P player, B board) throws IOException {

		I input = null;

		boolean isHuman = player.isHuman();

		if (isHuman) {
			input = this.humanController.inputForHuman(player);
		} else {
			input = this.intelligenceController.inputForIntelligence(player,
					board);
		}

		return input;
	}

	public List getInputForPlayers(List
 players, B board) throws IOException {
		List turnInput = new ArrayList();
		List
 playingPlayers = this.filterPlayersForNextTurn(players);

		for (P player : playingPlayers) {
			I input = this.getInputForPlayer(player, board);

			if (input != null) {
				turnInput.add(input);
			}
		}

		return turnInput;
	}

	protected abstract List
 filterPlayersForNextTurn(List
 players);
}


text:
#!/bin/sh
#
# Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Distribution License v. 1.0, which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: BSD-3-Clause
#

while getopts :r:l:t:s:b:j:m:u:p:w:dh arg
do
    case "$arg" in
        r)  RELEASE_VERSION="${OPTARG:?}" ;;
        b)  RELEASE_BRANCH="${OPTARG:?}" ;;
        j)  JAXB_VERSION="${OPTARG:?}" ;;
        t)  GIT_VERSION="${OPTARG:?}" ;;
        l)  MAVEN_USER_HOME="${OPTARG:?}" ;;
        s)  MAVEN_SETTINGS="${OPTARG:?}" ;;
        m)  SOURCES_VERSION="${OPTARG:?}" ;;
        w)  WORKROOT="${OPTARG:?}" ;;
        u)  WWW_SVN_USER="${OPTARG:?}" ;;
        p)  WWW_SVN_PASSWORD="${OPTARG:?}" ;;
        d)  debug=true ;;
        h)
            echo "Usage: release.sh [-r RELEASE_VERSION] --mandatory, the release version string, for example 2.2.11"
            echo "                   [-t GIT_VERSION] --mandatory, git tag or sha to checkout for the release"
            echo "                   [-b RELEASE_BRANCH] --optional, the branch for the release"
            echo "                   [-j JAXB_VERSION] --optional, the branch for the release"
            echo "                   [-l MVEN_USER_HOME] -- optional, alternative maven local repository location"
            echo "                   [-w WORKROOT] -- optional, default is current dir (`pwd`)"
            echo "                   [-m SOURCES_VERSION] -- optional, version in pom.xml need to be repaced with \$RELEASE_VERSION, default is \${RELEASE_VERSION}-SNAPSHOT"
            echo "                   [-s MAVEN_SETTINGS] --optional, alternative maven settings.xml"
            echo "                   [-u WWW_SVN_USER] --optional, the svn scm username for commit the www docs, if not specified it uses cached credential"
            echo "                   [-p WWW_SVN_PASSWORD] --optional the svn scm password for commit the www docs"
            echo "                   [-d] -- debug mode"
            exit ;;
        "?")
            echo "ERROR: unknown option \"$OPTARG\"" 1>&2
            echo "" 1>&2 ;;
    esac
done

if [ "$M2_HOME" = "" -o ! -d $M2_HOME ]; then
    echo "ERROR: Check your M2_HOME: $M2_HOME"
    exit 1
fi

if [ "$JAVA_HOME" = "" -o ! -d $JAVA_HOME ]; then
    echo "ERROR: Check your JAVA_HOME: $JAVA_HOME"
    exit 1
fi
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
export TMPDIR=${TMPDIR:-/tmp}

PROXYURL=www-proxy.us.oracle.com
PROXYPORT=80

export http_proxy=$PROXYURL:$PROXYPORT
export https_proxy=$http_proxy

export MAVEN_OPTS="-Xms256m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=512m -Dhttp.proxyHost=$PROXYURL -Dhttp.proxyPort=$PROXYPORT -Dhttps.proxyHost=$PROXYURL -Dhttps.proxyPort=$PROXYPORT"

if [ "$MAVEN_USER_HOME" = "" ]; then
     user=${LOGNAME:-${USER-"`whoami`"}}
     MAVEN_USER_HOME="/scratch/$user/.m2/repository"
fi

if [ -n "$MAVEN_SETTINGS" ]; then
    MAVEN_SETTINGS="-s $MAVEN_SETTINGS"
fi

if [ "$WORKROOT" = "" ]; then
    WORKROOT=`pwd`
fi

if [ "$MAVEN_USER_HOME" = "" ]; then
    MAVEN_LOCAL_REPO="-Dmaven.repo.local=${WORKROOT}/.m2/repository"
else
    MAVEN_LOCAL_REPO="-Dmaven.repo.local=${MAVEN_USER_HOME}"
fi

if [ "$RELEASE_VERSION" = "" ]; then
    echo "ERROR: you need to give the -r with the release revision"
    exit 1
fi

echo "Release on git version: $GIT_VERSION"
if [ "$GIT_VERSION" = "" ]; then
   exit 1;
fi

cd $WORKROOT || {
    echo "ERROR: fail to cd to working dir $WORKROOT"
    exit 1
}

if [ -e jaxws-ri ] ; then
   echo "INFO: Removing old JAXWS workspace"
   rm -rf jaxws-ri
fi

echo "INFO: Cloning jaxws-ri git repository"
git clone git@orahub.oraclecorp.com:fmw-infra-metro/jaxws-ri.git || {
    echo "fail to clone the git repository"
    exit 1
}

# create release branch from the given git version to be released
cd jaxws-ri
RELEASE_BRANCH=${RELEASE_BRANCH:-`echo jaxws${RELEASE_VERSION} |sed 's/\.//g'`}
echo "INFO: git checkout -b $RELEASE_BRANCH $GIT_VERSION"
git checkout -b $RELEASE_BRANCH $GIT_VERSION || {
    echo "ERROR: fail to checkout $GIT_VRSION to branch $RELEASE_BRANCH"
    exit 1
}
GIT_SHA=`git rev-parse --short HEAD`
echo "INFO: release $RELEASE_VERSION base on the git sha $GIT_SHA"
SOURCES_VERSION=${SOURCES_VERSION:-"${RELEASE_VERSION}-SNAPSHOT"}
echo "INFO: Replacing project version $SOURCES_VERSION in sources with new release version $RELEASE_VERSION"
find ./ -name "pom.xml" | while read file; do
    return_status=0
    echo "INFO: Editing $file ..."
    perl -i -pe "s|${SOURCES_VERSION}|${RELEASE_VERSION}|g" $file || {
        echo "ERROR: Fail replace version $RELEASE_VERSION on $file"
        return_status=1
    }
    grep -q "<version>$RELEASE_VERSION<\/version>" $file
    if [ $? -ne 0 ]; then
        echo "ERROR: release version $RELEASE_VERSION not found in $file"
        return_status=1
    fi
    if [ $return_status -eq 1 ]; then
        exit 1
    fi
done
if [ -n "$JAXB_VERSION" ]; then
    perl -i -pe "s|<jaxb.version>.*</jaxb.version>|<jaxb.version>$JAXB_VERSION</jaxb.version>|g" jaxws-ri/boms/bom/pom.xml
fi

if [ $? -ne 0 ]; then
    echo "ERROR: fail to replace release version $RELEASE_VERSION to pom.xml files"
    exit 1
fi

git diff --quiet
if [ $? -eq 0 ]; then
    echo "WARNING: no change found on pom.xml for the release"
else
    git commit -a -m "release version $RELEASE_VERSION" || {
        echo "ERROR: fail to commit the modified pom.xml"
        exit 1
    }
fi

if [ "$debug" = "true" ]; then
    echo "DEBUG: build while no deploy"
    echo "INFO:  mvn $MAVEN_SETTINGS -B -C -f jaxws-ri/pom.xml $MAVEN_LOCAL_REPO -DskipTests=true -Prelease-profile,release-sign-artifacts -Dlicense.url=http://hudson-sca.us.oracle.com/job/tlda-license/lastSuccessfulBuild/artifact/ clean install"
    mvn $MAVEN_SETTINGS -B -C -f jaxws-ri/pom.xml $MAVEN_LOCAL_REPO -DskipTests=true -Prelease-profile,release-sign-artifacts -Dlicense.url=http://hudson-sca.us.oracle.com/job/tlda-license/lastSuccessfulBuild/artifact/ clean install
else
    echo "INFO: Build and Deploy ..."
    echo "INFO:  mvn $MAVEN_SETTINGS -B -C -f jaxws-ri/pom.xml $MAVEN_LOCAL_REPO -DskipTests=true -Prelease-profile,release-sign-artifacts -Dlicense.url=http://hudson-sca.us.oracle.com/job/tlda-license/lastSuccessfulBuild/artifact/ clean install deploy"
    mvn $MAVEN_SETTINGS -B -C -f jaxws-ri/pom.xml $MAVEN_LOCAL_REPO -DskipTests=true -Prelease-profile,release-sign-artifacts -Dlicense.url=http://hudson-sca.us.oracle.com/job/tlda-license/lastSuccessfulBuild/artifact/ clean install deploy
fi
if [ $? -ne 0 ]; then
      exit 1
fi
echo "INFO: Tagging release $RELEASE_VERSION"
RELEASE_TAG=`echo "JAXWS_$RELEASE_VERSION" |sed 's/\./_/g'`
echo "INFO: git tag -m \"Tag release $RELEASE_VERSION\" $RELEASE_TAG"
git tag -m "Tag release $RELEASE_VERSION" $RELEASE_TAG

if [ "$debug" = "true" ]; then
    echo "DEBUG: debug only, no push ..."
else
    git push origin $RELEASE_BRANCH
    git push origin $RELEASE_VERSION
fi

cd $WORKROOT
echo "INFO: Updating www docs ..."
if [ -d "www" ]; then
    rm -rf www
fi
echo "INFO: svn checkout --non-interactive --depth=empty https://svn.java.net/svn/jax-ws~wcr/trunk/www"
svn checkout --non-interactive --depth=empty https://svn.java.net/svn/jax-ws~wcr/trunk/www || {
    echo "ERROR: checkout www failed"
    exit 1
}
# create www release folder and copy the built out docs
cd www || {
    echo "ERROR: fail chdir to www"
    exit 1
}
mkdir -p $RELEASE_VERSION/docs $RELEASE_VERSION/javadocs/rt $RELEASE_VERSION/javadocs/tools
echo "INFO: cp $WORKROOT/jaxws-ri/jaxws-ri/target/jaxws-ri-$RELEASE_VERSION-src-licensee.zip $RELEASE_VERSION/"
cp $WORKROOT/jaxws-ri/jaxws-ri/target/jaxws-ri-$RELEASE_VERSION-src-licensee.zip $RELEASE_VERSION/ || {
    echo "ERROR: fail copy jaxws-ri-$RELEASE_VERSION-src-licensee.zip"
    exit 1
}
echo "INFO: cp $WORKROOT/jaxws-ri/jaxws-ri/docs/www/target/www-stage/index.html $RELEASE_VERSION/"
cp $WORKROOT/jaxws-ri/jaxws-ri/docs/www/target/www-stage/index.html $RELEASE_VERSION/ || {
    echo "ERROR: fail copy index.html"
    exit 1
}
echo "INFO: cp -r $WORKROOT/jaxws-ri/jaxws-ri/docs/release-documentation/target/docbook/* $RELEASE_VERSION/docs/"
cp -r $WORKROOT/jaxws-ri/jaxws-ri/docs/release-documentation/target/docbook/* $RELEASE_VERSION/docs/ || {
    echo "ERROR: fail copy docbook"
    exit 1
}
find $RELEASE_VERSION/docs -type f -name "*.fo" |xargs rm -f
(
    cd $WORKROOT/www/$RELEASE_VERSION/javadocs/rt
    jar -xf $WORKROOT/jaxws-ri/jaxws-ri/bundles/jaxws-rt/target/jaxws-rt-$RELEASE_VERSION-javadoc.jar
) || {
    echo "ERROR: fail extract jaxws-rt-$RELEASE_VERSION-javadoc.jar"
    exit 1
}
(
    cd $WORKROOT/www/$RELEASE_VERSION/javadocs/tools
    jar -xf $WORKROOT/jaxws-ri/jaxws-ri/bundles/jaxws-tools/target/jaxws-tools-$RELEASE_VERSION-javadoc.jar
) || {
    echo "ERROR: fail extract jaxws-tools-$RELEASE_VERSION-javadoc.jar"
    exit 1
}
cd $WORKROOT/www
svn add --non-interactive $RELEASE_VERSION

# link the latest relase to current release
echo "INFO: Update latest download page link to $RELEASE_VERSION"
svn --non-interactive update -q latest
sed -i "s#URL=https://jax-ws.java.net/.*/#URL=https://jax-ws.java.net/$RELEASE_VERSION/#" latest/download.html
sed -i "s#URL=https://jax-ws.java.net/.*/docs/#URL=https://jax-ws.java.net/$RELEASE_VERSION/docs/#" latest/docs.html

# modify www/downloads/ri/index.html
svn --non-interactive update -q downloads
RELEASE_VERSION_MAIN=${RELEASE_VERSION%.*}
set +e
grep -q "
Latest RI for JAX-WS $RELEASE_VERSION_MAIN<\/h2>" downloads/ri/index.html
if [ $? -eq 0 ]; then
    echo "INFO: found $RELEASE_VERSION_MAIN snippet, updating downloads/ri/index.html to current release..."
    sed -i -e "s#RI Version: $RELEASE_VERSION_MAIN.*#RI Version: $RELEASE_VERSION#" -e "s#Binary Distribution
#Binary Distribution
#" -e "s#Source Distribution
#Source Distribution
#" -e "s#More about RI $RELEASE_VERSION_MAIN.* release
#More about RI $RELEASE_VERSION release
#" downloads/ri/index.html
else
    echo "INFO: adding new $RELEASE_VERSION_MAIN snippet into downloads/ri/index.html"
    tmpfile=$TMPDIR/release_jaxws_newentry_$$
    rm -f $tmpfile
    cat > $tmpfile <<EOF

Latest RI for JAX-WS $RELEASE_VERSIN_MAIN

RI Version: $RELEASE_VERION

Binary Distribution

Source Distribution

More about RI $RELEASE_VERSION release

EOF
    # I maybe figure out a better way of not hardcode the line number here later
    sed  -i "5 r $tmpfile" downloads/ri/index.html
    rm -f $tmpfile
fi

# modify www/__modules/left_sidebar.htmlx
echo "INFO: add $RELEASE_VERSION to the left side bar"
svn --non-interactive update -q __modules
line=`sed -n '/ *<li><a href=\"#\">Download RI<\/a>/=' __modules/left_sidebar.htmlx`
line=`expr $line + 1`
appendLine="\ \ \ \ \ \ \
$RELEASE_VERSION"
sed -i "$line a\
$appendLine" __modules/left_sidebar.htmlx
sed -i -e "s#
Release documentation#
Release documentation#" -e "s#
API Javadoc#
API Javadoc#" __modules/left_sidebar.htmlx

if [ -n "$WWW_SVN_USER"  -a -n "$WWW_SVN_PASSWORD" ]; then
    AUTH="--username $WWW_SVN_USER --password $WWW_SVN_PASSWORD --no-auth-cache"
else
    AUTH=""
fi
if [ "$debug" = "true" ]; then
    echo "DEBUG: debug only, not commit the docs."
    echo "DEBUG: svn $AUTH --non-interactive commit -m \"JAXWS release $RELEASE_VERSION\""
else
    echo "INFO: commit the updated docs"
    svn $AUTH --non-interactive commit -m "JAXWS $RELEASE_VERSION" .
    if [ $? -ne 0 ]; then
        echo "ERROR: fail to commit the www docs!"
        exit 1
    fi
fi


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ExchangeId** | **string** | Exchange identifier used to identify the routing destination. |
**ClientOrderId** | **string** | The unique identifier of the order assigned by the client. |
**SymbolIdExchange** | Pointer to **string** | Exchange symbol. One of the properties (`symbol_id_exchange`, `symbol_id_coinapi`) is required to identify the market for the new order. | [optional]
**SymbolIdCoinapi** | Pointer to **string** | CoinAPI symbol. One of the properties (`symbol_id_exchange`, `symbol_id_coinapi`) is required to identify the market for the new order. | [optional]
**AmountOrder** | **float32** | Order quantity. |
**Price** | **float32** | Order price. |
**Side** | [**OrdSide**](OrdSide.md) |  |
**OrderType** | [**OrdType**](OrdType.md) |  |
**TimeInForce** | [**TimeInForce**](TimeInForce.md) |  |
**ExpireTime** | Pointer to **string** | Expiration time. Conditionaly required for orders with time_in_force = `GOOD_TILL_TIME_EXCHANGE` or `GOOD_TILL_TIME_OEML`. | [optional]
**ExecInst** | Pointer to **[]string** | Order execution instructions are documented in the separate section: EMS / Starter Guide / Order parameters / Execution instructions  | [optional]
**ClientOrderIdFormatExchange** | **string** | The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. |
**ExchangeOrderId** | Pointer to **string** | Unique identifier of the order assigned by the exchange or executing system. | [optional]
**AmountOpen** | **float32** | Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled` |
**AmountFilled** | **float32** | Total quantity filled. |
**AvgPx** | Pointer to **float32** | Calculated average price of all fills on this order. | [optional]
**Status** | [**OrdStatus**](OrdStatus.md) |  |
**StatusHistory** | Pointer to **[][]string** | Timestamped history of order status changes. | [optional]
**ErrorMessage** | Pointer to **string** | Error message. | [optional]
**Fills** | Pointer to [**[]Fills**](Fills.md) | Relay fill information on working orders. | [optional]

## Methods

### NewOrderExecutionReport

`func NewOrderExecutionReport(exchangeId string, clientOrderId string, amountOrder float32, price float32, side OrdSide, orderType OrdType, timeInForce TimeInForce, clientOrderIdFormatExchange string, amountOpen float32, amountFilled float32, status OrdStatus, ) *OrderExecutionReport`

NewOrderExecutionReport instantiates a new OrderExecutionReport object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed

### NewOrderExecutionReportWithDefaults

`func NewOrderExecutionReportWithDefaults() *OrderExecutionReport`

NewOrderExecutionReportWithDefaults instantiates a new OrderExecutionReport object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set

### GetExchangeId

`func (o *OrderExecutionReport) GetExchangeId() string`

GetExchangeId returns the ExchangeId field if non-nil, zero value otherwise.

### GetExchangeIdOk

`func (o *OrderExecutionReport) GetExchangeIdOk() (*string, bool)`

GetExchangeIdOk returns a tuple with the ExchangeId field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetExchangeId

`func (o *OrderExecutionReport) SetExchangeId(v string)`

SetExchangeId sets ExchangeId field to given value.

### GetClientOrderId

`func (o *OrderExecutionReport) GetClientOrderId() string`

GetClientOrderId returns the ClientOrderId field if non-nil, zero value otherwise.

### GetClientOrderIdOk

`func (o *OrderExecutionReport) GetClientOrderIdOk() (*string, bool)`

GetClientOrderIdOk returns a tuple with the ClientOrderId field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetClientOrderId

`func (o *OrderExecutionReport) SetClientOrderId(v string)`

SetClientOrderId sets ClientOrderId field to given value.

### GetSymbolIdExchange

`func (o *OrderExecutionReport) GetSymbolIdExchange() string`

GetSymbolIdExchange returns the SymbolIdExchange field if non-nil, zero value otherwise.

### GetSymbolIdExchangeOk

`func (o *OrderExecutionReport) GetSymbolIdExchangeOk() (*string, bool)`

GetSymbolIdExchangeOk returns a tuple with the SymbolIdExchange field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetSymbolIdExchange

`func (o *OrderExecutionReport) SetSymbolIdExchange(v string)`

SetSymbolIdExchange sets SymbolIdExchange field to given value.

### HasSymbolIdExchange

`func (o *OrderExecutionReport) HasSymbolIdExchange() bool`

HasSymbolIdExchange returns a boolean if a field has been set.

### GetSymbolIdCoinapi

`func (o *OrderExecutionReport) GetSymbolIdCoinapi() string`

GetSymbolIdCoinapi returns the SymbolIdCoinapi field if non-nil, zero value otherwise.

### GetSymbolIdCoinapiOk

`func (o *OrderExecutionReport) GetSymbolIdCoinapiOk() (*string, bool)`

GetSymbolIdCoinapiOk returns a tuple with the SymbolIdCoinapi field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetSymbolIdCoinapi

`func (o *OrderExecutionReport) SetSymbolIdCoinapi(v string)`

SetSymbolIdCoinapi sets SymbolIdCoinapi field to given value.

### HasSymbolIdCoinapi

`func (o *OrderExecutionReport) HasSymbolIdCoinapi() bool`

HasSymbolIdCoinapi returns a boolean if a field has been set.

### GetAmountOrder

`func (o *OrderExecutionReport) GetAmountOrder() float32`

GetAmountOrder returns the AmountOrder field if non-nil, zero value otherwise.

### GetAmountOrderOk

`func (o *OrderExecutionReport) GetAmountOrderOk() (*float32, bool)`

GetAmountOrderOk returns a tuple with the AmountOrder field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetAmountOrder

`func (o *OrderExecutionReport) SetAmountOrder(v float32)`

SetAmountOrder sets AmountOrder field to given value.

### GetPrice

`func (o *OrderExecutionReport) GetPrice() float32`

GetPrice returns the Price field if non-nil, zero value otherwise.

### GetPriceOk

`func (o *OrderExecutionReport) GetPriceOk() (*float32, bool)`

GetPriceOk returns a tuple with the Price field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetPrice

`func (o *OrderExecutionReport) SetPrice(v float32)`

SetPrice sets Price field to given value.

### GetSide

`func (o *OrderExecutionReport) GetSide() OrdSide`

GetSide returns the Side field if non-nil, zero value otherwise.

### GetSideOk

`func (o *OrderExecutionReport) GetSideOk() (*OrdSide, bool)`

GetSideOk returns a tuple with the Side field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetSide

`func (o *OrderExecutionReport) SetSide(v OrdSide)`

SetSide sets Side field to given value.

### GetOrderType

`func (o *OrderExecutionReport) GetOrderType() OrdType`

GetOrderType returns the OrderType field if non-nil, zero value otherwise.

### GetOrderTypeOk

`func (o *OrderExecutionReport) GetOrderTypeOk() (*OrdType, bool)`

GetOrderTypeOk returns a tuple with the OrderType field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetOrderType

`func (o *OrderExecutionReport) SetOrderType(v OrdType)`

SetOrderType sets OrderType field to given value.

### GetTimeInForce

`func (o *OrderExecutionReport) GetTimeInForce() TimeInForce`

GetTimeInForce returns the TimeInForce field if non-nil, zero value otherwise.

### GetTimeInForceOk

`func (o *OrderExecutionReport) GetTimeInForceOk() (*TimeInForce, bool)`

GetTimeInForceOk returns a tuple with the TimeInForce field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetTimeInForce

`func (o *OrderExecutionReport) SetTimeInForce(v TimeInForce)`

SetTimeInForce sets TimeInForce field to given value.

### GetExpireTime

`func (o *OrderExecutionReport) GetExpireTime() string`

GetExpireTime returns the ExpireTime field if non-nil, zero value otherwise.

### GetExpireTimeOk

`func (o *OrderExecutionReport) GetExpireTimeOk() (*string, bool)`

GetExpireTimeOk returns a tuple with the ExpireTime field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetExpireTime

`func (o *OrderExecutionReport) SetExpireTime(v string)`

SetExpireTime sets ExpireTime field to given value.

### HasExpireTime

`func (o *OrderExecutionReport) HasExpireTime() bool`

HasExpireTime returns a boolean if a field has been set.

### GetExecInst

`func (o *OrderExecutionReport) GetExecInst() []string`

GetExecInst returns the ExecInst field if non-nil, zero value otherwise.

### GetExecInstOk

`func (o *OrderExecutionReport) GetExecInstOk() (*[]string, bool)`

GetExecInstOk returns a tuple with the ExecInst field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetExecInst

`func (o *OrderExecutionReport) SetExecInst(v []string)`

SetExecInst sets ExecInst field to given value.

### HasExecInst

`func (o *OrderExecutionReport) HasExecInst() bool`

HasExecInst returns a boolean if a field has been set.

### GetClientOrderIdFormatExchange

`func (o *OrderExecutionReport) GetClientOrderIdFormatExchange() string`

GetClientOrderIdFormatExchange returns the ClientOrderIdFormatExchange field if non-nil, zero value otherwise.

### GetClientOrderIdFormatExchangeOk

`func (o *OrderExecutionReport) GetClientOrderIdFormatExchangeOk() (*string, bool)`

GetClientOrderIdFormatExchangeOk returns a tuple with the ClientOrderIdFormatExchange field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetClientOrderIdFormatExchange

`func (o *OrderExecutionReport) SetClientOrderIdFormatExchange(v string)`

SetClientOrderIdFormatExchange sets ClientOrderIdFormatExchange field to given value.

### GetExchangeOrderId

`func (o *OrderExecutionReport) GetExchangeOrderId() string`

GetExchangeOrderId returns the ExchangeOrderId field if non-nil, zero value otherwise.

### GetExchangeOrderIdOk

`func (o *OrderExecutionReport) GetExchangeOrderIdOk() (*string, bool)`

GetExchangeOrderIdOk returns a tuple with the ExchangeOrderId field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetExchangeOrderId

`func (o *OrderExecutionReport) SetExchangeOrderId(v string)`

SetExchangeOrderId sets ExchangeOrderId field to given value.

### HasExchangeOrderId

`func (o *OrderExecutionReport) HasExchangeOrderId() bool`

HasExchangeOrderId returns a boolean if a field has been set.

### GetAmountOpen

`func (o *OrderExecutionReport) GetAmountOpen() float32`

GetAmountOpen returns the AmountOpen field if non-nil, zero value otherwise.

### GetAmountOpenOk

`func (o *OrderExecutionReport) GetAmountOpenOk() (*float32, bool)`

GetAmountOpenOk returns a tuple with the AmountOpen field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetAmountOpen

`func (o *OrderExecutionReport) SetAmountOpen(v float32)`

SetAmountOpen sets AmountOpen field to given value.

### GetAmountFilled

`func (o *OrderExecutionReport) GetAmountFilled() float32`

GetAmountFilled returns the AmountFilled field if non-nil, zero value otherwise.

### GetAmountFilledOk

`func (o *OrderExecutionReport) GetAmountFilledOk() (*float32, bool)`

GetAmountFilledOk returns a tuple with the AmountFilled field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetAmountFilled

`func (o *OrderExecutionReport) SetAmountFilled(v float32)`

SetAmountFilled sets AmountFilled field to given value.

### GetAvgPx

`func (o *OrderExecutionReport) GetAvgPx() float32`

GetAvgPx returns the AvgPx field if non-nil, zero value otherwise.

### GetAvgPxOk

`func (o *OrderExecutionReport) GetAvgPxOk() (*float32, bool)`

GetAvgPxOk returns a tuple with the AvgPx field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetAvgPx

`func (o *OrderExecutionReport) SetAvgPx(v float32)`

SetAvgPx sets AvgPx field to given value.

### HasAvgPx

`func (o *OrderExecutionReport) HasAvgPx() bool`

HasAvgPx returns a boolean if a field has been set.

### GetStatus

`func (o *OrderExecutionReport) GetStatus() OrdStatus`

GetStatus returns the Status field if non-nil, zero value otherwise.

### GetStatusOk

`func (o *OrderExecutionReport) GetStatusOk() (*OrdStatus, bool)`

GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetStatus

`func (o *OrderExecutionReport) SetStatus(v OrdStatus)`

SetStatus sets Status field to given value.

### GetStatusHistory

`func (o *OrderExecutionReport) GetStatusHistory() [][]string`

GetStatusHistory returns the StatusHistory field if non-nil, zero value otherwise.

### GetStatusHistoryOk

`func (o *OrderExecutionReport) GetStatusHistoryOk() (*[][]string, bool)`

GetStatusHistoryOk returns a tuple with the StatusHistory field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetStatusHistory

`func (o *OrderExecutionReport) SetStatusHistory(v [][]string)`

SetStatusHistory sets StatusHistory field to given value.

### HasStatusHistory

`func (o *OrderExecutionReport) HasStatusHistory() bool`

HasStatusHistory returns a boolean if a field has been set.

### GetErrorMessage

`func (o *OrderExecutionReport) GetErrorMessage() string`

GetErrorMessage returns the ErrorMessage field if non-nil, zero value otherwise.

### GetErrorMessageOk

`func (o *OrderExecutionReport) GetErrorMessageOk() (*string, bool)`

GetErrorMessageOk returns a tuple with the ErrorMessage field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetErrorMessage

`func (o *OrderExecutionReport) SetErrorMessage(v string)`

SetErrorMessage sets ErrorMessage field to given value.

### HasErrorMessage

`func (o *OrderExecutionReport) HasErrorMessage() bool`

HasErrorMessage returns a boolean if a field has been set.

### GetFills

`func (o *OrderExecutionReport) GetFills() []Fills`

GetFills returns the Fills field if non-nil, zero value otherwise.

### GetFillsOk

`func (o *OrderExecutionReport) GetFillsOk() (*[]Fills, bool)`

GetFillsOk returns a tuple with the Fills field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetFills

`func (o *OrderExecutionReport) SetFills(v []Fills)`

SetFills sets Fills field to given value.

### HasFills

`func (o *OrderExecutionReport) HasFills() bool`

HasFills returns a boolean if a field has been set.

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
'use strict';

describe('Controller: AppCtrl', function () {

  // load the controller's module
  beforeEach(module('timelinerApp'));

  var AppCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    AppCtrl = $controller('AppCtrl', {
      $scope: scope
      // place here mocked dependencies
    });
  }));

  it('should attach isLoggedIn function to the scope', function () {
    expect(typeof scope.isLoggedIn).toBe('function');
  });
});


text:
<?php

function shrinkUrl($url)  {
	$ch = curl_init();
	$timeout = 5;
	curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}

?>


text:
<?php
$t = new \Trust\TableComposer("locations");

$t->string("location",50)->primary();
$t->jsonb("data_info");

$queries[] = $t->parse();


text:
import {Interceptor} from '@ciscospark/http-core';

/**
 * @class
 */
export default class EmbargoInterceptor extends Interceptor {
  /**
   * @returns {EmbargoInterceptor}
   */
  static create() {
    /* eslint no-invalid-this: [0] */
    return new EmbargoInterceptor({spark: this});
  }

  /**
   * @see Interceptor#onResponseError
   * @param {Object} options
   * @param {Error} reason
   * @returns {Promise}
   */
  onResponseError(options, reason) {
    if (reason.statusCode === 451) {
      this.spark.device.clear();
      this.spark.credentials.clear();
      this.spark.logger.info(`Received \`HTTP 451 Unavailable For Legal Reasons\`, discarding credentials and device registration`);
    }

    return Promise.reject(reason);
  }
}


text:
package com.caran.agaadapter;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

import org.slf4j.Logger;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import android.swedspot.scs.data.DataType;

/**
 * Loader for object defining the conversion from a MQTT signal to a SDP signal,
 * or the opposite.
 *
 */
public class LoadConversionConfig {

    /**
     * Logger.
     */
    private Logger logger = null;

    /**
     * Signal conversion information.
     */
    public ArrayList<SignalInfo> approvedSignals = null;

    /**
     * Signal conversion information. The AGA ID is the key.
     */
    public HashMap<Integer, SignalInfo> signalFromAgaId = null;

    /**
     * Signal conversion information. The MQTT topic is the key.
     */
    public HashMap<String, SignalInfo> signalFromTopic = null;

    /**
     * Load a .JSON file describing the conversion from MQTT to SDP
     * (and opposite).
     * @param fileName name of the .JSON file
     * @throws JsonSyntaxException TODO
     * @throws IOException TODO
     */
    public final void loadConversionConfig(final String fileName) throws
                      JsonSyntaxException, IOException {
        ConversionInfo conversionInfo = null;
        Gson jsonParser = new Gson();

        final Float agaMultiplierDefault = 1.0f;
        final Float agaMultiplierMin = 0.0000001f; // Avoid divide by zero
        final int agaIdMax = 0xFFFF;
        final String[] settingsAgaTypesAllowed = new String[] {
                DataType.UINT8.name(),
                DataType.SHORT.name(),
                DataType.INTEGER.name(),
                DataType.FLOAT.name(),
                DataType.DOUBLE.name() };

        // Read configuration file
        BufferedReader reader = new BufferedReader(new FileReader(fileName));
        conversionInfo = jsonParser.fromJson(reader, ConversionInfo.class);

        // Initialize array to store approved signals
        approvedSignals = new ArrayList<SignalInfo>();

        for (SignalInfo signal : conversionInfo.signals) {
            // Verify AGA id
            if (signal.agaId <= 0 || signal.agaId > agaIdMax) {
                //logger.warn("Wrong agaId for signal " + signal);
                continue;
            }
            // Verify AGA Type
            if (!(Arrays.asList(settingsAgaTypesAllowed).
                    contains(signal.agaType))) {
                //logger.warn("Wrong agaType for signal " + signal +
                //". Not implemented.");
                continue;
            }
            // Give AGA multiplier a value if none was given in config file
            if (signal.agaMultiplier == null) {
                signal.agaMultiplier = agaMultiplierDefault;
            }
            // Verify that AGA multiplier is larger than MIN_
            if (signal.agaMultiplier < agaMultiplierMin) {
            //  logger.warn("Wrong agaMultiplier for signal " + signal);
                continue;
            }
            // Verify that MQTT topic is given
            if (signal.mqttTopic == null) {
            //  logger.warn("Wrong mqttTopic for signal " + signal);
                continue;
            }

            // Signal is approved
            approvedSignals.add(signal);

        }

        // Create hash tables to ease signal lookup
        signalFromAgaId = new HashMap<Integer, SignalInfo>();
        signalFromTopic = new HashMap<String, SignalInfo>();
        for (SignalInfo signal : approvedSignals) {
            signalFromAgaId.put(signal.agaId, signal);
            signalFromTopic.put(signal.mqttTopic, signal);
        }

        // Check if topic or agaId has been duplicated
        if (approvedSignals.size() != signalFromAgaId.size()
            || approvedSignals.size() != signalFromTopic.size()) {
        //  logger.error("mqttTopic and/or AGAid duplication found in "
        //+ "conversion file");
            JsonSyntaxException e =
                new JsonSyntaxException("Duplicate data found");
            throw e;
        }
    }

    /**
     * @return an object holding the approved signals.
     */
    public final ArrayList<SignalInfo> getApprovedSignals() {
        return approvedSignals;
    }

    /**
     * Set the approved signals.
     * @param approvedSignals An object holding signal conversion information,
     *         where the AGA ID is the key.
     */
    public final void setApprovedSignals(
                      final ArrayList<SignalInfo> approvedSignals) {
        this.approvedSignals = approvedSignals;
    }

    /**
     * @return an object holding signal conversion information,
     *         where the AGA ID is the key.
     */
    public final HashMap<Integer, SignalInfo> getSignalFromAgaId() {
        return signalFromAgaId;
    }

    /**
     * Set the signal conversion info.
     * @param signalFromAgaId An object holding signal conversion information,
     *         where the AGA ID is the key.
     */
    public final void setSignalFromAgaId(
                final HashMap<Integer, SignalInfo> signalFromAgaId) {
        this.signalFromAgaId = signalFromAgaId;
    }

    /**
     * @return an object holding signal conversion information,
     *         where the MQTT topic is the key.
     */
    public final HashMap<String, SignalInfo> getSignalFromTopic() {
        return signalFromTopic;
    }

    /**
     * Set the signal conversion info.
     * @param signalFromTopic An object holding signal conversion information,
     *         where the MQTT topic is the key.
     */
    public final void setSignalFromTopic(
                final HashMap<String, SignalInfo> signalFromTopic) {
        this.signalFromTopic = signalFromTopic;
    }

}


text:
import test from "ava";

import { Worker } from "../worker";
import { sleep, mocked, registerCleaner } from "./_helper";

registerCleaner(test);

test("accepts queues as an array", (t) => {
  const worker = new Worker({ queues: ["test"] });

  t.deepEqual(
    worker.queues,
    ["test"],
    "queues passed as array does not yield array"
  );
});

test("accepts queues as an object", (t) => {
  const worker = new Worker({ queues: { test: 1, ci: 2 } });

  t.deepEqual(
    worker.queues.sort(),
    ["ci", "test"],
    "queues passed as array does not yield array"
  );
});

test("adds default to an empty queue array", (t) => {
  const worker = new Worker({ queues: [] });

  t.deepEqual(worker.queues, ["default"]);
});

test("passes the password to the client", (t) => {
  const worker = new Worker({ password: "1234" });

  t.is(worker.client.password, "1234");
});

test("passes poolSize option to Client", (t) => {
  const worker = new Worker({ poolSize: 8 });

  t.is(worker.client.pool.size, 8);
});

test.only("allows registering job functions", async (t) => {
  await mocked(async (server, port) => {
    server
      .on("BEAT", mocked.beat())
      .on("ACK", mocked.ok())
      .on(
        "FETCH",
        mocked.fetch({ jid: "123", jobtype: "test", args: [], queue: "defaut" })
      );
    const worker = new Worker({ concurrency: 1, port });

    worker.register("test", () => t.pass());

    await worker.work();
    await worker.stop();
  });
});

test("hearbeats", async (t) => {
  await mocked(async (server, port) => {
    let worker: Worker;
    let called = 0;

    return new Promise<void>((resolve) => {
      server
        .on("BEAT", ({ socket }) => {
          called += 1;
          if (called == 3) {
            t.pass();
            resolve();
            worker.stop();
          }
          mocked.beat()({ socket });
        })
        .on("FETCH", mocked.fetch(null));

      worker = new Worker({ concurrency: 1, port, beatInterval: 0.1 });
      worker.work();
    });
  });
});

test(".work() creates a worker, runs, then resolves the worker", async (t) => {
  t.plan(3);
  await mocked(async (server, port) => {
    server
      .on("BEAT", ({ socket }) => {
        socket.write("+OK\r\n");
        t.true(true);
      })
      .on("FETCH", async ({ socket }) => {
        await sleep(10);
        t.true(true);
        socket.write("$-1\r\n");
      });
    const worker = await new Worker({ port, concurrency: 1 }).work();

    t.true(worker instanceof Worker);

    await worker.stop();
  });
});


text:
This is a simple system for taking notes and tracking hours worked. The python script will tabulate your hours by month and calculate your income.

### How to use these files

Simple! Create a textfile much like the [sample log](https://github.com/palpen/wage_calculator/blob/master/sample_log.txt) in this repository. Each entry should be formatted like the sample below

    **Date**: 21 December 2015
    **Time**: 5pm - 7pm, 12-1am
    **Hours**: 2, 1

    **Notes**:
    + Debugged script written yesterday
    + Checked data

The script depends on \*\*Date\*\* and \*\*Hours\*\* and their exact ordering to work. Other than that, it is fairly flexible. The only other requirement is that the year is four digits (to distinguish it from the day). The hours during each session may be delimited using any common delimiter (comma, space, semi-colon). There are no restrictions on how log entries under \*\*Notes\*\* are entered (you can write paragraphs if you wish).

### Calculating hours and total wages for a month

When the time comes for you to calculate your total hours and wages for the month, move the python script to the same directory as your log, then execute the following in the command line

    python calculate_hours.py MY_LOG.txt MONTH YEAR HOURLY_WAGE

For example, to calculate total hours and wages for December 2015 using the sample_log.txt, we execute

    python calculate_hours.py sample_log.txt December 2015 25

The output for which is

![Alt text][id]

### To Do:
- Get hours worked from \*\*Time\*\*
- Allow calculation of hours and wages for multiple months
- Allow abbreviations of month and year (e.g. Dec '16)
    + Use the `parsedatetime` python module
- Add printout of the earliest and latest month/year in log

[id]: img/output_term.png


text:
#include <setjmp.h>

#ifdef VARARGCK
# pragma varargck	argpos	debug	2
# pragma varargck	argpos	dprint	1
# pragma varargck	argpos	event	1
# pragma varargck	argpos	warning	1
#
# pragma varargck	type	"a"	Area*
# pragma varargck	type	"C"	Client*
# pragma varargck	type	"r"	void
#endif

#define _cond(cond, n) (cond) && __alive++ == n
#define _cont(cont) (void)(__alive--, cont)

#define with(type, var) \
	for(type var=(type)-1; (var == (type)-1) && ((var=0) || true);)

/* Grotesque, but worth it. */

#define foreach_area(v, s, a) \
	with(int, __alive)				\
	with(Area*, __anext)				\
	for(s=0; _cond(s <= nscreens, 0); _cont(s++))	\
		for((a)=(s < nscreens ? (v)->areas[s] : v->floating), __anext=((a)?(a)->next:NULL); \
		    _cond(a, 1);			\
		    _cont(((a)=__anext) && (__anext=(a)->next)))

#define foreach_column(v, s, a) \
	with(int, __alive)				\
	with(Area*, __anext)				\
	for(s=0; _cond(s < nscreens, 0); _cont(s++))	\
		for((a)=(v)->areas[s], __anext=((a)?(a)->next:NULL);	\
		    _cond(a, 1);				\
		    _cont(((a)=__anext) && (__anext=(a)->next)))

#define foreach_frame(v, s, a, f) \
	with(Frame*, __fnext)     \
	foreach_area(v, s, a)     \
		for((void)(((f)=(a)->frame) && (__fnext=(f)?((f)->anext):NULL));	\
		    _cond(f, 2);					\
		    _cont(((f)=__fnext) && (__fnext=(f)->anext)))

#define btassert(arg, cond) \
	(cond ? fprint(1, __FILE__":%d: failed assertion: " #cond "\n", __LINE__), backtrace(arg), true : false)

/* area.c */
int	afmt(Fmt*);
void	area_attach(Area*, Frame*);
Area*	area_create(View*, Area *pos, int scrn, uint w);
void	area_destroy(Area*);
void	area_detach(Frame*);
Area*	area_find(View*, Rectangle, int, bool);
void	area_focus(Area*);
int	area_idx(Area*);
void	area_moveto(Area*, Frame*);
char*	area_name(Area*);
Client*	area_selclient(Area*);
void	area_setsel(Area*, Frame*);

/* bar.c */
Bar*	bar_create(Bar**, const char*);
void	bar_destroy(Bar**, Bar*);
void	bar_draw(WMScreen*);
Bar*	bar_find(Bar*, const char*);
void	bar_init(WMScreen*);
void	bar_resize(WMScreen*);
void	bar_sety(WMScreen*, int);
void	bar_setbounds(WMScreen*, int, int);

/* client.c */
int	Cfmt(Fmt *f);
bool	client_applytags(Client*, const char*);
void	client_configure(Client*);
Client*	client_create(XWindow, XWindowAttributes*);
void	client_destroy(Client*);
char*	client_extratags(Client*);
bool	client_floats_p(Client*);
void	client_focus(Client*);
Frame*	client_groupframe(Client*, View*);
void	client_kill(Client*, bool);
void	client_manage(Client*);
void	client_map(Client*);
void	client_message(Client*, char*, long);
bool	client_prop(Client*, Atom);
void	client_reparent(Client*);
void	client_resize(Client*, Rectangle);
void	client_setcursor(Client*, Cursor);
void	client_seturgent(Client*, int, int);
void	client_setviews(Client*, char**);
void	client_unmap(Client*, int state);
Frame*	client_viewframe(Client *c, View *v);
void	focus(Client*, bool user);
void	fullscreen(Client*, int, long);
void	group_init(Client*);
Client*	group_leader(Group*);
void	group_remove(Client*);
int	client_mapframe(Client*);
Client*	selclient(void);
int	client_unmapframe(Client*);
void	update_class(Client*);
Client*	win2client(XWindow);
Rectangle	client_grav(Client*, Rectangle);

/* column.c */
bool	column_setmode(Area*, const char*);
char*	column_getmode(Area*);
void	column_arrange(Area*, bool dirty);
void	column_attach(Area*, Frame*);
void	column_attachrect(Area*, Frame*, Rectangle);
void	column_destroy(Area*);
void	column_detach(Frame*);
void	column_frob(Area*);
void	column_insert(Area*, Frame*, Frame*);
int	column_minwidth(void);
Area*	column_new(View*, Area*, int, uint);
void	column_remove(Frame*);
void	column_resize(Area*, int);
void	column_resizeframe(Frame*, Rectangle);
void	column_settle(Area*);
void	div_draw(Divide*);
void	div_set(Divide*, int x);
void	div_update_all(void);

/* error.c */
#define waserror() setjmp(*pusherror())
void	error(char*, ...);
void	nexterror(void);
void	poperror(void);
jmp_buf*	pusherror(void);

/* event.c */
void	debug_event(XEvent*);
void	print_focus(const char*, Client*, const char*);

/* ewmh.c */
void	ewmh_checkresponsive(Client*);
void	ewmh_destroyclient(Client*);
void	ewmh_framesize(Client*);
void	ewmh_getstrut(Client*);
void	ewmh_getwintype(Client*);
void	ewmh_init(void);
void	ewmh_initclient(Client*);
bool	ewmh_prop(Client*, Atom);
long	ewmh_protocols(Window*);
bool	ewmh_responsive_p(Client*);
void	ewmh_updateclient(Client*);
void	ewmh_updateclientlist(void);
void	ewmh_updateclients(void);
void	ewmh_updatestacking(void);
void	ewmh_updatestate(Client*);
void	ewmh_updateview(void);
void	ewmh_updateviews(void);

/* float.c */
void	float_arrange(Area*);
void	float_attach(Area*, Frame*);
void	float_detach(Frame*);
void	float_resizeframe(Frame*, Rectangle);
Vector_rect*	unique_rects(Vector_rect*, Rectangle);
Rectangle	max_rect(Vector_rect*);

/* frame.c */
Frame*	frame_create(Client*, View*);
int	frame_delta_h(void);
void	frame_draw(Frame*);
void	frame_draw_all(void);
void	frame_focus(Frame*);
uint	frame_idx(Frame*);
void	frame_insert(Frame*, Frame *pos);
void	frame_remove(Frame*);
void	frame_resize(Frame*, Rectangle);
bool	frame_restack(Frame*, Frame*);
void	frame_swap(Frame*, Frame*);
int	ingrabbox_p(Frame*, int x, int y);
void	move_focus(Frame*, Frame*);
Rectangle constrain(Rectangle, int);
Rectangle frame_client2rect(Client*, Rectangle, bool);
WinHints  frame_gethints(Frame*);
Rectangle frame_hints(Frame*, Rectangle, Align);
Rectangle frame_rect2client(Client*, Rectangle, bool);

/* fs.c */
void	fs_attach(Ixp9Req*);
void	fs_clunk(Ixp9Req*);
void	fs_create(Ixp9Req*);
void	fs_flush(Ixp9Req*);
void	fs_freefid(IxpFid*);
void	fs_open(Ixp9Req*);
void	fs_read(Ixp9Req*);
void	fs_remove(Ixp9Req*);
void	fs_stat(Ixp9Req*);
void	fs_walk(Ixp9Req*);
void	fs_write(Ixp9Req*);
void	event(const char*, ...);

/* key.c */
void	init_lock_keys(void);
void	kpress(XWindow, ulong mod, KeyCode);
void	update_keys(void);

/* main.c */
void	init_screens(void);
void	spawn_command(const char*);
void	wipe_screens(void);

/* message.c */
char*	mask(char**, int*, int*);
char*	message_bar(Bar*, IxpMsg*);
char*	message_client(Client*, IxpMsg*);
char*	message_root(void*, IxpMsg*);
char*	message_view(View*, IxpMsg*);
void	msg_debug(char*);
void	msg_eatrunes(IxpMsg*, int (*)(Rune), int);
char*	msg_getword(IxpMsg*, char*);
void	msg_parsecolors(IxpMsg*, CTuple*);
char*	msg_selectarea(Area*, IxpMsg*);
char*	msg_sendclient(View*, IxpMsg*, bool swap);
char*	readctl_bar(Bar*);
char*	readctl_client(Client*);
char*	readctl_root(void);
char*	readctl_view(View*);
Area*	strarea(View*, ulong, const char*);
void	warning(const char*, ...);

/* mouse.c */
Window*	constraintwin(Rectangle);
void	destroyconstraintwin(Window*);
void	grab_button(XWindow, uint button, ulong mod);
void	mouse_checkresize(Frame*, Point, bool);
void	mouse_movegrabbox(Client*, bool);
void	mouse_resize(Client*, Align, bool);
void	mouse_resizecol(Divide*);
bool	readmotion(Point*);
int	readmouse(Point*, uint*);
Align	snap_rect(const Rectangle *rects, int num, Rectangle *current, Align *mask, int snapw);

/* print.c */
int	Ffmt(Fmt*);

/* root.c */
void	root_init(void);

/* screen.c */
void*	findthing(Rectangle, int, Vector_ptr*, Rectangle(*)(void*), bool);
int	ownerscreen(Rectangle);

/* rule.c */
void	update_rules(Rule**, char*);

/* stack.c */
bool	find(Area* *, Frame**, int, bool, bool);
int	stack_count(Frame*, int*);
Frame*	stack_find(Area*, Frame*, int, bool);
void	stack_info(Frame*, Frame**, Frame**, int*, int*);
void	stack_scale(Frame*, int);

/* view.c */
void	view_arrange(View*);
void	view_attach(View*, Frame*);
View*	view_create(const char*);
void	view_destroy(View*);
void	view_detach(Frame*);
Area*	view_findarea(View*, int, int, bool);
void	view_focus(WMScreen*, View*);
bool	view_fullscreen_p(View*, int);
char*	view_index(View*);
void	view_init(View*, int iscreen);
char**	view_names(void);
uint	view_newcolwidth(View*, int, int);
void	view_restack(View*);
void	view_scale(View*, int, int);
Client*	view_selclient(View*);
void	view_select(const char*);
void	view_update(View*);
void	view_update_all(void);
void	view_update_rect(View*);
void	view_update_screens(View*);
void	view_update_urgency(View*, char*);
Rectangle*	view_rects(View*, uint *num, Frame *ignore);

/* utf.c */
char*	toutf8(const char*);
char*	toutf8n(const char*, size_t);

/* xdnd.c */
void	xdnd_initwindow(Window*);


text:
sudo apt-get install libxml2-dev libxslt1-dev r-base

if ! [ -e "$HOME/.rvm" ]; then
	\curl -sSL https://get.rvm.io | bash -s stable
	source "$HOME/.rvm/scripts/rvm"
fi

rvm install ruby-2.1
rvm ruby-2.1.2 do rvm gemset create raidopt
rvm-exec 2.1@raidopt gem install nokogiri -v 1.5.5
rvm-exec 2.1@raidopt gem install rbvmomi
rvm-exec 2.1@raidopt gem install highline
rvm-exec 2.1@raidopt gem install xml-simple
rvm-exec 2.1@raidopt gem install pry

if ! [ -e ~/.Renviron ]; then
	echo 'R_LIBS_USER="~/.Rlibs"' > ~/.Renviron
fi

if ! [ -e ~/.Rlibs ]; then
	mkdir ~/.Rlibs
fi

install_R_package() {
	package=$1
	if ! [ -e "$HOME/.Rlibs/$package" ]; then
		R -e "install.packages(\"$package\", dependencies = TRUE, repos=\"http://cran.cnr.Berkeley.edu\", lib=\"~/.Rlibs\")"
	fi
}

install_R_package caret
install_R_package doParallel


text:
#include <shell/shell.h>
#include <logging/log_ctrl.h>
#include <logging/log.h>
#include <string.h>

typedef int (*log_backend_cmd_t)(const struct shell *shell,
				 const struct log_backend *backend,
				 size_t argc,
				 char **argv);

static const char * const severity_lvls[] = {
	"none",
	"err",
	"wrn",
	"inf",
	"dbg",
};

static const char * const severity_lvls_sorted[] = {
	"dbg",
	"err",
	"inf",
	"none",
	"wrn",
};

/**
 * @brief Function for finding backend instance with given name.
 *
 * @param p_name Name of the backend instance.
 *
 * @return Pointer to the instance or NULL.
 *
 */
static const struct log_backend *backend_find(char const *name)
{
	const struct log_backend *backend;
	size_t slen = strlen(name);

	for (int i = 0; i < log_backend_count_get(); i++) {
		backend = log_backend_get(i);
		if (strncmp(name, backend->name, slen) == 0) {
			return backend;
		}
	}

	return NULL;
}

static bool shell_state_precheck(const struct shell *shell)
{
	if (shell->log_backend->control_block->state
				== SHELL_LOG_BACKEND_UNINIT) {
		shell_error(shell, "Shell log backend not initialized.");
		return false;
	}

	return true;
}

/**
 * @brief Function for executing command on given backend.
 */
static int shell_backend_cmd_execute(const struct shell *shell,
				     size_t argc,
				     char **argv,
				     log_backend_cmd_t func)
{
	/* Based on the structure of backend commands, name of the backend can
	 * be found at -1 (log backend <name> command).
	 */
	char const *name = argv[-1];
	const struct log_backend *backend = backend_find(name);

	if (backend != NULL) {
		func(shell, backend, argc, argv);
	} else {
		shell_error(shell, "Invalid backend: %s", name);
		return -ENOEXEC;
	}
	return 0;
}

static int log_status(const struct shell *shell,
		      const struct log_backend *backend,
		      size_t argc, char **argv)
{
	u32_t modules_cnt = log_sources_count();
	u32_t dynamic_lvl;
	u32_t compiled_lvl;
	u32_t i;

	if (!log_backend_is_active(backend)) {
		shell_warn(shell, "Logs are halted!");
	}

	shell_fprintf(shell, SHELL_NORMAL, "%-40s | current | built-in \r\n",
					   "module_name");
	shell_fprintf(shell, SHELL_NORMAL,
	      "----------------------------------------------------------\r\n");

	for (i = 0U; i < modules_cnt; i++) {
		dynamic_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
					     i, true);
		compiled_lvl = log_filter_get(backend, CONFIG_LOG_DOMAIN_ID,
					      i, false);

		shell_fprintf(shell, SHELL_NORMAL, "%-40s | %-7s | %s\r\n",
			      log_source_name_get(CONFIG_LOG_DOMAIN_ID, i),
			      severity_lvls[dynamic_lvl],
			      severity_lvls[compiled_lvl]);
	}
	return 0;
}

static int cmd_log_self_status(const struct shell *shell,
			       size_t argc, char **argv)
{
	if (!shell_state_precheck(shell)) {
		return 0;
	}

	log_status(shell, shell->log_backend->backend, argc, argv);
	return 0;
}

static int cmd_log_backend_status(const struct shell *shell,
				  size_t argc, char **argv)
{
	shell_backend_cmd_execute(shell, argc, argv, log_status);
	return 0;
}

static int module_id_get(const char *name)
{
	u32_t modules_cnt = log_sources_count();
	const char *tmp_name;
	u32_t i;

	for (i = 0U; i < modules_cnt; i++) {
		tmp_name = log_source_name_get(CONFIG_LOG_DOMAIN_ID, i);

		if (strncmp(tmp_name, name, 64) == 0) {
			return i;
		}
	}
	return -1;
}

static void filters_set(const struct shell *shell,
			const struct log_backend *backend,
			size_t argc, char **argv, u32_t level)
{
	int i;
	int id;
	bool all = argc ? false : true;
	int cnt = all ? log_sources_count() : argc;

	if (!backend->cb->active) {
		shell_warn(shell, "Backend not active.");
	}

	for (i = 0; i < cnt; i++) {
		id = all ? i : module_id_get(argv[i]);
		if (id >= 0) {
			u32_t set_lvl = log_filter_set(backend,
						       CONFIG_LOG_DOMAIN_ID,
						       id, level);

			if (set_lvl != level) {
				const char *name;

				name = all ?
					log_source_name_get(
						CONFIG_LOG_DOMAIN_ID, i) :
					argv[i];
				shell_warn(shell, "%s: level set to %s.",
					   name, severity_lvls[set_lvl]);
			}
		} else {
			shell_error(shell, "%s: unknown source name.", argv[i]);
		}
	}
}

static int severity_level_get(const char *str)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(severity_lvls); i++) {
		if (strncmp(str, severity_lvls[i], 4) == 0) {
			return i;
		}
	}

	return -1;
}
static int log_enable(const struct shell *shell,
		      const struct log_backend *backend,
		      size_t argc,
		      char **argv)
{
	int severity_level;

	severity_level = severity_level_get(argv[1]);

	if (severity_level < 0) {
		shell_error(shell, "Invalid severity: %s", argv[1]);
		return -ENOEXEC;
	}

	/* Arguments following severity level are interpreted as module names.*/
	filters_set(shell, backend, argc - 2, &argv[2], severity_level);
	return 0;
}

static int cmd_log_self_enable(const struct shell *shell,
			       size_t argc, char **argv)
{
	if (!shell_state_precheck(shell)) {
		return 0;
	}

	return log_enable(shell, shell->log_backend->backend, argc, argv);
}

static int cmd_log_backend_enable(const struct shell *shell,
				  size_t argc, char **argv)
{
	return shell_backend_cmd_execute(shell, argc, argv, log_enable);
}

static int log_disable(const struct shell *shell,
		       const struct log_backend *backend,
		       size_t argc,
		       char **argv)
{
	filters_set(shell, backend, argc - 1, &argv[1], LOG_LEVEL_NONE);
	return 0;
}

static int cmd_log_self_disable(const struct shell *shell,
				 size_t argc, char **argv)
{
	if (!shell_state_precheck(shell)) {
		return 0;
	}

	return log_disable(shell, shell->log_backend->backend, argc, argv);
}

static int cmd_log_backend_disable(const struct shell *shell,
				   size_t argc, char **argv)
{
	return shell_backend_cmd_execute(shell, argc, argv, log_disable);
}

static void module_name_get(size_t idx, struct shell_static_entry *entry);

SHELL_DYNAMIC_CMD_CREATE(dsub_module_name, module_name_get);

static void module_name_get(size_t idx, struct shell_static_entry *entry)
{
	entry->handler = NULL;
	entry->help  = NULL;
	entry->subcmd = &dsub_module_name;
	entry->syntax = log_source_name_get(CONFIG_LOG_DOMAIN_ID, idx);
}

static void severity_lvl_get(size_t idx, struct shell_static_entry *entry)
{
	entry->handler = NULL;
	entry->help  = NULL;
	entry->subcmd = &dsub_module_name;
	entry->syntax = (idx < ARRAY_SIZE(severity_lvls_sorted)) ?
					severity_lvls_sorted[idx] : NULL;
}

SHELL_DYNAMIC_CMD_CREATE(dsub_severity_lvl, severity_lvl_get);

static int log_halt(const struct shell *shell,
		    const struct log_backend *backend,
		    size_t argc,
		    char **argv)
{
	log_backend_deactivate(backend);
	return 0;
}

static int cmd_log_self_halt(const struct shell *shell,
			      size_t argc, char **argv)
{
	if (!shell_state_precheck(shell)) {
		return 0;
	}

	return log_halt(shell, shell->log_backend->backend, argc, argv);
}

static int cmd_log_backend_halt(const struct shell *shell,
				size_t argc, char **argv)
{
	return shell_backend_cmd_execute(shell, argc, argv, log_halt);
}

static int log_go(const struct shell *shell,
		  const struct log_backend *backend,
		  size_t argc,
		  char **argv)
{
	log_backend_activate(backend, backend->cb->ctx);
	return 0;
}

static int cmd_log_self_go(const struct shell *shell,
			   size_t argc, char **argv)
{
	if (!shell_state_precheck(shell)) {
		return 0;
	}

	return log_go(shell, shell->log_backend->backend, argc, argv);
}

static int cmd_log_backend_go(const struct shell *shell,
			      size_t argc, char **argv)
{
	return shell_backend_cmd_execute(shell, argc, argv, log_go);
}

static int cmd_log_backends_list(const struct shell *shell,
				 size_t argc, char **argv)
{
	int backend_count;

	backend_count = log_backend_count_get();

	for (int i = 0; i < backend_count; i++) {
		const struct log_backend *backend = log_backend_get(i);

		shell_fprintf(shell, SHELL_NORMAL,
			      "%s\r\n"
			      "\t- Status: %s\r\n"
			      "\t- ID: %d\r\n\r\n",
			      backend->name,
			      backend->cb->active ? "enabled" : "disabled",
			      backend->cb->id);

	}
	return 0;
}

static int cmd_log_strdup_utilization(const struct shell *shell,
				      size_t argc, char **argv)
{

	/* Defines needed when string duplication is disabled (LOG_IMMEDIATE is
	 * on). In that case, this function is not compiled in.
	 */
	#ifndef CONFIG_LOG_STRDUP_BUF_COUNT
	#define CONFIG_LOG_STRDUP_BUF_COUNT 0
	#endif

	#ifndef CONFIG_LOG_STRDUP_MAX_STRING
	#define CONFIG_LOG_STRDUP_MAX_STRING 0
	#endif

	u32_t buf_cnt = log_get_strdup_pool_utilization();
	u32_t buf_size = log_get_strdup_longest_string();
	u32_t percent = CONFIG_LOG_STRDUP_BUF_COUNT ?
			100 * buf_cnt / CONFIG_LOG_STRDUP_BUF_COUNT : 0;

	shell_print(shell,
		"Maximal utilization of the buffer pool: %d / %d (%d %%).",
		buf_cnt, CONFIG_LOG_STRDUP_BUF_COUNT, percent);
	if (buf_cnt == CONFIG_LOG_STRDUP_BUF_COUNT) {
		shell_warn(shell, "Buffer count too small.");
	}

	shell_print(shell,
		"Longest duplicated string: %d, buffer capacity: %d.",
		buf_size, CONFIG_LOG_STRDUP_MAX_STRING);
	if (buf_size > CONFIG_LOG_STRDUP_MAX_STRING) {
		shell_warn(shell, "Buffer size too small.");

	}

	return 0;
}

SHELL_STATIC_SUBCMD_SET_CREATE(sub_log_backend,
	SHELL_CMD_ARG(disable, &dsub_module_name,
		  "'log disable <module_0> .. <module_n>' disables logs in "
		  "specified modules (all if no modules specified).",
		  cmd_log_backend_disable, 2, 255),
	SHELL_CMD_ARG(enable, &dsub_severity_lvl,
		  "'log enable <level> <module_0> ...  <module_n>' enables logs"
		  " up to given level in specified modules (all if no modules "
		  "specified).",
		  cmd_log_backend_enable, 2, 255),
	SHELL_CMD(go, NULL, "Resume logging", cmd_log_backend_go),
	SHELL_CMD(halt, NULL, "Halt logging", cmd_log_backend_halt),
	SHELL_CMD(status, NULL, "Logger status", cmd_log_backend_status),
	SHELL_SUBCMD_SET_END
);

static void backend_name_get(size_t idx, struct shell_static_entry *entry)
{
	entry->handler = NULL;
	entry->help  = NULL;
	entry->subcmd = &sub_log_backend;
	entry->syntax  = NULL;

	if (idx < log_backend_count_get()) {
		const struct log_backend *backend = log_backend_get(idx);

		entry->syntax = backend->name;
	}
}

SHELL_DYNAMIC_CMD_CREATE(dsub_backend_name_dynamic, backend_name_get);

SHELL_STATIC_SUBCMD_SET_CREATE(sub_log_stat,
	SHELL_CMD(backend, &dsub_backend_name_dynamic,
			"Logger backends commands.", NULL),
	SHELL_CMD_ARG(disable, &dsub_module_name,
	"'log disable <module_0> .. <module_n>' disables logs in specified "
	"modules (all if no modules specified).",
	cmd_log_self_disable, 2, 255),
	SHELL_CMD_ARG(enable, &dsub_severity_lvl,
	"'log enable <level> <module_0> ...  <module_n>' enables logs up to"
	" given level in specified modules (all if no modules specified).",
	cmd_log_self_enable, 2, 255),
	SHELL_CMD(go, NULL, "Resume logging", cmd_log_self_go),
	SHELL_CMD(halt, NULL, "Halt logging", cmd_log_self_halt),
	SHELL_CMD_ARG(list_backends, NULL, "Lists logger backends.",
		      cmd_log_backends_list, 1, 0),
	SHELL_CMD(status, NULL, "Logger status", cmd_log_self_status),
	SHELL_COND_CMD_ARG(CONFIG_LOG_STRDUP_POOL_PROFILING, strdup_utilization,
			NULL, "Get utilization of string duplicates pool",
			cmd_log_strdup_utilization, 1, 0),
	SHELL_SUBCMD_SET_END
);

SHELL_CMD_REGISTER(log, &sub_log_stat, "Commands for controlling logger",
		   NULL);


text:
using System;
using System.Web;
using CollectionsOnline.WebSite.Extensions;
using Nancy;
using Serilog;

namespace CollectionsOnline.WebSite
{
    public class Global : HttpApplication
    {
        protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
        {
            Response.Headers.Remove("Server");
            Response.Headers.Remove("X-MiniProfiler-Ids");
        }

        protected void Application_Error(object sender, EventArgs e)
        {
            // Capture any errors occurring before the nancy pipeline
            var ex = Server.GetLastError();

            Log.Logger.Fatal(ex, "Unhandled Exception occured in System.Web pipeline {Url} {@HttpParams}", Request.Url, Request.RenderParams());

            Server.ClearError();

            Response.ContentType = "text/html";
            Response.StatusCode = (int)HttpStatusCode.InternalServerError;
            Response.TransmitFile(@"Views\Error\500.html");
        }
    }
}


text:
<?php

namespace Tracy;

use Tracy;

/**
 * Red BlueScreen.
 *
 * @author     David Grudl
 */
class BlueScreen
{
	/** @var string[] */
	public $info = array();

	/** @var callable[] */
	private $panels = array();

	/** @var string[] paths to be collapsed in stack trace (e.g. core libraries) */
	public $collapsePaths = array(__DIR__);

	/**
	 * Add custom panel.
	 * @param  callable
	 * @return self
	 */
	public function addPanel($panel)
	{
		if (!in_array($panel, $this->panels, TRUE)) {
			$this->panels[] = $panel;
		}
		return $this;
	}

	/**
	 * Renders blue screen.
	 * @param  \Exception
	 * @return void
	 */
	public function render(\Exception $exception)
	{
		$panels = $this->panels;
		$info = array_filter($this->info);
		require __DIR__ . '/templates/bluescreen.phtml';
	}

	/**
	 * Returns syntax highlighted source code.
	 * @param  string
	 * @param  int
	 * @param  int
	 * @return string
	 */
	public static function highlightFile($file, $line, $lines = 15, array $vars = NULL)
	{
		$source = @file_get_contents($file); // intentionally @
		if ($source) {
			$source = static::highlightPhp($source, $line, $lines, $vars);
			if ($editor = Helpers::editorUri($file, $line)) {
				$source = substr_replace($source, ' data-tracy-href="' . htmlspecialchars($editor) . '"', 4, 0);
			}
			return $source;
		}
	}

	/**
	 * Returns syntax highlighted source code.
	 * @param  string
	 * @param  int
	 * @param  int
	 * @return string
	 */
	public static function highlightPhp($source, $line, $lines = 15, array $vars = NULL)
	{
		if (function_exists('ini_set')) {
			ini_set('highlight.comment', '#998; font-style: italic');
			ini_set('highlight.default', '#000');
			ini_set('highlight.html', '#06B');
			ini_set('highlight.keyword', '#D24; font-weight: bold');
			ini_set('highlight.string', '#080');
		}

		$source = str_replace(array("\r\n", "\r"), "\n", $source);
		$source = explode("\n", highlight_string($source, TRUE));
		$out = $source[0]; //
		$source = str_replace('
', "\n", $source[1]);
		$out .= static::highlightLine($source, $line, $lines);

		if ($vars) {
			$out = preg_replace_callback('#">\$(\w+)( )?#', function($m) use ($vars) {
				return array_key_exists($m[1], $vars)
					? '" title="' . str_replace('"', '"', trim(strip_tags(Dumper::toHtml($vars[$m[1]])))) . $m[0]
					: $m[0];
			}, $out);
		}

		return "

$out

";
	}

	/**
	 * Returns highlighted line in HTML code.
	 * @return string
	 */
	public static function highlightLine($html, $line, $lines = 15)
	{
		$source = explode("\n", "\n" . str_replace("\r\n", "\n", $html));
		$out = '';
		$spans = 1;
		$start = $i = max(1, $line - floor($lines * 2/3));
		while (--$i >= 1) { // find last highlighted block
			if (preg_match('#.*(</?span[^>]*>)#', $source[$i], $m)) {
				if ($m[1] !== '') {
					$spans++;
					$out .= $m[1];
				}
				break;
			}
		}

		$source = array_slice($source, $start, $lines, TRUE);
		end($source);
		$numWidth = strlen((string) key($source));

		foreach ($source as $n => $s) {
			$spans += substr_count($s, '<span') - substr_count($s, '</span');
			$s = str_replace(array("\r", "\n"), array('', ''), $s);
			preg_match_all('#<[^>]+>#', $s, $tags);
			if ($n == $line) {
				$out .= sprintf(
					"%{$numWidth}s:    %s\n%s",
					$n,
					strip_tags($s),
					implode('', $tags[0])
				);
			} else {
				$out .= sprintf("%{$numWidth}s:    %s\n", $n, $s);
			}
		}
		$out .= str_repeat('', $spans) . '';
		return $out;
	}

	/**
	 * Should a file be collapsed in stack trace?
	 * @param  string
	 * @return bool
	 */
	public function isCollapsed($file)
	{
		foreach ($this->collapsePaths as $path) {
			if (strpos(strtr($file, '\\', '/'), strtr("$path/", '\\', '/')) === 0) {
				return TRUE;
			}
		}
		return FALSE;
	}

}


text:
(function () {
  const list = new App.List({
    containerSelector: '.list-container'
  });
  const lighters =  [
    new TrafficLighter('.traffic-lighter-wrapper'),
    new TrafficLighter('.traffic-lighter-wrapper-2'),
    new TrafficLighter('.traffic-lighter-wrapper-3')
  ];
  const controller = new LighterController('.controller-container', lighters);
})();


text:
package client

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func Test_Successful_NewRestClient(t *testing.T) {
	url := "http://127.0.0.1/test"
	space := "space"
	token := "token"

	client := NewRestClient(url, token, space)

	assert.Equal(t, client.Token, token)
	assert.Equal(t, client.Space, space)
	assert.Equal(t, client.TargetURL, url)
}

func Test_NewRestClient_WithBadToken(t *testing.T) {
	url := "http://127.0.0.1/test"
	space := "space"
	token := ""

	assert.Panics(t, func() {
		_ = NewRestClient(url, token, space)
	})
}


text:
require 'docpipe/command'

module Docpipe
  class PdfToText
    def initialize(command = Command.new, validator = TextLengthValidator.new)
      @command = command
      @validator = validator
    end

    def extract(page_number, pdf_path, output_path)
      @command.run('pdftotext -enc UTF-8 -f ? -l ? ? ?', page_number, page_number, pdf_path, output_path)
      @validator.valid?(output_path)
    end

    class TextLengthValidator
      MIN_TEXT_PER_PAGE = 100

      def valid?(path)
        File.read(path).length > MIN_TEXT_PER_PAGE
      end
    end
  end
end


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

package operations

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

import (
	"net/http"

	"github.com/go-openapi/runtime"

	"github.com/sapcc/kubernikus/pkg/api/models"
)

// GetClusterCredentialsOIDCOKCode is the HTTP code returned for type GetClusterCredentialsOIDCOK
const GetClusterCredentialsOIDCOKCode int = 200

/*
GetClusterCredentialsOIDCOK OK

swagger:response getClusterCredentialsOIdCOK
*/
type GetClusterCredentialsOIDCOK struct {

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

// NewGetClusterCredentialsOIDCOK creates GetClusterCredentialsOIDCOK with default headers values
func NewGetClusterCredentialsOIDCOK() *GetClusterCredentialsOIDCOK {

	return &GetClusterCredentialsOIDCOK{}
}

// WithPayload adds the payload to the get cluster credentials o Id c o k response
func (o *GetClusterCredentialsOIDCOK) WithPayload(payload *models.Credentials) *GetClusterCredentialsOIDCOK {
	o.Payload = payload
	return o
}

// SetPayload sets the payload to the get cluster credentials o Id c o k response
func (o *GetClusterCredentialsOIDCOK) SetPayload(payload *models.Credentials) {
	o.Payload = payload
}

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

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

/*
GetClusterCredentialsOIDCDefault Error

swagger:response getClusterCredentialsOIdCDefault
*/
type GetClusterCredentialsOIDCDefault struct {
	_statusCode int

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

// NewGetClusterCredentialsOIDCDefault creates GetClusterCredentialsOIDCDefault with default headers values
func NewGetClusterCredentialsOIDCDefault(code int) *GetClusterCredentialsOIDCDefault {
	if code <= 0 {
		code = 500
	}

	return &GetClusterCredentialsOIDCDefault{
		_statusCode: code,
	}
}

// WithStatusCode adds the status to the get cluster credentials o ID c default response
func (o *GetClusterCredentialsOIDCDefault) WithStatusCode(code int) *GetClusterCredentialsOIDCDefault {
	o._statusCode = code
	return o
}

// SetStatusCode sets the status to the get cluster credentials o ID c default response
func (o *GetClusterCredentialsOIDCDefault) SetStatusCode(code int) {
	o._statusCode = code
}

// WithPayload adds the payload to the get cluster credentials o ID c default response
func (o *GetClusterCredentialsOIDCDefault) WithPayload(payload *models.Error) *GetClusterCredentialsOIDCDefault {
	o.Payload = payload
	return o
}

// SetPayload sets the payload to the get cluster credentials o ID c default response
func (o *GetClusterCredentialsOIDCDefault) SetPayload(payload *models.Error) {
	o.Payload = payload
}

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

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


text:
<!DOCTYPE html>

	    <meta charset="UTF-8" />
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <title>Tobias Sernhede</title>
	    <link rel="icon" type="image/png" href="img/ts-favicon.png">
	    <link rel="stylesheet" href="css/style.css">

  				Tobias Sernhede

						circlelinkedin

						circlefacebook

						circlegithubalt

	  			Say Hello

Tobias Sernhede

Digital marketer by day, coder by night

About me

Since I started working in digital marketing I have always been interested how everything fits togehter and that is when I got passionated about coding. Thanks to this I have a better understanding how everything fits together and works "behind the scenes". But I have also enabled myself to create awesome things with code and unleash my creativity in a whole new way.

Portfolio

Some of the projects I have done

 Project

  										View Website

  										 View GitHub

Used in this project

  	<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">


text:
<?php

namespace line\core\util;

/**
 * 一个无重复元素的集合。
 * @class Set
 * @link  http://linephp.com
 * @author Alivop[alivop.liu@gmail.com]
 * @since 1.0
 * @see Collection
 * @see AbstractCollection
 * @see ArrayList
 * @package line\core\util
 */
class Set extends AbstractCollection
{
    private $set;
    private $size;

    /**
     * Constructs an empty Set collection.
     */
    public function __construct()
    {
        $this->set = array();
        $this->size = 0;
    }

    public function add($element)
    {
        if (!$this->contains($element)) {
            $this->set[$this->size] = $element;
            $this->size++;
        }
    }

    public function addAll(Collection $collection)
    {
        $iterator = $collection->iterator();
        while ($iterator->hasNext()) {
            $element = $iterator->next();
            $this->add($element);
        }
    }

    public function contains($obj)
    {
        $iterator = $this->iterator();
        while ($iterator->hasNext()) {
            $element = $iterator->next();
            if ($this->compare($obj, $element)) {
                return true;
            }
        }
        return false;
    }

    public function iterator()
    {
        return new ListIterator($this, $this->set);
    }

    public function size()
    {
        return $this->size;
    }

    public function sort()
    {
        return natsort($this->set);
    }

    public function toArray()
    {
        return $this->set;
    }

}


text:
Work in Progress LibGit2 bindings for Julia

Adapted from the Ruby's Rugged libgit bindings

[![Build Status](https://travis-ci.org/jakebolewski/LibGit2.jl.svg?branch=master)](https://travis-ci.org/jakebolewski/LibGit2.jl)
[![Build status](https://ci.appveyor.com/api/projects/status/t2pfbamvrps6v53t)](https://ci.appveyor.com/project/jakebolewski/libgit2-jl)
[![Coverage Status](https://img.shields.io/coveralls/jakebolewski/LibGit2.jl.svg)](https://coveralls.io/r/jakebolewski/LibGit2.jl)

## Installation / Testing
LibGit2.jl is tested against the latest release version of
libgit2 (v0.21.3).  To build libgit2 from source you need CMake.  See the
specific build instructions in libgit2's [README](https://github.com/libgit2/libgit2#building-libgit2---using-cmake).

To install and build the package, simply clone the latest master snapshot of the package:

```julia
Pkg.clone("LibGit2")
Pkg.build("LibGit2")
```

The test suite can then be run with:

```julia
Pkg.test("LibGit2")
```


text:
<?php

/**
 * Manager Class de la tabla personal
 */
class personal {

  /**
   * Llave Principal y campo autoincrementable de la tabla Personal
   * @var integer
   */
  private $id;

  /**
   * Numero de Identificacion del Personal (C.C / T.I)
   * @var string
   */
  private $identificacion;
  private $identificacionAprendiz;
  private $idTipoPersona;
  private $foto;
  private $nombre;
  private $apellidos;
  private $genero;
  private $ficha;
  private $celFamiliar;

  private $create_at;
  private $update_at;
  private $delete_at;

  /**
   * Obtiene el ID del registro
   * @return Integer
   */
  public function getId() {
    return $this->id;
  }

  /**
   * Obtiene la identificacion de la persona
   * @return string
   */

  public function getIdentificacion() {
    return $this->identificacion;
  }

  /**
   * Obtiene el NIS  del Aprendiz
   * @return integer
   */
  public function getIdentificacionAprendiz() {
    return $this->identificacionAprendiz;
  }

  /**
   * Obtiene el tipo de Persona el cual se registra
   * @return integer
   */
  public function getIdTipoPersona() {
    return $this->idTipoPersona;
  }

  /**
   * Obtiene la foto de la persona
   * @return string
   */
  public function getFoto() {
    return $this->foto;
  }

  /**
   * Obtiene el nombre de la persona
   * @return string
   */
  public function getNombre() {
    return $this->nombre;
  }

  /**
   * Obtiene el apellido de la persona
   * @return string
   */
  public function getApellidos() {
    return $this->apellidos;
  }

  /**
   * Obtiene un booleano (true=Femenino; false=Masculino )
   * @return boolean
   */
  public function getGenero() {
    return $this->genero;
  }

  /**
   * Obtiene la ficha de formacion a quien pertenece el estudiante
   * @return string
   */
  public function getFicha() {
    return $this->ficha;
  }

  /**
   * Obtiene el numero de celular de un familiar de la persona
   * @return string
   */
  public function getCelFamiliar() {
    return $this->celFamiliar;
  }

  /**
   * Obtiene la fecha de cuando se creo el registro
   * @return string
   */
  public function getCreateAt() {
    return $this->create_at;
  }

  /**
   * Obtiene la fecha de cuando se actualizo el registro
   * @return string
   */
  public function getUpdateAt() {
    return $this->update_at;
  }

  /**
   * Obtiene la fecha de cuando se elimino el registro
   * @return string
   */
  public function getDeleteAt() {
    return $this->delete_at;
  }

  /**
   * Setea el ID del registro
   * @param Integer $id
   */
  public function setId($id) {
    $this->id = $id;
  }

  /**
   * Setea el numero de informacion de la persona
   * @param string
   */
  public function setIdentificacion($identificacion) {
    $this->identificacion = $identificacion;
  }

  /**
   * Setea el numero del NIS del aprendiz
   * @param integer
   */
  public function setIdentificacionAprendiz($identificacionAprendiz) {
    $this->identificacionAprendiz = $identificacionAprendiz;
  }

  /**
   * Setea numero del tipo de Persona el cual se registra
   * @param Integer
   */
  public function setIdTipoPersona($idTipoPersona) {
    $this->idTipoPersona = $idTipoPersona;
  }

  /**
   * Setea la direccion fisica de donde se encuentra la foto de la persona
   * @param string
   */
  public function setFoto($foto) {
    $this->foto = $foto;
  }

  /**
   * Setea el nombre de la persona
   * @param string
   */
  public function setNombre($nombre) {
    $this->nombre = $nombre;
  }

  /**
   * Setea el apellido de la persona
   * @param string
   */
  public function setApellidos($apellidos) {
    $this->apellidos = $apellidos;
  }

  /**
   * Setea un booleano (true=Femenino; false=Masculino )
   * @param boolean
   */
  public function setGenero($genero) {
    $this->genero = $genero;
  }

  /**
   * Setea el numero de la ficha de la formacion de donde pertenese la persona
   * @param string
   */
  public function setFicha($ficha) {
    $this->ficha = $ficha;
  }

  /**
   * Setea el numero del telefono de un familiar de la persona
   * @param string
   */
  public function setCelFamiliar($celFamiliar) {
    $this->celFamiliar = $celFamiliar;
  }

  /**
   * Setea la fecha de cuando se crea(en el momento) el registro
   * @param string
   */
  public function setCreateAt($create_at) {
    $this->create_at = $create_at;
  }

  /**
   * Setea la fecha del momento de actualizar el registro
   * @param string
   */
  public function setUpdateAt($update_at) {
    $this->update_at = $update_at;
  }

  /**
   * Setea la fecha del momento cuando se elimina el registro
   * @param string
   */
  public function setDeleteAt($delete_at) {
    $this->delete_at = $delete_at;
  }

}


text:
from __future__ import division, absolute_import, print_function
from future.builtins import super

from iris_sdk.models.base_resource import BaseResource
from iris_sdk.models.data.order_response import OrderResponseData

XPATH_ORDER_RESPONSE = "/{}"

class OrderResponse(BaseResource, OrderResponseData):

    """Telephone numbers order response"""

    _xpath = XPATH_ORDER_RESPONSE

    @property
    def id(self):
        return self.order.order_id
    @id.setter
    def id(self, order_id):
        self.order.order_id = order_id

    @property
    def order(self):
        return self._order
    @order.setter
    def order(self, order):
        self._order = order

    def __init__(self, parent=None, client=None):
        super().__init__(parent, client)
        OrderResponseData.__init__(self)

    def get(self, id=None, params=None):
        return self._get_data((id or self.id), params=params)


text:
Another simple http server for serving static resources.

## Install
```npm
npm install augustine -g
```

## Run
Enter your web content root directory, and run:
```text
augustine
```
will listen on defaut port *8080*, or you can specify a customize port or host, run:
```text
augustine --port yourPort --host yourAddress
```

Enjoy it!

or feedback!

## Reference
* RFC2616 https://tools.ietf.org/pdf/rfc2616.pdf
* RFC6455 https://tools.ietf.org/pdf/rfc6455.pdf


text:
<?php

namespace Koenvu\FormTests\Components;

use PHPUnit_Framework_TestCase;
use Koenvu\Forms\Components\Elementary;
use Koenvu\Forms\Contracts\FormElement;

class MirrorTest extends PHPUnit_Framework_TestCase
{
    public function testMirroring()
    {
        $mirror = $this->getMockForAbstractClass('Koenvu\FormTests\Stubs\TestableMirror');

        $mirror->setMirrorOptions([
            'a' => 'sub.b',
            'b' => [
                'c',
                'd',
                'e'
            ]
        ]);
        $mirror->set('a', 'Some value');
        $mirror->set('b', 'Different');
        $mirror->set('c', 'Unchanged');

        $mirror->mirrorOptions();

        $this->assertEquals('Some value', $mirror->get('sub.b'));
        $this->assertEquals('Unchanged', $mirror->get('c'));
        $this->assertEquals('Different', $mirror->get('d'));
        $this->assertEquals('Different', $mirror->get('e'));
    }

    /**
     * @expectedException Koenvu\Forms\Components\Exceptions\MirrorException
     */
    public function testThrowingException()
    {
        $mirror = $this->getMockForTrait('Koenvu\Forms\Components\Mirror');
        $mirror->mirrorOptions([]);
    }
}