text:
/*!
 * Datetimepicker for Bootstrap v3
 * https://github.com/Eonasdan/bootstrap-datetimepicker/
 */
.bootstrap-datetimepicker-widget {
  top: 0;
  left: 0;
  width: 250px;
  padding: 4px;
  margin-top: 1px;
  z-index: 99999 !important;
  border-radius: 4px;
}
.bootstrap-datetimepicker-widget.timepicker-sbs {
  width: 600px;
}
.bootstrap-datetimepicker-widget.bottom:before {
  content: '';
  display: inline-block;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #ccc;
  border-bottom-color: rgba(0, 0, 0, 0.2);
  position: absolute;
  top: -7px;
  left: 7px;
}
.bootstrap-datetimepicker-widget.bottom:after {
  content: '';
  display: inline-block;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid white;
  position: absolute;
  top: -6px;
  left: 8px;
}
.bootstrap-datetimepicker-widget.top:before {
  content: '';
  display: inline-block;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #ccc;
  border-top-color: rgba(0, 0, 0, 0.2);
  position: absolute;
  bottom: -7px;
  left: 6px;
}
.bootstrap-datetimepicker-widget.top:after {
  content: '';
  display: inline-block;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid white;
  position: absolute;
  bottom: -6px;
  left: 7px;
}
.bootstrap-datetimepicker-widget .dow {
  width: 14.2857%;
}
.bootstrap-datetimepicker-widget.pull-right:before {
  left: auto;
  right: 6px;
}
.bootstrap-datetimepicker-widget.pull-right:after {
  left: auto;
  right: 7px;
}
.bootstrap-datetimepicker-widget > ul {
  list-style-type: none;
  margin: 0;
}
.bootstrap-datetimepicker-widget .timepicker-hour,
.bootstrap-datetimepicker-widget .timepicker-minute,
.bootstrap-datetimepicker-widget .timepicker-second {
  width: 100%;
  font-weight: bold;
  font-size: 1.2em;
}
.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator {
  width: 4px;
  padding: 0;
  margin: 0;
}
.bootstrap-datetimepicker-widget .datepicker > div {
  display: none;
}
.bootstrap-datetimepicker-widget .picker-switch {
  text-align: center;
}
.bootstrap-datetimepicker-widget table {
  width: 100%;
  margin: 0;
}
.bootstrap-datetimepicker-widget td,
.bootstrap-datetimepicker-widget th {
  text-align: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
}
.bootstrap-datetimepicker-widget td.day:hover,
.bootstrap-datetimepicker-widget td.hour:hover,
.bootstrap-datetimepicker-widget td.minute:hover,
.bootstrap-datetimepicker-widget td.second:hover {
  background: #eeeeee;
  cursor: pointer;
}
.bootstrap-datetimepicker-widget td.old,
.bootstrap-datetimepicker-widget td.new {
  color: #999999;
}
.bootstrap-datetimepicker-widget td.today {
  position: relative;
}
.bootstrap-datetimepicker-widget td.today:before {
  content: '';
  display: inline-block;
  border-left: 7px solid transparent;
  border-bottom: 7px solid #428bca;
  border-top-color: rgba(0, 0, 0, 0.2);
  position: absolute;
  bottom: 4px;
  right: 4px;
}
.bootstrap-datetimepicker-widget td.active,
.bootstrap-datetimepicker-widget td.active:hover {
  background-color: #428bca;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget td.active.today:before {
  border-bottom-color: #fff;
}
.bootstrap-datetimepicker-widget td.disabled,
.bootstrap-datetimepicker-widget td.disabled:hover {
  background: none;
  color: #999999;
  cursor: not-allowed;
}
.bootstrap-datetimepicker-widget td span {
  display: block;
  width: 47px;
  height: 54px;
  line-height: 54px;
  float: left;
  margin: 2px;
  cursor: pointer;
  border-radius: 4px;
}
.bootstrap-datetimepicker-widget td span:hover {
  background: #eeeeee;
}
.bootstrap-datetimepicker-widget td span.active {
  background-color: #428bca;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget td span.old {
  color: #999999;
}
.bootstrap-datetimepicker-widget td span.disabled,
.bootstrap-datetimepicker-widget td span.disabled:hover {
  background: none;
  color: #999999;
  cursor: not-allowed;
}
.bootstrap-datetimepicker-widget th.switch {
  width: 145px;
}
.bootstrap-datetimepicker-widget th.next,
.bootstrap-datetimepicker-widget th.prev {
  font-size: 21px;
}
.bootstrap-datetimepicker-widget th.disabled,
.bootstrap-datetimepicker-widget th.disabled:hover {
  background: none;
  color: #999999;
  cursor: not-allowed;
}
.bootstrap-datetimepicker-widget thead tr:first-child th {
  cursor: pointer;
}
.bootstrap-datetimepicker-widget thead tr:first-child th:hover {
  background: #eeeeee;
}
.input-group.date .input-group-addon span {
  display: block;
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.bootstrap-datetimepicker-widget.left-oriented:before {
  left: auto;
  right: 6px;
}
.bootstrap-datetimepicker-widget.left-oriented:after {
  left: auto;
  right: 7px;
}
.bootstrap-datetimepicker-widget ul.list-unstyled li div.timepicker div.timepicker-picker table.table-condensed tbody > tr > td {
  padding: 0px !important;
}


text:
class C extends Object {
  bla() {}
}

const bla = C.prototype.bla;

function bar(c) {
  %TurbofanStaticAssert(c.bla === bla);
}

function foo() {
  var c = new C();
  bar(c);
}
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(bar);
%PrepareFunctionForOptimization(C);
bar({});
bar({a:1});
bar({aa:1});
bar({aaa:1});
bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();

redpajama_set_name: RedPajamaGithub


text:
package org.elasticsearch.action.admin.indices.delete;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.DestructiveOperations;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataDeleteIndexService;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.index.Index;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * Delete index action.
 */
public class TransportDeleteIndexAction extends AcknowledgedTransportMasterNodeAction<DeleteIndexRequest> {

    private static final Logger logger = LogManager.getLogger(TransportDeleteIndexAction.class);

    private final MetadataDeleteIndexService deleteIndexService;
    private final DestructiveOperations destructiveOperations;

    @Inject
    public TransportDeleteIndexAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
                                      MetadataDeleteIndexService deleteIndexService, ActionFilters actionFilters,
                                      IndexNameExpressionResolver indexNameExpressionResolver,
                                      DestructiveOperations destructiveOperations) {
        super(DeleteIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, DeleteIndexRequest::new,
            indexNameExpressionResolver, ThreadPool.Names.SAME);
        this.deleteIndexService = deleteIndexService;
        this.destructiveOperations = destructiveOperations;
    }

    @Override
    protected void doExecute(Task task, DeleteIndexRequest request, ActionListener<AcknowledgedResponse> listener) {
        destructiveOperations.failDestructive(request.indices());
        super.doExecute(task, request, listener);
    }

    @Override
    protected ClusterBlockException checkBlock(DeleteIndexRequest request, ClusterState state) {
        return state.blocks().indicesAllowReleaseResources(indexNameExpressionResolver.concreteIndexNames(state, request));
    }

    @Override
    protected void masterOperation(Task task, final DeleteIndexRequest request, final ClusterState state,
                                   final ActionListener<AcknowledgedResponse> listener) {
        final Set<Index> concreteIndices = new HashSet<>(Arrays.asList(indexNameExpressionResolver.concreteIndices(state, request)));
        if (concreteIndices.isEmpty()) {
            listener.onResponse(AcknowledgedResponse.TRUE);
            return;
        }

        DeleteIndexClusterStateUpdateRequest deleteRequest = new DeleteIndexClusterStateUpdateRequest()
            .ackTimeout(request.timeout()).masterNodeTimeout(request.masterNodeTimeout())
            .indices(concreteIndices.toArray(new Index[concreteIndices.size()]));

        deleteIndexService.deleteIndices(deleteRequest, listener.delegateResponse((l, e) -> {
            logger.debug(() -> new ParameterizedMessage("failed to delete indices [{}]", concreteIndices), e);
            listener.onFailure(e);
        }));
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="@color/default_base_bg_press">
</ripple>


text:
package types

import (
	"sort"

	"github.com/gravitational/trace"

	"github.com/gravitational/teleport/api/utils"
)

// WindowsDesktopService represents a Windows desktop service instance.
type WindowsDesktopService interface {
	// ResourceWithLabels provides common resource methods.
	ResourceWithLabels
	// GetAddr returns the network address of this service.
	GetAddr() string
	// GetVersion returns the teleport binary version of this service.
	GetTeleportVersion() string
	// GetHostname returns the hostname of this service
	GetHostname() string
	// ProxiedService provides common methods for a proxied service.
	ProxiedService
}

type WindowsDesktopServices []WindowsDesktopService

// AsResources returns windows desktops as type resources with labels.
func (s WindowsDesktopServices) AsResources() []ResourceWithLabels {
	resources := make([]ResourceWithLabels, 0, len(s))
	for _, server := range s {
		resources = append(resources, ResourceWithLabels(server))
	}
	return resources
}

var _ WindowsDesktopService = &WindowsDesktopServiceV3{}

// NewWindowsDesktopServiceV3 creates a new WindowsDesktopServiceV3 resource.
func NewWindowsDesktopServiceV3(meta Metadata, spec WindowsDesktopServiceSpecV3) (*WindowsDesktopServiceV3, error) {
	s := &WindowsDesktopServiceV3{
		ResourceHeader: ResourceHeader{
			Metadata: meta,
		},
		Spec: spec,
	}
	if err := s.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	return s, nil
}

func (s *WindowsDesktopServiceV3) setStaticFields() {
	s.Kind = KindWindowsDesktopService
	s.Version = V3
}

// CheckAndSetDefaults checks and sets default values for any missing fields.
func (s *WindowsDesktopServiceV3) CheckAndSetDefaults() error {
	if s.Spec.Addr == "" {
		return trace.BadParameter("WindowsDesktopServiceV3.Spec missing Addr field")
	}
	if s.Spec.TeleportVersion == "" {
		return trace.BadParameter("WindowsDesktopServiceV3.Spec missing TeleportVersion field")
	}

	s.setStaticFields()
	if err := s.ResourceHeader.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	return nil
}

// GetAddr returns the network address of this service.
func (s *WindowsDesktopServiceV3) GetAddr() string {
	return s.Spec.Addr
}

// GetTeleportVersion returns the teleport binary version of this service.
func (s *WindowsDesktopServiceV3) GetTeleportVersion() string {
	return s.Spec.TeleportVersion
}

// Origin returns the origin value of the resource.
func (s *WindowsDesktopServiceV3) Origin() string {
	return s.Metadata.Origin()
}

// SetOrigin sets the origin value of the resource.
func (s *WindowsDesktopServiceV3) SetOrigin(origin string) {
	s.Metadata.SetOrigin(origin)
}

// GetProxyID returns a list of proxy ids this server is connected to.
func (s *WindowsDesktopServiceV3) GetProxyIDs() []string {
	return s.Spec.ProxyIDs
}

// SetProxyID sets the proxy ids this server is connected to.
func (s *WindowsDesktopServiceV3) SetProxyIDs(proxyIDs []string) {
	s.Spec.ProxyIDs = proxyIDs
}

// GetAllLabels returns the resources labels.
func (s *WindowsDesktopServiceV3) GetAllLabels() map[string]string {
	return s.Metadata.Labels
}

// GetStaticLabels returns the windows desktop static labels.
func (s *WindowsDesktopServiceV3) GetStaticLabels() map[string]string {
	return s.Metadata.Labels
}

// SetStaticLabels sets the windows desktop static labels.
func (s *WindowsDesktopServiceV3) SetStaticLabels(sl map[string]string) {
	s.Metadata.Labels = sl
}

// GetHostname returns the windows hostname of this service.
func (s *WindowsDesktopServiceV3) GetHostname() string {
	return s.Spec.Hostname
}

// MatchSearch goes through select field values and tries to
// match against the list of search values.
func (s *WindowsDesktopServiceV3) MatchSearch(values []string) bool {
	fieldVals := append(utils.MapToStrings(s.GetAllLabels()), s.GetName(), s.GetHostname())
	return MatchSearch(fieldVals, values, nil)
}

// WindowsDesktop represents a Windows desktop host.
type WindowsDesktop interface {
	// ResourceWithLabels provides common resource methods.
	ResourceWithLabels
	// GetAddr returns the network address of this host.
	GetAddr() string
	// LabelsString returns all labels as a string.
	LabelsString() string
	// GetDomain returns the ActiveDirectory domain of this host.
	GetDomain() string
	// GetHostID returns the ID of the Windows Desktop Service reporting the desktop.
	GetHostID() string
}

var _ WindowsDesktop = &WindowsDesktopV3{}

// NewWindowsDesktopV3 creates a new WindowsDesktopV3 resource.
func NewWindowsDesktopV3(name string, labels map[string]string, spec WindowsDesktopSpecV3) (*WindowsDesktopV3, error) {
	d := &WindowsDesktopV3{
		ResourceHeader: ResourceHeader{
			Metadata: Metadata{
				Name:   name,
				Labels: labels,
			},
		},
		Spec: spec,
	}
	if err := d.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}
	return d, nil
}

func (d *WindowsDesktopV3) setStaticFields() {
	d.Kind = KindWindowsDesktop
	d.Version = V3
}

// CheckAndSetDefaults checks and sets default values for any missing fields.
func (d *WindowsDesktopV3) CheckAndSetDefaults() error {
	if d.Spec.Addr == "" {
		return trace.BadParameter("WindowsDesktopV3.Spec missing Addr field")
	}

	d.setStaticFields()
	if err := d.ResourceHeader.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	return nil
}

// GetAddr returns the network address of this host.
func (d *WindowsDesktopV3) GetAddr() string {
	return d.Spec.Addr
}

// GetHostID returns the HostID for the associated desktop service.
func (d *WindowsDesktopV3) GetHostID() string {
	return d.Spec.HostID
}

// GetAllLabels returns combined static and dynamic labels.
func (d *WindowsDesktopV3) GetAllLabels() map[string]string {
	// TODO(zmb3): add dynamic labels when running in agent mode
	return CombineLabels(d.Metadata.Labels, nil)
}

// GetStaticLabels returns the windows desktop static labels.
func (d *WindowsDesktopV3) GetStaticLabels() map[string]string {
	return d.Metadata.Labels
}

// SetStaticLabels sets the windows desktop static labels.
func (d *WindowsDesktopV3) SetStaticLabels(sl map[string]string) {
	d.Metadata.Labels = sl
}

// LabelsString returns all desktop labels as a string.
func (d *WindowsDesktopV3) LabelsString() string {
	return LabelsAsString(d.Metadata.Labels, nil)
}

// GetDomain returns the Active Directory domain of this host.
func (d *WindowsDesktopV3) GetDomain() string {
	return d.Spec.Domain
}

// Origin returns the origin value of the resource.
func (d *WindowsDesktopV3) Origin() string {
	return d.Metadata.Labels[OriginLabel]
}

// SetOrigin sets the origin value of the resource.
func (d *WindowsDesktopV3) SetOrigin(o string) {
	d.Metadata.Labels[OriginLabel] = o
}

// MatchSearch goes through select field values and tries to
// match against the list of search values.
func (d *WindowsDesktopV3) MatchSearch(values []string) bool {
	fieldVals := append(utils.MapToStrings(d.GetAllLabels()), d.GetName(), d.GetAddr())
	return MatchSearch(fieldVals, values, nil)
}

// DeduplicateDesktops deduplicates desktops by name.
func DeduplicateDesktops(desktops []WindowsDesktop) (result []WindowsDesktop) {
	seen := make(map[string]struct{})
	for _, desktop := range desktops {
		if _, ok := seen[desktop.GetName()]; ok {
			continue
		}
		seen[desktop.GetName()] = struct{}{}
		result = append(result, desktop)
	}
	return result
}

// Match checks if a given desktop request matches this filter.
func (f *WindowsDesktopFilter) Match(req WindowsDesktop) bool {
	if f.HostID != "" && req.GetHostID() != f.HostID {
		return false
	}
	if f.Name != "" && req.GetName() != f.Name {
		return false
	}
	return true
}

// WindowsDesktops represents a list of windows desktops.
type WindowsDesktops []WindowsDesktop

// Len returns the slice length.
func (s WindowsDesktops) Len() int { return len(s) }

// Less compares desktops by name and host ID.
func (s WindowsDesktops) Less(i, j int) bool {
	switch {
	case s[i].GetName() < s[j].GetName():
		return true
	case s[i].GetName() > s[j].GetName():
		return false
	default:
		return s[i].GetHostID() < s[j].GetHostID()
	}
}

// Swap swaps two windows desktops.
func (s WindowsDesktops) Swap(i, j int) { s[i], s[j] = s[j], s[i] }

// SortByCustom custom sorts by given sort criteria.
func (s WindowsDesktops) SortByCustom(sortBy SortBy) error {
	if sortBy.Field == "" {
		return nil
	}

	isDesc := sortBy.IsDesc
	switch sortBy.Field {
	case ResourceMetadataName:
		sort.SliceStable(s, func(i, j int) bool {
			return stringCompare(s[i].GetName(), s[j].GetName(), isDesc)
		})
	case ResourceSpecAddr:
		sort.SliceStable(s, func(i, j int) bool {
			return stringCompare(s[i].GetAddr(), s[j].GetAddr(), isDesc)
		})
	default:
		return trace.NotImplemented("sorting by field %q for resource %q is not supported", sortBy.Field, KindWindowsDesktop)
	}

	return nil
}

// AsResources returns windows desktops as type resources with labels.
func (s WindowsDesktops) AsResources() []ResourceWithLabels {
	resources := make([]ResourceWithLabels, 0, len(s))
	for _, server := range s {
		resources = append(resources, ResourceWithLabels(server))
	}
	return resources
}

// GetFieldVals returns list of select field values.
func (s WindowsDesktops) GetFieldVals(field string) ([]string, error) {
	vals := make([]string, 0, len(s))
	switch field {
	case ResourceMetadataName:
		for _, server := range s {
			vals = append(vals, server.GetName())
		}
	case ResourceSpecAddr:
		for _, server := range s {
			vals = append(vals, server.GetAddr())
		}
	default:
		return nil, trace.NotImplemented("getting field %q for resource %q is not supported", field, KindWindowsDesktop)
	}

	return vals, nil
}

// ListWindowsDesktopsResponse is a response type to ListWindowsDesktops.
type ListWindowsDesktopsResponse struct {
	Desktops []WindowsDesktop
	NextKey  string
}

// ListWindowsDesktopsRequest is a request type to ListWindowsDesktops.
type ListWindowsDesktopsRequest struct {
	WindowsDesktopFilter
	Limit                         int
	StartKey, PredicateExpression string
	Labels                        map[string]string
	SearchKeywords                []string
}

// ListWindowsDesktopServicesResponse is a response type to ListWindowsDesktopServices.
type ListWindowsDesktopServicesResponse struct {
	DesktopServices []WindowsDesktopService
	NextKey         string
}

// ListWindowsDesktopServicesRequest is a request type to ListWindowsDesktopServices.
type ListWindowsDesktopServicesRequest struct {
	Limit                         int
	StartKey, PredicateExpression string
	Labels                        map[string]string
	SearchKeywords                []string
}


text:
import pygame
from pygame import Rect

class Camera(object):
	def __init__(self, update_function, width, height):
		self.update_function = update_function
		self.state = Rect(0, 0, width, height)

	def scroll(self, target):
		return target.rect.move(self.state.topleft)

	def update(self, target):
		self.state = self.update_function(self.state, target.rect)

class Platform(pygame.sprite.Sprite):
	def __init__(self, x, y):
		pygame.sprite.Sprite.__init__(self)
		self.image = pygame.image.load("images/platform.png")
		self.rect = self.image.get_rect()
		self.x = x
		self.y = y
		self.rect.topleft = x,y

class Player(pygame.sprite.Sprite):
	isFalling = 0
	isJumping = 0
	movingLeft = 0
	movingRight = 0

	def __init__(self,  x, y):
		pygame.sprite.Sprite.__init__(self)
		self.image = pygame.image.load("images/player.png")
		self.rect = self.image.get_rect()
		self.rect.topleft = x,y

	def move(self, event):
		if (event.type == pygame.KEYDOWN):
			if event.key == pygame.K_UP:
                		self.isJumping = 1
			if event.key == pygame.K_RIGHT:
                		self.movingRight = 1
                	if event.key == pygame.K_LEFT:
                        	self.movingLeft = 1
		if (event.type == pygame.KEYUP):
			if event.key == pygame.K_RIGHT:
				self.movingRight = 0
			if event.key == pygame.K_LEFT:
				self.movingLeft = 0

	def update(self):
		movement = [0,0]
		if (self.movingLeft == 1):
			movement[0] = -2
		if (self.movingRight == 1):
			movement[0] = 2
		if (self.isJumping == 1):
			movement[1] = -100
			self.isJumping = 0
		if (self.isFalling ==1):
			movement[1] = 2

	        self.rect = self.rect.move(movement)

class Wall(pygame.sprite.Sprite):
	def __init__(self):
		pygame.sprite.Sprite.__init__(self)
		self.image = pygame.image.load("images/wall.png")
		self.rect = self.image.get_rect()
		self.rect.topleft = 0,0

	def update(self):
		self.rect = self.rect.move(1.75,0)

class Goal(pygame.sprite.Sprite):
	def __init__(self, x, y):
		pygame.sprite.Sprite.__init__(self)
		self.image = pygame.image.load("images/goal.png")
		self.rect = self.image.get_rect()
		self.rect.topleft = x, y


text:
package org.cs160.bactracker;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.Node;
import com.google.android.gms.wearable.NodeApi;
import com.google.android.gms.wearable.Wearable;

import java.util.ArrayList;

public class BACActivity extends Activity
        implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{

    private final String TAG = "BACActivity";
    public static GoogleApiClient mGoogleApiClient;
    public static float alcohol = 0.0f;
    private float limit;
    private float bac;
    private BroadcastReceiver receiver, menuReceiver;
    private ImageButton menuButton;
    public static DBAdapterWearable dbAdapterWearable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        Log.i(TAG, "BACActivity started!");
        dbAdapterWearable = new DBAdapterWearable(getApplicationContext());
        super.onCreate(savedInstanceState);

        dbAdapterWearable.deleteAll();
        Intent i = new Intent(this, SignalForMenu.class);
        startService(i);

        mGoogleApiClient= new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(Wearable.API)
                .build();

        mGoogleApiClient.connect();
        Log.i(TAG, "BACActivity.onCreate finished");

        // broadcast listener
        receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                Log.i(TAG, "Broadcast received!");
                String s = intent.getStringExtra("bac");
                if (s != null) {
                    Log.i(TAG, "Found BAC: " + s);
                    bac = Float.parseFloat(s);
                    TextView view = (TextView) findViewById(R.id.current_BAC);
                    view.setText(s);
                    Log.i(TAG, color_limit());
                    view.setTextColor(Color.parseColor(color_limit()));
                }

                Float new_limit = intent.getFloatExtra("limit", -1.0f);
                if (new_limit>0.0f){
                    Log.i(TAG, "Limit updated: "+new_limit);
                    limit = new_limit;
                }
            }
        };
        menuReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                Log.d(TAG, "Menu Recieved");
            }
        };
        registerReceiver(receiver, new IntentFilter("wat?"));
        registerReceiver(menuReceiver, new IntentFilter("menuRetrieved"));

        // check existing BAC
        bac = 0.00f;
        sendMessage("/check_BAC", null);
        // check legal limit
        limit = 0.08f;
        sendMessage("/check_limit", null);

        setContentView(R.layout.activity_bac);
    }

    @Override
    public void onConnected(Bundle connectionHint) {
        Log.i(TAG, "Connected to GoogleAPI");
    }

    @Override
    public void onConnectionSuspended(int cause) {
        Log.i(TAG, "Connection to GoogleAPI suspended");
    }

    @Override
    public void onConnectionFailed(ConnectionResult result) {
        Log.i(TAG, "Connection to GoogleAPI failed!");
    }

    @Override
    protected void onDestroy(){
        super.onDestroy();
        unregisterReceiver(receiver);
        unregisterReceiver(menuReceiver);
        mGoogleApiClient.disconnect();

    }

    private void sendMessage(final String path, final byte[] data){
        new Thread( new Runnable() {
            @Override
            public void run() {
                Log.i(TAG, "Sending message: "+path);
                NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(
                        mGoogleApiClient ).await();
                for(Node node : nodes.getNodes()) {
                    Log.i(TAG, "Node: "+node);
                    MessageApi.SendMessageResult result = Wearable.MessageApi.sendMessage(
                            mGoogleApiClient, node.getId(), path, data ).await();
                }
            }
        }).start();
    }

    public void reset(View v){
        AlertDialog ad = new AlertDialog.Builder(this)
                .setMessage("Are you sure you want to reset?")
                .setTitle("Reset?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        sendMessage("/reset", null);
                        dialog.dismiss();
                    }
                })
                .setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // do nothing
                        dialog.dismiss();
                    }
                })
                .create();
        ad.show();

        Cursor c = BACActivity.dbAdapterWearable.getAllRows();
        ArrayList<String> names = new ArrayList<String>();
        while (!c.isAfterLast()) {
            String name = c.getString(DBAdapterWearable.COL_NAME);
            names.add(name);
            c.moveToNext();
        }

        for (String name : names) {
            BACActivity.dbAdapterWearable.updateRow(name, 0);
        }
    }
    public void toDrinksSelection(View v) {

        Intent i = new Intent(this, MenuWearableList.class);
        startActivity(i);
    }

    public void toExitActivity (View v) {
        Intent i = new Intent(getApplicationContext(), ExitActivity.class);
        Log.i(TAG, "Exitting with BAC "+bac+" and limit "+limit);
        if (bac < limit) {
            i.putExtra("safe", true);
        } else {
            i.putExtra("safe", false);
        }
        startActivity(i);
    }

    private String color_limit(){
        // returns hex color code based on ratio between current bac and legal limit
        int red;
        int green;
        int blue = 0;
        double ratio = bac/limit;
        if (ratio > 1.0){
            ratio = 1.0;
        }

        if (ratio < 0.5f){
            red = (int) Math.floor(ratio*255);
            green = 255;
        } else {
            red = 255;
            green = 255 - ((int) Math.floor(ratio * 255));
        }
        return String.format("#%02x%02x%02x", red, green, blue);
   }
    public void toMenu(View v) {
        startActivity(new Intent(this, MenuWearableList.class));
    }
}


