text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">

    <item
        android:id="@+id/action_share"
        myapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"
        myapp:showAsAction="never"
        android:title="Share"/>

    <item
        android:id="@+id/action_search"
        android:icon="@drawable/ic_search"
        android:title="@string/action_search"
        android:textColor="@color/io15_white"
        myapp:actionViewClass="android.support.v7.widget.SearchView"
        myapp:showAsAction="ifRoom" />

    <item android:id="@+id/action_bookmark"
        android:title="@string/action_boookmark"
        myapp:showAsAction="ifRoom" />
</menu>

redpajama_set_name: RedPajamaGithub


text:
package org.keycloak.adapters.elytron;

import org.jboss.logging.Logger;
import org.keycloak.adapters.AdapterDeploymentContext;
import org.keycloak.adapters.AuthenticatedActionsHandler;
import org.keycloak.adapters.KeycloakDeployment;
import org.keycloak.adapters.NodesRegistrationManagement;
import org.keycloak.adapters.PreAuthActionsHandler;
import org.keycloak.adapters.RequestAuthenticator;
import org.keycloak.adapters.spi.AuthChallenge;
import org.keycloak.adapters.spi.AuthOutcome;
import org.keycloak.adapters.spi.UserSessionManagement;
import org.wildfly.security.http.HttpAuthenticationException;
import org.wildfly.security.http.HttpScope;
import org.wildfly.security.http.HttpServerAuthenticationMechanism;
import org.wildfly.security.http.HttpServerRequest;
import org.wildfly.security.http.Scope;

import javax.security.auth.callback.CallbackHandler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author Pedro Igor
 */
class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticationMechanism {

    static Logger LOGGER = Logger.getLogger(KeycloakHttpServerAuthenticationMechanismFactory.class);
    static final String NAME = "KEYCLOAK";

    private final Map<String, ?> properties;
    private final CallbackHandler callbackHandler;
    private final AdapterDeploymentContext deploymentContext;

    public KeycloakHttpServerAuthenticationMechanism(Map<String, ?> properties, CallbackHandler callbackHandler, AdapterDeploymentContext deploymentContext) {
        this.properties = properties;
        this.callbackHandler = callbackHandler;
        this.deploymentContext = deploymentContext;
    }

    @Override
    public String getMechanismName() {
        return NAME;
    }

    @Override
    public void evaluateRequest(HttpServerRequest request) throws HttpAuthenticationException {
        LOGGER.debugf("Evaluating request for path [%s]", request.getRequestURI());
        AdapterDeploymentContext deploymentContext = getDeploymentContext(request);
        ElytronHttpFacade httpFacade = new ElytronHttpFacade(request, deploymentContext, callbackHandler);

        if (preActions(httpFacade, deploymentContext)) {
            LOGGER.debugf("Pre-actions has aborted the evaluation of [%s]", request.getRequestURI());
            return;
        }

        KeycloakDeployment deployment = httpFacade.getDeployment();

        if (!deployment.isConfigured()) {
            request.noAuthenticationInProgress();
            return;
        }

        RequestAuthenticator authenticator = createRequestAuthenticator(request, httpFacade, deployment);
        AuthOutcome outcome = authenticator.authenticate();

        if (AuthOutcome.AUTHENTICATED.equals(outcome)) {
            new AuthenticatedActionsHandler(deployment, httpFacade).handledRequest();
            return;
        }

        AuthChallenge challenge = authenticator.getChallenge();

        if (challenge != null) {
            httpFacade.authenticationInProgress(challenge);
            return;
        }

        if (AuthOutcome.FAILED.equals(outcome)) {
            httpFacade.getResponse().setStatus(403);
            httpFacade.authenticationFailed();
            return;
        }

        request.noAuthenticationInProgress();
    }

    private ElytronRequestAuthenticator createRequestAuthenticator(HttpServerRequest request, ElytronHttpFacade httpFacade, KeycloakDeployment deployment) {
        return new ElytronRequestAuthenticator(this.callbackHandler, httpFacade, deployment, getConfidentialPort(request));
    }

    private AdapterDeploymentContext getDeploymentContext(HttpServerRequest request) {
        if (this.deploymentContext == null) {
            return (AdapterDeploymentContext) request.getScope(Scope.APPLICATION).getAttachment(AdapterDeploymentContext.class.getName());
        }

        return this.deploymentContext;
    }

    private boolean preActions(ElytronHttpFacade httpFacade, AdapterDeploymentContext deploymentContext) {
        NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();

        nodesRegistrationManagement.tryRegister(httpFacade.getDeployment());

        PreAuthActionsHandler preActions = new PreAuthActionsHandler(new UserSessionManagement() {
            @Override
            public void logoutAll() {
                Collection<String> sessions = httpFacade.getScopeIds(Scope.SESSION);
                logoutHttpSessions(new ArrayList<>(sessions));
            }

            @Override
            public void logoutHttpSessions(List<String> ids) {
                for (String id : ids) {
                    HttpScope session = httpFacade.getScope(Scope.SESSION, id);

                    if (session != null) {
                        session.invalidate();
                    }
                }

            }
        }, deploymentContext, httpFacade);

        return preActions.handleRequest();
    }

