text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class FixCorporationContract extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		Schema::table('corporation_contracts', function(Blueprint $table)
			{
				$table->integer('assigneeID')->after('issuerCorpID');
			});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
		Schema::table('corporation_contracts', function(Blueprint $table)
			{
				$table->dropColumn('assigneeID');
			});
	}

}


text:
using Alachisoft.NCache.Common.Pooling.Lease;
using Alachisoft.NCache.Common.Pooling.Extension;

namespace Alachisoft.NCache.Common.Protobuf
{
    public partial class RemoveCommand : SimpleLease
    {
        #region ILeasable

        public override sealed void ResetLeasable()
        {
            commandID = -1;
            datasourceItemRemovedCallbackId = default(int);
            extensionObject = default(ProtoBuf.IExtension);
            flag = default(int);
            isAsync = default(bool);
            key = string.Empty;
            lockAccessType = default(int);
            lockId = string.Empty;
            MethodOverload = 0;
            providerName = string.Empty;
            requestId = default(long);
            version = default(ulong);
        }

        public override sealed void ReturnLeasableToPool()
        {
            PoolManager.GetProtobufRemoveCommandPool()?.Return(this);
        }

        #endregion
    }
}

redpajama_set_name: RedPajamaGithub


text:
from django.utils.translation import ugettext_lazy as _

from horizon import exceptions
from horizon import forms
from horizon import messages

from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.aggregates import constants

INDEX_URL = constants.AGGREGATES_INDEX_URL

class UpdateAggregateForm(forms.SelfHandlingForm):
    name = forms.CharField(label=_("Name"),
                           max_length=255)
    availability_zone = forms.CharField(label=_("Availability Zone"),
                                        required=False,
                                        max_length=255)

    def handle(self, request, data):
        id = self.initial['id']
        old_availability_zone = self.initial['availability_zone']
        name = data['name']
        availability_zone = data['availability_zone']
        aggregate = {'name': name}
        try:
            if availability_zone:
                aggregate['availability_zone'] = availability_zone
            elif old_availability_zone:
                raise ValueError
        except Exception:
            exceptions.handle(request,
                              _('The new availability zone can\'t be empty'))
        try:
            api.nova.aggregate_update(request, id, aggregate)
            message = (_('Successfully updated aggregate: "%s."')
                       % data['name'])
            messages.success(request, message)
        except Exception:
            exceptions.handle(request,
                              _('Unable to update the aggregate.'))
        return True


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" />
<title><service> | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../assets/css/default.css" rel="stylesheet" type="text/css">

          	Quicknav
			      Quicknav

                  Design

Develop

Distribute

Links

Google Play Developer Console

Android Developers Blog

About Android

Android Sites

Android.com

Android Developers

Android Open Source Project

      <form onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../')"
onkeyup="return search_changed(event, false, '../../../')" />
      </form>

        close

Get Started

Style

Patterns

Building Blocks

Downloads

Videos

Training

API Guides

Reference

Tools

Get the SDK

Google Services

Google Play

Publishing

Promoting

App Quality

Spotlight

Open Distribution

Results

Loading...

Training

API Guides

Reference

Tools

Google Services

to top

        App Components

            App Fundamentals

            Activities

              Fragments

              Loaders

              Tasks and Back Stack

            Services

              Bound Services

              AIDL

            Content Providers

              Content Provider Basics

              Creating a Content Provider

              Calendar Provider

              Contacts Provider

              Storage Access Framework

          Intents and Intent Filters

          Processes and Threads

          Permissions

            App Widgets

              App Widget Host

          Android Manifest

<action>

<activity>

<activity-alias>

<application>

<category>

<compatible-screens>

<data>

<grant-uri-permission>

<instrumentation>

<intent-filter>

<manifest>

<meta-data>

<path-permission>

<permission>

<permission-group>

<permission-tree>

<provider>

<receiver>

<service>

<supports-gl-texture>

<supports-screens>

<uses-configuration>

<uses-feature>

<uses-library>

<uses-permission>

<uses-sdk>

        User Interface

          Overview

            Layouts

              Linear Layout

              Relative Layout

              List View

              Grid View

            Input Controls

              Buttons

              Text Fields

              Checkboxes

              Radio Buttons

              Toggle Buttons

              Spinners

              Pickers

          Input Events

          Menus

           Action Bar

            Settings

           Dialogs

          Notifications

          Toasts

            Search

Creating a Search Interface

Adding Recent Query Suggestions

Adding Custom Suggestions

Searchable Configuration

          Drag and Drop

            Accessibility

              Making Applications Accessible

              Accessibility Developer Checklist

              Building Accessibility Services

          Styles and Themes

          Custom Components

           App Resources

            Overview

            Providing Resources

            Accessing Resources

              Handling Runtime Changes

            Localization

              Resource Types

Animation

Color State List

Drawable

Layout

Menu

String

Style

More Types

          Animation and Graphics

            Overview

            Property Animation

            View Animation

            Drawable Animation

            Canvas and Drawables

            OpenGL ES

            Hardware Acceleration

              Computation

                    RenderScript

                    Advanced RenderScript

                    Runtime API Reference

            Media and Camera

                  Media Playback

                   Supported Media Formats

                  Audio Capture

                  JetPlayer

                  Camera

              Location and Sensors

               Location and Maps

               Location Strategies

              Sensors Overview

              Motion Sensors

              Position Sensors

              Environment Sensors

               Connectivity

          Bluetooth

Bluetooth Low Energy

          NFC

NFC Basics

Advanced NFC

Host-based Card Emulation

            Wi-Fi P2P

            USB

Accessory

Host

            SIP

            Text and Input

              Copy and Paste

              Creating an IME

              Spelling Checker

          Data Storage

            Storage Options

            Data Backup

            App Install Location

               Administration

                Device Policies

    Web Apps

            Overview

            Targeting Screens from Web Apps

            Building Web Apps in WebView

            Migrating to WebView in Android 4.4

            Debugging Web Apps

            Best Practices for Web Apps

      Best Practices
      Bewährte Verfahren
      Prácticas recomendadas
      Meilleures pratiques
      Best practice
      ベスト プラクティス
      最佳实践
      最佳實務

            Compatibility

          Supporting Multiple Screens

            Distributing to Specific Screens

            Screen Compatibility Mode

            Supporting Tablets and Handsets

<service>

syntax:

<service android:enabled=["true" | "false"]
         android:exported=["true" | "false"]
         android:icon="drawable resource"
         android:isolatedProcess=["true" | "false"]
         android:label="string resource"
         android:name="string"
         android:permission="string"
         android:process="string" >
    . . .
</service>

contained in:

<application>

can contain:

<intent-filter>

<meta-data>

description:

Declares a service (a Service subclass) as one
of the application's components.  Unlike activities, services lack a
visual user interface.  They're used to implement long-running background
operations or a rich communications API that can be called by other
applications.

All services must be represented by <service> elements in
the manifest file.  Any that are not declared there will not be seen
by the system and will never be run.

attributes:

android:enabled

Whether or not the service can be instantiated by the system —
"true" if it can be, and "false" if not.  The default value
is "true".

The <application> element has its own
enabled attribute that applies to all
application components, including services.  The
<application> and <service>
attributes must both be "true" (as they both
are by default) for the service to be enabled.  If either is
"false", the service is disabled; it cannot be instantiated.

android:exported

Whether or not components of other applications can invoke
the service or interact with it — "true" if they can, and
"false" if not.  When the value is "false", only
components of the same application or applications
with the same user ID can start the service or bind to it.

The default value depends on whether the service contains intent filters.  The
absence of any filters means that it can be invoked only by specifying
its exact class name.  This implies that the service is intended only for
application-internal use (since others would not know the class name).  So in
this case, the default value is "false".
On the other hand, the presence of at least one filter implies that the service
is intended for external use, so the default value is "true".

This attribute is not the only way to limit the exposure of a service to other
applications.  You can also use a permission to limit the external entities that
can interact with the service (see the permission
attribute).

android:icon

An icon representing the service.  This attribute must be set as a
reference to a drawable resource containing the image definition.
If it is not set, the icon specified for the application
as a whole is used instead (see the <application>
element's icon attribute).

The service's icon — whether set here or by the
<application> element — is also the
default icon for all the service's intent filters (see the
<intent-filter> element's
icon attribute).

android:isolatedProcess

If set to true, this service will run under a special process that is isolated from the
  rest of the system and has no permissions of its own.
  The only communication with it is through the Service API
  (binding and starting).

android:label

A name for the service that can be displayed to users.
If this attribute is not set, the label set for the application as a whole is
used instead (see the <application> element's
label attribute).

The service's label — whether set here or by the
<application> element — is also the
default label for all the service's intent filters (see the
<intent-filter> element's
label attribute).

The label should be set as a reference to a string resource, so that
it can be localized like other strings in the user interface.
However, as a convenience while you're developing the application,
it can also be set as a raw string.

android:name

The name of the Service subclass that implements
the service.  This should be a fully qualified class name (such as,
"com.example.project.RoomService").  However, as a shorthand, if
the first character of the name is a period (for example, ".RoomService"),
it is appended to the package name specified in the
<manifest> element.