text:
(function () {
    'use strict';

    angular.module('movieFinder', [
        'ngRoute',
        'ngAnimate',
        'mgcrea.ngStrap',
        'movieFinder.controllers',
        'movieFinder.directives',
        'movieFinder.filters',
        'movieFinder.services',
        'movieFinder.constants',
        'movieFinder.templates'
    ]);

    angular.module('movieFinder.controllers', []);
    angular.module('movieFinder.directives', []);
    angular.module('movieFinder.filters', []);
    angular.module('movieFinder.services', []);
    angular.module('movieFinder.constants', []);
    angular.module('movieFinder.templates', []);
})();


text:
<?php

namespace Symfony\Component\Serializer\Context\Normalizer;

use Symfony\Component\Serializer\Context\ContextBuilderInterface;
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;

/**
 * A helper providing autocompletion for available AbstractNormalizer options.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
abstract class AbstractNormalizerContextBuilder implements ContextBuilderInterface
{
    use ContextBuilderTrait;

    /**
     * Configures how many loops of circular reference to allow while normalizing.
     *
     * The value 1 means that when we encounter the same object a
     * second time, we consider that a circular reference.
     *
     * You can raise this value for special cases, e.g. in combination with the
     * max depth setting of the object normalizer.
     *
     * Must be strictly positive.
     *
     * @param positive-int|null $circularReferenceLimit
     */
    public function withCircularReferenceLimit(?int $circularReferenceLimit): static
    {
        return $this->with(AbstractNormalizer::CIRCULAR_REFERENCE_LIMIT, $circularReferenceLimit);
    }

    /**
     * Configures an object to be updated instead of creating a new instance.
     *
     * If you have a nested structure, child objects will be overwritten with
     * new instances unless you set AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE to true.
     */
    public function withObjectToPopulate(?object $objectToPopulate): static
    {
        return $this->with(AbstractNormalizer::OBJECT_TO_POPULATE, $objectToPopulate);
    }

    /**
     * Configures groups containing attributes to (de)normalize.
     *
     * Eg: ['group1', 'group2']
     *
     * @param list<string>|string|null $groups
     */
    public function withGroups(array|string|null $groups): static
    {
        if (null === $groups) {
            return $this->with(AbstractNormalizer::GROUPS, null);
        }

        return $this->with(AbstractNormalizer::GROUPS, (array) $groups);
    }

    /**
     * Configures attributes to (de)normalize.
     *
     * For nested structures, this list needs to reflect the object tree.
     *
     * Eg: ['foo', 'bar', 'object' => ['baz']]
     *
     * @param array<string|array>|null $attributes
     *
     * @throws InvalidArgumentException
     */
    public function withAttributes(?array $attributes): static
    {
        $it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($attributes ?? []), \RecursiveIteratorIterator::LEAVES_ONLY);

        foreach ($it as $attribute) {
            if (!\is_string($attribute)) {
                throw new InvalidArgumentException(sprintf('Each attribute must be a string, "%s" given.', get_debug_type($attribute)));
            }
        }

        return $this->with(AbstractNormalizer::ATTRIBUTES, $attributes);
    }

    /**
     * If AbstractNormalizer::ATTRIBUTES are specified, and the source has fields that are not part of that list,
     * configures whether to ignore those attributes or throw an ExtraAttributesException.
     */
    public function withAllowExtraAttributes(?bool $allowExtraAttributes): static
    {
        return $this->with(AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES, $allowExtraAttributes);
    }

    /**
     * Configures an hashmap of classes containing hashmaps of constructor argument => default value.
     *
     * The names need to match the parameter names in the constructor arguments.
     *
     * Eg: [Foo::class => ['foo' => true, 'bar' => 0]]
     *
     * @param array<class-string, array<string, mixed>>|null $defaultContructorArguments
     */
    public function withDefaultContructorArguments(?array $defaultContructorArguments): static
    {
        return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultContructorArguments);
    }

    /**
     * Configures an hashmap of field name => callable to normalize this field.
     *
     * The callable is called if the field is encountered with the arguments:
     *
     * - mixed                 $attributeValue value of this field
     * - object                $object         the whole object being normalized
     * - string                $attributeName  name of the attribute being normalized
     * - string                $format         the requested format
     * - array<string, mixed>  $context        the serialization context
     *
     * @param array<string, callable>|null $callbacks
     */
    public function withCallbacks(?array $callbacks): static
    {
        return $this->with(AbstractNormalizer::CALLBACKS, $callbacks);
    }

    /**
     * Configures an handler to call when a circular reference has been detected.
     *
     * If no handler is specified, a CircularReferenceException is thrown.
     *
     * The method will be called with ($object, $format, $context) and its
     * return value is returned as the result of the normalize call.
     */
    public function withCircularReferenceHandler(?callable $circularReferenceHandler): static
    {
        return $this->with(AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER, $circularReferenceHandler);
    }

    /**
     * Configures attributes to be skipped when normalizing an object tree.
     *
     * This list is applied to each element of nested structures.
     *
     * Eg: ['foo', 'bar']
     *
     * Note: The behaviour for nested structures is different from ATTRIBUTES
     * for historical reason. Aligning the behaviour would be a BC break.
     *
     * @param list<string>|null $attributes
     */
    public function withIgnoredAttributes(?array $ignoredAttributes): static
    {
        return $this->with(AbstractNormalizer::IGNORED_ATTRIBUTES, $ignoredAttributes);
    }
}