    // TODO: obtain confidential port from Elytron
    private int getConfidentialPort(HttpServerRequest request) {
        return 8443;
    }
}


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.ComponentModel;

namespace osu.Game.Screens.Select.Leaderboards
{
    public enum BeatmapLeaderboardScope
    {
        [Description("Local Ranking")]
        Local,

        [Description("Country Ranking")]
        Country,

        [Description("Global Ranking")]
        Global,

        [Description("Friend Ranking")]
        Friend,
    }
}


text:
package rottentomatoes

import (
	"encoding/json"
	"strconv"
	"strings"
)

type MovieListsResponse struct {
	Total        int        `json:"total,omitempty"`
	Movies       []Movie    `json:"movies,omitempty"`
	Links        MovieLinks `json:"links,omitempty"`
	LinkTemplate string     `json:"link_template,omitempty"`
}

type Movie struct {
	Id                Id           `json:"id,omitempty"`
	Title             string       `json:"title,omitempty"`
	Year              IntWrapper   `json:"year,omitempty"`
	Genres            []string     `json:"genres,omitempty"`
	MPAA_Rating       string       `json:"mpaa_rating,omitempty"`
	Runtime           IntWrapper   `json:"runtime,omitempty"`
	CriticsConsensus  string       `json:"critics_consensus,omitempty"`
	ReleaseDates      ReleaseDates `json:"release_dates,omitempty"`
	Ratings           Ratings      `json:"ratings,omitempty"`
	Synopsis          string       `json:"synopsis,omitempty"`
	Posters           Posters      `json:"posters,omitempty"`
	AbridgedCast      []Cast       `json:"abridged_cast,omitempty"`
	AbridgedDirectors []Director   `json:"abridged_directors,omitempty"`
	Studio            string       `json:"studio,omitempty"`
	AlternateIds      AlternateIds `json:"alternate_ids,omitempty"`
	Links             MovieLinks   `json:"links,omitempty"`
	LinkTemplate      string       `json:"link_template,omitempty"`
}

// The Rotten Tomatoes API sends an empty string if the field is missing rather than omitting it.
type IntWrapper int64

func (i *IntWrapper) UnmarshalJSON(b []byte) (err error) {
	var s string
	err = json.Unmarshal(b, &s)
	if err == nil {
		*i = IntWrapper(0)
		return
	}
	var n int
	err = json.Unmarshal(b, &n)
	if err == nil {
		*i = IntWrapper(n)
	}
	return
}

type Id int64

func (i *Id) UnmarshalJSON(b []byte) (err error) {
	if n, err := strconv.Atoi(strings.Trim(string(b), `"`)); err == nil {
		*i = Id(n)
	}
	return err
}

type ReleaseDates struct {
	Theater string `json:"theater,omitempty"`
	DVD     string `json:"dvd,omitempty"`
}

type Ratings struct {
	CriticsRating  string `json:"critics_rating,omitempty"`
	CriticsScore   int    `json:"critics_score,omitempty"`
	AudienceRating string `json:"audience_rating,omitempty"`
	AudienceScore  int    `json:"audience_score,omitempty"`
}

type Posters struct {
	Thumbnail string `json:"thumbnail,omitempty"`
	Profile   string `json:"Profile,omitempty"`
	Detailed  string `json:"Detailed,omitempty"`
	Original  string `json:"original,omitempty"`
}

type Director struct {
	Name string `json:"name,omitempty"`
}

type AlternateIds struct {
	IMDB Id `json:"imdb,omitempty"`
}

type MovieLinks struct {
	Self      string `json:"self,omitempty"`
	Alternate string `json:"alternate,omitempty"`
	Cast      string `json:"cast,omitempty"`
	Clips     string `json:"clips,omitempty"`
	Reviews   string `json:"reviews,omitempty"`
	Similar   string `json:"similar,omitempty"`
	Canonical string `json:"canonical,omitempty"`
}

type MovieListsService struct {
	client *Client
}

// Returns Top Box Office Earning Movies, Sorted by Most Recent Weekend Gross Ticket Sales.
// Available options: Limit, Country.
func (m *MovieListsService) BoxOffice(opt *Options) (*MovieListsResponse, error) {
	rel := "lists/movies/box_office.json?"
	resp := new(MovieListsResponse)
	_, err := m.client.get(rel, opt, resp)
	return resp, err
}

// Returns movies currently in theaters.
// Available options: PageLimit, Page, Country.
func (m *MovieListsService) InTheaters(opt *Options) (*MovieListsResponse, error) {
	rel := "lists/movies/in_theaters.json?"
	resp := new(MovieListsResponse)
	_, err := m.client.get(rel, opt, resp)
	return resp, err
}