Once you publish your application, you should not
change this name (unless you've set android:exported="false").

There is no default.  The name must be specified.

android:permission

The name of a permission that that an entity must have in order to
launch the service or bind to it.  If a caller of
startService(),
bindService(), or
stopService(),
has not been granted this permission, the method will not work and the
Intent object will not be delivered to the service.

If this attribute is not set, the permission set by the
<application> element's
permission
attribute applies to the service.  If neither attribute is set, the service is
not protected by a permission.

For more information on permissions, see the
Permissions
section in the introduction and a separate document,
Security and Permissions.

android:process

The name of the process where the service is to run.  Normally,
all components of an application run in the default process created for the
application.  It has the same name as the application package.  The
<application> element's
process
attribute can set a different
default for all components.  But component can override the default
with its own process attribute, allowing you to spread your
application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new
process, private to the application, is created when it's needed and
the service runs in that process.
If the process name begins with a lowercase character, the service will run
in a global process of that name, provided that it has permission to do so.
This allows components in different applications to share a process, reducing
resource usage.

see also:

<application>

<activity>

introduced in:

API Level 1

  Except as noted, this content is
  licensed under
  Creative Commons Attribution 2.5. For details and
  restrictions, see the Content
  License.

    About Android  |
    Legal  |
    Support


text:
void ActorBase::SetLocation(const Point& location)
{
   setPosition(static_cast<float>(location.x.Value()), static_cast<float>(location.y.Value()));
}
PhysicalObject::Point ActorBase::GetLocation() const
{
   auto position = getPosition();
   return Point(kPixel * position.x, kPixel * position.y);
}

PhysicalObject::Size ActorBase::GetSize() const
{
   auto size = getSize();
   return{ size.x * kPixel, size.y * kPixel };
}
void ActorBase::SetSize(const Size& size)
{
   setSize(static_cast<float>(size.x.Value()), static_cast<float>(size.y.Value()));
}


text:
#include "RosPressureVisualizer.h"
#include <m3skin_ros/None_TransformArray.h>
#include <m3skin_ros/None_String.h>

#include <visualization_msgs/MarkerArray.h>

namespace m3 {

visualization_msgs::Marker RosPressureVisualizer::GetArrowMarker(tf::Vector3 position, tf::Quaternion orientation, double scale)
{
	visualization_msgs::Marker m;
    m.type = visualization_msgs::Marker::ARROW;
    m.action = visualization_msgs::Marker::ADD;

	m.pose.position.x = position.x();
	m.pose.position.y = position.y();
	m.pose.position.z = position.z();

	m.pose.orientation.x = orientation.x();
	m.pose.orientation.y = orientation.y();
	m.pose.orientation.z = orientation.z();
	m.pose.orientation.w = orientation.w();

	m.scale.x = scale;
	m.scale.y = SCALE_ARROW_Y;
	m.scale.z = SCALE_ARROW_Z;

	m.color.r = 1.0;
	m.color.g = 0;
	m.color.b = 0;
	m.color.a = 0.5;

	m.lifetime = ros::Duration(DURATION_ARROW);

	return m;
}

void RosPressureVisualizer::GetArrowTextMarkers(tf::Vector3 position,
                            tf::Quaternion orientation, double scale,
                            visualization_msgs::Marker *arrow,
                            visualization_msgs::Marker *text,
                            double nx, double ny, double nz)
{
    arrow->type = visualization_msgs::Marker::ARROW;
    arrow->action = visualization_msgs::Marker::ADD;

	arrow->pose.position.x = position.x();
	arrow->pose.position.y = position.y();
	arrow->pose.position.z = position.z();

	arrow->pose.orientation.x = orientation.x();
	arrow->pose.orientation.y = orientation.y();
	arrow->pose.orientation.z = orientation.z();
	arrow->pose.orientation.w = orientation.w();

    /*
    //   Diamondback
	arrow->scale.x = scale;
	arrow->scale.y = SCALE_ARROW_Y;
	arrow->scale.z = SCALE_ARROW_Z;
    */

    // Electric
	arrow->scale.x = SCALE_ARROW_Y;
	arrow->scale.y = SCALE_ARROW_Z;
	arrow->scale.z = scale;

	arrow->color.r = 1.0;
	arrow->color.g = 0;
	arrow->color.b = 0;
	arrow->color.a = 1.0;

	arrow->lifetime = ros::Duration(DURATION_ARROW);

    text->type = visualization_msgs::Marker::TEXT_VIEW_FACING;
    text->action = visualization_msgs::Marker::ADD;

	text->pose.position.x = position.x() + nx * (scale + 0.04) * 1.4;
	text->pose.position.y = position.y() + ny * (scale + 0.04) * 1.4;
	text->pose.position.z = position.z() + nz * (scale + 0.04) * 1.4;

	text->pose.orientation.x = orientation.x();
	text->pose.orientation.y = orientation.y();
	text->pose.orientation.z = orientation.z();
	text->pose.orientation.w = orientation.w();

	text->scale.x = 0.03;
	text->scale.y = 0.03;
	text->scale.z = 0.03;

	text->color.r = 1.0;
	text->color.g = 0;
	text->color.b = 0;
	text->color.a = 1.0;

	text->lifetime = ros::Duration(DURATION_ARROW);

    char s[20];
    sprintf(s, "%.1fN", scale/SCALING_FACTOR);
    text->text = s;

}

void RosPressureVisualizer::DisplayPressure(
		const hrl_haptic_manipulation_in_clutter_msgs::TaxelArray::ConstPtr& msg) {
	if (frequency_count < FREQUENCY_DIVISOR) {
		frequency_count += 1;
		return;
	}

	//ROS_INFO("Unlatching");

	frequency_count = 0;

	visualization_msgs::MarkerArray markerArray;
	visualization_msgs::MarkerArray textMarkerArray;

	// Compute the norm over all taxels and find out
	// which one we should display
	int size = msg->values_z.size();
	for (int i = 0; i < size; i++) {
		double n = norm(msg->values_x[i], msg->values_y[i], msg->values_z[i]);
        double dot_prod = msg->values_x[i] * msg->normals_x[i] + \
                          msg->values_y[i] * msg->normals_y[i] + \
                          msg->values_z[i] * msg->normals_z[i];
        double sign = 1;
        if (dot_prod < 0)
            sign = -1;

		//ROS_INFO("Norm %f", n);
		if (n > MIN_PRESSURE_VALUE) {
            visualization_msgs::Marker m1, m2;
            GetArrowTextMarkers(taxels_transforms[i].getOrigin(),
                    taxels_arrows_quaternions[i],
					n * SCALING_FACTOR * sign, &m1, &m2, msg->normals_x[i],
                    msg->normals_y[i], msg->normals_z[i]);
			m1.header.stamp = msg->header.stamp - ros::Duration(TF_TIME_OFFSET);
			m1.header.frame_id = msg->header.frame_id;
			m1.id = i;
			markerArray.markers.push_back(m1);

			m2.header.stamp = msg->header.stamp - ros::Duration(TF_TIME_OFFSET);
			m2.header.frame_id = msg->header.frame_id;
			m2.id = i;
			textMarkerArray.markers.push_back(m2);
			//ROS_INFO("Sending marker. Taxel %d, norm %f", i, n);
		}

	}

	publisher_marker_array.publish(markerArray);
	publisher_text_marker_array.publish(textMarkerArray);
}

void RosPressureVisualizer::GetTaxelTransforms() {
	m3skin_ros::None_TransformArray srv;

		if (local_coords_client.call(srv)) {
			ROS_INFO("Got taxels frames.");

			transforms = srv.response.data;
			std::vector<geometry_msgs::Transform>::iterator it;
			for (it = transforms.begin(); it != transforms.end(); it++) {
				//tf::Transform tf = GeometryTransformToTf(*it);
				tf::Transform tf;
                tf::transformMsgToTF(*it, tf);

				taxels_transforms.push_back(tf);
				taxels_transforms_inv.push_back(tf.inverse());
				taxels_arrows_quaternions.push_back(tf*tf::Quaternion(0, -1, 0, 1));
			}
		} else {
			ROS_ERROR("Failed to get taxels frames");
		}
}

void RosPressureVisualizer::GetLinkName() {
	m3skin_ros::None_String srv;

	if (link_name_client.call(srv)) {
		linkName = srv.response.data;

		ROS_INFO("Got link name %s", linkName.c_str());
	} else {
		ROS_ERROR("Failed to get link name");
	}
}

void RosPressureVisualizer::Init() {
    std::string local_coord_srv_name = "taxels/srv/local_coord_frames";
    std::string link_name_srv_name = "taxels/srv/link_name";

	local_coords_client = n.serviceClient<m3skin_ros::None_TransformArray> (local_coord_srv_name.c_str());
	link_name_client = n.serviceClient<m3skin_ros::None_String> (link_name_srv_name.c_str());

	publisher_marker_array = n.advertise<visualization_msgs::MarkerArray> (
			"viz/taxel_array_array", 1000);

	publisher_text_marker_array = n.advertise<visualization_msgs::MarkerArray> (
			"viz/taxel_array_text_array", 1000);

	subscriber = n.subscribe<hrl_haptic_manipulation_in_clutter_msgs::TaxelArray> (
			"taxels/forces", 1000,
			&RosPressureVisualizer::DisplayPressure, this);

    ROS_INFO("Waiting for services");
    ros::service::waitForService(local_coord_srv_name.c_str());
    ros::service::waitForService(link_name_srv_name.c_str());
    ROS_INFO("Done waiting");

	GetTaxelTransforms();
	GetLinkName();

	frequency_count = 0;
}

RosPressureVisualizer::RosPressureVisualizer() {

}

RosPressureVisualizer::~RosPressureVisualizer() {
	// TODO Auto-generated destructor stub
}

}


text:
@class SRHRace;

@interface SRHRacesViewModel : RVMViewModel

@property(nonatomic, strong, readonly) NSArray *sectionViewModels;
@property(nonatomic, strong, readonly) RACSignal *updatedContentSignal;
@property(nonatomic, strong, readonly) RACCommand *updateContentCommand;
@property(nonatomic, strong) SRHRace *selectedRace;

- (NSInteger)numberOfSections;
- (NSInteger)numberOfRowsInSection:(NSInteger)section;
- (SRHRace *)itemAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)titleForHeaderInSection:(NSInteger)section;
- (UIImage *)iconForHeaderInSection:(NSInteger)section;

@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Widget.WebClient.Helpers;
using Xunit;

namespace Widget.Tests.WebClientTests {
    public class WidgetHelpersTests {
        private readonly MockWidgetDbContext mockContext;

        public WidgetHelpersTests() {
            mockContext = new MockWidgetDbContext();
        }