text:
package workbench.db;

import java.sql.SQLException;

/**
 *
 * @author Thomas Kellerer
 */
public interface ViewReader
{

	CharSequence getExtendedViewSource(TableIdentifier tbl)
		throws SQLException;

	CharSequence getExtendedViewSource(TableIdentifier tbl, DropType dropType)
		throws SQLException;

	/**
	 * Returns a complete SQL statement to (re)create the given view.
	 *
	 * This method will extend the stored source to a valid CREATE VIEW.
	 *
	 * If no SQL Statement was configured to retrieve the source, an explanation
	 * on how to configure will be returned.
	 *
	 * @param view The view for which thee source should be created
	 * @param includeCommit if true, terminate the whole statement with a COMMIT
	 * @param includeDrop if true, add a DROP statement before the CREATE statement
	 *
	 * @see #getViewSource(workbench.db.TableIdentifier)
	 */
	CharSequence getExtendedViewSource(TableDefinition view, DropType dropType, boolean includeCommit)
		throws SQLException;

	/**
	 * Returns a complete SQL statement to create the given view.
	 *
	 * This method will extend the stored source to a valid CREATE VIEW.
	 *
	 * If no SQL Statement was configured to retrieve the source, an explanation
	 * on how to configure will be returned.
   *
   * Unlike getExtendedViewSource() this method will not add any addtional SQL statements like
   * the grants, a commit or a drop statement.
	 *
	 * @param view The view for which thee source should be created
   *
	 * @see #getExtendedViewSource(workbench.db.TableDefinition, boolean, boolean)
	 */
	CharSequence getFullViewSource(TableDefinition view)
		throws SQLException, NoConfigException;