// Returns current opening movies.
// Available options: Limit, Country.
func (m *MovieListsService) OpeningMovies(opt *Options) (*MovieListsResponse, error) {
	rel := "lists/movies/opening.json?"
	resp := new(MovieListsResponse)
	_, err := m.client.get(rel, opt, resp)
	return resp, err
}

// Returns upcoming movies. Results are paginated if they go past the specified page limit.
// Available options: PageLimit, Page, Country.
func (m *MovieListsService) UpcomingMovies(opt *Options) (*MovieListsResponse, error) {
	rel := "lists/movies/upcoming.json?"
	resp := new(MovieListsResponse)
	_, err := m.client.get(rel, opt, resp)
	return resp, err
}


text:
package common

import (
	"github.com/stellar/go/support/log"
)

const StellarAmountPrecision = 7

func CreateLogger(serviceName string) *log.Entry {
	return log.DefaultLogger.WithField("service", serviceName)
}


text:
module load  lammps
mpiexec -n $NSLOTS lmp_mpi  < system.in


text:
import React from 'react';
var Component = React.Component;

module.exports = {
    createFile: function () {

    },
    deleteFile: function () {

    }
};

export function foo () {

}

export function baz () {

}

export class MyComponent extends React.Component {

}

export class MySecondComponent extends Component {
    constructor(props) {
        super(props);
        this.state = {foo: 1};
    }
    componentDidMount() {

    }
    render () {
        return

;
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>FireCards</title>
        <meta name="description" content="">
        <meta name="HandheldFriendly" content="True">
        <meta name="MobileOptimized" content="320">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, target-densitydpi=device-dpi" />
        <meta http-equiv="cleartype" content="on">

        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/img/touch/apple-touch-icon-144x144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/img/touch/apple-touch-icon-114x114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/img/touch/apple-touch-icon-72x72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="assets/img/touch/apple-touch-icon-57x57-precomposed.png">
        <link rel="shortcut icon" href="img/touch/apple-touch-icon.png">

        <meta name="msapplication-TileImage" content="assets/img/touch/apple-touch-icon-144x144-precomposed.png">
        <meta name="msapplication-TileColor" content="#222222">

        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-title" content="">

        <link rel="stylesheet" href="assets/css/normalize.css">
        <link rel="stylesheet" href="assets/css/main.css">
        <link rel="stylesheet" href="assets/css/vendor/jquery.mobile-1.3.1.min.css">
        <link rel="stylesheet" href="assets/css/vendor/iosSlider.css">
        <link rel="stylesheet" href="assets/css/layout.css">

FireCards - Flashcards

Select Subject

                               Boys

                               Girls

FireCards

Boys

                Home

I am a ginger

Jake Toolson

I am tall

Abraham Lincoln

Young Kid

Travis

Girls

                Home

I'm a readhead

Kaitlyn

Our current President

Barack Obama.


text:
namespace Xilium.CefGlue
{
    using System;
    using Xilium.CefGlue.Interop;

    public sealed class CefKeyEvent
    {
        private CefKeyEventType _type;
        private CefEventFlags _modifiers;
        private int _windowsKeyCode;
        private int _nativeKeyCode;
        private bool _isSystemKey;
        private char _character;
        private char _unmodifiedCharacter;
        private bool _focusOnEditableField;

        public CefKeyEvent()
        {
        }

        /// <summary>
        /// The type of keyboard event.
        /// </summary>
        public CefKeyEventType EventType
        {
            get { return _type; }
            set { _type = value; }
        }

        /// <summary>
        /// Bit flags describing any pressed modifier keys. See
        /// cef_event_flags_t for values.
        /// </summary>
        public CefEventFlags Modifiers
        {
            get { return _modifiers; }
            set { _modifiers = value; }
        }

        /// <summary>
        /// The Windows key code for the key event. This value is used by the DOM
        /// specification. Sometimes it comes directly from the event (i.e. on
        /// Windows) and sometimes it's determined using a mapping function. See
        /// WebCore/platform/chromium/KeyboardCodes.h for the list of values.
        /// </summary>
        public int WindowsKeyCode
        {
            get { return _windowsKeyCode; }
            set { _windowsKeyCode = value; }
        }

        /// <summary>
        /// The actual key code genenerated by the platform.
        /// </summary>
        public int NativeKeyCode
        {
            get { return _nativeKeyCode; }
            set { _nativeKeyCode = value; }
        }

        /// <summary>
        /// Indicates whether the event is considered a "system key" event (see
        /// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).
        /// This value will always be false on non-Windows platforms.
        /// </summary>
        public bool IsSystemKey
        {
            get { return _isSystemKey; }
            set { _isSystemKey = value; }
        }

        /// <summary>
        /// The character generated by the keystroke.
        /// </summary>
        public char Character
        {
            get { return _character; }
            set { _character = value; }
        }

        /// <summary>
        /// Same as |character| but unmodified by any concurrently-held modifiers
        /// (except shift). This is useful for working out shortcut keys.
        /// </summary>
        public char UnmodifiedCharacter
        {
            get { return _unmodifiedCharacter; }
            set { _unmodifiedCharacter = value; }
        }

        /// <summary>
        /// True if the focus is currently on an editable field on the page. This is
        /// useful for determining if standard key events should be intercepted.
        /// </summary>
        public bool FocusOnEditableField
        {
            get { return _focusOnEditableField; }
            set { _focusOnEditableField = value; }
        }

        #region Interop

        internal static unsafe CefKeyEvent FromNative(cef_key_event_t* ptr)
        {
            if (ptr == null) throw new ArgumentNullException("ptr");

            return new CefKeyEvent
            {
                EventType = ptr->type,
                Modifiers = ptr->modifiers,
                WindowsKeyCode = ptr->windows_key_code,
                NativeKeyCode = ptr->native_key_code,
                IsSystemKey = ptr->is_system_key,
                Character = (char)ptr->character,
                UnmodifiedCharacter = (char)ptr->unmodified_character,
                FocusOnEditableField = ptr->focus_on_editable_field,
            };
        }

        internal unsafe void ToNative(cef_key_event_t* ptr)
        {
            if (ptr == null) throw new ArgumentNullException("ptr");

            ptr->type = EventType;
            ptr->modifiers = Modifiers;
            ptr->windows_key_code = WindowsKeyCode;
            ptr->native_key_code = NativeKeyCode;
            ptr->is_system_key = IsSystemKey;
            ptr->character = Character;
            ptr->unmodified_character = UnmodifiedCharacter;
            ptr->focus_on_editable_field = FocusOnEditableField;
        }

        #endregion
    }
}


text:
title: "Safely upgrade the Istio control plane with revisions and tags"
description: Learn how to perform canary upgrades of your mesh control plane.
publishdate: 2021-05-26
attribution: "Christian Posta (Solo.io), Lin Sun (Solo.io), Sam Naser (Google)"
keywords: [upgrades,revisions,operations,canary]
---

Like all security software, your service mesh should be kept up-to-date. The Istio community [releases new versions every quarter](/docs/releases/supported-releases/), with regular patch releases for bug fixes [and security vulnerabilities](/blog/2021/patch-tuesdays/). The operator of a service mesh will need to upgrade the control plane and data plane components many times. You must take care when upgrading, as a mistake could affect your business traffic. Istio has many mechanisms to make it safe to perform upgrades in a controlled manner, and in Istio 1.10 we further improve this operational experience.

## Background

[In Istio 1.6](/news/releases/1.6.x/announcing-1.6/change-notes/), we added [basic support for upgrading the service mesh following a canary pattern using revisions](/blog/2020/multiple-control-planes/). Using this approach, you can run multiple control planes side-by-side without impacting an existing deployment and slowly migrate workloads from the old control plane to the new.

To support this revision-based upgrade, Istio introduced a `istio.io/rev` label for namespaces. This indicates which control plane revision should inject sidecar proxies for the workloads in the respective namespace. For example, a label of `istio.io/rev=1-9-5` indicates the control plane revision `1-9-5` should inject the data plane using proxies for `1-9-5` for workloads in that namespace.

If you wanted to upgrade the data-plane proxies for a particular namespace, you would update the `istio.io/rev` label to point to a new version, such as `istio.io/rev=1-10-0`. Manually changing (or even trying to orchestrate) changes of labels across a large number of namespaces can be error-prone and lead to unintended downtime.

## Introducing Revision Tags

[In Istio 1.10](/news/releases/1.10.x/announcing-1.10/), we've improved revision-based upgrades with a new feature called _[revision tags](/docs/setup/upgrade/canary/#stable-revision-labels-experimental)_. A revision tag reduces the number of changes an operator has to make to use revisions, and safely upgrade an Istio control plane. You use the tag as the label for your namespaces, and assign a revision to that tag. This means you don't have to change the labels on a namespace while upgrading, and minimizes the number of manual steps and configuration changes.

For example, you can define a tag named `prod-stable` and point it to the `1-9-5` revision of a control plane. You can also define another tag named `prod-canary` which points to the `1-10-0` revision. You may have a lot of important namespaces in your cluster, and you can label those namespaces with `istio.io/rev=prod-stable`. In other namespaces you may be willing to test the new version of Istio, and you can label that namespace `istio.io/rev=prod-canary`. The tag will indirectly associate those namespaces with the `1-9-5` revision for `prod-stable` and `1-10-0` for `prod-canary` respectively.

{{< image link="./tags.png" caption="Stable revision tags" >}}

Once you've determined the new control plane is suitable for the rest of the `prod-stable` namespaces, you can change the tag to point to the new revision. This enables you to update all the namespaces labeled `prod-stable` to the new `1-10-0` revision without making any changes to the labels on the namespaces. You will need to restart the workloads in a namespace once you've changed the tag to point to a different revision.

{{< image link="./tags-updated.png" caption="Updated revision tags" >}}

Once you're satisfied with the upgrade to the new control-plane revision, you can remove the old control plane.

## Stable revision tags in action

To create a new `prod-stable` tag for a revision `1-9-5`, run the following command:

{{< text bash >}}
$ istioctl x revision tag set prod-stable --revision 1-9-5
{{< /text >}}

You can then label your namespaces with the `istio.io/rev=prod-stable` label. Note, if you installed a `default` revision (i.e., no revision) of Istio, you will first have to remove the standard injection label:

{{< text bash >}}
$ kubectl label ns istioinaction istio-injection-
$ kubectl label ns istioinaction istio.io/rev=prod-stable
{{< /text >}}

You can list the tags in your mesh with the following:

{{< text bash >}}
$ istioctl x revision tag list

TAG         REVISION NAMESPACES
prod-stable 1-9-5    istioinaction
{{< /text >}}

A tag is implemented with a `MutatingWebhookConfiguration`. You can verify a corresponding `MutatingWebhookConfiguration` has been created:

{{< text bash >}}
$ kubectl get MutatingWebhookConfiguration

NAME                             WEBHOOKS   AGE
istio-revision-tag-prod-stable   2          75s
istio-sidecar-injector           1          5m32s
{{< /text >}}

Let's say you are trying to canary a new revision of the control plane based on 1.10.0. First you would install the new version using a revision:

{{< text bash >}}
$ istioctl install -y --set profile=minimal --revision 1-10-0
{{< /text >}}

You can create a new tag called `prod-canary` and point that to your `1-10-0` revision:

{{< text bash >}}
$ istioctl x revision tag set prod-canary --revision 1-10-0
{{< /text >}}

Then label your namespaces accordingly:

{{< text bash >}}
$ kubectl label ns istioinaction-canary istio.io/rev=prod-canary
{{< /text >}}

If you list out the tags in your mesh, you will see two stable tags pointing to two different revisions:

{{< text bash >}}
$ istioctl x revision tag list

TAG         REVISION NAMESPACES
prod-stable 1-9-5    istioinaction
prod-canary 1-10-0   istioinaction-canary
{{< /text >}}

Any of the namespaces that you have labeled with `istio.io/rev=prod-canary` will be injected by the control plane that corresponds to the `prod-canary` stable tag name (which in this example points to the `1-10-0` revision). When you're ready, you can switch the `prod-stable` tag to the new control plane with:

{{< text bash >}}
$ istioctl x revision tag set prod-stable --revision 1-10-0 --overwrite
{{< /text >}}

Any time you switch a tag to point to a new revision, you will need to restart the workloads in any respective namespace to pick up the new revision's proxy.

When both the `prod-stable` and `prod-canary` no longer point to the old revision, it may be safe to remove the old revision as follows:

{{< text bash >}}
$ istioctl x uninstall --revision 1-9-5
{{< /text >}}

## Wrapping up

Using revisions makes it safer to canary changes to an Istio control plane. In large environments with lots of namespaces, you may prefer to use stable tags, as we've introduced in this blog, to remove the number of moving pieces and simplify any automation you may build around updating an Istio control plane. Please check out the [1.10 release](/news/releases/1.10.x/announcing-1.10/) [and the new tag feature](/docs/setup/upgrade/canary/#stable-revision-labels-experimental) and give us your feedback!


text:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ngengs.android.cekinote.detailgame.history.HistoryGameFragment">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/activity_vertical_margin"
                android:text="@string/title_score"
                android:textSize="@dimen/text_size_small" />

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/activity_vertical_margin_small"
                android:background="#FFF"
                app:elevation="1dp"
                card_view:cardCornerRadius="0.1dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FFF"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="@dimen/activity_vertical_margin_small"
                        android:weightSum="9">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="1"
                            android:text="@string/text_number_abstract"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/name_game_history_player1"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:text="@string/text_player"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/name_game_history_player2"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:text="@string/text_player"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/name_game_history_player3"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:text="@string/text_player"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/name_game_history_player4"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:text="@string/text_player"
                            android:textAlignment="center"
                            android:textStyle="bold" />
                    </LinearLayout>

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/history_game_list"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="@dimen/activity_vertical_margin_small"
                        android:weightSum="9">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="1"
                            android:text="@string/text_total"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/score_game_history_player1"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/score_game_history_player2"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/score_game_history_player3"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:textAlignment="center"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/score_game_history_player4"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="2"
                            android:textAlignment="center"
                            android:textStyle="bold" />
                    </LinearLayout>
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>


text:
set -euo pipefail
# unofficial bash 'strict mode'
IFS=$'\n\t'

BACKUP_FILE="bblinder_backup-$(date +%F).tar.gz"
BACKUP_DIR="$HOME/BackUps"
FILE_TO_ENCRYPT="$BACKUP_DIR/$BACKUP_FILE"

cd /tmp/ && echo "Compressing..."

DEAL_WITH_IT(){
	echo -n "( •_•)"
	sleep .75
	echo -n -e "\r( •_•)>⌐■-■"
	sleep .75
	echo -n -e "\r               "
	echo  -e "\r(⌐■_■)"
	sleep .5
}

COMPRESS(){
    tar -cpzf "$BACKUP_FILE" ~/Documents ~/Downloads ~/.gnupg\
	    ~/.irssi ~/Pictures ~/.ssh ~/.bashrc\
	    ~/.zshrc ~/Videos /etc/vim/vimrc ~/.config/terminator/config || return 1
}

COMPRESS # just adding a comment, since this looks lonely sitting here by itself.

if [[ COMPRESS ]] ; then
	mv /tmp/"$BACKUP_FILE" "$BACKUP_DIR"
	echo "All done. File size is $(du -sh "$BACKUP_DIR"/"$BACKUP_FILE" \
		| awk '{ print $1 }')"
else
	echo "Compression Failed."
fi

ENCRYPT(){
	if [[ "$FILE_TO_ENCRYPT" ]] ; then
		echo "Encrypting... standby..."
		sudo gpg "$FILE_TO_ENCRYPT" || return 1 # Can also use 'gpg --symmetric' to utilize password instead of keys.
	fi
}

ENCRYPT

if [[ ENCRYPT ]] ; then
	DEAL_WITH_IT
	echo "Encryption done... ready for transfer."
	rm "$FILE_TO_ENCRYPT"
else
	echo "Encryption failed."
fi


text:
package org.apache.maven.plugin.dependency.fromDependencies;

import org.apache.maven.plugins.annotations.Parameter;

import java.io.File;

/**
 * Abstract Parent class used by mojos that get Artifact information from the
 * project dependencies.
 *
 * @author Brian Fox
 * @version $Id$
 */
public abstract class AbstractFromDependenciesMojo
    extends AbstractDependencyFilterMojo
{
    /**
     * Output location.
     *
     * @since 1.0
     */
    @Parameter( property = "outputDirectory", defaultValue = "${project.build.directory}/dependency" )
    protected File outputDirectory;

    /**
     * Strip artifact version during copy
     */
    @Parameter( property = "mdep.stripVersion", defaultValue = "false" )
    protected boolean stripVersion = false;

    /**
     * Strip artifact classifier during copy
     */
    @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
    protected boolean stripClassifier = false;

    /**
     * Place each artifact in the same directory layout as a default repository.
     *
example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
     *
     * @since 2.0-alpha-2
     */
    @Parameter( property = "mdep.useRepositoryLayout", defaultValue = "false" )
    protected boolean useRepositoryLayout;

    /**
     * Place each type of file in a separate subdirectory. (example
     * /outputDirectory/runtime /outputDirectory/provided etc)
     *
     * @since 2.2
     */
    @Parameter( property = "mdep.useSubDirectoryPerScope", defaultValue = "false" )
    protected boolean useSubDirectoryPerScope;

    /**
     * Place each type of file in a separate subdirectory. (example
     * /outputDirectory/jars /outputDirectory/wars etc)
     *
     * @since 2.0-alpha-1
     */
    @Parameter( property = "mdep.useSubDirectoryPerType", defaultValue = "false" )
    protected boolean useSubDirectoryPerType;

    /**
     * Place each file in a separate subdirectory. (example
     * /outputDirectory/junit-3.8.1-jar)
     *
     * @since 2.0-alpha-1
     */
    @Parameter( property = "mdep.useSubDirectoryPerArtifact", defaultValue = "false" )
    protected boolean useSubDirectoryPerArtifact;

    /**
     * This only applies if the classifier parameter is used.
     *
     * @since 2.0-alpha-2
     */
    @Parameter( property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false" )
    protected boolean failOnMissingClassifierArtifact = true;

    /**
     * @return Returns the outputDirectory.
     */
    public File getOutputDirectory()
    {
        return this.outputDirectory;
    }

    /**
     * @param theOutputDirectory The outputDirectory to set.
     */
    public void setOutputDirectory( File theOutputDirectory )
    {
        this.outputDirectory = theOutputDirectory;
    }

    /**
     * @return Returns the useSubDirectoryPerArtifact.
     */
    public boolean isUseSubDirectoryPerArtifact()
    {
        return this.useSubDirectoryPerArtifact;
    }

    /**
     * @param theUseSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
     */
    public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
    {
        this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
    }

    /**
     * @return Returns the useSubDirectoryPerScope
     */
    public boolean isUseSubDirectoryPerScope()
    {
        return this.useSubDirectoryPerScope;
    }

    /**
     * @param theUseSubDirectoryPerScope The useSubDirectoryPerScope to set.
     */
    public void setUseSubDirectoryPerScope( boolean theUseSubDirectoryPerScope )
    {
        this.useSubDirectoryPerScope = theUseSubDirectoryPerScope;
    }

    /**
     * @return Returns the useSubDirectoryPerType.
     */
    public boolean isUseSubDirectoryPerType()
    {
        return this.useSubDirectoryPerType;
    }

    /**
     * @param theUseSubDirectoryPerType The useSubDirectoryPerType to set.
     */
    public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
    {
        this.useSubDirectoryPerType = theUseSubDirectoryPerType;
    }

    public boolean isFailOnMissingClassifierArtifact()
    {
        return failOnMissingClassifierArtifact;
    }

    public void setFailOnMissingClassifierArtifact( boolean failOnMissingClassifierArtifact )
    {
        this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
    }

    public boolean isStripVersion()
    {
        return stripVersion;
    }

    public void setStripVersion( boolean stripVersion )
    {
        this.stripVersion = stripVersion;
    }

    /**
     * @return true, if dependencies must be planted in a repository layout
     */
    public boolean isUseRepositoryLayout()
    {
        return useRepositoryLayout;
    }

    /**
     * @param useRepositoryLayout -
     *                            true if dependencies must be planted in a repository layout
     */
    public void setUseRepositoryLayout( boolean useRepositoryLayout )
    {
        this.useRepositoryLayout = useRepositoryLayout;
    }
}


text:
export PYTHONPATH=$PYTHONPATH:$HOME/bin

pushd /home/oceano/notebooks
  ipython notebook
popd


text:
+++
author = "Ash"
comments = false
date = "2016-07-16T23:37:56-04:00"
draft = false
image = "images/pokemon.jpg"
menu = ""
share = true
#slug = "post-title"
tags = ["pokemon", "datamining", "bitcoin", "deeplearning", "china" ]
title = "AshTech #7 - Pokemon Go"

+++

Pokemon Go, Story Arcs, Bitcoin Halving,  AI photo coloring, China
Fitness Boom

<!--more-->

### Pokemon Go
<https://goo.gl/hTaCD3>

Pokemon Go mania  is upon us. Almost every person you
encounter walking while looking into their phone is playing the game.
Walking on NYC streets, on buses and restaurants that I visit
Pokemons, poke-stops and poke-gyms are everywhere . I am glad that this
game has got kids off the couch and exploring neighborhoods looking for
Pokemon.  Although 20 years in the making Pokemon is best suited to the
Augmented reality experience and the game developers Niantic have done a
very good job with it. This week it became the most downloaded app in a
week on the ios app store. Gotta Catch em all !

### Six basic Arcs of story telling
<https://goo.gl/iOMJhW>

Word sentiment analysis  data mining of over 1700 stories has shown that they
fall into 6 basic arcs. Vonnegut spoke about graphical shapes of stories
in a lecture in 1995 and Aristotle spoke about similar arcs 2000 years
ago. Its good to see that data mining is lending its voice to these
theories.

### Bitcoin Miner reward is cut in half
<http://goo.gl/Srdihi>

The reward miners get for sealing a block on the bitcoin ledger drops
from 25 btc to 12.5 btc .Known as "the halving" this has been  a programmed
feature  in bitcoin. It is only the second time that this has
happened. It will  be interesting to keep an eye on the bitcoin price for
the next few weeks to see the impact if any.

### Deep Learning to colorize your photos
<https://goo.gl/MNOlPU>

A deep learning algorithm developed by UC Berekley students is doing a
decent job at colorizing photos. Click the link above to see some
stunning results.

### VCs are betting on a chinese fitness boom
<https://goo.gl/E1MkcI>

365 million chinese  millenials are hitting the gym and VCs are taking
note. I suspect Apple and Fitbit have their eyes on this mega market.


text:
package blue.mesh;

import java.util.ArrayList;
import java.util.UUID;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.util.Log;

public class BlueMeshService {

    private RouterObject        router;
    private UUID                uuid;
    private String              uniqueDeviceId;
    private boolean             bluetoothEnabled = false;
    private String              bluetoothName = null;
    private static final String TAG = "BlueMesh Service";

    //Used to store all Bluetoot Connection Threads
    private ArrayList <BluetoothConnectionThread> bluetoothConnectionThreads = new ArrayList<BluetoothConnectionThread>();

    private void setupBluetooth() throws NullPointerException{

        //Detect the OS and add the connection threads accordingly
        if( Utils.isOS( Utils.OS.ANDROID ) ){

            // Gets bluetooth hardware from phone and makes sure that it is
            // non-null;
            BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();

            // If bluetooth hardware does not exist...
            if (adapter == null) {
            	if(Constants.DEBUG) Log.d(TAG, "BluetoothAdapter is is null");
                throw new NullPointerException("BluetoothAdapter is null");
            } else {
            	if(Constants.DEBUG) Log.d(TAG, "BluetoothAdapter is is non-null");
            }

            bluetoothName = adapter.getName();

            try {
                bluetoothConnectionThreads.add( new ServerThread(adapter, router, uuid) );
            } catch (NullPointerException e) {
            	if(Constants.DEBUG) Log.e(TAG, "Could not add server thread", e);
                throw e;
            }
            if (Constants.DEBUG) Log.d(TAG, "Sever Thread Created");
            // Create a new clientThread
            bluetoothConnectionThreads.add( new ClientThread(adapter, this, router, uuid) );
            if (Constants.DEBUG) Log.d(TAG, "Client Thread Created");
        }
        else if( Utils.isOS( Utils.OS.WINDOWS ) ){
            //TODO: implement this
        	throw new NullPointerException("BlueMesh not supported on windows");
        }
        else if( Utils.isOS( Utils.OS.LINUX ) ){
            //TODO: implement this
        	throw new NullPointerException("BlueMesh not supported on linux");
        }
        else if( Utils.isOS( Utils.OS.OSX ) ){
            //TODO: implement this
        	throw new NullPointerException("BlueMesh not supported on OSX");
        }
        else{
        	throw new NullPointerException("BlueMesh not supported on this device");
        }
    }

    private void setupRouter(){
        router = new RouterObject(uniqueDeviceId);
        if (Constants.DEBUG) Log.d(TAG, "Router Object Created");
    }

    //This is called from the builder once all the configurations are set
    protected void setup(){
        setupRouter();

        if( bluetoothEnabled ){
            setupBluetooth();
        }
    }

    protected BlueMeshService(){
    }

    protected void setUUID( UUID a_uuid ){
        uuid = a_uuid;
    }

    protected void enableBluetooth( boolean enabled ){
        bluetoothEnabled = enabled;
    }

    protected void setDeviceId( String Id ){
        uniqueDeviceId = Id;
    }

    public void launch() {
        for( BluetoothConnectionThread bct: bluetoothConnectionThreads)
        if (!bct.isAlive()) {
            bct.start();
        }
    }

    // function that writes message to all devices
    public void write(byte[] buffer) {
        router.write(buffer, Constants.MESSAGE_ALL, null);
    }

    public void write(byte[] buffer, BluetoothDevice target) {
    	router.write(buffer, Constants.MESSAGE_TARGET, target);
    }

    // function to grab most recent message off of message queue
    // (message stack actually a linked list but is used like a queue)
    public byte[] pull() throws NullPointerException{
        if( router == null ){
            throw new NullPointerException("router is null");
        }
        return router.getNextMessage();
    }

    public int getNumberOfDevicesOnNetwork() {
    	//Not Implemented
        return 0;//router.getNumberOfDevicesOnNetwork();
    }

    // Returns the Bluetooth name of the device
    public String getMyDeviceName() {
        return bluetoothName;
    }

    // Kills threads and stops all communications
    public int disconnect() {
    	if(Constants.DEBUG) Log.d(TAG, "kill start");
    	if(Constants.DEBUG) Log.d(TAG, "Killing " + bluetoothConnectionThreads.size());
        for( BluetoothConnectionThread bct: bluetoothConnectionThreads ){
        	if(Constants.DEBUG) Log.d(TAG, "Killing " + bct.getName());
            if (bct != null) {
                bct.kill();
                bct = null;
            }
        }

        if (this.router != null) {
            this.router.stop();
            this.router = null;
        }

        if(Constants.DEBUG) Log.d(TAG, "kill success");
        return Constants.SUCCESS;
    }

}


text:
// https://www.hackerrank.com/challenges/plus-minus
#include <iostream>
#include <iomanip>
using namespace std;

int n;
int main() {
    int a(0),b(0),c(0); // C++11
    cin >> n;
    for(int i=0;i<n;i++)
	{ int x; cin >> x;
	  if(x > 0) a++;
	  if(x < 0) b++;
	  if(x == 0) c++; }
    cout << setiosflags(ios::fixed) << setprecision(3)
	<< a/(n * 1.0) << "\n"
	<< b/(n * 1.0) << "\n" << c / (n*1.0) << endl;
    return 0;
}
/*	You're given an array of integers.
Can you find what fraction of the elements are
positive numbers, negative numbers and zeroes?
Print the value of the fractions
in decimal form with 3 decimal places.
	Input Format:
The first line contains N: the size of the array.
The next line contains N space-separated integers.
	Output Format:
Output the three values each on a different line.
The first value shows the fraction
of the count of positive numbers to the total numbers,
the second shows the fraction of negative numbers,
and the third represents the fraction of zeroes.
Correct the fraction to 3 decimal places.
	Sample Input:
6
-4 3 -9 0 4 1
	Sample Output:
0.500
0.333
0.167
*/