        ///
        /// Test to make sure that the WidgetPrice extension method returns the proper
        /// HTML for a Widget with no discount.
        ///
        [Fact]
        public void Test_WidgetPrice_NoDiscount() {
            HtmlHelper helper = null;

            Domain.Models.Widget widget = new Domain.Models.Widget {
                BasePrice = 4.97M,
                IsDiscounted = false
            };

            Assert.Equal("
$4.97
", helper.WidgetPrice(widget).ToHtmlString());
        }

        ///
        /// Test to make sure that the WidgetPrice extension method returns the proper
        /// HTML for a Widget with a discount.
        ///
        [Fact]
        public void Test_WidgetPrice_Discount() {
            HtmlHelper helper = null;

            Domain.Models.Widget widget = new Domain.Models.Widget {
                BasePrice = 4.97M,
                IsDiscounted = true
            };

            StringBuilder expected = new StringBuilder();
            expected.Append("
<s>$4.97</s> ");
            expected.Append("$");
            expected.Append(Math.Round(4.97M * 0.9M, 2).ToString());
            expected.Append(@"Discounted
");

            Assert.Equal(expected.ToString(), helper.WidgetPrice(widget).ToHtmlString());
        }
    }
}


text:
import {Component} from 'angular2/core';
@Component({
    selector: 'my-app',
    template: '
My First Angular 2 App
'
})
export class AppComponent { }


text:
package main

import (
	"knative.dev/operator/pkg/reconciler/knativeeventing"
	"knative.dev/operator/pkg/reconciler/knativeserving"
	"knative.dev/pkg/injection/sharedmain"
)

func main() {
	sharedmain.Main("knative-operator",
		knativeserving.NewController,
		knativeeventing.NewController,
	)
}


text:
"""Utilties for Preprocessing data.
"""
from ._block_transformer import BlockTransformer
from ._encoders import OneHotEncoder
from .data import (
    Categorizer,
    DummyEncoder,
    MinMaxScaler,
    OrdinalEncoder,
    PolynomialFeatures,
    QuantileTransformer,
    RobustScaler,
    StandardScaler,
)
from .label import LabelEncoder

__all__ = [
    "StandardScaler",
    "MinMaxScaler",
    "RobustScaler",
    "QuantileTransformer",
    "Categorizer",
    "DummyEncoder",
    "OrdinalEncoder",
    "LabelEncoder",
    "OneHotEncoder",
    "PolynomialFeatures",
    "BlockTransformer",
]


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX                                                                           XX
XX                 State machine used in the JIT                             XX
XX                                                                           XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

#include "jitpch.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif

#include "smcommon.cpp"

//
// The array to map from EE opcodes (i.e. CEE_ ) to state machine opcodes (i.e. SM_ )
//
const SM_OPCODE smOpcodeMap[] = {
#define OPCODEMAP(eename, eestring, smname) smname,
#include "smopcodemap.def"
#undef OPCODEMAP
};

// ????????? How to make this method inlinable, since it refers to smOpcodeMap????
/* static */ SM_OPCODE CodeSeqSM::MapToSMOpcode(OPCODE opcode)
{
    assert(opcode < CEE_COUNT);

    SM_OPCODE smOpcode = smOpcodeMap[opcode];
    assert(smOpcode < SM_COUNT);
    return smOpcode;
}

void CodeSeqSM::Start(Compiler* comp)
{
    pComp          = comp;
    States         = gp_SMStates;
    JumpTableCells = gp_SMJumpTableCells;
    StateWeights   = gp_StateWeights;
    NativeSize     = 0;

    Reset();
}

void CodeSeqSM::Reset()
{
    curState = SM_STATE_ID_START;

#ifdef DEBUG
    // Reset the state occurence counts
    memset(StateMatchedCounts, 0, sizeof(StateMatchedCounts));
#endif
}

void CodeSeqSM::End()
{
    if (States[curState].term)
    {
        TermStateMatch(curState DEBUGARG(pComp->verbose));
    }
}

void CodeSeqSM::Run(SM_OPCODE opcode DEBUGARG(int level))
{
    SM_STATE_ID nextState;
    SM_STATE_ID rollbackState;

    SM_OPCODE opcodesToRevisit[MAX_CODE_SEQUENCE_LENGTH];

    assert(level <= MAX_CODE_SEQUENCE_LENGTH);

_Next:
    nextState = GetDestState(curState, opcode);

    if (nextState != 0)
    {
        // This is easy, Just go to the next state.
        curState = nextState;
        return;
    }

    assert(curState != SM_STATE_ID_START);

    if (States[curState].term)
    {
        TermStateMatch(curState DEBUGARG(pComp->verbose));
        curState = SM_STATE_ID_START;
        goto _Next;
    }

    // This is hard. We need to rollback to the longest matched term state and restart from there.

    rollbackState = States[curState].longestTermState;
    TermStateMatch(rollbackState DEBUGARG(pComp->verbose));

    assert(States[curState].length > States[rollbackState].length);

    unsigned numOfOpcodesToRevisit = States[curState].length - States[rollbackState].length + 1;
    assert(numOfOpcodesToRevisit > 1 &&
           numOfOpcodesToRevisit <= MAX_CODE_SEQUENCE_LENGTH); // So it can fit in the local array opcodesToRevisit[]

    SM_OPCODE* p = opcodesToRevisit + (numOfOpcodesToRevisit - 1);

    *p = opcode;

    // Fill in the local array:
    for (unsigned i = 0; i < numOfOpcodesToRevisit - 1; ++i)
    {
        *(--p)   = States[curState].opc;
        curState = States[curState].prevState;
    }

    assert(curState == rollbackState);

    // Now revisit these opcodes, starting from SM_STATE_ID_START.
    curState = SM_STATE_ID_START;
    for (p = opcodesToRevisit; p < opcodesToRevisit + numOfOpcodesToRevisit; ++p)
    {
        Run(*p DEBUGARG(level + 1));
    }
}

SM_STATE_ID CodeSeqSM::GetDestState(SM_STATE_ID srcState, SM_OPCODE opcode)
{
    assert(opcode < SM_COUNT);

    JumpTableCell* pThisJumpTable = (JumpTableCell*)(((PBYTE)JumpTableCells) + States[srcState].jumpTableByteOffset);

    JumpTableCell* cell = pThisJumpTable + opcode;

    if (cell->srcState != srcState)
    {
        assert(cell->srcState == 0 ||
               cell->srcState != srcState); // Either way means there is not outgoing edge from srcState.
        return 0;
    }
    else
    {
        return cell->destState;
    }
}

#ifdef DEBUG

const char* CodeSeqSM::StateDesc(SM_STATE_ID stateID)
{
    static char      s_StateDesc[500];
    static SM_OPCODE s_StateDescOpcodes[MAX_CODE_SEQUENCE_LENGTH];

    if (stateID == 0)
    {
        return "invalid";
    }
    if (stateID == SM_STATE_ID_START)
    {
        return "start";
    }
    unsigned i = 0;

    SM_STATE_ID b = stateID;

    while (States[b].prevState != 0)
    {
        s_StateDescOpcodes[i] = States[b].opc;
        b                     = States[b].prevState;
        ++i;
    }

    assert(i == States[stateID].length && i > 0);

    *s_StateDesc = 0;

    while (--i > 0)
    {
        strcat(s_StateDesc, smOpcodeNames[s_StateDescOpcodes[i]]);
        strcat(s_StateDesc, " -> ");
    }

    strcat(s_StateDesc, smOpcodeNames[s_StateDescOpcodes[0]]);

    return s_StateDesc;
}

#endif // DEBUG


text:
<resources>
    <string name="app_name">DiGeo</string>
</resources>


text:
package main

type Commands map[string]string

func readCommands(filename string) (commands Commands) {
	readJson(filename, &commands)
	return
}


text:
Deface::Override.new(
  :virtual_path => 'spree/admin/shared/_configuration_menu',
  :name => 'add_banks_to_admin_configuration_sidebar',
  :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']",
  :text => %q{
    <%= configurations_sidebar_menu_item Spree.t(:banks), admin_banks_path %>
    }
)


text:
// DotNetNuke® - http://www.dnnsoftware.com//
// Copyright (c) 2002-2016, DNN Corp.
// All rights reserved.

namespace DotNetNuke.Tests.Integration.Framework.Scripts
{
    public static class SqlScripts
    {
        public const string SingleUserCreation = @"
            DECLARE @UserName nvarchar(100)
            DECLARE @Password nvarchar(1000)
            DECLARE @Email nvarchar(100)
            DECLARE @PasswordSalt nvarchar(1000)
            DECLARE @PasswordFormat INT
            DECLARE @ApplicationId nvarchar(1000)
            DECLARE @PortalID INT
            DECLARE @RoleID INT
            DECLARE @AspUserID UNIQUEIDENTIFIER
            DECLARE @CurrentDate AS DATETIME
            DECLARE @FirstName nvarchar(100)
            DECLARE @LastName nvarchar(100)
            DECLARE @DisplayName nvarchar(100)
            DECLARE @UserID INT
            DECLARE @StartingUserID INT
            DECLARE @UsersToCreate INT
            DECLARE @UserSuffix nvarchar(25)
            DECLARE @UserToCopy nvarchar(100)
            DECLARE @PhotoPropertyDefinitionID INT
            DECLARE @FirstNamePropertyDefinitionID INT
            DECLARE @LastNamePropertyDefinitionID INT
            DECLARE @AvatarFileID INT
            DECLARE @SuperUser BIT
            DECLARE @CreateFriends BIT
            DECLARE @CreateFollowers BIT
            DECLARE @IsAdministrator BIT
            DECLARE @IsModerator BIT
            DECLARE @RoleName nvarchar(100)
            DECLARE @FriendsRelationShipId INT
            DECLARE @FollowersRelationShipId INT

            SET @PortalID = '$[portal_id]'
            SET @UserToCopy = '$[users_to_copy]'
            SET @FirstName = '$[first_name]'
            SET @LastName = '$[last_name]'
            SET @SuperUser = '$[isSuperUser]'
            SET @RoleName = '$[role_name]'
            SET @CreateFriends = '$[CreateFriends]'
            SET @CreateFollowers = '$[CreateFollowers]'

            SELECT  @Password = [Password], @PasswordSalt = PasswordSalt, @PasswordFormat = PasswordFormat, @ApplicationId = dbo.aspnet_Membership.ApplicationId FROM dbo.aspnet_Membership
            INNER JOIN dbo.aspnet_Users ON dbo.aspnet_Membership.UserId = dbo.aspnet_Users.UserId
            WHERE UserName = @UserToCopy

            SELECT  @PhotoPropertyDefinitionID = PropertyDefinitionID FROM dbo.{objectQualifier}ProfilePropertyDefinition WHERE PortalID = @PortalID AND PropertyName = 'Photo'
            SELECT  @FirstNamePropertyDefinitionID = PropertyDefinitionID FROM dbo.{objectQualifier}ProfilePropertyDefinition WHERE PortalID = @PortalID AND PropertyName = 'FirstName'
            SELECT  @LastNamePropertyDefinitionID = PropertyDefinitionID FROM dbo.{objectQualifier}ProfilePropertyDefinition WHERE PortalID = @PortalID AND PropertyName = 'LastName'

            SELECT  @FriendsRelationShipId = RelationshipID FROM dbo.{objectQualifier}Relationships WHERE PortalID = @PortalID AND [Name] = 'Friends'
            SELECT  @FollowersRelationShipId = RelationshipID FROM dbo.{objectQualifier}Relationships WHERE PortalID = @PortalID AND [Name] = 'Followers'

            IF @ApplicationId is NULL
	            BEGIN
		            RAISERROR ('User does not exist', 16, 1);
		            return
	            END

            SELECT  @RoleID = [RoleID] FROM dbo.{objectQualifier}Roles WHERE PortalID = @PortalID AND RoleName = 'Registered Users'

            SELECT @StartingUserID = max(userid) from dbo.{objectQualifier}Users --Find the last user id
            SET @StartingUserID = @StartingUserID + 1 --Start from the next

            BEGIN
	            SET @AspUserID = NEWID()
	            SET @UserName = @FirstName + '.' + @LastName
	            SET @Email = LOWER(@UserName + '@test.com')
	            SET @DisplayName = @FirstName + ' ' + @LastName
	            SET @CurrentDate = GETDATE()

	            IF EXISTS(SELECT * from dbo.{objectQualifier}Users where Username = @UserName)
	            BEGIN
		            return
	            END

	            INSERT INTO dbo.aspnet_Users
			            ( ApplicationId ,
			                UserId ,
			                UserName ,
			                LoweredUserName ,
			                MobileAlias ,
			                IsAnonymous ,
			                LastActivityDate
			            )
		            VALUES
			            ( @ApplicationId , -- ApplicationId - uniqueidentifier
			                @AspUserID , -- UserId - uniqueidentifier
			                @UserName , -- UserName - nvarchar(256)
			                @UserName , -- LoweredUserName - nvarchar(256)
			                NULL , -- MobileAlias - nvarchar(16)
			                0 , -- IsAnonymous - bit
			                @CurrentDate  -- LastActivityDate - datetime
			            )

	            INSERT INTO dbo.aspnet_Membership
			            ( ApplicationId ,
			                UserId ,
			                Password ,
			                PasswordFormat ,
			                PasswordSalt ,
			                MobilePIN ,
			                Email ,
			                LoweredEmail ,
			                PasswordQuestion ,
			                PasswordAnswer ,
			                IsApproved ,
			                IsLockedOut ,
			                CreateDate ,
			                LastLoginDate ,
			                LastPasswordChangedDate ,
			                LastLockoutDate ,
			                FailedPasswordAttemptCount ,
			                FailedPasswordAttemptWindowStart ,
			                FailedPasswordAnswerAttemptCount ,
			                FailedPasswordAnswerAttemptWindowStart ,
			                Comment
			            )
		            VALUES
			            ( @ApplicationId , -- ApplicationId - uniqueidentifier
			                @AspUserID , -- UserId - uniqueidentifier
			                @Password , -- Password - nvarchar(128)
			                @PasswordFormat , -- PasswordFormat - int
			                @PasswordSalt , -- PasswordSalt - nvarchar(128)
			                NULL , -- MobilePIN - nvarchar(16)
			                @Email , -- Email - nvarchar(256)
			                @Email , -- LoweredEmail - nvarchar(256)
			                NULL , -- PasswordQuestion - nvarchar(256)
			                NULL , -- PasswordAnswer - nvarchar(128)
			                1 , -- IsApproved - bit
			                0 , -- IsLockedOut - bit
			                @CurrentDate , -- CreateDate - datetime
			                @CurrentDate , -- LastLoginDate - datetime
			                @CurrentDate , -- LastPasswordChangedDate - datetime
			                '1754-01-01 00:00:00.000' , -- LastLockoutDate - datetime
			                0 , -- FailedPasswordAttemptCount - int
			                '1754-01-01 00:00:00.000' , -- FailedPasswordAttemptWindowStart - datetime
			                0 , -- FailedPasswordAnswerAttemptCount - int
			                '1754-01-01 00:00:00.000' , -- FailedPasswordAnswerAttemptWindowStart - datetime
			                NULL  -- Comment - ntext
			            )

	            INSERT INTO dbo.{objectQualifier}Users
			            ( Username ,
			                FirstName ,
			                LastName ,
			                IsSuperUser ,
			                AffiliateId ,
			                Email ,
			                DisplayName ,
			                UpdatePassword ,
			                LastIPAddress ,
			                IsDeleted ,
			                CreatedByUserID ,
			                CreatedOnDate ,
			                LastModifiedByUserID ,
			                LastModifiedOnDate
			            )
		            VALUES
			            ( @UserName , -- Username - nvarchar(100)
			                @FirstName , -- FirstName - nvarchar(50)
			                @LastName , -- LastName - nvarchar(50)
			                @SuperUser , -- IsSuperUser - bit
			                NULL , -- AffiliateId - int
			                @Email , -- Email - nvarchar(256)
			                @DisplayName , -- DisplayName - nvarchar(128)
			                0 , -- UpdatePassword - bit
			                N'' , -- LastIPAddress - nvarchar(50)
			                0 , -- IsDeleted - bit
			                0 , -- CreatedByUserID - int
			                @CurrentDate , -- CreatedOnDate - datetime
			                0 , -- LastModifiedByUserID - int
			                @CurrentDate  -- LastModifiedOnDate - datetime
			            )

	            SET @UserID = SCOPE_IDENTITY()

	            INSERT INTO dbo.{objectQualifier}UserRoles
			            ( UserID ,
			                RoleID ,
			                ExpiryDate ,
			                IsTrialUsed ,
			                EffectiveDate ,
			                CreatedByUserID ,
			                CreatedOnDate ,
			                LastModifiedByUserID ,
			                LastModifiedOnDate
			            )
		            VALUES
			            ( @UserID , -- UserID - int
			                @RoleID , -- RoleID - int
			                NULL , -- ExpiryDate - datetime
			                1 , -- IsTrialUsed - bit
			                NULL , -- EffectiveDate - datetime
			                0 , -- CreatedByUserID - int
			                @CurrentDate , -- CreatedOnDate - datetime
			                0 , -- LastModifiedByUserID - int
			                @CurrentDate  -- LastModifiedOnDate - datetime
			            )

	            INSERT INTO dbo.{objectQualifier}UserPortals
			            ( UserId ,
			                PortalId ,
			                CreatedDate ,
			                Authorised ,
			                IsDeleted ,
			                RefreshRoles
			            )
		            VALUES
			            ( @UserID , -- UserId - int
			                @PortalID , -- PortalId - int
			                @CurrentDate , -- CreatedDate - datetime
			                1 , -- Authorised - bit
			                0 , -- IsDeleted - bit
			                0  -- RefreshRoles - bit
			            )

	            --Create FirstName UserProfile Property
	            INSERT INTO dbo.{objectQualifier}UserProfile
			            ( UserID ,
			                PropertyDefinitionID ,
			                PropertyValue ,
			                PropertyText ,
			                Visibility ,
			                LastUpdatedDate ,
			                ExtendedVisibility
			            )
		            VALUES
			            ( @UserID , -- UserID - int
			                @FirstNamePropertyDefinitionID , -- PropertyDefinitionID - int
			                @FirstName , -- PropertyValue - nvarchar(3750)
			                NULL , -- PropertyText - nvarchar(max)
			                0 , -- Visibility - int
			                @CurrentDate , -- LastUpdatedDate - datetime
			                ''  -- ExtendedVisibility - varchar(400)
			            )

	            --Create LastName UserProfile Property
	            INSERT INTO dbo.{objectQualifier}UserProfile
			            ( UserID ,
			                PropertyDefinitionID ,
			                PropertyValue ,
			                PropertyText ,
			                Visibility ,
			                LastUpdatedDate ,
			                ExtendedVisibility
			            )
		            VALUES
			            ( @UserID , -- UserID - int
			                @LastNamePropertyDefinitionID , -- PropertyDefinitionID - int
			                @LastName , -- PropertyValue - nvarchar(3750)
			                NULL , -- PropertyText - nvarchar(max)
			                0 , -- Visibility - int
			                @CurrentDate , -- LastUpdatedDate - datetime
			                ''  -- ExtendedVisibility - varchar(400)
			            )

	            ;WITH Avatars
	                AS (
		            SELECT ROW_NUMBER() OVER(ORDER BY FileId)-1 AS RowNumber, fi.FileID
		            FROM dbo.{objectQualifier}Files fi INNER JOIN dbo.{objectQualifier}Folders fo ON fi.FolderID = fo.FolderID
		            WHERE fo.FolderPath like 'Users%'
		                AND fi.Extension in ('png', 'gif', 'jpg', 'jpeg')
		                AND fi.PortalId = @PortalID
		            )
	            SELECT @AvatarFileID = FileID
	            FROM Avatars
	            WHERE RowNumber = (@UserID % (SELECT COUNT(*) FROM Avatars))

	            IF @AvatarFileID IS NULL
	            BEGIN
		            ;WITH Avatars2
		                AS (
			            SELECT ROW_NUMBER() OVER(ORDER BY FileId)-1 AS RowNumber, FileID
			            FROM dbo.{objectQualifier}Files
			            WHERE Extension in ('png', 'gif', 'jpg', 'jpeg')
			                AND PortalId = @PortalID
			            )
		            SELECT @AvatarFileID = FileID
		            FROM Avatars2
		            WHERE RowNumber = (@UserID % (SELECT COUNT(*) FROM Avatars2))
	            END

	            --Create Photo UserProfile Property
	            INSERT INTO dbo.{objectQualifier}UserProfile
			            ( UserID ,
			                PropertyDefinitionID ,
			                PropertyValue ,
			                PropertyText ,
			                Visibility ,
			                LastUpdatedDate ,
			                ExtendedVisibility
			            )
		            VALUES
			            ( @UserID , -- UserID - int
			                @PhotoPropertyDefinitionID , -- PropertyDefinitionID - int
			                @AvatarFileID , -- PropertyValue - nvarchar(3750)
			                NULL , -- PropertyText - nvarchar(max)
			                0 , -- Visibility - int
			                @CurrentDate , -- LastUpdatedDate - datetime
			                ''  -- ExtendedVisibility - varchar(400)
			            )

                --Create Friends
                IF @CreateFriends > 0
                BEGIN
	                INSERT INTO dbo.{objectQualifier}UserRelationships
			                    ([UserID]
			                    ,[RelatedUserID]
			                    ,[RelationshipID]
			                    ,[Status]
			                    ,[CreatedByUserID]
			                    ,[CreatedOnDate]
			                    ,[LastModifiedByUserID]
			                    ,[LastModifiedOnDate])
		                SELECT DISTINCT TOP 10 @UserID, UserId, 1, 2, @UserID, @CurrentDate, @UserID, @CurrentDate
		                FROM dbo.{objectQualifier}Users
		                WHERE UserId <> @UserID
		                    AND IsSuperUser = 0
		                    AND (UserID NOT IN (SELECT RelatedUserID FROM dbo.{objectQualifier}UserRelationships WHERE UserID = @userID AND RelationshipID = @FriendsRelationshipId))

	                INSERT INTO dbo.{objectQualifier}UserRelationships
			                    ([UserID]
			                    ,[RelatedUserID]
			                    ,[RelationshipID]
			                    ,[Status]
			                    ,[CreatedByUserID]
			                    ,[CreatedOnDate]
			                    ,[LastModifiedByUserID]
			                    ,[LastModifiedOnDate])
		                SELECT DISTINCT TOP 15 @UserID, UserId, 1, 1, @UserID, @CurrentDate, @UserID, @CurrentDate
		                FROM dbo.{objectQualifier}Users
		                WHERE UserId <> @UserID
		                    AND IsSuperUser = 0
		                    AND (UserID NOT IN (SELECT RelatedUserID FROM dbo.{objectQualifier}UserRelationships WHERE UserID = @userID AND RelationshipID = @FriendsRelationshipId))
                END

	            --Create Followers
                IF @CreateFollowers > 0
                BEGIN
	                --Create Followers
	                INSERT INTO dbo.{objectQualifier}UserRelationships
			                    ([UserID]
			                    ,[RelatedUserID]
			                    ,[RelationshipID]
			                    ,[Status]
			                    ,[CreatedByUserID]
			                    ,[CreatedOnDate]
			                    ,[LastModifiedByUserID]
			                    ,[LastModifiedOnDate])
		                SELECT DISTINCT TOP 5 @UserID, UserId, 2, 2, @UserID, @CurrentDate, @UserID, @CurrentDate
		                FROM dbo.{objectQualifier}Users
		                WHERE UserId <> @UserID
		                    AND IsSuperUser = 0
		                    AND (UserID NOT IN (SELECT RelatedUserID FROM dbo.{objectQualifier}UserRelationships WHERE UserID = @userID AND RelationshipID = @FollowersRelationshipId))

	                --Create Followings
	                INSERT INTO dbo.{objectQualifier}UserRelationships
			                    ([UserID]
			                    ,[RelatedUserID]
			                    ,[RelationshipID]
			                    ,[Status]
			                    ,[CreatedByUserID]
			                    ,[CreatedOnDate]
			                    ,[LastModifiedByUserID]
			                    ,[LastModifiedOnDate])
		                SELECT DISTINCT TOP 6 UserId, @UserID, 2, 2, @UserID, @CurrentDate, @UserID, @CurrentDate
		                FROM dbo.{objectQualifier}Users
		                WHERE UserId <> @UserID
		                    AND IsSuperUser = 0
		                    AND (UserID NOT IN (SELECT RelatedUserID FROM dbo.{objectQualifier}UserRelationships WHERE [RelatedUserID] = @userID AND RelationshipID = @FollowersRelationshipId))
                END

	            IF DATALENGTH(@RoleName) > 0
	            BEGIN
		            DECLARE @ExistingRoleId INT
		            SELECT @ExistingRoleId = RoleId from dbo.{objectQualifier}Roles where RoleName = @RoleName

		            IF NOT EXISTS(SELECT UserRoleID from dbo.{objectQualifier}UserRoles where UserId = @UserID and RoleID = @ExistingRoleId)
		            BEGIN
			                EXEC dbo.{objectQualifier}AddUserRole
					                @PortalID = 0,
					                @UserID = @UserID,
					                @RoleId = @ExistingRoleId,
					                @Status = 1,
					                @IsOwner = 1,
					                @CreatedByUserID = 1
		            END
	            END
            END";

        public const string SingleRoleCreation = @"
            DECLARE @PortalID INT
            DECLARE @RoleName NVARCHAR(50)
            DECLARE @Description NVARCHAR(1000)
            DECLARE @CurrentDate DATETIME

            SET @PortalID = '$[portal_id]'
            SET @RoleName = '$[role_name]'
            SET @Description = '$[role_description]'
            SET @CurrentDate = GETDATE()

        IF EXISTS(SELECT * from [dbo].[{objectQualifier}Roles] where [RoleName] = @RoleName)
	        BEGIN
		        RETURN
	        END

            INSERT INTO [dbo].[{objectQualifier}Roles]
            (
	        [PortalID],
	        [RoleName],
	        [Description],
	        [ServiceFee],
	        [BillingFrequency],
	        [TrialPeriod],
	        [TrialFrequency],
	        [BillingPeriod],
	        [TrialFee],
	        [IsPublic],
	        [AutoAssignment],
	        [RoleGroupID],
	        [RSVPCode],
	        [IconFile],
	        [CreatedByUserID],
	        [CreatedOnDate],
	        [LastModifiedByUserID],
	        [LastModifiedOnDate],
	        [Status],
	        [SecurityMode],
	        [IsSystemRole]
            )
            VALUES
            (
	        @PortalID,
	        @RoleName,
	        @Description,
	        0.00,
	        'N',
	        -1,
	        'N',
	        -1,
	        0.00,
	        0,
	        0,
	        NULL,
	        '',
	        '',
	        -1,
	        @CurrentDate,
	        -1,
	        @CurrentDate,
	        1,
	        0,
	        0
            )";

        public const string AssignRoleToUser = @"
            DECLARE @CurrentDate DATETIME
            DECLARE @UserId INT
            DECLARE @RoleId INT

            SET @UserId = '$[user_id]'
            SET @RoleId= '$[role_id]'
            SET @CurrentDate = GETDATE()

            DELETE FROM [dbo].[{objectQualifier}UserRoles]
            WHERE [UserID] = @UserId AND [RoleID] = @RoleId

            INSERT INTO [dbo].[{objectQualifier}UserRoles]
            (
	            [UserID],
	            [RoleID],
	            [ExpiryDate],
	            [IsTrialUsed],
	            [EffectiveDate],
	            [CreatedByUserID],
	            [CreatedOnDate],
	            [LastModifiedByUserID],
	            [LastModifiedOnDate],
	            [Status],
	            [IsOwner]
            )
            VALUES
            (
	            @UserId,
	            @RoleId,
	            NULL,
	            1,
	            NULL,
	            -1,
	            @CurrentDate,
	            -1,
	            @CurrentDate,
	            1,
	            0
            )";

        public const string UserDelete = @"
            DECLARE @userId INT
            DECLARE @username NVARCHAR(100)
            DECLARE @userGuid UNIQUEIDENTIFIER

            SET @userId = '$[user_id]'
            SELECT @username = [Username] FROM [dbo].[{objectQualifier}Users] WHERE [UserID] = @userId
            SELECT @userGuid = [UserId] FROM [dbo].[aspnet_Users] WHERE UserName = @username

            DELETE FROM [dbo].[{objectQualifier}Journal_Comments] WHERE [UserId] = @userId
            DELETE FROM [dbo].[{objectQualifier}Blogs_Entry] WHERE [BlogId] IN
                (SELECT [BlogId] FROM [dbo].[{objectQualifier}Blogs_Blog] WHERE [UserId] = @userId)
            DELETE FROM [dbo].[{objectQualifier}Blogs_Blog] WHERE [UserId] = @userId

            DELETE FROM [dbo].[aspnet_Membership] WHERE [UserId] = @userGuid
            DELETE FROM [dbo].[aspnet_Users] WHERE [UserId] = @userGuid
            DELETE FROM [dbo].[{objectQualifier}UserRelationships] WHERE [UserID] = @userId OR [RelatedUserID] =  @userId
            DELETE FROM [dbo].[{objectQualifier}Users] WHERE [UserID] = @userId";

        public const string AddModulePermission = @"
            DECLARE @PortalId INT
            DECLARE @RoleId INT
            DECLARE @ModuleId INT
            DECLARE @PermissionCode NVARCHAR(50)
            DECLARE @PermissionKey NVARCHAR(50)

            DECLARE @ModuledDefId INT
            DECLARE @CurrentDate DATETIME
            DECLARE @PermissionId INT

            SET @PortalId = '$[portal_id]'
            SET @RoleId = '$[role_id]'
            SET @ModuleId = '$[module_id]'
            SET @PermissionCode = '$[permission_code]'
            SET @PermissionKey = '$[permission_key]'

            SET @CurrentDate = GETDATE()
            SELECT @ModuledDefId = ModuleDefId from [dbo].[{objectQualifier}Modules] WHERE [ModuleID] = @ModuleId

            SELECT @PermissionId = [PermissionID] FROM [dbo].[{objectQualifier}Permission]
            WHERE ModuleDefID = @ModuledDefId AND [PermissionCode] = @PermissionCode AND [PermissionKey] = @PermissionKey

            DELETE FROM [dbo].[{objectQualifier}ModulePermission]
            WHERE [ModuleID] = @ModuleId AND [PermissionID] = @PermissionId AND [RoleID] = @RoleId AND [UserID] IS NULL

            INSERT INTO [dbo].[{objectQualifier}ModulePermission]
            (
	            [ModuleID],
	            [PermissionID],
	            [AllowAccess],
	            [RoleID],
	            [UserID],
	            [CreatedByUserID],
	            [CreatedOnDate],
	            [LastModifiedByUserID],
	            [LastModifiedOnDate],
	            [PortalID]
            )
            VALUES
            (
	            @ModuleId,
	            @PermissionId,
	            1,
	            @RoleId,
	            NULL,
	            -1,
	            @CurrentDate,
	            -1,
	            @CurrentDate,
	            @PortalId
            )

            SELECT SCOPE_IDENTITY() AS ModulePermissionId";

        public static string UserGetPreferredTimeZone = @"
            DECLARE @UserId INT
            DECLARE @PortalID INT
            DECLARE @PropertyDefinitionId INT

            SET @UserId = '$[user_id]'
            SET @PortalID = '$[portal_id]'

            SELECT TOP 1 @PropertyDefinitionId = PropertyDefinitionID
            FROM [dbo].[{objectQualifier}ProfilePropertyDefinition]
            WHERE PortalID = @PortalID AND PropertyName = 'PreferredTimeZone' AND PropertyCategory = 'Preferences'

            SELECT PropertyValue FROM [dbo].[{objectQualifier}UserProfile]
            WHERE PropertyDefinitionID = @PropertyDefinitionId AND [UserId] = @UserId";

        public const string PortalGetTimeZone = @"
            DECLARE @PortalID INT
            SET @PortalID = '$[portal_id]'

            SELECT SettingValue FROM [dbo].[{objectQualifier}PortalSettings]
            WHERE PortalID = @PortalID AND SettingName = 'TimeZone'";

        public const string Modulenformation = @"
            DECLARE @PortalID INT = 0
                DECLARE @friendlyName NVARCHAR(100) = 'Scheduler'

                SELECT  dtm.DesktopModuleID, dtm.FriendlyName AS DtmFriendlyName,
                        mdfn.ModuleDefID, mdfn.FriendlyName AS ModuleFriendlyName, mdfn.DefinitionName,
                        mdl.ModuleID, mdl.PortalID,
                        tab.TabID, tab.TabName, tab.TabPath,
		                tm.TabModuleID
                FROM    dbo.{objectQualifier}DesktopModules dtm
			                INNER JOIN dbo.{objectQualifier}ModuleDefinitions mdfn on dtm.DesktopModuleID = mdfn.DesktopModuleID
			                INNER JOIN dbo.{objectQualifier}Modules mdl on mdfn.ModuleDefID = mdl.ModuleDefID
			                INNER JOIN dbo.{objectQualifier}TabModules tm on mdl.ModuleID = tm.ModuleID
			                INNER JOIN dbo.{objectQualifier}Tabs tab on tm.TabID = tab.TabID
                WHERE   (mdl.PortalID IS NULL OR mdl.PortalID = @PortalID) -- null for HOST modules
                AND   (dtm.FriendlyName = @friendlyName OR mdfn.FriendlyName = @friendlyName)
                ORDER BY dtm.FriendlyName, mdfn.FriendlyName, dtm.DesktopModuleID, mdfn.ModuleDefID, mdl.ModuleID;";

        public const string TableExist = @"
            IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.[{objectQualifier}$[table_name]]') AND type in (N'U'))
                SELECT 1
            ELSE
                SELECT 0
            ;";
    }
}


text:
// Provides control sap.ui.core.CustomData.
sap.ui.define(['jquery.sap.global', './Element', './library'],
	function(jQuery, Element, library) {
	"use strict";

	// shortcut for sap.ui.core.ID
	var ID = library.ID;

	/**
	 * Constructor for a new CustomData.
	 *
	 * @param {string} [sId] id for the new control, generated automatically if no id is given
	 * @param {object} [mSettings] initial settings for the new control
	 *
	 * @class
	 * Contains a single key/value pair of custom data attached to an Element. See method data().
	 * @extends sap.ui.core.Element
	 * @version 1.38.7
	 *
	 * @constructor
	 * @public
	 * @alias sap.ui.core.CustomData
	 * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
	 */
	var CustomData = Element.extend("sap.ui.core.CustomData", /** @lends sap.ui.core.CustomData.prototype */ { metadata : {

		library : "sap.ui.core",
		properties : {

			/**
			 * The key of the data in this CustomData object.
			 * When the data is just stored, it can be any string, but when it is to be written to HTML (writeToDom == true) then it must also be a valid HTML attribute name (it must conform to the sap.ui.core.ID type and may contain no colon) to avoid collisions, it also may not start with "sap-ui". When written to HTML, the key is prefixed with "data-".
			 * If any restriction is violated, a warning will be logged and nothing will be written to the DOM.
			 */
			key : {type : "string", group : "Data", defaultValue : null},

			/**
			 * The data stored in this CustomData object.
			 * When the data is just stored, it can be any JS type, but when it is to be written to HTML (writeToDom == true) then it must be a string.
			 * If this restriction is violated, a warning will be logged and nothing will be written to the DOM.
			 */
			value : {type : "any", group : "Data", defaultValue : null},

			/**
			 * If set to "true" and the value is of type "string" and the key conforms to the documented restrictions, this custom data is written to the HTML root element of the control as a "data-*" attribute.
			 * If the key is "abc" and the value is "cde", the HTML will look as follows:
			 * <SomeTag ... data-abc="cde" ... >
			 * Thus the application can provide stable attributes by data binding which can be used for styling or identification purposes.
			 * ATTENTION: use carefully to not create huge attributes or a large number of them.
			 * @since 1.9.0
			 */
			writeToDom : {type : "boolean", group : "Data", defaultValue : false}
		},
		designtime : true
	}});

	CustomData.prototype.setValue = function(oValue) {
		this.setProperty("value", oValue, true);

		var oControl = this.getParent();
		if (oControl && oControl.getDomRef()) {
			var oCheckResult = this._checkWriteToDom(oControl);
			if (oCheckResult) {
				// update DOM directly
				oControl.$().attr(oCheckResult.key, oCheckResult.value);
			}
		}
		return this;
	};

	CustomData.prototype._checkWriteToDom = function(oRelated) {
		if (!this.getWriteToDom()) {
			return null;
		}

		var key = this.getKey();
		var value = this.getValue();

		if (typeof value != "string") {
			jQuery.sap.log.error("CustomData with key " + key + " should be written to HTML of " + oRelated + " but the value is not a string.");
			return null;
		}

		if (!(ID.isValid(key)) || (key.indexOf(":") != -1)) {
			jQuery.sap.log.error("CustomData with key " + key + " should be written to HTML of " + oRelated + " but the key is not valid (must be a valid sap.ui.core.ID without any colon).");
			return null;
		}

		if (key == jQuery.sap._FASTNAVIGATIONKEY) {
			value = /^\s*(x|true)\s*$/i.test(value) ? "true" : "false"; // normalize values
		} else if (key.indexOf("sap-ui") == 0) {
			jQuery.sap.log.error("CustomData with key " + key + " should be written to HTML of " + oRelated + " but the key is not valid (may not start with 'sap-ui').");
			return null;
		}

		return {key: "data-" + key, value: value};

	};

	return CustomData;

});


text:
<?php

/* IPMotorsWebServiceBundle:Default:index.html.twig */
class __TwigTemplate_b55282d962e2d0c6e8389c21bf519e90a5ff5fe864d6e8ad8b4844eabc744cd8 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo "Hello ";
        echo twig_escape_filter($this->env, (isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")), "html", null, true);
        echo "!
";
    }

    public function getTemplateName()
    {
        return "IPMotorsWebServiceBundle:Default:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  19 => 1,);
    }
}


text:
namespace GitHub.VisualStudio.Helpers
{
    public static class Constants
    {
        public const string NoAngleBracketsErrorMessage = "Failed to parse signature - Neither `name` nor `email` should contain angle brackets chars.";
        public const int MaxRepositoryNameLength = 100;
        public const int MaxDirectoryLength = 200; // Windows allows 248, but we need to allow room for subdirectories.
        public const int MaxFilePathLength = 260;
    }
}


text:
package web_server

import (
	"errors"
	"fmt"
	"net/http"
	"os"
	"strconv"
	"strings"

	"github.com/Azure/azure-sdk-for-go/arm/storage"
	storageclient "github.com/Azure/azure-sdk-for-go/storage"

	ac "github.com/bingosummer/azure_storage_service_broker/azure_client"
	"github.com/bingosummer/azure_storage_service_broker/model"
	"github.com/bingosummer/azure_storage_service_broker/utils"
)

const (
	X_BROKER_API_VERSION_NAME = "X-Broker-Api-Version"
	X_BROKER_API_VERSION      = "2.5"
)

type Controller struct {
	serviceClient ac.Client

	instanceMap map[string]*model.ServiceInstance
	bindingMap  map[string]*model.ServiceBinding
}

func NewController(instanceMap map[string]*model.ServiceInstance, bindingMap map[string]*model.ServiceBinding) *Controller {
	serviceClient := ac.NewClient()
	if serviceClient == nil {
		return nil
	}

	return &Controller{
		instanceMap:   instanceMap,
		bindingMap:    bindingMap,
		serviceClient: serviceClient,
	}
}

func (c *Controller) Catalog(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Get Service Broker Catalog...")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	apiVersion := r.Header.Get(X_BROKER_API_VERSION_NAME)
	supported := validateApiVersion(apiVersion, X_BROKER_API_VERSION)
	if !supported {
		fmt.Printf("API Version is %s, not supported.\n", apiVersion)
		w.WriteHeader(http.StatusPreconditionFailed)
		return
	}
	fmt.Println("API Version is " + apiVersion)

	var catalog model.Catalog
	err = utils.ReadAndUnmarshal(&catalog, conf.CatalogPath, "catalog.json")
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	utils.WriteResponse(w, http.StatusOK, catalog)
}

func (c *Controller) CreateServiceInstance(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Create Service Instance...")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	var instance model.ServiceInstance
	instance.DashboardUrl = "http://dashbaord_url"

	err = utils.ProvisionDataFromRequest(r, &instance)
	if err != nil {
		fmt.Println("Failed to provision data from request")
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	acceptsIncomplete := r.URL.Query().Get("accepts_incomplete")
	if acceptsIncomplete != "true" {
		fmt.Println("Only asynchronous provisioning is supported")
		response := make(map[string]string)
		response["error"] = "AsyncRequired"
		response["description"] = "This service plan requires client support for asynchronous service operations."
		utils.WriteResponse(w, 422, response)
		return
	}

	serviceInstanceGuid := utils.ExtractVarsFromRequest(r, "service_instance_guid")
	instance.Id = serviceInstanceGuid

	var containerAccessType storageclient.ContainerAccessType
	switch instance.Parameters.(type) {
	case map[string]interface{}:
		param := instance.Parameters.(map[string]interface{})

		if param["container_access_type"] != nil {
			containerAccessType = storageclient.ContainerAccessType(param["container_access_type"].(string))
		} else {
			containerAccessType = storageclient.ContainerAccessTypePrivate
		}
	default:
		containerAccessType = storageclient.ContainerAccessTypePrivate
	}

	resourceGroupName, storageAccountName, err := c.serviceClient.CreateInstance(serviceInstanceGuid, instance.Parameters)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	instance.ResourceGroupName = resourceGroupName
	instance.StorageAccountName = storageAccountName
	instance.ContainerAccessType = containerAccessType

	instance.State = "in progress"
	instance.Description = "creating service instance..."

	c.instanceMap[instance.Id] = &instance
	err = utils.MarshalAndRecord(c.instanceMap, conf.DataPath, conf.ServiceInstancesFileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	response := model.CreateServiceInstanceResponse{
		DashboardUrl: instance.DashboardUrl,
	}
	utils.WriteResponse(w, http.StatusAccepted, response)
}

func (c *Controller) GetServiceInstance(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Get Service Instance State....")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	instanceId := utils.ExtractVarsFromRequest(r, "service_instance_guid")
	instance := c.instanceMap[instanceId]
	if instance == nil {
		w.WriteHeader(http.StatusGone)
		return
	}

	state, err := c.serviceClient.GetInstanceState(instance.ResourceGroupName, instance.StorageAccountName)
	if err != nil {
		if strings.Contains(err.Error(), "404") {
			w.WriteHeader(http.StatusGone)
		} else {
			w.WriteHeader(http.StatusInternalServerError)
		}
		return
	}

	if state == storage.Creating || state == storage.ResolvingDNS {
		instance.State = "in progress"
		instance.Description = "Creating the service instance, state: " + string(state)
	} else if state == storage.Succeeded {
		instance.State = "succeeded"
		instance.Description = "Successfully created the service instance, state: " + string(state)
	} else {
		instance.State = "failed"
		instance.Description = "Failed to create the service instance, state: " + string(state)
	}

	err = utils.MarshalAndRecord(c.instanceMap, conf.DataPath, conf.ServiceInstancesFileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	response := model.CreateLastOperationResponse{
		State:       instance.State,
		Description: instance.Description,
	}
	utils.WriteResponse(w, http.StatusOK, response)
}

func (c *Controller) RemoveServiceInstance(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Remove Service Instance...")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	instanceId := utils.ExtractVarsFromRequest(r, "service_instance_guid")
	instance := c.instanceMap[instanceId]
	if instance == nil {
		w.WriteHeader(http.StatusGone)
		return
	}

	err = c.serviceClient.DeleteInstance(instance.ResourceGroupName, instance.StorageAccountName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	delete(c.instanceMap, instanceId)
	utils.MarshalAndRecord(c.instanceMap, conf.DataPath, conf.ServiceInstancesFileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	err = c.deleteAssociatedBindings(instanceId)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	response := make(map[string]string)
	utils.WriteResponse(w, http.StatusOK, response)
}

func (c *Controller) Bind(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Bind Service Instance...")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	bindingId := utils.ExtractVarsFromRequest(r, "service_binding_guid")
	instanceId := utils.ExtractVarsFromRequest(r, "service_instance_guid")

	instance := c.instanceMap[instanceId]
	if instance == nil {
		w.WriteHeader(http.StatusNotFound)
		return
	}

	primaryAccessKey, secondaryAccessKey, containerName, err := c.serviceClient.GetAccessKeys(instanceId, instance.ResourceGroupName, instance.StorageAccountName, instance.ContainerAccessType)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	credentials := model.Credentials{
		StorageAccountName: instance.StorageAccountName,
		ContainerName:      containerName,
		PrimaryAccessKey:   primaryAccessKey,
		SecondaryAccessKey: secondaryAccessKey,
	}

	response := model.CreateServiceBindingResponse{
		Credentials: credentials,
	}

	c.bindingMap[bindingId] = &model.ServiceBinding{
		Id:                bindingId,
		ServiceId:         instance.ServiceId,
		ServicePlanId:     instance.PlanId,
		ServiceInstanceId: instance.Id,
		Credentials:       credentials,
	}

	err = utils.MarshalAndRecord(c.bindingMap, conf.DataPath, conf.ServiceBindingsFileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	utils.WriteResponse(w, http.StatusCreated, response)
}

func (c *Controller) UnBind(w http.ResponseWriter, r *http.Request) {
	fmt.Println("Unbind Service Instance...")

	statusCode, err := authentication(r)
	if err != nil {
		w.WriteHeader(statusCode)
		return
	}

	bindingId := utils.ExtractVarsFromRequest(r, "service_binding_guid")
	instanceId := utils.ExtractVarsFromRequest(r, "service_instance_guid")
	instance := c.instanceMap[instanceId]
	if instance == nil {
		w.WriteHeader(http.StatusGone)
		return
	}

	err = c.serviceClient.RegenerateAccessKeys(instance.ResourceGroupName, instance.StorageAccountName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	delete(c.bindingMap, bindingId)
	err = utils.MarshalAndRecord(c.bindingMap, conf.DataPath, conf.ServiceBindingsFileName)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	response := make(map[string]string)
	utils.WriteResponse(w, http.StatusOK, response)
}

func (c *Controller) deleteAssociatedBindings(instanceId string) error {
	for id, binding := range c.bindingMap {
		if binding.ServiceInstanceId == instanceId {
			delete(c.bindingMap, id)
		}
	}

	return utils.MarshalAndRecord(c.bindingMap, conf.DataPath, conf.ServiceBindingsFileName)
}

func authentication(r *http.Request) (int, error) {
	authUsername, authPassword, err := loadAuthCredentials()
	if err != nil {
		return http.StatusInternalServerError, err
	}

	username, password, ok := r.BasicAuth()
	if !ok {
		return http.StatusUnauthorized, errors.New("No username and password provided in the request's Authorization header")
	}

	if username != authUsername || password != authPassword {
		return http.StatusUnauthorized, errors.New("The username and password are invalid")
	}

	return 0, nil
}

func loadAuthCredentials() (string, string, error) {
	username := os.Getenv("authUsername")
	if username == "" {
		return "", "", errors.New("No auth_username provided in environment variables")
	}

	password := os.Getenv("authPassword")
	if password == "" {
		return "", "", errors.New("No auth_password provided in environment variables")
	}

	return username, password, nil
}

func validateApiVersion(actual, expected string) bool {
	apiVersion := strings.Split(actual, ".")
	majorApiVersionActual, err1 := strconv.Atoi(apiVersion[0])
	minorApiVersionActual, err2 := strconv.Atoi(apiVersion[1])
	if err1 != nil || err2 != nil {
		return false
	}

	apiVersion = strings.Split(expected, ".")
	majorApiVersionExpected, _ := strconv.Atoi(apiVersion[0])
	minorApiVersionExpected, _ := strconv.Atoi(apiVersion[1])

	if majorApiVersionActual < majorApiVersionExpected {
		return false
	}
	if majorApiVersionActual == majorApiVersionExpected && minorApiVersionActual < minorApiVersionExpected {
		return false
	}
	return true
}


text:
package org.apache.axis.encoding.ser;

import org.apache.axis.attachments.ImageDataSource;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.encoding.SerializationContext;
import org.apache.commons.logging.Log;
import org.xml.sax.Attributes;

import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import java.awt.*;
import java.io.IOException;

/**
 * ImageDataHandler Serializer
 * @author Russell Butek (butek@us.ibm.com)
 */
public class ImageDataHandlerSerializer extends JAFDataHandlerSerializer {

    protected static Log log =
        LogFactory.getLog(ImageDataHandlerSerializer.class.getName());

    /**
     * Serialize a Source DataHandler quantity.
     */
    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh = new DataHandler(
                new ImageDataSource("source", (Image) value));
        super.serialize(name, attributes, dh, context);
    } // serialize
} // class ImageDataHandlerSerializer


text:
.timeline-container {
  width: 100%;
  height: calc(100% - 55px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border: none;
}
.timeline-container svg {
  font: 10px sans-serif;
}
.timeline-container svg .rgroups > .selected {
  fill: #dbb510 !important;
}
.timeline-container svg .axis path,
.timeline-container svg .axis line {
  fill: none;
  stroke: black;
  shape-rendering: crispEdges;
}
.timeline-container svg .axis.y > .tick > text {
  fill: gray;
}
.timeline-container svg .axis.y path {
  stroke: none;
}
.timeline-container svg .grid .tick {
  stroke-width: 2px;
  stroke: #c7c7c7;
  stroke-opacity: 0.5;
  shape-rendering: crispEdges;
}
.timeline-container svg .grid path {
  stroke-width: 0;
}
.timeline-container svg .brush .extent {
  stroke-width: 2px;
  fill: url(#timeline-gradient);
  fill-opacity: .522;
  shape-rendering: crispEdges;
}
.timeline-container svg .dot {
  stroke: #000;
}


text:
@interface TargetSetup : NSObject

-(void) drawTargetDemowithResultsIf:(BOOL)readyToAssess;
-(void) drawCylinderPlacementReminderAtLocation:(TargetSelection)targetLocation;
-(void) drawConePlacementReminderAtLocation:(TargetSelection)targetLocation;

-(void) drawStaticTable;
-(void) drawWhiteTableSizedBG;

-(void)drawLevel3ReminderForTarget1:(TargetSelection)targetLocation1 andTarget2:(TargetSelection)targetLocation2;
-(void)drawOnlyConePlacementWithNoTableAtLocation:(TargetSelection)targetLocation;

@property float sceneOpacity;

@property (assign) TargetTypes targetTypeLeft;
@property (assign) TargetTypes targetTypeMid;
@property (assign) TargetTypes targetTypeRight;

@property(assign) BOOL leftTargetIsCorrect;
@property(assign) BOOL middleTargetIsCorrect;
@property(assign) BOOL rightTargetIsCorrect;
@property(assign) BOOL transportEnabledIsCorrect;

@property(assign) NSString * speechTag;

@property(assign) int targetID1ForL3;
@property(assign) int targetID2ForL3;
@property(assign) BOOL isTransportTask;

@end


text:
/******************************************************************************
 *  Compilation:  javac InteractivePercolationVisualizer.java
 *  Execution:    java InteractivePercolationVisualizer n
 *  Dependencies: PercolationVisualizer.java Percolation.java
 *                StdDraw.java StdOut.java
 *
 *  This program takes the grid size n as a command-line argument.
 *  Then, the user repeatedly clicks sites to open with the mouse.
 *  After each site is opened, it draws full sites in light blue,
 *  open sites (that aren't full) in white, and blocked sites in black.
 *
 ******************************************************************************/

package week1.percolation;

import edu.princeton.cs.algs4.StdDraw;
import edu.princeton.cs.algs4.StdOut;

public class InteractivePercolationVisualizer {

    public static void main(String[] args) {
        // n-by-n percolation system (read from command-line, default = 10)
        int n = 10;
        if (args.length == 1) n = Integer.parseInt(args[0]);

        // repeatedly open site specified my mouse click and draw resulting system
        StdOut.println(n);

        StdDraw.enableDoubleBuffering();
        Percolation perc = new Percolation(n);
        PercolationVisualizer.draw(perc, n);
        StdDraw.show();

        while (true) {

            // detected mouse click
            if (StdDraw.isMousePressed()) {

                // screen coordinates
                double x = StdDraw.mouseX();
                double y = StdDraw.mouseY();

                // convert to row i, column j
                int i = (int) (n - Math.floor(y));
                int j = (int) (1 + Math.floor(x));

                // open site (i, j) provided it's in bounds
                if (i >= 1 && i <= n && j >= 1 && j <= n) {
                    if (!perc.isOpen(i, j)) {
                        StdOut.println(i + " " + j);
                    }
                    perc.open(i, j);
                }

                // draw n-by-n percolation system
                PercolationVisualizer.draw(perc, n);
                StdDraw.show();
            }

            StdDraw.pause(20);
        }
    }
}


text:
from devp2p import discovery
from devp2p import kademlia
from devp2p import crypto
from devp2p.app import BaseApp
import gevent
import random

random.seed(42)

###############################

def test_address():
    Address = discovery.Address

    ipv4 = '127.98.19.21'
    ipv6 = '5aef:2b::8'
    hostname = 'localhost'
    port = 1

    a4 = Address(ipv4, port)
    aa4 = Address(ipv4, port)
    assert a4 == aa4
    a6 = Address(ipv6, port)
    aa6 = Address(ipv6, port)
    assert a6 == aa6

    b_a4 = a4.to_binary()
    assert a4 == Address.from_binary(*b_a4)

    b_a6 = a6.to_binary()
    assert len(b_a6) == 3
    assert a6 == Address.from_binary(*b_a6)

    e_a4 = a4.to_endpoint()
    assert a4 == Address.from_endpoint(*e_a4)

    e_a6 = a6.to_endpoint()
    assert a6 == Address.from_endpoint(*e_a6)

    assert len(b_a6[0]) == 16
    assert len(b_a4[0]) == 4
    assert isinstance(b_a6[1], str)

    host_a = Address(hostname, port)
    assert host_a.ip in ("127.0.0.1", "::1")

#############################

class AppMock(object):
    pass

class NodeDiscoveryMock(object):

    messages = []  # [(to_address, from_address, message), ...] shared between all instances

    def __init__(self, host, port, seed):
        self.address = discovery.Address(host, port)

        config = dict(
            discovery=dict(),
            node=dict(privkey_hex=crypto.sha3(seed).encode('hex')),
            p2p=dict(listen_port=port),
        )
        config_discovery = config['discovery']
        config_discovery['listen_host'] = host
        config_discovery['listen_port'] = port

        app = AppMock()
        app.config = config
        self.protocol = discovery.DiscoveryProtocol(app=app, transport=self)

    def send(self, address, message):
        assert isinstance(address, discovery.Address)
        assert address != self.address
        self.messages.append((address, self.address, message))

    def receive(self, address, message):
        assert isinstance(address, discovery.Address)
        self.protocol.receive(address, message)

    def poll(self):
        # try to receive a message
        for i, (to_address, from_address, message) in enumerate(self.messages):
            if to_address == self.address:
                del self.messages[i]
                self.receive(from_address, message)

def test_packing():
    """
    https://github.com/ethereum/go-ethereum/blob/develop/crypto/secp256k1/secp256.go#L299
    https://github.com/ethereum/go-ethereum/blob/develop/p2p/discover/udp.go#L343
    """

    # get two DiscoveryProtocol instances
    alice = NodeDiscoveryMock(host='127.0.0.1', port=1, seed='alice').protocol
    bob = NodeDiscoveryMock(host='127.0.0.1', port=1, seed='bob').protocol

    for cmd_id in alice.cmd_id_map.values():
        payload = ['a', ['b', 'c']]
        message = alice.pack(cmd_id, payload)
        r_pubkey, r_cmd_id, r_payload, mdc = bob.unpack(message)
        assert r_cmd_id == cmd_id
        assert r_payload == payload
        assert len(r_pubkey) == len(alice.pubkey)
        assert r_pubkey == alice.pubkey

def test_ping_pong():
    alice = NodeDiscoveryMock(host='127.0.0.1', port=1, seed='alice')
    bob = NodeDiscoveryMock(host='127.0.0.2', port=2, seed='bob')

    bob_node = alice.protocol.get_node(bob.protocol.pubkey, bob.address)
    alice.protocol.kademlia.ping(bob_node)
    assert len(NodeDiscoveryMock.messages) == 1
    # inspect message in queue
    msg = NodeDiscoveryMock.messages[0][2]
    remote_pubkey, cmd_id, payload, mdc = bob.protocol.unpack(msg)
    assert cmd_id == alice.protocol.cmd_id_map['ping']
    bob.poll()  # receives ping, sends pong
    assert len(NodeDiscoveryMock.messages) == 1
    alice.poll()  # receives pong
    assert len(NodeDiscoveryMock.messages) == 0

# ############ test with real UDP ##################

def get_app(port, seed):
    config = dict(
        discovery=dict(),
        node=dict(privkey_hex=crypto.sha3(seed).encode('hex')),
        p2p=dict(listen_port=port),
    )
    config_discovery = config['discovery']
    config_discovery['listen_host'] = '127.0.0.1'
    config_discovery['listen_port'] = port
    config_discovery['bootstrap_nodes'] = []
    # create app
    app = BaseApp(config)
    discovery.NodeDiscovery.register_with_app(app)
    return app

def test_ping_pong_udp():
    alice_app = get_app(30000, 'alice')
    alice_app.start()
    alice_discovery = alice_app.services.discovery
    bob_app = get_app(30001, 'bob')
    bob_app.start()
    bob_discovery = bob_app.services.discovery

    gevent.sleep(0.1)
    bob_node = alice_discovery.protocol.get_node(bob_discovery.protocol.pubkey,
                                                 bob_discovery.address)
    assert bob_node not in alice_discovery.protocol.kademlia.routing
    alice_discovery.protocol.kademlia.ping(bob_node)
    assert bob_node not in alice_discovery.protocol.kademlia.routing
    gevent.sleep(0.1)
    bob_app.stop()
    alice_app.stop()
    assert bob_node in alice_discovery.protocol.kademlia.routing

def test_bootstrap_udp():
    """
    startup num_apps udp server and node applications
    """

    # set timeout to something more tolerant
    kademlia.k_request_timeout = 10000.

    num_apps = 6
    apps = []
    for i in range(num_apps):
        app = get_app(30002 + i, 'app%d' % i)
        app.start()
        apps.append(app)

    gevent.sleep(0.1)
    sleep_delay = 1  # we need to wait for the packets to be delivered

    kproto = lambda app: app.services.discovery.protocol.kademlia
    this_node = lambda app: kproto(app).this_node

    boot_node = this_node(apps[0])
    assert boot_node.address

    for app in apps[1:]:
        print 'test bootstrap from=%s to=%s' % (this_node(app), boot_node)
        kproto(app).bootstrap([boot_node])
        gevent.sleep(sleep_delay)

    gevent.sleep(sleep_delay * 2)

    for app in apps[1:]:
        print 'test find_node from=%s' % (this_node(app))
        kproto(app).find_node(this_node(app).id)
        gevent.sleep(sleep_delay)

    gevent.sleep(sleep_delay * 2)

    for app in apps:
        app.stop()

    # now all nodes should know each other
    for i, app in enumerate(apps):
        num = len(kproto(app).routing)
        print num
        if i < len(apps) / 2:  # only the first half has enough time to get all updates
            assert num >= num_apps - 1

def main():
    "test connecting nodes"

    # stop on every unhandled exception!
    gevent.get_hub().SYSTEM_ERROR = BaseException  # (KeyboardInterrupt, SystemExit, SystemError)

    app = get_app(30304, 'theapp')
    # app.config['p2p']['listen_host'] = '127.0.0.1'
    app.config['p2p']['listen_host'] = '0.0.0.0'

    print "this node is"
    proto = app.services.discovery.protocol.kademlia
    this_node = proto.this_node
    print this_node.pubkey.encode('hex')

    # add external node

    go_local = 'enode://6ed2fecb28ff17dec8647f08aa4368b57790000e0e9b33a7b91f32c41b6ca9ba21600e9a8c44248ce63a71544388c6745fa291f88f8b81e109ba3da11f7b41b9@127.0.0.1:30303'

    go_bootstrap = 'enode://6cdd090303f394a1cac34ecc9f7cda18127eafa2a3a06de39f6d920b0e583e062a7362097c7c65ee490a758b442acd5c80c6fce4b148c6a391e946b45131365b@54.169.166.226:30303'

    cpp_bootstrap = 'enode://24f904a876975ab5c7acbedc8ec26e6f7559b527c073c6e822049fee4df78f2e9c74840587355a068f2cdb36942679f7a377a6d8c5713ccf40b1d4b99046bba0@5.1.83.226:30303'

    n1 = 'enode://1d799d32547761cf66250f94b4ac1ebfc3246ce9bd87fbf90ef8d770faf48c4d96290ea0c72183d6c1ddca3d2725dad018a6c1c5d1971dbaa182792fa937e89d@162.247.54.200:1024'
    n2 = 'enode://1976e20d6ec2de2dd4df34d8e949994dc333da58c967c62ca84b4d545d3305942207565153e94367f5d571ef79ce6da93c5258e88ca14788c96fbbac40f4a4c7@52.0.216.64:30303'
    n3 = 'enode://14bb48727c8a103057ba06cc010c810e9d4beef746c54d948b681218195b3f1780945300c2534d422d6069f7a0e378c450db380f8efff8b4eccbb48c0c5bb9e8@179.218.168.19:30303'

    nb = 'enode://1976e20d6ec2de2dd4df34d8e949994dc333da58c967c62ca84b4d545d3305942207565153e94367f5d571ef79ce6da93c5258e88ca14788c96fbbac40f4a4c7@52.0.216.64:30303'

    node_uri = cpp_bootstrap

    r_node = discovery.Node.from_uri(node_uri)
    print "remote node is", r_node
    # add node to the routing table

    print "START & TEST BOOTSTRAP"
    app.config['p2p']['bootstrap_nodes'] = [node_uri]
    app.start()

    gevent.sleep(2.)
    print "TEST FIND_NODE"
    for i in range(10):
        nodeid = kademlia.random_nodeid()
        assert isinstance(nodeid, type(this_node.id))
        proto.find_node(nodeid)
    gevent.sleep(1.)

    pinged = lambda: set(n for t, n, r in proto._expected_pongs.values())

    for i in range(10):
        print 'num nodes', len(proto.routing)
        gevent.sleep(1)
        # proto.find_node(this_node.id)
        # for node in proto.routing:
        proto.ping(r_node)
        # proto.find_node(this_node.id)

    print 'nodes in routing'
    for node in proto.routing:
        print node.to_uri()
    print 'nodes we are waiting for pongs'

    for node in pinged():
        print node.to_uri()

if __name__ == '__main__':
    import ethereum.slogging

    ethereum.slogging.configure(config_string=':debug')
    main()

"""
unexpected pongs from cpp client

case:
    bootstrap pubkey does not match

versions would be good
i get a ping reply by 2 nodes

"""


text:
from django.db import models

# Create your models here.

class Dataset(models.Model):
    ds_id          = models.IntegerField()
    ds_name        = models.CharField(max_length=100)

    def __str__(self):
        return self.ds_name

class Cache(models.Model):
    c_id          = models.IntegerField()
    c_name        = models.CharField(max_length=100)
    c_config_path = models.CharField(max_length=1000)
    c_is_active   = models.BooleanField(default=True)

    def __str__(self):
        return self.c_name

class Module(models.Model):
    mod_id          = models.IntegerField()
    mod_name        = models.CharField(max_length=255)
    mod_definition  = models.CharField(max_length=100000)
    mod_is_active   = models.BooleanField(default=True)

    mod_cache       = models.ForeignKey(Cache, on_delete=models.PROTECT)
    mod_datasets    = models.ManyToManyField(Dataset, blank=True, null=True)
    mod_depends_on  = models.ForeignKey('self', on_delete=models.PROTECT, blank=True, null=True)

    def __str__(self):
        return self.mod_name


text:
using System.Runtime.CompilerServices;

namespace System
{
    public readonly partial struct DateTime
    {
        public static DateTime UtcNow
        {
            get
            {
                return new DateTime(((ulong)(GetSystemTimeAsFileTime() + FileTimeOffset)) | KindUtc);
            }
        }

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        private static extern long GetSystemTimeAsFileTime();
    }
}


text:
	<title>Garry Bushell's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Garry Bushell's panel show appearances

Garry Bushell (born 1955-05-13[ref]) has appeared in 1 episodes between 2000-2000.  Garry Bushell on IMDB. Garry Bushell on Wikipedia.

2000

2000-03-17 / Loose Women


text:
namespace net {

namespace {

TEST(HostMappingRulesTest, SetRulesFromString) {
  HostMappingRules rules;
  rules.SetRulesFromString(
      "map *.com baz , map *.net bar:60, EXCLUDE *.foo.com");

  HostPortPair host_port("test", 1234);
  EXPECT_FALSE(rules.RewriteHost(&host_port));
  EXPECT_EQ("test", host_port.host());
  EXPECT_EQ(1234u, host_port.port());

  host_port = HostPortPair("chrome.net", 80);
  EXPECT_TRUE(rules.RewriteHost(&host_port));
  EXPECT_EQ("bar", host_port.host());
  EXPECT_EQ(60u, host_port.port());

  host_port = HostPortPair("crack.com", 80);
  EXPECT_TRUE(rules.RewriteHost(&host_port));
  EXPECT_EQ("baz", host_port.host());
  EXPECT_EQ(80u, host_port.port());

  host_port = HostPortPair("wtf.foo.com", 666);
  EXPECT_FALSE(rules.RewriteHost(&host_port));
  EXPECT_EQ("wtf.foo.com", host_port.host());
  EXPECT_EQ(666u, host_port.port());
}

TEST(HostMappingRulesTest, PortSpecificMatching) {
  HostMappingRules rules;
  rules.SetRulesFromString(
      "map *.com:80 baz:111 , map *.com:443 blat:333, EXCLUDE *.foo.com");

  // No match
  HostPortPair host_port("test.com", 1234);
  EXPECT_FALSE(rules.RewriteHost(&host_port));
  EXPECT_EQ("test.com", host_port.host());
  EXPECT_EQ(1234u, host_port.port());

  // Match port 80
  host_port = HostPortPair("crack.com", 80);
  EXPECT_TRUE(rules.RewriteHost(&host_port));
  EXPECT_EQ("baz", host_port.host());
  EXPECT_EQ(111u, host_port.port());

  // Match port 443
  host_port = HostPortPair("wtf.com", 443);
  EXPECT_TRUE(rules.RewriteHost(&host_port));
  EXPECT_EQ("blat", host_port.host());
  EXPECT_EQ(333u, host_port.port());

  // Match port 443, but excluded.
  host_port = HostPortPair("wtf.foo.com", 443);
  EXPECT_FALSE(rules.RewriteHost(&host_port));
  EXPECT_EQ("wtf.foo.com", host_port.host());
  EXPECT_EQ(443u, host_port.port());
}

// Parsing bad rules should silently discard the rule (and never crash).
TEST(HostMappingRulesTest, ParseInvalidRules) {
  HostMappingRules rules;

  EXPECT_FALSE(rules.AddRuleFromString("xyz"));
  EXPECT_FALSE(rules.AddRuleFromString(std::string()));
  EXPECT_FALSE(rules.AddRuleFromString(" "));
  EXPECT_FALSE(rules.AddRuleFromString("EXCLUDE"));
  EXPECT_FALSE(rules.AddRuleFromString("EXCLUDE foo bar"));
  EXPECT_FALSE(rules.AddRuleFromString("INCLUDE"));
  EXPECT_FALSE(rules.AddRuleFromString("INCLUDE x"));
  EXPECT_FALSE(rules.AddRuleFromString("INCLUDE x :10"));
}

TEST(HostMappingRulesTest, RewritesUrl) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  GURL url("http://initial.test:111");
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("http://replacement.test:1000"));
}

TEST(HostMappingRulesTest, RewritesUrlToIpv6Literal) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test [2345:6789::0abc]:1112");

  GURL url("http://initial.test:111");
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("http://[2345:6789::0abc]:1112"));
}

TEST(HostMappingRulesTest, RewritesUrlPreservingScheme) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  GURL url("wss://initial.test:222");
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("wss://replacement.test:1000"));
}

TEST(HostMappingRulesTest, RewritesFileUrl) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  // Expect replacement port to be ignored because file URLs do not use port.
  GURL url("file://initial.test/file.txt");
  ASSERT_EQ(url.EffectiveIntPort(), url::PORT_UNSPECIFIED);
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("file://replacement.test/file.txt"));
  EXPECT_EQ(url.EffectiveIntPort(), url::PORT_UNSPECIFIED);
}

TEST(HostMappingRulesTest, RewritesAnyStandardUrlWithPort) {
  const char kScheme[] = "foo";
  url::ScopedSchemeRegistryForTests scoped_registry;
  AddStandardScheme(kScheme, url::SCHEME_WITH_HOST_AND_PORT);
  ASSERT_TRUE(url::IsStandard(kScheme, url::Component(0, strlen(kScheme))));

  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  GURL url("foo://initial.test:100");
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("foo://replacement.test:1000"));
}

TEST(HostMappingRulesTest, RewritesAnyStandardUrlWithoutPort) {
  const char kScheme[] = "foo";
  url::ScopedSchemeRegistryForTests scoped_registry;
  AddStandardScheme(kScheme, url::SCHEME_WITH_HOST);
  ASSERT_TRUE(url::IsStandard(kScheme, url::Component(0, strlen(kScheme))));

  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  // Expect replacement port to be ignored.
  GURL url("foo://initial.test");
  ASSERT_EQ(url.EffectiveIntPort(), url::PORT_UNSPECIFIED);
  EXPECT_EQ(rules.RewriteUrl(url), HostMappingRules::RewriteResult::kRewritten);
  EXPECT_EQ(url, GURL("foo://replacement.test"));
  EXPECT_EQ(url.EffectiveIntPort(), url::PORT_UNSPECIFIED);
}

TEST(HostMappingRulesTest, IgnoresUnmappedUrls) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test replacement.test:1000");

  GURL url("http://different.test:111");
  EXPECT_EQ(rules.RewriteUrl(url),
            HostMappingRules::RewriteResult::kNoMatchingRule);
  EXPECT_EQ(url, GURL("http://different.test:111"));
}

TEST(HostMappingRulesTest, IgnoresInvalidReplacementUrls) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test invalid/url");

  GURL url("http://initial.test");
  EXPECT_EQ(rules.RewriteUrl(url),
            HostMappingRules::RewriteResult::kInvalidRewrite);
  EXPECT_EQ(url, GURL("http://initial.test"));
}

// Remapping to "~NOTFOUND" is documented as a special case for
// MappedHostResolver usage. Ensure that it is handled as invalid as expected.
TEST(HostMappingRulesTest, NotFoundIgnoredAsInvalidUrl) {
  HostMappingRules rules;
  rules.AddRuleFromString("MAP initial.test ~NOTFOUND");

  GURL url("http://initial.test");
  EXPECT_EQ(rules.RewriteUrl(url),
            HostMappingRules::RewriteResult::kInvalidRewrite);
  EXPECT_EQ(url, GURL("http://initial.test"));
}

}  // namespace

}  // namespace net