	/**
	 * Return the source of a view definition as it is stored in the database.
	 *

	 * Usually (depending on how the meta data is stored in the database) the DBMS
	 * only stores the underlying SELECT statement (but not a full CREATE VIEW),
	 * and that will be returned by this method.
	 *

	 * To create a complete SQL to re-create a view, use {@link #getExtendedViewSource(workbench.db.TableIdentifier) }
	 *
	 * @return the view source as stored in the database.
	 */
	CharSequence getViewSource(TableIdentifier viewId)
		throws NoConfigException;

}


text:
void sayname(char* name) {
  printf("My name is %s!\n", name);
}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

/**
 * Parent class of all the logstore subplugin implementations.
 *
 * Note: While this intermediate class is not strictly required and all the
 * subplugin implementations can extend directly {@link restore_subplugin},
 * it is always recommended to have it, both for better testing and also
 * for sharing code between all subplugins.
 */
abstract class restore_tool_log_logstore_subplugin extends restore_subplugin {

    /**
     * Process log entries.
     *
     * This method proceeds to read, complete, remap and, finally,
     * discard or save every log entry.
     *
     * @param array $data log entry.
     * @return object|null $dataobject A data object with values for one or more fields in the record,
     *  or null if we are not going to process the log.
     */
    protected function process_log($data) {
        $data = (object) $data;

        // Complete the information that does not come from backup.
        $contextid = $data->contextid;
        if (!$data->contextid = $this->get_mappingid('context', $contextid)) {
            $message = "Context id \"$contextid\" could not be mapped. Skipping log record.";
            $this->log($message, backup::LOG_DEBUG);
            return;
        }
        $context = context::instance_by_id($data->contextid, MUST_EXIST);
        $data->contextlevel = $context->contextlevel;
        $data->contextinstanceid = $context->instanceid;
        $data->courseid = $this->task->get_courseid();

        // Remap users.
        $userid = $data->userid;
        if (!$data->userid = $this->get_mappingid('user', $userid)) {
            $message = "User id \"$userid\" could not be mapped. Skipping log record.";
            $this->log($message, backup::LOG_DEBUG);
            return;
        }
        if (!empty($data->relateduserid)) { // This is optional.
            $relateduserid = $data->relateduserid;
            if (!$data->relateduserid = $this->get_mappingid('user', $relateduserid)) {
                $message = "Related user id \"$relateduserid\" could not be mapped. Skipping log record.";
                $this->log($message, backup::LOG_DEBUG);
                return;
            }
        }
        if (!empty($data->realuserid)) { // This is optional.
            $realuserid = $data->realuserid;
            if (!$data->realuserid = $this->get_mappingid('user', $realuserid)) {
                $message = "Real user id \"$realuserid\" could not be mapped. Skipping log record.";
                $this->log($message, backup::LOG_DEBUG);
                return;
            }
        }

        // There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.

        // Revert other to its original php way.
        $data->other = unserialize(base64_decode($data->other));

        // Arrived here, we have both 'objectid' and 'other' to be converted. This is the tricky part.
        // Both are pointing to other records id, but the sources are not identified in the
        // same way restore mappings work. So we need to delegate them to some resolver that
        // will give us the correct restore mapping to be used.
        if (!empty($data->objectid)) {
            // Check if there is an available class for this event we can use to map this value.
            $eventclass = $data->eventname;
            if (class_exists($eventclass)) {
                $mapping = $eventclass::get_objectid_mapping();
                if ($mapping) {
                    // Check if it can not be mapped.
                    if ((is_int($mapping) && $mapping === \core\event\base::NOT_MAPPED) ||
                        ($mapping['restore'] === \core\event\base::NOT_MAPPED)) {
                        $data->objectid = \core\event\base::NOT_MAPPED;
                    } else {
                        $data->objectid = $this->get_mappingid($mapping['restore'], $data->objectid,
                            \core\event\base::NOT_FOUND);
                    }
                }
            } else {
                $message = "Event class not found: \"$eventclass\". Skipping log record.";
                $this->log($message, backup::LOG_DEBUG);
                return; // No such class, can not restore.
            }
        }
        if (!empty($data->other)) {
            // Check if there is an available class for this event we can use to map this value.
            $eventclass = $data->eventname;
            if (class_exists($eventclass)) {
                $othermapping = $eventclass::get_other_mapping();
                if ($othermapping) {
                    // Go through the data we have.
                    foreach ($data->other as $key => $value) {
                        // Check if there is a corresponding key we can use to map to.
                        if (isset($othermapping[$key]) && !empty($value)) {
                            // Ok, let's map this.
                            $mapping = $othermapping[$key];
                            // Check if it can not be mapped.
                            if ((is_int($mapping) && $mapping === \core\event\base::NOT_MAPPED) ||
                                ($mapping['restore'] === \core\event\base::NOT_MAPPED)) {
                                $data->other[$key] = \core\event\base::NOT_MAPPED;
                            } else {
                                $data->other[$key] = $this->get_mappingid($mapping['restore'], $value,
                                    \core\event\base::NOT_FOUND);
                            }
                        }
                    }
                }
                // Now we want to serialize it so we can store it in the DB.
                $data->other = serialize($data->other);
            } else {
                $message = "Event class not found: \"$eventclass\". Skipping log record.";
                $this->log($message, backup::LOG_DEBUG);
                return; // No such class, can not restore.
            }
        }

        return $data;
    }
}


text:
var dyson = require('dyson');

dyson.bootstrap({
    configDir: __dirname + '/civo',
    port: 3000
});


text:
package app

import (
	"github.com/postgres-ci/app-server/src/app/controllers"
	"github.com/postgres-ci/app-server/src/app/controllers/auth"
	"github.com/postgres-ci/app-server/src/app/controllers/notification"
	"github.com/postgres-ci/app-server/src/app/controllers/password"
	"github.com/postgres-ci/app-server/src/app/controllers/project"
	"github.com/postgres-ci/app-server/src/app/controllers/users"
	"github.com/postgres-ci/app-server/src/app/controllers/webhooks"
)

func (app *app) route() {

	auth.Route(app.Server)
	users.Route(app.Server)
	password.Route(app.Server)
	project.Route(app.Server)
	webhooks.Route(app.Server)
	controllers.Index(app.Server)
	notification.Route(app.Server)
}


text:
author: Donna Dubinsky
description: "I am excited to let you know that we recently announced a relationship with Cortical.io, an innovative company based in Austria that is working on the next generation of natural language processing: language intelligence. Cortical.io has created a technology that can"
date: 2015/05/14
image: ../../../../images/numenta.png
org: CEO
tags: numenta newsletter may 2015 announcing relatioship cortical.io
title: "May 2015 Newsletter: Cortical.io Relationship"
type: post
---

### Numenta Newsletter

**May 14, 2015**

Dear Numenta newsletter subscriber:

I am excited to let you know that we recently announced a relationship with
Cortical.io, an innovative company based
in Austria that is working on the next generation of natural language
processing: language intelligence. Cortical.io has created a technology that can
translate text into sparse distributed representations, called Semantic Folding.
By using Cortical.io's Semantic Folding technology in combination with HTM, we
plan to tackle problems in language that have frustrated computer scientists for
many years. To learn more about Cortical.io, you can read our
[press release](/press/2015/05/14/numenta-and-cortical-io-form-strategic-partnership/),
view the Cortical.io [website](http://cortical.io/), or try the Cortical.io API
at [AWS](https://aws.amazon.com/marketplace/seller-profile?id=c88ca878-a648-464c-b29b-38ba057bd2f5).

I also wanted to draw your attention to a new paper about HTM written by
Sebastian Billaudelle, with Subutai Ahmad, our VP Research. As part of the
European based Human Brain Project, Sebastian spent several months at Numenta
porting HTM to the Heidelberg Neuromorphic Computing Platform, with positive
results. Sebastian implemented HTM using spiking neurons, which are complex
models often used by neuroscientists to reproduce actual biophysical
characteristics of neurons. You can read about his work [here](/resources/papers/).

We have several great projects under development and look forward to sharing
more with you over the coming months.


text:
extern "C" {
#endif  // __cplusplus

// Abstract resource type whose lifetime is managed by reference counting.
// Used mostly just to get a virtual dtor and vtable, though we could add nicer
// logging by allowing resources to capture debug names, stack traces of
// creation, etc.
//
// All resource types must have the iree_hal_resource_t at offset 0. This allows
// the HAL code to cast any type pointer to a resource to gain access to the
// ref count and vtable at predictable locations. Note that this allows for the
// resource to be at >0 of the allocation but the pointers used with the HAL
// (iree_hal_event_t*, etc) must point to the iree_hal_resource_t.
typedef struct iree_hal_resource_t {
  // Reference count used to manage resource lifetime. The vtable->destroy
  // method will be called when the reference count falls to zero.
  iree_atomic_ref_count_t ref_count;

  // Opaque vtable for the resource object.
  // Must start with iree_hal_resource_vtable_t at offset 0.
  //
  // NOTE: this field may be hidden in the future. Only use this for
  // IREE_HAL_VTABLE_DISPATCH and not equality/direct dereferencing.
  const void* vtable;

  // TODO(benvanik): debug string/logging utilities.
} iree_hal_resource_t;

// Base vtable for all resources.
// This provides the base functions required to generically manipulate resources
// of various types.
//
// This must be aliased at offset 0 of all typed vtables:
//   typedef struct iree_hal_foo_vtable_t {
//     void(IREE_API_PTR* destroy)(...);
//     void(IREE_API_PTR* foo_method)(...);
//   } iree_hal_foo_vtable_t;
typedef struct iree_hal_resource_vtable_t {
  // Destroys the resource upon the final reference being released.
  // The resource pointer must be assumed invalid upon return from the function
  // (even if in some implementations its returned to a pool and still live).
  void(IREE_API_PTR* destroy)(iree_hal_resource_t* resource);
} iree_hal_resource_vtable_t;

// Verifies that the vtable has the right resource sub-vtable.
#define IREE_HAL_ASSERT_VTABLE_LAYOUT(vtable_type)   \
  static_assert(offsetof(vtable_type, destroy) == 0, \
                "iree_hal_resource_vtable_t must be at offset 0");

// Initializes the base resource type.
static inline void iree_hal_resource_initialize(
    const void* vtable, iree_hal_resource_t* out_resource) {
  iree_atomic_ref_count_init(&out_resource->ref_count);
  out_resource->vtable = vtable;
}

// Retains a resource for the caller.
static inline void iree_hal_resource_retain(const void* any_resource) {
  iree_hal_resource_t* resource = (iree_hal_resource_t*)any_resource;
  if (IREE_LIKELY(resource)) {
    iree_atomic_ref_count_inc(&resource->ref_count);
  }
}

// Releases a resource and destroys it if there are no more references.
// This routes through the vtable and can disable optimizations; always prefer
// to use the type-specific release functions (such as iree_hal_buffer_release)
// to allow for more optimizations and better compile-time type safety.
static inline void iree_hal_resource_release(const void* any_resource) {
  iree_hal_resource_t* resource = (iree_hal_resource_t*)any_resource;
  if (IREE_LIKELY(resource) &&
      iree_atomic_ref_count_dec(&resource->ref_count) == 1) {
    ((iree_hal_resource_vtable_t*)resource->vtable)->destroy(resource);
  }
}

// Returns true if the |resource| has the given |vtable| type.
// This is *not* a way to ensure that an instance is of a specific type but
// instead that it has a compatible vtable. This is because LTO may very rarely
// dedupe identical vtables and cause the pointer comparison to succeed even if
// the spellings of the types differs.
static inline bool iree_hal_resource_is(const void* resource,
                                        const void* vtable) {
  return resource ? ((const iree_hal_resource_t*)resource)->vtable == vtable
                  : false;
}

// Asserts (**DEBUG ONLY**) that the |resource| has the given |vtable| type.
// This is only useful to check for programmer error and may have false
// positives - do not rely on it for handling untrusted user input.
#define IREE_HAL_ASSERT_TYPE(resource, vtable)             \
  IREE_ASSERT_TRUE(iree_hal_resource_is(resource, vtable), \
                   "type does not match expected " #vtable)

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // IREE_HAL_RESOURCE_H_


text:
#ifndef PLC_HARDWARE_H_
#define PLC_HARDWARE_H_
/** \brief Hardware interaction layer
 **
 ** Hardware interaction layer
 **
 **/

/** \addtogroup CIAA_Firmware CIAA Firmware
 ** @{ */
/** \addtogroup PLC PLC Module
 ** @{ */

/*
 * Initials     Name
 * ---------------------------
 * ErPe         Eric Pernia
 * LeKo         Leandro Kollenberger
 */

/*
 * modification history (new versions first)
 * -----------------------------------------------------------
 * 20150428 v0.0.1 ErPe & LeKo CIAA Firmware porting
 * 20120204 v0.0.1 ErPe initial version (for LPCXpresso 1768/9)
 */

/*==================[inclusions]=============================================*/
#include "ciaaPOSIX_stdio.h"  /* <= device handler header */
#include "ciaaPOSIX_string.h" /* <= string header */
#include "ciaak.h"            /* <= ciaa kernel header */

/*==================[cplusplus]==============================================*/
#ifdef __cplusplus
extern "C" {
#endif

/*==================[macros]=================================================*/
/** \brief PLC DIGITAL INPUT PINS */
#define PLC_IN_0 0
#define PLC_IN_1 1
#define PLC_IN_2 2
#define PLC_IN_3 3
#define PLC_IN_4 4
#define PLC_IN_5 5
#define PLC_IN_6 6
#define PLC_IN_7 7
/** \brief PLC DIGITAL OUTPUT PINS */
#define PLC_OUT_0 0
#define PLC_OUT_1 1
#define PLC_OUT_2 2
#define PLC_OUT_3 3
#define PLC_OUT_4 4
#define PLC_OUT_5 5
#define PLC_OUT_6 6
#define PLC_OUT_7 7
/** \brief PLC STATUS PINS */
#define PLC_RUN (1UL << 10)
#define PLC_ERR (1UL << 11)
/*==================[typedef]================================================*/

/*==================[external data declaration]==============================*/

/*==================[external functions declaration]=========================*/
/** \brief PLC PLC_DIOs_Init */
void PLC_DIOs_Init(void);		/* Initialize Digital Inputs and Outputs */
/** \brief PLC_Read_DIs */
uint8_t PLC_Read_DIs(void);		/* Read Digital Outputs */
/** \brief PLC_Write_DOs */
void PLC_Write_DOs(uint8_t);	/* Write Digital Outputs */

/*==================[cplusplus]==============================================*/
#ifdef __cplusplus
}
#endif
/** @} doxygen end group definition */
/** @} doxygen end group definition */
/*==================[end of file]============================================*/
#endif /* PLC_HARDWARE_H_ */


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Classes/PayReq.html">

		<Token>
			<TokenIdentifier>//apple_ref/occ/cl/PayReq</TokenIdentifier>
			<Abstract type="html">第三方向微信终端发起支付的消息结构体

第三方向微信终端发起支付的消息结构体,微信终端处理后会向第三方返回处理结果</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

	<RelatedTokens>
		<TokenIdentifier>//apple_ref/occ/cl/PayResp</TokenIdentifier>

	</RelatedTokens>

			<NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setPartnerId:</TokenIdentifier>
			<Abstract type="html">商家向财付通申请的商家id</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *partnerId</Declaration>

			<Anchor>//api/name/partnerId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/partnerId</TokenIdentifier>
			<Abstract type="html">商家向财付通申请的商家id</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *partnerId</Declaration>

			<Anchor>//api/name/partnerId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/partnerId</TokenIdentifier>
			<Abstract type="html">商家向财付通申请的商家id</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *partnerId</Declaration>

			<Anchor>//api/name/partnerId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setPrepayId:</TokenIdentifier>
			<Abstract type="html">预支付订单</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *prepayId</Declaration>

			<Anchor>//api/name/prepayId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/prepayId</TokenIdentifier>
			<Abstract type="html">预支付订单</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *prepayId</Declaration>

			<Anchor>//api/name/prepayId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/prepayId</TokenIdentifier>
			<Abstract type="html">预支付订单</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *prepayId</Declaration>

			<Anchor>//api/name/prepayId</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setNonceStr:</TokenIdentifier>
			<Abstract type="html">随机串,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *nonceStr</Declaration>

			<Anchor>//api/name/nonceStr</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/nonceStr</TokenIdentifier>
			<Abstract type="html">随机串,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *nonceStr</Declaration>

			<Anchor>//api/name/nonceStr</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/nonceStr</TokenIdentifier>
			<Abstract type="html">随机串,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *nonceStr</Declaration>

			<Anchor>//api/name/nonceStr</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setTimeStamp:</TokenIdentifier>
			<Abstract type="html">时间戳,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, assign) UInt32 timeStamp</Declaration>

			<Anchor>//api/name/timeStamp</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/timeStamp</TokenIdentifier>
			<Abstract type="html">时间戳,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, assign) UInt32 timeStamp</Declaration>

			<Anchor>//api/name/timeStamp</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/timeStamp</TokenIdentifier>
			<Abstract type="html">时间戳,防重发</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, assign) UInt32 timeStamp</Declaration>

			<Anchor>//api/name/timeStamp</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setPackage:</TokenIdentifier>
			<Abstract type="html">商家根据财付通文档填写的数据和签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *package</Declaration>

			<Anchor>//api/name/package</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/package</TokenIdentifier>
			<Abstract type="html">商家根据财付通文档填写的数据和签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *package</Declaration>

			<Anchor>//api/name/package</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/package</TokenIdentifier>
			<Abstract type="html">商家根据财付通文档填写的数据和签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *package</Declaration>

			<Anchor>//api/name/package</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/setSign:</TokenIdentifier>
			<Abstract type="html">商家根据微信开放平台文档对数据做的签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *sign</Declaration>

			<Anchor>//api/name/sign</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/PayReq/sign</TokenIdentifier>
			<Abstract type="html">商家根据微信开放平台文档对数据做的签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *sign</Declaration>

			<Anchor>//api/name/sign</Anchor>
            <NodeRef refid="35"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/PayReq/sign</TokenIdentifier>
			<Abstract type="html">商家根据微信开放平台文档对数据做的签名</Abstract>
			<DeclaredIn>WXApiObject.h</DeclaredIn>

			<Declaration>@property (nonatomic, retain) NSString *sign</Declaration>

			<Anchor>//api/name/sign</Anchor>
            <NodeRef refid="35"/>
		</Token>

	</File>
</Tokens>


text:
<?php

namespace api\modules\chart\controllers;

use yii;
use kartik\datecontrol\Module;
use yii\helpers\Json;
use yii\rest\ActiveController;
use yii\web\Controller;
use yii\data\ActiveDataProvider;
use yii\data\ArrayDataProvider;
use common\models\User;
use api\modules\sistem\models\UserloginSearch;
use yii\filters\auth\CompositeAuth;
use yii\filters\auth\QueryParamAuth;
use yii\filters\auth\HttpBasicAuth;
use yii\filters\auth\HttpBearerAuth;
use yii\filters\ContentNegotiator;
use yii\filters\VerbFilter;
use yii\web\Response;
use yii\helpers\ArrayHelper;
use api\modules\chart\models\Cnfweek;
use api\modules\chart\models\Cnfmonth;
use api\modules\chart\models\FusionChart;

class EsmsalesmduserController extends ActiveController
{
	public $modelClass = 'api\modules\chart\models\Cnfweek';
	public $serializer = [
		'class' => 'yii\rest\Serializer',
		'collectionEnvelope' => 'SalesUser',
	];

    public function behaviors()    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' => CompositeAuth::className(),
                'authMethods' => [
                 // ['class' => HttpBearerAuth::className()],
                 // ['class' => QueryParamAuth::className()],//, 'tokenParam' => 'access-token'],
                ]
            ],
			'bootstrap'=> [
				'class' => ContentNegotiator::className(),
				'formats' => [
					'application/json' => Response::FORMAT_JSON,'charset' => 'UTF-8',
				],
				'languages' => [
					'en',
					'de',
				],
			],
			'corsFilter' => [
				'class' => \yii\filters\Cors::className(),
				'cors' => [
					// restrict access to
					'Origin' => ['*'],
					'Access-Control-Request-Method' => ['POST', 'PUT','GET'],
					// Allow only POST and PUT methods
					'Access-Control-Request-Headers' => ['X-Wsse'],
					// Allow only headers 'X-Wsse'
					'Access-Control-Allow-Credentials' => true,
					// Allow OPTIONS caching
					'Access-Control-Max-Age' => 3600,
					// Allow the X-Pagination-Current-Page header to be exposed to the browser.
					'Access-Control-Expose-Headers' => ['X-Pagination-Current-Page'],
				]
			],
        ]);

    }

	/**
     * @inheritdoc
     */
	public function actions()
	{
		$actions = parent::actions();
		unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']);
		//unset($actions['update'], $actions['create'], $actions['delete'], $actions['view']);
		//set($actions['visit']);
		return $actions;
	}

	public function actionIndex()
	{
        $f_date     = date('Y-m-01');
        $l_date     = date('Y-m-t');
        $NM_END 	= 'SALESMD';
		$data_view=Yii::$app->db_emp
						        ->createCommand('SELECT users.ID_USER,users.NM_FIRST,users.IMG_BASE64 FROM dbm_086.user_profile users WHERE users.NM_END = "'.$NM_END.'" ')
						        ->queryAll();
		$provider= new ArrayDataProvider(['allModels'=>$data_view,'pagination' => ['pageSize' => 1000,]]);
		return $provider;
	}

	public function actionSearch()
    {
        if (!empty($_GET))
        {
        	$TGLSTART   = $_GET['TGLSTART'];
            $TGLEND     = $_GET['TGLEND'];
        	$USER_ID 	= $_GET['USER_ID'];
        	$f_date     = date('Y-m-d', strtotime($TGLSTART));
	        $l_date     = date('Y-m-d', strtotime($TGLEND));
	        $namabulan  = date('F Y', strtotime($TGLSTART));

        	$data_view=Yii::$app->db_emp
						        ->createCommand('SELECT SUM(CASE WHEN scdldetail.STATUS = 1 THEN 1 ELSE 0 END)AS CC,SUM(CASE WHEN scdldetail.STATUS = 0 THEN 1 ELSE 0 END)AS NC,scdldetail.ID,scdldetail.TGL,scdldetail.CUST_ID FROM dbc002.c0002scdl_detail scdldetail
												WHERE scdldetail.USER_ID='.$USER_ID .' AND scdldetail.TGL BETWEEN "'.$f_date.'" AND "'.$l_date.'" GROUP BY scdldetail.TGL ORDER BY scdldetail.TGL ASC')
						        ->queryAll();

			foreach ($data_view as $key => $value)
			{
				$TGL         	= $value['TGL'];
            	$category[]     = array('label' => $TGL);
			}
			$categories[]   = array('category'=>$category);

			foreach ($data_view as $key => $value)
			{
				$CC         	= $value['CC'];
				$NC         	= $value['NC'];
            	$dataCC[]     	= array('value'=>$CC);
            	$dataNC[]     	= array('value'=>$NC);
			}
	        $dataset[]  = array('seriesname'=>'ACTIVE CALL','data'=>$dataCC);
	        $dataset[]  = array('seriesname'=>'NONACTIVE CALL','data'=>$dataNC);

			$FS = new FusionChart();
	        $FS->setCaption('Customer Call');
	        $FS->setSubCaption($namabulan);
	        $FS->setLabelDisplay('rotate');
	        $FS->setXAxisName('Tanggal Call');
	        $chart = Yii::$app->ambilkonci->objectToArray($FS);

	        $result = array('chart'=>$chart,'categories'=>$categories,'dataset'=>$dataset);
	        $resulteffectivecall = $this->EffectiveCall($TGLSTART,$TGLEND,$USER_ID);
	        $resultNewCustomer	 = $this->NewCustomer($TGLSTART,$TGLEND,$USER_ID);
            $JumlahKunjunganLayerA  = $this->JumlahKunjunganLayerA($TGLSTART,$TGLEND,$USER_ID);
            $JumlahKunjunganLayerB  = $this->JumlahKunjunganLayerB($TGLSTART,$TGLEND,$USER_ID);
	        return array(
                            'CustomerCall'=>$result,
                            'EffectiveCall'=>$resulteffectivecall,
                            'NewCustomer'=>$resultNewCustomer,
                            'JumlahKunjunganLayerA'=>$JumlahKunjunganLayerA,
                            'JumlahKunjunganLayerB'=>$JumlahKunjunganLayerB
                        );

        }
    }

	public function EffectiveCall($TGLSTART,$TGLEND,$USER_ID)
    {
        $USER_ID	= $USER_ID;
        $f_date     = date('Y-m-d', strtotime($TGLSTART));
        $l_date     = date('Y-m-d', strtotime($TGLEND));
        $namabulan  = date('F Y', strtotime($TGLSTART));

        $commandlayer    = Yii::$app->db3
                                ->createCommand('SELECT layer.LAYER_ID,layer.LAYER_NM FROM dbc002.c0002scdl_layer layer WHERE layer.LAYER_ID != 5')
                                ->queryAll();

        $commandproduct         = Yii::$app->db3
                                ->createCommand('SELECT prod.KD_BARANG,prod.NM_BARANG,prod.KD_TYPE FROM dbc002.b0001 prod WHERE prod.KD_TYPE=01 AND prod.KD_KATEGORI=01')
                                ->queryAll();

        foreach ($commandlayer as $key => $valuelayer)
        {
            $LAYER_NM       = $valuelayer['LAYER_NM'];
            $category[]     = array('label' => $LAYER_NM);
        }

        foreach ($commandproduct as $key => $valueproduct)
        {
            $KD_BARANG      = $valueproduct['KD_BARANG'];
            $NM_BARANG      = $valueproduct['NM_BARANG'];

            $data           = array();
            foreach ($commandlayer as $key => $valuelayer)
            {
                $LAYER_ID         = $valuelayer['LAYER_ID'];

                $commandstock   = Yii::$app->db3
                                ->createCommand('SELECT SUM(stock.SO_QTY) as JUMLAH ,stock.USER_ID,stock.NM_BARANG,stock.CUST_NM,stock.TGL,cust.LAYER,stock.SO_TYPE,stock.SO_QTY FROM dbc002.so_t2 stock
												INNER JOIN dbc002.c0001 cust ON stock.CUST_KD = cust.CUST_KD
												WHERE
												stock.SO_TYPE = 9 AND
												stock.USER_ID = '.$USER_ID.' AND
												stock.KD_BARANG= "'. $KD_BARANG. '" AND
												stock.TGL BETWEEN "'.$f_date.'" AND "'.$l_date.'" AND cust.LAYER = '.$LAYER_ID.' ')
                                ->queryAll();

                if($commandstock[0]['JUMLAH'])
                {
                    $total = $commandstock[0]['JUMLAH'];
                }
                else
                {
                    $total = 0;
                }
                $data[]     = array('value'=>$total);
            }
            $dataset[]  = array('seriesname'=>$NM_BARANG,'data'=>$data);
        }

        $categories[]   = array('category'=>$category);
        $FS = new FusionChart();
        $FS->setCaption('Request Estimate');
        $FS->setSubCaption($namabulan);
        $FS->setXAxisName('Layer');
        $chart = Yii::$app->ambilkonci->objectToArray($FS);
        $result = array('chart'=>$chart,'categories'=>$categories,'dataset'=>$dataset);
        return $result;
    }

    public function NewCustomer($TGLSTART,$TGLEND,$USER_ID)
	{

        $f_date     = date('Y-m-01', strtotime($TGLSTART));
        $l_date     = date('Y-m-t', strtotime($TGLEND));
        $USER_ID    = $USER_ID;
        $namabulan  = date('F Y', strtotime($TGLSTART));

        $commandgeo    = Yii::$app->db3
                                ->createCommand('SELECT geo.GEO_ID,geo.GEO_NM FROM dbc002.c0002scdl_geo geo WHERE geo.GEO_ID != 1 AND geo.GEO_ID != 7')
                                ->queryAll();

        $commandlayer    = Yii::$app->db3
                                ->createCommand('SELECT layer.LAYER_ID,layer.LAYER_NM FROM dbc002.c0002scdl_layer layer')
                                ->queryAll();

        foreach ($commandgeo as $key => $valuegeo)
        {
        	$GEO_NM 		= $valuegeo['GEO_NM'];
        	$category[] 	= array('label' => $GEO_NM);
        }

        foreach ($commandlayer as $key => $valuelayer)
        {
        	$ID_LAYER 		= $valuelayer['LAYER_ID'];
        	$data 			= array();
        	foreach ($commandgeo as $key => $valuegeo)
	        {
	        	$ID_GEO 	= $valuegeo['GEO_ID'];
	        	$commandcust    = Yii::$app->db3
                                ->createCommand('
                                                    SELECT cust.CUST_KD FROM dbc002.c0001 cust
                                                    INNER JOIN dbm001.user users on cust.CREATED_BY = users.username
                                                    WHERE cust.JOIN_DATE BETWEEN "'.$f_date.'"
                                                    AND "'.$l_date.'"
                                                    AND users.id = '.$USER_ID.'
                                                    AND cust.GEO =' .$ID_GEO. '
                                                    AND cust.LAYER='.$ID_LAYER
                                                )
                                ->queryAll();
                $jumlah		= count($commandcust);
                $data[]     = array('value'=>$jumlah);
	        }
        	$dataset[]  = array('seriesname'=>$valuelayer['LAYER_NM'],'data'=>$data);
        }
        $categories[] 	= array('category'=>$category);

        $FS = new FusionChart();
        $FS->setCaption('New Customer ');
        $FS->setSubCaption('On '.$namabulan);
        $FS->setXAxisName('Geolocation');
        $chart = Yii::$app->ambilkonci->objectToArray($FS);

		$result = array('chart'=>$chart,'categories'=>$categories,'dataset'=>$dataset);
		return $result;
	}

    public function JumlahKunjunganLayerA($TGLSTART,$TGLEND,$USER_ID)
    {

        $USER_ID    = $USER_ID;
        $f_date     = date('Y-m-01', strtotime($TGLSTART));
        $l_date     = date('Y-m-t', strtotime($TGLEND));

        $namabulan  = date('F Y', strtotime($TGLSTART));

        $commandlayer    = Yii::$app->db3
                                ->createCommand('SELECT layer.LAYER_ID,layer.LAYER_NM FROM dbc002.c0002scdl_layer layer WHERE layer.LAYER_ID != 5')
                                ->queryAll();

        $commandcust    = Yii::$app->db3
                            ->createCommand('SELECT cust.CUST_NM as label,Jadwal.LALA as value FROM dbc002.c0001 cust
                                            INNER JOIN
                                            (
                                                SELECT scdl.CUST_ID,xx.LAYER,xx.GEO,SUM(scdl.STATUS)AS LALA
                                                FROM dbc002.c0002scdl_detail scdl
                                                INNER JOIN dbc002.c0001 xx ON scdl.CUST_ID = xx.CUST_KD
                                                WHERE scdl.USER_ID = ' .$USER_ID. ' AND scdl.TGL BETWEEN "'.$f_date.'" AND "'.$l_date.'" GROUP BY scdl.CUST_ID
                                            )AS Jadwal
                                            ON cust.CUST_KD = Jadwal.CUST_ID
                                            WHERE  cust.GEO = Jadwal.GEO AND cust.LAYER = 1
                                            ORDER BY Jadwal.LALA DESC')
                            ->queryAll();

        $data         = $commandcust;

        $FS = new FusionChart();
        $FS->setCaption('Jumlah Kunjungan');
        $FS->setXAxisName('Layer A');
        $FS->setLabelDisplay('rotate');
        $FS->setSlantLabels(1);
        $chart = Yii::$app->ambilkonci->objectToArray($FS);

        $result = array('chart'=>$chart,'data'=>$data);
        return $result;
    }
    public function JumlahKunjunganLayerB($TGLSTART,$TGLEND,$USER_ID)
    {

        $USER_ID    = $USER_ID;
        $f_date     = date('Y-m-01', strtotime($TGLSTART));
        $l_date     = date('Y-m-t', strtotime($TGLEND));

        $namabulan  = date('F Y', strtotime($TGLSTART));

        $commandlayer    = Yii::$app->db3
                                ->createCommand('SELECT layer.LAYER_ID,layer.LAYER_NM FROM dbc002.c0002scdl_layer layer WHERE layer.LAYER_ID != 5')
                                ->queryAll();

        $commandcust    = Yii::$app->db3
                            ->createCommand('SELECT cust.CUST_NM as label,Jadwal.LALA as value FROM dbc002.c0001 cust
                                            INNER JOIN
                                            (
                                                SELECT scdl.CUST_ID,xx.LAYER,xx.GEO,SUM(scdl.STATUS)AS LALA
                                                FROM dbc002.c0002scdl_detail scdl
                                                INNER JOIN dbc002.c0001 xx ON scdl.CUST_ID = xx.CUST_KD
                                                WHERE scdl.USER_ID = ' .$USER_ID. ' AND scdl.TGL BETWEEN "'.$f_date.'" AND "'.$l_date.'" GROUP BY scdl.CUST_ID
                                            )AS Jadwal
                                            ON cust.CUST_KD = Jadwal.CUST_ID
                                            WHERE  cust.GEO = Jadwal.GEO AND cust.LAYER = 2
                                            ORDER BY Jadwal.LALA DESC')
                            ->queryAll();

        $data         = $commandcust;

        $FS = new FusionChart();
        $FS->setCaption('Jumlah Kunjungan');
        $FS->setXAxisName('Layer B');
        $FS->setLabelDisplay('rotate');
        $FS->setSlantLabels(1);
        $chart = Yii::$app->ambilkonci->objectToArray($FS);

        $result = array('chart'=>$chart,'data'=>$data);
        return $result;
    }

}


text:
/* eslint-env node */
const { Command } = require("discord-akairo");
const config = require("./../../config.json");

function exec(message) {
    let infoMsg = `I am ${this.client.user.username}, a selfhosted instance of [YoutubeBot](https://github.com/GregoryGregoryGregory/YoutubeDiscordBot) by Greg#5821. If you would like to host your own YoutubeBot, check out the [docs](about:blank). To get a list of commands for this instance, do ${config.prefix}help`;
    config.mention_prefix === true ? infoMsg += ", or you can use a mention as the prefix." : infoMsg += ".";
    return message.channel.sendEmbed(this.client.util.embed().setAuthor(`Hello! I am ${this.client.user.username}`).setColor(14493733).setDescription(infoMsg));
}

module.exports = new Command("information", exec, {
    aliases: ["info", "youtube", "yt", "information"]
});


text:
===============================
approx
===============================

.. image:: https://img.shields.io/travis/jeroyang/approx.svg
        :target: https://travis-ci.org/jeroyang/approx

.. image:: https://img.shields.io/pypi/v/approx.svg
        :target: https://pypi.python.org/pypi/approx

A game for mental mathematicsin approximate numbers

* Free software: BSD license
* Documentation: https://approx.readthedocs.org.

Features
--------

* TODO


text:
You may whant to set the following environment variables:

```
DB_URL: jdbc:postgresql://DB-HOST:5432/DB-NAME
DB_USERNAME: user-name
DB_PASSWORD: your-password
DB_DIALECT: org.hibernate.dialect.PostgreSQLDialect
DB_DRIVER: org.postgresql.Driver
```

Also there are a few locations you may whant to mount as volumes:

```
/srv/squash-tm/tmp                         # Jetty tmp and work directory
/srv/squash-tm/bundles                     # Bundles directory
/srv/squash-tm/conf                        # Configurations directory
/srv/squash-tm/logs                        # Log directory
/srv/squash-tm/jettyhome                   # Jetty home directory
/srv/squash-tm/luceneindexes               # Lucene indexes directory
/srv/squash-tm/plugins                     # Plugins directory
```

## Preparation for the first run

If you are going to use Postgres database you need to prepare DB and schema.

Run bash command on this image/container. e.g:

```
docker run --rm -it logicify/squash-tm /bin/bash
```

and issue the following:

```
psql -h <DBHOST HERE> --user $DB_USER $DB_NAME < ../database-scripts/postgresql-full-install-version-1.14.0.RELEASE.sql
```

## Docker compose example

Here is an example of the configuration using docker compose. Which starts an app on the port ```8012``` using external postgres databse (separate container):

```
postgres:
  build: postgres:9.4.1
  expose:
    - 5432
  volumes:
    - ./data-postgres:/var/lib/postgresql/data

squashtm:
  image: logicify/squash-tm:latest
  ports:
    - "8012:8080"
  environment:
    DB_URL: jdbc:postgresql://postgres:5432/squashtm
    DB_USERNAME: squashtm
    DB_PASSWORD: your-password
    DB_DIALECT: org.hibernate.dialect.PostgreSQLDialect
    DB_DRIVER: org.postgresql.Driver
  links:
    - postgres:postgres
```


text:
(function () {
    'use strict';

    angular
        .module('jass.config')
        .config(config);

    config.$inject = ['$locationProvider'];

    function config($locationProvider) {
        $locationProvider.html5Mode(true);
        $locationProvider.hashPrefix('!');
    }
})();


text:
<?php
namespace Inventory\Domain\Item\Serial;

use Application\Domain\Shared\AbstractDTO;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class SerialSnapshot extends AbstractDTO
{

    /*
     * |=============================
     * | Inventory\Domain\Item\Serial\BaseSerial
     * |
     * |=============================
     */
    public $invoiceSysNumber;

    public $vendorName;

    public $invoiceId;

    public $invoiceToken;

    public $grSysNumber;

    public $grId;

    public $grToken;

    public $itemName;

    public $itemToken;

    /*
     * |=============================
     * | Inventory\Domain\Item\Serial\AbstractSerial
     * |
     * |=============================
     */
    public $id;

    public $token;

    public $serialNumber;

    public $isActive;

    public $remarks;

    public $createdOn;

    public $consumedOn;

    public $mfgSerialNumber;

    public $mfgDate;

    public $lotNumber;

    public $mfgWarrantyStart;

    public $mfgWarrantyEnd;

    public $location;

    public $category;

    public $mfgName;

    public $lastchangeOn;

    public $revisionNo;

    public $sysNumber;

    public $serialNumber1;

    public $serialNumber2;

    public $serialNumber3;

    public $mfgModel;

    public $mfgModel1;

    public $mfgModel2;

    public $mfgDescription;

    public $capacity;

    public $erpAssetNumber;

    public $erpAssetNumber1;

    public $isReversed;

    public $reversalDate;

    public $reversalDoc;

    public $reversalReason;

    public $isReversable;

    public $uuid;

    public $createdBy;

    public $lastchangeBy;

    public $item;

    public $serial;

    public $inventoryTrx;

    public $apRow;

    public $grRow;

    public $originCountry;

    /**
     *
     * @return mixed
     */
    public function getInvoiceSysNumber()
    {
        return $this->invoiceSysNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getInvoiceId()
    {
        return $this->invoiceId;
    }

    /**
     *
     * @return mixed
     */
    public function getInvoiceToken()
    {
        return $this->invoiceToken;
    }

    /**
     *
     * @return mixed
     */
    public function getGrSysNumber()
    {
        return $this->grSysNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getGrId()
    {
        return $this->grId;
    }

    /**
     *
     * @return mixed
     */
    public function getGrToken()
    {
        return $this->grToken;
    }

    /**
     *
     * @return mixed
     */
    public function getItemName()
    {
        return $this->itemName;
    }

    /**
     *
     * @return mixed
     */
    public function getItemToken()
    {
        return $this->itemToken;
    }

    /**
     *
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     *
     * @return mixed
     */
    public function getToken()
    {
        return $this->token;
    }

    /**
     *
     * @return mixed
     */
    public function getSerialNumber()
    {
        return $this->serialNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     *
     * @return mixed
     */
    public function getRemarks()
    {
        return $this->remarks;
    }

    /**
     *
     * @return mixed
     */
    public function getCreatedOn()
    {
        return $this->createdOn;
    }

    /**
     *
     * @return mixed
     */
    public function getConsumedOn()
    {
        return $this->consumedOn;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgSerialNumber()
    {
        return $this->mfgSerialNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgDate()
    {
        return $this->mfgDate;
    }

    /**
     *
     * @return mixed
     */
    public function getLotNumber()
    {
        return $this->lotNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgWarrantyStart()
    {
        return $this->mfgWarrantyStart;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgWarrantyEnd()
    {
        return $this->mfgWarrantyEnd;
    }

    /**
     *
     * @return mixed
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     *
     * @return mixed
     */
    public function getCategory()
    {
        return $this->category;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgName()
    {
        return $this->mfgName;
    }

    /**
     *
     * @return mixed
     */
    public function getLastchangeOn()
    {
        return $this->lastchangeOn;
    }

    /**
     *
     * @return mixed
     */
    public function getRevisionNo()
    {
        return $this->revisionNo;
    }

    /**
     *
     * @return mixed
     */
    public function getSysNumber()
    {
        return $this->sysNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getSerialNumber1()
    {
        return $this->serialNumber1;
    }

    /**
     *
     * @return mixed
     */
    public function getSerialNumber2()
    {
        return $this->serialNumber2;
    }

    /**
     *
     * @return mixed
     */
    public function getSerialNumber3()
    {
        return $this->serialNumber3;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgModel()
    {
        return $this->mfgModel;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgModel1()
    {
        return $this->mfgModel1;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgModel2()
    {
        return $this->mfgModel2;
    }

    /**
     *
     * @return mixed
     */
    public function getMfgDescription()
    {
        return $this->mfgDescription;
    }

    /**
     *
     * @return mixed
     */
    public function getCapacity()
    {
        return $this->capacity;
    }

    /**
     *
     * @return mixed
     */
    public function getErpAssetNumber()
    {
        return $this->erpAssetNumber;
    }

    /**
     *
     * @return mixed
     */
    public function getErpAssetNumber1()
    {
        return $this->erpAssetNumber1;
    }

    /**
     *
     * @return mixed
     */
    public function getIsReversed()
    {
        return $this->isReversed;
    }

    /**
     *
     * @return mixed
     */
    public function getReversalDate()
    {
        return $this->reversalDate;
    }

    /**
     *
     * @return mixed
     */
    public function getReversalDoc()
    {
        return $this->reversalDoc;
    }

    /**
     *
     * @return mixed
     */
    public function getReversalReason()
    {
        return $this->reversalReason;
    }

    /**
     *
     * @return mixed
     */
    public function getIsReversable()
    {
        return $this->isReversable;
    }

    /**
     *
     * @return mixed
     */
    public function getUuid()
    {
        return $this->uuid;
    }

    /**
     *
     * @return mixed
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     *
     * @return mixed
     */
    public function getLastchangeBy()
    {
        return $this->lastchangeBy;
    }

    /**
     *
     * @return mixed
     */
    public function getItem()
    {
        return $this->item;
    }

    /**
     *
     * @return mixed
     */
    public function getSerial()
    {
        return $this->serial;
    }

    /**
     *
     * @return mixed
     */
    public function getInventoryTrx()
    {
        return $this->inventoryTrx;
    }

    /**
     *
     * @return mixed
     */
    public function getApRow()
    {
        return $this->apRow;
    }

    /**
     *
     * @return mixed
     */
    public function getGrRow()
    {
        return $this->grRow;
    }

    /**
     *
     * @return mixed
     */
    public function getOriginCountry()
    {
        return $this->originCountry;
    }

    /**
     *
     * @param mixed $invoiceSysNumber
     */
    public function setInvoiceSysNumber($invoiceSysNumber)
    {
        $this->invoiceSysNumber = $invoiceSysNumber;
    }

    /**
     *
     * @param mixed $invoiceId
     */
    public function setInvoiceId($invoiceId)
    {
        $this->invoiceId = $invoiceId;
    }

    /**
     *
     * @param mixed $invoiceToken
     */
    public function setInvoiceToken($invoiceToken)
    {
        $this->invoiceToken = $invoiceToken;
    }

    /**
     *
     * @param mixed $grSysNumber
     */
    public function setGrSysNumber($grSysNumber)
    {
        $this->grSysNumber = $grSysNumber;
    }

    /**
     *
     * @param mixed $grId
     */
    public function setGrId($grId)
    {
        $this->grId = $grId;
    }

    /**
     *
     * @param mixed $grToken
     */
    public function setGrToken($grToken)
    {
        $this->grToken = $grToken;
    }

    /**
     *
     * @param mixed $itemName
     */
    public function setItemName($itemName)
    {
        $this->itemName = $itemName;
    }

    /**
     *
     * @param mixed $itemToken
     */
    public function setItemToken($itemToken)
    {
        $this->itemToken = $itemToken;
    }

    /**
     *
     * @param mixed $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     *
     * @param mixed $token
     */
    public function setToken($token)
    {
        $this->token = $token;
    }

    /**
     *
     * @param mixed $serialNumber
     */
    public function setSerialNumber($serialNumber)
    {
        $this->serialNumber = $serialNumber;
    }

    /**
     *
     * @param mixed $isActive
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;
    }

    /**
     *
     * @param mixed $remarks
     */
    public function setRemarks($remarks)
    {
        $this->remarks = $remarks;
    }

    /**
     *
     * @param mixed $createdOn
     */
    public function setCreatedOn($createdOn)
    {
        $this->createdOn = $createdOn;
    }

    /**
     *
     * @param mixed $consumedOn
     */
    public function setConsumedOn($consumedOn)
    {
        $this->consumedOn = $consumedOn;
    }

    /**
     *
     * @param mixed $mfgSerialNumber
     */
    public function setMfgSerialNumber($mfgSerialNumber)
    {
        $this->mfgSerialNumber = $mfgSerialNumber;
    }

    /**
     *
     * @param mixed $mfgDate
     */
    public function setMfgDate($mfgDate)
    {
        $this->mfgDate = $mfgDate;
    }

    /**
     *
     * @param mixed $lotNumber
     */
    public function setLotNumber($lotNumber)
    {
        $this->lotNumber = $lotNumber;
    }

    /**
     *
     * @param mixed $mfgWarrantyStart
     */
    public function setMfgWarrantyStart($mfgWarrantyStart)
    {
        $this->mfgWarrantyStart = $mfgWarrantyStart;
    }

    /**
     *
     * @param mixed $mfgWarrantyEnd
     */
    public function setMfgWarrantyEnd($mfgWarrantyEnd)
    {
        $this->mfgWarrantyEnd = $mfgWarrantyEnd;
    }

    /**
     *
     * @param mixed $location
     */
    public function setLocation($location)
    {
        $this->location = $location;
    }

    /**
     *
     * @param mixed $category
     */
    public function setCategory($category)
    {
        $this->category = $category;
    }

    /**
     *
     * @param mixed $mfgName
     */
    public function setMfgName($mfgName)
    {
        $this->mfgName = $mfgName;
    }

    /**
     *
     * @param mixed $lastchangeOn
     */
    public function setLastchangeOn($lastchangeOn)
    {
        $this->lastchangeOn = $lastchangeOn;
    }

    /**
     *
     * @param mixed $revisionNo
     */
    public function setRevisionNo($revisionNo)
    {
        $this->revisionNo = $revisionNo;
    }

    /**
     *
     * @param mixed $sysNumber
     */
    public function setSysNumber($sysNumber)
    {
        $this->sysNumber = $sysNumber;
    }

    /**
     *
     * @param mixed $serialNumber1
     */
    public function setSerialNumber1($serialNumber1)
    {
        $this->serialNumber1 = $serialNumber1;
    }

    /**
     *
     * @param mixed $serialNumber2
     */
    public function setSerialNumber2($serialNumber2)
    {
        $this->serialNumber2 = $serialNumber2;
    }

    /**
     *
     * @param mixed $serialNumber3
     */
    public function setSerialNumber3($serialNumber3)
    {
        $this->serialNumber3 = $serialNumber3;
    }

    /**
     *
     * @param mixed $mfgModel
     */
    public function setMfgModel($mfgModel)
    {
        $this->mfgModel = $mfgModel;
    }

    /**
     *
     * @param mixed $mfgModel1
     */
    public function setMfgModel1($mfgModel1)
    {
        $this->mfgModel1 = $mfgModel1;
    }

    /**
     *
     * @param mixed $mfgModel2
     */
    public function setMfgModel2($mfgModel2)
    {
        $this->mfgModel2 = $mfgModel2;
    }

    /**
     *
     * @param mixed $mfgDescription
     */
    public function setMfgDescription($mfgDescription)
    {
        $this->mfgDescription = $mfgDescription;
    }

    /**
     *
     * @param mixed $capacity
     */
    public function setCapacity($capacity)
    {
        $this->capacity = $capacity;
    }

    /**
     *
     * @param mixed $erpAssetNumber
     */
    public function setErpAssetNumber($erpAssetNumber)
    {
        $this->erpAssetNumber = $erpAssetNumber;
    }

    /**
     *
     * @param mixed $erpAssetNumber1
     */
    public function setErpAssetNumber1($erpAssetNumber1)
    {
        $this->erpAssetNumber1 = $erpAssetNumber1;
    }

    /**
     *
     * @param mixed $isReversed
     */
    public function setIsReversed($isReversed)
    {
        $this->isReversed = $isReversed;
    }

    /**
     *
     * @param mixed $reversalDate
     */
    public function setReversalDate($reversalDate)
    {
        $this->reversalDate = $reversalDate;
    }

    /**
     *
     * @param mixed $reversalDoc
     */
    public function setReversalDoc($reversalDoc)
    {
        $this->reversalDoc = $reversalDoc;
    }

    /**
     *
     * @param mixed $reversalReason
     */
    public function setReversalReason($reversalReason)
    {
        $this->reversalReason = $reversalReason;
    }

    /**
     *
     * @param mixed $isReversable
     */
    public function setIsReversable($isReversable)
    {
        $this->isReversable = $isReversable;
    }

    /**
     *
     * @param mixed $uuid
     */
    public function setUuid($uuid)
    {
        $this->uuid = $uuid;
    }

    /**
     *
     * @param mixed $createdBy
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;
    }

    /**
     *
     * @param mixed $lastchangeBy
     */
    public function setLastchangeBy($lastchangeBy)
    {
        $this->lastchangeBy = $lastchangeBy;
    }

    /**
     *
     * @param mixed $item
     */
    public function setItem($item)
    {
        $this->item = $item;
    }

    /**
     *
     * @param mixed $serial
     */
    public function setSerial($serial)
    {
        $this->serial = $serial;
    }

    /**
     *
     * @param mixed $inventoryTrx
     */
    public function setInventoryTrx($inventoryTrx)
    {
        $this->inventoryTrx = $inventoryTrx;
    }

    /**
     *
     * @param mixed $apRow
     */
    public function setApRow($apRow)
    {
        $this->apRow = $apRow;
    }

    /**
     *
     * @param mixed $grRow
     */
    public function setGrRow($grRow)
    {
        $this->grRow = $grRow;
    }

    /**
     *
     * @param mixed $originCountry
     */
    public function setOriginCountry($originCountry)
    {
        $this->originCountry = $originCountry;
    }

    /**
     *
     * @return mixed
     */
    public function getVendorName()
    {
        return $this->vendorName;
    }
}


text:
<template name="question">

{{type}}

{{title}}

{{desc}}

                {{#each opt in options}}

                    <input name="{{getName}}" type="radio" id="{{getId @index}}"
                           value="{{@index}}" {{getChecked @index}}/>

                        {{opt.title}}   {{opt.desc}}

                {{/each}}

</template>


text:
New Candidate

        <form class="form-horizontal" data-ng-submit="create()" novalidate>
            <fieldset>

                    Name

                        <input type="text" data-ng-model="candidate.name" id="name" class="form-control" placeholder="Name" required>

                    Nationality

                        <select id="nationality" name="nationality" class="form-control" data-ng-model="candidate.nationality" placeholder="nationality">
						  <option value="ch">Swiss</option>
						  <option value="de">German</option>
						  <option value="in">Indian</option>
						</select>

                    Bachelor in related fields?

                        <input type="checkbox" data-ng-model="candidate.relevantBachelor" id="relevantBachelor" class="form-control" required>

                    Grades

                        <input type="text" data-ng-model="candidate.grades" id="grades" class="form-control" placeholder="Candidate's grades" required>

                    Diplom from a certified University

                        <input type="checkbox" data-ng-model="candidate.certifiedUniversity" id="certifiedUniversity" class="form-control" required>

					Contact Information (Phone number, Address, ...)
					<textarea id="contactInformation" name="contactInformation" class="form-control" data-ng-model="candidate.contactInformation" placeholder="Write down the candidate's address, phone number or other contact information."></textarea>

					Academic Qualifications
					<textarea id="academicQualifications" name="academicQualifications" class="form-control" data-ng-model="candidate.academicQualifications" placeholder="Write down the candidate's academic qualifications."></textarea>

					Professional Experience
					<textarea id="professionalExperience" name="professionalExperience" class="form-control" data-ng-model="candidate.professionalExperience" placeholder="Write down the candidate's professional experience."></textarea>

                    <input type="submit" value="Update" class="btn btn-default">

					Candidate Saved Successfully

            </fieldset>
        </form>