text:
namespace Samples.Specifications.Tests.Acceptance.Specs
{
    using TechTalk.SpecFlow;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.0.0.0")]
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public partial class GracefulShutdownFeature : Xunit.IClassFixture<GracefulShutdownFeature.FixtureData>, System.IDisposable
    {

        private static TechTalk.SpecFlow.ITestRunner testRunner;

        private Xunit.Abstractions.ITestOutputHelper _testOutputHelper;

#line 1 "GracefulShutdown.feature"
#line hidden

        public GracefulShutdownFeature(GracefulShutdownFeature.FixtureData fixtureData, Xunit.Abstractions.ITestOutputHelper testOutputHelper)
        {
            this._testOutputHelper = testOutputHelper;
            this.TestInitialize();
        }

        public static void FeatureSetup()
        {
            testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
            TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "GracefulShutdown", "\tIn order to avoid losing data\r\n\tAs a system user\r\n\tI want to have an option of s" +
                    "aving changes before closing the application", ProgrammingLanguage.CSharp, ((string[])(null)));
            testRunner.OnFeatureStart(featureInfo);
        }

        public static void FeatureTearDown()
        {
            testRunner.OnFeatureEnd();
            testRunner = null;
        }

        public virtual void TestInitialize()
        {
        }

        public virtual void ScenarioTearDown()
        {
            testRunner.OnScenarioEnd();
        }

        public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
        {
            testRunner.OnScenarioInitialize(scenarioInfo);
            testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<Xunit.Abstractions.ITestOutputHelper>(_testOutputHelper);
        }

        public virtual void ScenarioStart()
        {
            testRunner.OnScenarioStart();
        }

        public virtual void ScenarioCleanup()
        {
            testRunner.CollectScenarioErrors();
        }

        void System.IDisposable.Dispose()
        {
            this.ScenarioTearDown();
        }

        [Xunit.FactAttribute(DisplayName="Display exit application options if there are unsaved changes")]
        [Xunit.TraitAttribute("FeatureTitle", "GracefulShutdown")]
        [Xunit.TraitAttribute("Description", "Display exit application options if there are unsaved changes")]
        public virtual void DisplayExitApplicationOptionsIfThereAreUnsavedChanges()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Display exit application options if there are unsaved changes", null, ((string[])(null)));
#line 6
this.ScenarioInitialize(scenarioInfo);
            this.ScenarioStart();
#line hidden
            TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
                        "Kind",
                        "Price",
                        "Quantity"});
            table5.AddRow(new string[] {
                        "Oven",
                        "34.95",
                        "20"});
            table5.AddRow(new string[] {
                        "TV",
                        "346.95",
                        "50"});
            table5.AddRow(new string[] {
                        "PC",
                        "423.95",
                        "70"});
#line 7
 testRunner.Given("warehouse contains the following items:", ((string)(null)), table5, "Given ");
#line 12
 testRunner.And("I am able to log in successfully with username \'Admin\' and password \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 13
 testRunner.When("I open the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 14
 testRunner.And("I set the username to \'Admin\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 15
 testRunner.And("I set the password to \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 16
 testRunner.And("I log in to the system", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 17
 testRunner.And("I set the Price for \'TV\' item to 350", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 18
 testRunner.And("I close the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 19
 testRunner.Then("the exit application options are displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
            this.ScenarioCleanup();
        }

        [Xunit.FactAttribute(DisplayName="Don\'t display exit application options if there are no unsaved changes")]
        [Xunit.TraitAttribute("FeatureTitle", "GracefulShutdown")]
        [Xunit.TraitAttribute("Description", "Don\'t display exit application options if there are no unsaved changes")]
        public virtual void DontDisplayExitApplicationOptionsIfThereAreNoUnsavedChanges()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Don\'t display exit application options if there are no unsaved changes", null, ((string[])(null)));
#line 21
this.ScenarioInitialize(scenarioInfo);
            this.ScenarioStart();
#line hidden
            TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
                        "Kind",
                        "Price",
                        "Quantity"});
            table6.AddRow(new string[] {
                        "Oven",
                        "34.95",
                        "20"});
            table6.AddRow(new string[] {
                        "TV",
                        "346.95",
                        "50"});
            table6.AddRow(new string[] {
                        "PC",
                        "423.95",
                        "70"});
#line 22
 testRunner.Given("warehouse contains the following items:", ((string)(null)), table6, "Given ");
#line 27
 testRunner.And("I am able to log in successfully with username \'Admin\' and password \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 28
 testRunner.When("I open the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 29
 testRunner.And("I set the username to \'Admin\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 30
 testRunner.And("I set the password to \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 31
 testRunner.And("I log in to the system", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 32
 testRunner.And("I set the Price for \'TV\' item to 350", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 33
 testRunner.And("I discard the changes", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 34
 testRunner.And("I close the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 35
 testRunner.Then("the exit application options are not displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
            this.ScenarioCleanup();
        }

        [Xunit.FactAttribute(DisplayName="Save changed item data if exit with save option is selected", Skip="Ignored")]
        [Xunit.TraitAttribute("FeatureTitle", "GracefulShutdown")]
        [Xunit.TraitAttribute("Description", "Save changed item data if exit with save option is selected")]
        public virtual void SaveChangedItemDataIfExitWithSaveOptionIsSelected()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Save changed item data if exit with save option is selected", null, new string[] {
                        "ignore"});
#line 38
this.ScenarioInitialize(scenarioInfo);
            this.ScenarioStart();
#line hidden
            TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
                        "Kind",
                        "Price",
                        "Quantity"});
            table7.AddRow(new string[] {
                        "Oven",
                        "34.95",
                        "20"});
            table7.AddRow(new string[] {
                        "TV",
                        "346.95",
                        "50"});
            table7.AddRow(new string[] {
                        "PC",
                        "423.95",
                        "70"});
#line 39
 testRunner.Given("warehouse contains the following items:", ((string)(null)), table7, "Given ");
#line 44
 testRunner.And("I am able to log in successfully with username \'Admin\' and password \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 45
 testRunner.When("I open the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 46
 testRunner.And("I set the username to \'Admin\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 47
 testRunner.And("I set the password to \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 48
 testRunner.And("I log in to the system", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 49
 testRunner.And("I set the Quantity for \'TV\' item to 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 50
 testRunner.And("I close the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 51
 testRunner.And("I select exit with save option", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 52
 testRunner.Then("the Quantity for \"TV\" item is 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 53
 testRunner.And("the changes are saved", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [Xunit.FactAttribute(DisplayName="Discard changed item data if exit without save option is selected", Skip="Ignored")]
        [Xunit.TraitAttribute("FeatureTitle", "GracefulShutdown")]
        [Xunit.TraitAttribute("Description", "Discard changed item data if exit without save option is selected")]
        public virtual void DiscardChangedItemDataIfExitWithoutSaveOptionIsSelected()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Discard changed item data if exit without save option is selected", null, new string[] {
                        "ignore"});
#line 56
this.ScenarioInitialize(scenarioInfo);
            this.ScenarioStart();
#line hidden
            TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
                        "Kind",
                        "Price",
                        "Quantity"});
            table8.AddRow(new string[] {
                        "Oven",
                        "34.95",
                        "20"});
            table8.AddRow(new string[] {
                        "TV",
                        "346.95",
                        "50"});
            table8.AddRow(new string[] {
                        "PC",
                        "423.95",
                        "70"});
#line 57
 testRunner.Given("warehouse contains the following items:", ((string)(null)), table8, "Given ");
#line 62
 testRunner.And("I am able to log in successfully with username \'Admin\' and password \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 63
 testRunner.When("I open the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 64
 testRunner.And("I set the username to \'Admin\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 65
 testRunner.And("I set the password to \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 66
 testRunner.And("I log in to the system", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 67
 testRunner.And("I set the Quantity for \'TV\' item to 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 68
 testRunner.And("I close the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 69
 testRunner.And("I select exit without save option", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 70
 testRunner.Then("the Quantity for \"TV\" item is 50", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 71
 testRunner.And("the changes are discarded", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [Xunit.FactAttribute(DisplayName="Keep changed item data if cancel option is selected")]
        [Xunit.TraitAttribute("FeatureTitle", "GracefulShutdown")]
        [Xunit.TraitAttribute("Description", "Keep changed item data if cancel option is selected")]
        public virtual void KeepChangedItemDataIfCancelOptionIsSelected()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Keep changed item data if cancel option is selected", null, ((string[])(null)));
#line 73
this.ScenarioInitialize(scenarioInfo);
            this.ScenarioStart();
#line hidden
            TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
                        "Kind",
                        "Price",
                        "Quantity"});
            table9.AddRow(new string[] {
                        "Oven",
                        "34.95",
                        "20"});
            table9.AddRow(new string[] {
                        "TV",
                        "346.95",
                        "50"});
            table9.AddRow(new string[] {
                        "PC",
                        "423.95",
                        "70"});
#line 74
 testRunner.Given("warehouse contains the following items:", ((string)(null)), table9, "Given ");
#line 79
 testRunner.And("I am able to log in successfully with username \'Admin\' and password \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 80
 testRunner.When("I open the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 81
 testRunner.And("I set the username to \'Admin\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 82
 testRunner.And("I set the password to \'pass\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 83
 testRunner.And("I log in to the system", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 84
 testRunner.And("I set the Quantity for \'TV\' item to 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 85
 testRunner.And("I close the application", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 86
 testRunner.And("I select cancel option", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 87
 testRunner.Then("the Quantity for \"TV\" item is 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 88
 testRunner.And("the changes are intact", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
            this.ScenarioCleanup();
        }

        [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.0.0.0")]
        [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        public class FixtureData : System.IDisposable
        {

            public FixtureData()
            {
                GracefulShutdownFeature.FeatureSetup();
            }

            void System.IDisposable.Dispose()
            {
                GracefulShutdownFeature.FeatureTearDown();
            }
        }
    }
}
#pragma warning restore
#endregion


text:
importScripts('sha256.js');

var fileHasher;
var units;
var hashes = [];
var bytesHashed = 0;

function reset() {
    fileHasher = null;
    units = null;
    hashes = [];
    bytesHashed = 0;
}

onmessage = function (evt) {
    // Streaming setup (number of units expected)
    if(typeof evt.data === "number") {
        // Reset hasher
        reset();
        // Setup new file
        units = evt.data;
        fileHasher = new asmCrypto.SHA256.init();
    } else if(fileHasher) {

        // Append data for full hash
        fileHasher.process(evt.data);

        // Increment bytes hashed for progress
        bytesHashed += evt.data.byteLength;

        // Hash and save unit
        hashes.push(asmCrypto.SHA256.hex(evt.data));

        // Remove reference
        delete evt.data;

        // We are finished
        if(hashes.length >= units) {
            // Send 100% progress
            postMessage({id: 'progress', content: bytesHashed});
            // Send all hashes back
            postMessage({id: 'success', content: {
                full: asmCrypto.bytes_to_hex(fileHasher.finish().result),
                units: hashes
            }});
            // Reset hasher
            reset();
            // Progress update
        } else {
            postMessage({id: 'progress', content: bytesHashed});
        }
    }
};

redpajama_set_name: RedPajamaGithub


text:
import mxnet as mx
import proposal
import proposal_target
from rcnn.config import config

eps = 2e-5
use_global_stats = True
workspace = 512
res_deps = {'50': (3, 4, 6, 3), '101': (3, 4, 23, 3), '152': (3, 8, 36, 3), '200': (3, 24, 36, 3)}
units = res_deps['101']
filter_list = [256, 512, 1024, 2048]

def residual_unit(data, num_filter, stride, dim_match, name):
    bn1 = mx.sym.BatchNorm(data=data, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name=name + '_bn1')
    act1 = mx.sym.Activation(data=bn1, act_type='relu', name=name + '_relu1')
    conv1 = mx.sym.Convolution(data=act1, num_filter=int(num_filter * 0.25), kernel=(1, 1), stride=(1, 1), pad=(0, 0),
                               no_bias=True, workspace=workspace, name=name + '_conv1')
    bn2 = mx.sym.BatchNorm(data=conv1, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name=name + '_bn2')
    act2 = mx.sym.Activation(data=bn2, act_type='relu', name=name + '_relu2')
    conv2 = mx.sym.Convolution(data=act2, num_filter=int(num_filter * 0.25), kernel=(3, 3), stride=stride, pad=(1, 1),
                               no_bias=True, workspace=workspace, name=name + '_conv2')
    bn3 = mx.sym.BatchNorm(data=conv2, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name=name + '_bn3')
    act3 = mx.sym.Activation(data=bn3, act_type='relu', name=name + '_relu3')
    conv3 = mx.sym.Convolution(data=act3, num_filter=num_filter, kernel=(1, 1), stride=(1, 1), pad=(0, 0), no_bias=True,
                               workspace=workspace, name=name + '_conv3')
    if dim_match:
        shortcut = data
    else:
        shortcut = mx.sym.Convolution(data=act1, num_filter=num_filter, kernel=(1, 1), stride=stride, no_bias=True,
                                      workspace=workspace, name=name + '_sc')
    sum = mx.sym.ElementWiseSum(*[conv3, shortcut], name=name + '_plus')
    return sum

def get_resnet_conv(data):
    # res1
    data_bn = mx.sym.BatchNorm(data=data, fix_gamma=True, eps=eps, use_global_stats=use_global_stats, name='bn_data')
    conv0 = mx.sym.Convolution(data=data_bn, num_filter=64, kernel=(7, 7), stride=(2, 2), pad=(3, 3),
                               no_bias=True, name="conv0", workspace=workspace)
    bn0 = mx.sym.BatchNorm(data=conv0, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name='bn0')
    relu0 = mx.sym.Activation(data=bn0, act_type='relu', name='relu0')
    pool0 = mx.symbol.Pooling(data=relu0, kernel=(3, 3), stride=(2, 2), pad=(1, 1), pool_type='max', name='pool0')

    # res2
    unit = residual_unit(data=pool0, num_filter=filter_list[0], stride=(1, 1), dim_match=False, name='stage1_unit1')
    for i in range(2, units[0] + 1):
        unit = residual_unit(data=unit, num_filter=filter_list[0], stride=(1, 1), dim_match=True, name='stage1_unit%s' % i)

    # res3
    unit = residual_unit(data=unit, num_filter=filter_list[1], stride=(2, 2), dim_match=False, name='stage2_unit1')
    for i in range(2, units[1] + 1):
        unit = residual_unit(data=unit, num_filter=filter_list[1], stride=(1, 1), dim_match=True, name='stage2_unit%s' % i)

    # res4
    unit = residual_unit(data=unit, num_filter=filter_list[2], stride=(2, 2), dim_match=False, name='stage3_unit1')
    for i in range(2, units[2] + 1):
        unit = residual_unit(data=unit, num_filter=filter_list[2], stride=(1, 1), dim_match=True, name='stage3_unit%s' % i)
    return unit

def get_resnet_train(num_classes=config.NUM_CLASSES, num_anchors=config.NUM_ANCHORS):
    data = mx.symbol.Variable(name="data")
    im_info = mx.symbol.Variable(name="im_info")
    gt_boxes = mx.symbol.Variable(name="gt_boxes")
    rpn_label = mx.symbol.Variable(name='label')
    rpn_bbox_target = mx.symbol.Variable(name='bbox_target')
    rpn_bbox_weight = mx.symbol.Variable(name='bbox_weight')

    # shared convolutional layers
    conv_feat = get_resnet_conv(data)

    # RPN layers
    rpn_conv = mx.symbol.Convolution(
        data=conv_feat, kernel=(3, 3), pad=(1, 1), num_filter=512, name="rpn_conv_3x3")
    rpn_relu = mx.symbol.Activation(data=rpn_conv, act_type="relu", name="rpn_relu")
    rpn_cls_score = mx.symbol.Convolution(
        data=rpn_relu, kernel=(1, 1), pad=(0, 0), num_filter=2 * num_anchors, name="rpn_cls_score")
    rpn_bbox_pred = mx.symbol.Convolution(
        data=rpn_relu, kernel=(1, 1), pad=(0, 0), num_filter=4 * num_anchors, name="rpn_bbox_pred")

    # prepare rpn data
    rpn_cls_score_reshape = mx.symbol.Reshape(
        data=rpn_cls_score, shape=(0, 2, -1, 0), name="rpn_cls_score_reshape")

    # classification
    rpn_cls_prob = mx.symbol.SoftmaxOutput(data=rpn_cls_score_reshape, label=rpn_label, multi_output=True,
                                           normalization='valid', use_ignore=True, ignore_label=-1, name="rpn_cls_prob")
    # bounding box regression
    rpn_bbox_loss_ = rpn_bbox_weight * mx.symbol.smooth_l1(name='rpn_bbox_loss_', scalar=3.0, data=(rpn_bbox_pred - rpn_bbox_target))
    rpn_bbox_loss = mx.sym.MakeLoss(name='rpn_bbox_loss', data=rpn_bbox_loss_, grad_scale=1.0 / config.TRAIN.RPN_BATCH_SIZE)

    # ROI proposal
    rpn_cls_act = mx.symbol.SoftmaxActivation(
        data=rpn_cls_score_reshape, mode="channel", name="rpn_cls_act")
    rpn_cls_act_reshape = mx.symbol.Reshape(
        data=rpn_cls_act, shape=(0, 2 * num_anchors, -1, 0), name='rpn_cls_act_reshape')
    if config.TRAIN.CXX_PROPOSAL:
        rois = mx.contrib.symbol.Proposal(
            cls_prob=rpn_cls_act_reshape, bbox_pred=rpn_bbox_pred, im_info=im_info, name='rois',
            feature_stride=config.RPN_FEAT_STRIDE, scales=tuple(config.ANCHOR_SCALES), ratios=tuple(config.ANCHOR_RATIOS),
            rpn_pre_nms_top_n=config.TRAIN.RPN_PRE_NMS_TOP_N, rpn_post_nms_top_n=config.TRAIN.RPN_POST_NMS_TOP_N,
            threshold=config.TRAIN.RPN_NMS_THRESH, rpn_min_size=config.TRAIN.RPN_MIN_SIZE)
    else:
        rois = mx.symbol.Custom(
            cls_prob=rpn_cls_act_reshape, bbox_pred=rpn_bbox_pred, im_info=im_info, name='rois',
            op_type='proposal', feat_stride=config.RPN_FEAT_STRIDE,
            scales=tuple(config.ANCHOR_SCALES), ratios=tuple(config.ANCHOR_RATIOS),
            rpn_pre_nms_top_n=config.TRAIN.RPN_PRE_NMS_TOP_N, rpn_post_nms_top_n=config.TRAIN.RPN_POST_NMS_TOP_N,
            threshold=config.TRAIN.RPN_NMS_THRESH, rpn_min_size=config.TRAIN.RPN_MIN_SIZE)

    # ROI proposal target
    gt_boxes_reshape = mx.symbol.Reshape(data=gt_boxes, shape=(-1, 5), name='gt_boxes_reshape')
    group = mx.symbol.Custom(rois=rois, gt_boxes=gt_boxes_reshape, op_type='proposal_target',
                             num_classes=num_classes, batch_images=config.TRAIN.BATCH_IMAGES,
                             batch_rois=config.TRAIN.BATCH_ROIS, fg_fraction=config.TRAIN.FG_FRACTION)
    rois = group[0]
    label = group[1]
    bbox_target = group[2]
    bbox_weight = group[3]

    # Fast R-CNN
    roi_pool = mx.symbol.ROIPooling(
        name='roi_pool5', data=conv_feat, rois=rois, pooled_size=(14, 14), spatial_scale=1.0 / config.RCNN_FEAT_STRIDE)

    # res5
    unit = residual_unit(data=roi_pool, num_filter=filter_list[3], stride=(2, 2), dim_match=False, name='stage4_unit1')
    for i in range(2, units[3] + 1):
        unit = residual_unit(data=unit, num_filter=filter_list[3], stride=(1, 1), dim_match=True, name='stage4_unit%s' % i)
    bn1 = mx.sym.BatchNorm(data=unit, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name='bn1')
    relu1 = mx.sym.Activation(data=bn1, act_type='relu', name='relu1')
    pool1 = mx.symbol.Pooling(data=relu1, global_pool=True, kernel=(7, 7), pool_type='avg', name='pool1')

    # classification
    cls_score = mx.symbol.FullyConnected(name='cls_score', data=pool1, num_hidden=num_classes)
    cls_prob = mx.symbol.SoftmaxOutput(name='cls_prob', data=cls_score, label=label, normalization='batch')
    # bounding box regression
    bbox_pred = mx.symbol.FullyConnected(name='bbox_pred', data=pool1, num_hidden=num_classes * 4)
    bbox_loss_ = bbox_weight * mx.symbol.smooth_l1(name='bbox_loss_', scalar=1.0, data=(bbox_pred - bbox_target))
    bbox_loss = mx.sym.MakeLoss(name='bbox_loss', data=bbox_loss_, grad_scale=1.0 / config.TRAIN.BATCH_ROIS)

    # reshape output
    label = mx.symbol.Reshape(data=label, shape=(config.TRAIN.BATCH_IMAGES, -1), name='label_reshape')
    cls_prob = mx.symbol.Reshape(data=cls_prob, shape=(config.TRAIN.BATCH_IMAGES, -1, num_classes), name='cls_prob_reshape')
    bbox_loss = mx.symbol.Reshape(data=bbox_loss, shape=(config.TRAIN.BATCH_IMAGES, -1, 4 * num_classes), name='bbox_loss_reshape')

    group = mx.symbol.Group([rpn_cls_prob, rpn_bbox_loss, cls_prob, bbox_loss, mx.symbol.BlockGrad(label)])
    return group

def get_resnet_test(num_classes=config.NUM_CLASSES, num_anchors=config.NUM_ANCHORS):
    data = mx.symbol.Variable(name="data")
    im_info = mx.symbol.Variable(name="im_info")

    # shared convolutional layers
    conv_feat = get_resnet_conv(data)

    # RPN
    rpn_conv = mx.symbol.Convolution(
        data=conv_feat, kernel=(3, 3), pad=(1, 1), num_filter=512, name="rpn_conv_3x3")
    rpn_relu = mx.symbol.Activation(data=rpn_conv, act_type="relu", name="rpn_relu")
    rpn_cls_score = mx.symbol.Convolution(
        data=rpn_relu, kernel=(1, 1), pad=(0, 0), num_filter=2 * num_anchors, name="rpn_cls_score")
    rpn_bbox_pred = mx.symbol.Convolution(
        data=rpn_relu, kernel=(1, 1), pad=(0, 0), num_filter=4 * num_anchors, name="rpn_bbox_pred")

    # ROI Proposal
    rpn_cls_score_reshape = mx.symbol.Reshape(
        data=rpn_cls_score, shape=(0, 2, -1, 0), name="rpn_cls_score_reshape")
    rpn_cls_prob = mx.symbol.SoftmaxActivation(
        data=rpn_cls_score_reshape, mode="channel", name="rpn_cls_prob")
    rpn_cls_prob_reshape = mx.symbol.Reshape(
        data=rpn_cls_prob, shape=(0, 2 * num_anchors, -1, 0), name='rpn_cls_prob_reshape')
    if config.TEST.CXX_PROPOSAL:
        rois = mx.contrib.symbol.Proposal(
            cls_prob=rpn_cls_prob_reshape, bbox_pred=rpn_bbox_pred, im_info=im_info, name='rois',
            feature_stride=config.RPN_FEAT_STRIDE, scales=tuple(config.ANCHOR_SCALES), ratios=tuple(config.ANCHOR_RATIOS),
            rpn_pre_nms_top_n=config.TEST.RPN_PRE_NMS_TOP_N, rpn_post_nms_top_n=config.TEST.RPN_POST_NMS_TOP_N,
            threshold=config.TEST.RPN_NMS_THRESH, rpn_min_size=config.TEST.RPN_MIN_SIZE)
    else:
        rois = mx.symbol.Custom(
            cls_prob=rpn_cls_prob_reshape, bbox_pred=rpn_bbox_pred, im_info=im_info, name='rois',
            op_type='proposal', feat_stride=config.RPN_FEAT_STRIDE,
            scales=tuple(config.ANCHOR_SCALES), ratios=tuple(config.ANCHOR_RATIOS),
            rpn_pre_nms_top_n=config.TEST.RPN_PRE_NMS_TOP_N, rpn_post_nms_top_n=config.TEST.RPN_POST_NMS_TOP_N,
            threshold=config.TEST.RPN_NMS_THRESH, rpn_min_size=config.TEST.RPN_MIN_SIZE)

    # Fast R-CNN
    roi_pool = mx.symbol.ROIPooling(
        name='roi_pool5', data=conv_feat, rois=rois, pooled_size=(14, 14), spatial_scale=1.0 / config.RCNN_FEAT_STRIDE)

    # res5
    unit = residual_unit(data=roi_pool, num_filter=filter_list[3], stride=(2, 2), dim_match=False, name='stage4_unit1')
    for i in range(2, units[3] + 1):
        unit = residual_unit(data=unit, num_filter=filter_list[3], stride=(1, 1), dim_match=True, name='stage4_unit%s' % i)
    bn1 = mx.sym.BatchNorm(data=unit, fix_gamma=False, eps=eps, use_global_stats=use_global_stats, name='bn1')
    relu1 = mx.sym.Activation(data=bn1, act_type='relu', name='relu1')
    pool1 = mx.symbol.Pooling(data=relu1, global_pool=True, kernel=(7, 7), pool_type='avg', name='pool1')

    # classification
    cls_score = mx.symbol.FullyConnected(name='cls_score', data=pool1, num_hidden=num_classes)
    cls_prob = mx.symbol.softmax(name='cls_prob', data=cls_score)
    # bounding box regression
    bbox_pred = mx.symbol.FullyConnected(name='bbox_pred', data=pool1, num_hidden=num_classes * 4)

    # reshape output
    cls_prob = mx.symbol.Reshape(data=cls_prob, shape=(config.TEST.BATCH_IMAGES, -1, num_classes), name='cls_prob_reshape')
    bbox_pred = mx.symbol.Reshape(data=bbox_pred, shape=(config.TEST.BATCH_IMAGES, -1, 4 * num_classes), name='bbox_pred_reshape')

    # group output
    group = mx.symbol.Group([rois, cls_prob, bbox_pred])
    return group


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    style="@style/AppTheme.MainContainer"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        android:id="@+id/activity_pick_banner"
        layout="@layout/cheerleader_banner" />

    <ScrollView
        android:id="@+id/activity_pick_scrollview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:paddingTop="@dimen/cheerleader_banner_height">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:background="@drawable/white_background_shadow_top_offset">

            <View
                android:id="@+id/activity_pick_shadow"
                android:layout_width="match_parent"
                android:layout_height="@dimen/shadow_size"
                android:background="@drawable/shadow_top" />

            <View
                android:id="@+id/activity_pick_puce_project"
                android:layout_width="@dimen/puce_size"
                android:layout_height="@dimen/puce_size"
                android:layout_alignTop="@+id/activity_pick_section_project"
                android:layout_marginLeft="4dp"
                android:background="@drawable/puce" />

            <TextView
                android:id="@+id/activity_pick_section_project"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/activity_pick_shadow"
                android:layout_marginBottom="10dp"
                android:layout_marginLeft="35dp"
                android:layout_marginTop="20dp"
                android:text="@string/activity_pick_project_section"
                android:textColor="@color/pick_activity_section_text"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/activity_pick_section_project_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/activity_pick_section_project"
                android:layout_marginLeft="35dp"
                android:gravity="center_vertical"
                android:text="@string/activity_pick_project"
                android:textColor="@color/pick_activity_section_content_text"
                android:textSize="15sp" />

            <View
                android:id="@+id/activity_pick_puce_sample"
                android:layout_width="@dimen/puce_size"
                android:layout_height="@dimen/puce_size"
                android:layout_alignTop="@+id/activity_pick_section_try_it"
                android:layout_marginLeft="4dp"
                android:background="@drawable/puce" />

            <TextView
                android:id="@+id/activity_pick_section_try_it"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/activity_pick_section_project_content"
                android:layout_marginBottom="10dp"
                android:layout_marginLeft="35dp"
                android:layout_marginTop="20dp"
                android:text="@string/activity_pick_try_it_section"
                android:textColor="@color/pick_activity_section_text"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/activity_pick_extra_hint"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:layout_below="@+id/activity_pick_section_try_it"
                android:layout_marginBottom="-20dp"
                android:layout_marginLeft="35dp"
                android:text="@string/activity_pick_search_hint"
                android:textColor="@color/pick_activity_extra_hint_text" />

            <fr.tvbarthel.cheerleader.sampleapp.ui.ExtraHintEditText
                android:id="@+id/activity_pick_artist_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/activity_pick_extra_hint"
                android:layout_marginLeft="35dp"
                android:layout_toLeftOf="@+id/activity_pick_search_btn"
                android:hint="@string/activity_pick_search_hint"
                android:imeOptions="actionSearch"
                android:inputType="textPersonName"
                android:padding="@dimen/activity_vertical_margin"
                android:textColor="@color/pick_activity_artist_edit"
                android:textColorHint="@color/pick_activity_artist_edit_hint" />

            <TextView
                android:id="@+id/activity_pick_search_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/activity_pick_artist_edit"
                android:layout_alignParentRight="true"
                android:layout_gravity="bottom|end"
                android:layout_marginRight="@dimen/default_padding"
                android:background="@drawable/selectable_background_red"
                android:clickable="true"
                android:gravity="center"
                android:paddingBottom="@dimen/default_padding"
                android:paddingLeft="@dimen/activity_vertical_margin"
                android:paddingRight="@dimen/activity_vertical_margin"
                android:paddingTop="@dimen/default_padding"
                android:text="@string/activity_pick_try_it"
                android:textColor="@color/pick_activity_search" />

            <View
                android:id="@+id/activity_pick_puce_links"
                android:layout_width="@dimen/puce_size"
                android:layout_height="@dimen/puce_size"
                android:layout_alignTop="@+id/activity_pick_section_links"
                android:layout_marginLeft="4dp"
                android:background="@drawable/puce" />

            <TextView
                android:id="@+id/activity_pick_section_links"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/activity_pick_artist_edit"
                android:layout_marginBottom="20dp"
                android:layout_marginLeft="35dp"
                android:layout_marginTop="20dp"
                android:text="@string/activity_pick_links_section"
                android:textColor="@color/pick_activity_section_text"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/activity_pick_section_links_git"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/activity_pick_section_links"
                android:layout_below="@+id/activity_pick_section_links"
                android:layout_marginRight="4dp"
                android:layout_toLeftOf="@+id/activity_pick_middle"
                android:background="@drawable/selectable_background_red"
                android:clickable="true"
                android:drawableTop="@drawable/ic_github"
                android:gravity="center"
                android:text="@string/activity_pick_links_git"
                android:textColor="@color/pick_activity_section_links_text"
                android:textSize="15sp" />

            <TextView
                android:id="@+id/activity_pick_section_links_web"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/activity_pick_section_links"
                android:layout_marginLeft="4dp"
                android:layout_marginRight="30dp"
                android:layout_toRightOf="@+id/activity_pick_middle"
                android:background="@drawable/selectable_background_red"
                android:clickable="true"
                android:drawableTop="@drawable/ic_website"
                android:gravity="center"
                android:text="@string/activity_pick_links_website"
                android:textColor="@color/pick_activity_section_links_text"
                android:textSize="15sp" />

            <View
                android:id="@+id/activity_pick_middle"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_centerInParent="true" />

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="@dimen/activity_pick_bottom_logo_height"
                android:layout_below="@+id/activity_pick_section_links_web"
                android:layout_marginTop="60dp"
                android:scaleType="centerCrop"
                android:src="@drawable/ic_sound_cloud_red" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:paddingBottom="@dimen/default_padding"
                android:paddingRight="@dimen/default_padding"
                android:text="@string/sound_cloud_credits"
                android:textAllCaps="true"
                android:textColor="@color/pick_activity_credits"
                android:textSize="8sp"
                android:textStyle="bold" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:layout_above="@id/activity_pick_puce_sample"
                android:layout_below="@id/activity_pick_puce_project"
                android:layout_marginLeft="16dp"
                android:background="@drawable/line_vertical_grey" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:layout_above="@id/activity_pick_puce_links"
                android:layout_below="@id/activity_pick_puce_sample"
                android:layout_marginLeft="16dp"
                android:background="@drawable/line_vertical_grey" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:layout_below="@id/activity_pick_puce_links"
                android:layout_alignBottom="@+id/activity_pick_section_links_git"
                android:layout_marginLeft="16dp"
                android:background="@drawable/line_vertical_grey" />

        </RelativeLayout>

    </ScrollView>

</FrameLayout>


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* StockObjects.cs -- stock objects of GDI
   Ars Magna project, http://arsmagna.ru */

#region Using directives

using JetBrains.Annotations;

#endregion

// ReSharper disable InconsistentNaming

namespace AM.Win32
{
    /// <summary>
    /// Stock objects of GDI.
    /// </summary>
    [PublicAPI]
    public enum StockObjects
    {
        /// <summary>
        /// White brush.
        /// </summary>
        WHITE_BRUSH = 0,

        /// <summary>
        /// Light gray brush.
        /// </summary>
        LTGRAY_BRUSH = 1,

        /// <summary>
        /// Gray brush.
        /// </summary>
        GRAY_BRUSH = 2,

        /// <summary>
        /// Dark gray brush.
        /// </summary>
        DKGRAY_BRUSH = 3,

        /// <summary>
        /// Black brush.
        /// </summary>
        BLACK_BRUSH = 4,

        /// <summary>
        /// Null brush.
        /// </summary>
        NULL_BRUSH = 5,

        /// <summary>
        /// Hollow brush.
        /// </summary>
        HOLLOW_BRUSH = 5,

        /// <summary>
        /// White pen.
        /// </summary>
        WHITE_PEN = 6,

        /// <summary>
        /// Black pen.
        /// </summary>
        BLACK_PEN = 7,

        /// <summary>
        /// Null pen.
        /// </summary>
        NULL_PEN = 8,

        /// <summary>
        /// Original equipment manufacturer (OEM) dependent fixed-pitch
        /// (monospace) font.
        /// </summary>
        OEM_FIXED_FONT = 10,

        /// <summary>
        /// Windows fixed-pitch (monospace) system font.
        /// </summary>
        ANSI_FIXED_FONT = 11,

        /// <summary>
        /// Windows variable-pitch (proportional space) system font.
        /// </summary>
        ANSI_VAR_FONT = 12,

        /// <summary>
        /// System font. By default, the system uses the system font
        /// to draw menus, dialog box controls, and text.
        /// </summary>
        SYSTEM_FONT = 13,

        /// <summary>
        /// Windows NT/2000/XP: Device-dependent font.
        /// </summary>
        DEVICE_DEFAULT_FONT = 14,

        /// <summary>
        /// Default palette. This palette consists of the static colors
        /// in the system palette.
        /// </summary>
        DEFAULT_PALETTE = 15,

        /// <summary>
        /// Fixed-pitch (monospace) system font. This stock object is
        /// provided only for compatibility with 16-bit Windows versions
        /// earlier than 3.0.
        /// </summary>
        SYSTEM_FIXED_FONT = 16,

        /// <summary>
        /// Default font for user interface objects such as menus and
        /// dialog boxes. This is MS Sans Serif. Compare this with SYSTEM_FONT.
        /// </summary>
        DEFAULT_GUI_FONT = 17
    }
}


text:
{-# LANGUAGE OverloadedStrings #-}

-- |
--
--       Mine ---- Field
--         \         ^
--          \       /
--       Underground River
--

module Lamp.Location.Map where

import Lamp.Location ( Location (..) )

mine :: Location
mine = Location { label = "Mysterious mine"
                , exits = [ field
                          , undergroundRiver ] }

field :: Location
field = Location { label = "Sunlit field"
                 , exits = [ mine ] }

undergroundRiver :: Location
undergroundRiver = Location { label = "Fast stream under the ground"
                             , exits = [ field
                                       , mine ] }


text:
<?php

include_once("../classes/event.php");
$_SESSION['btEventID'] = "";
if(!isset($member) || substr($_SERVER['PHP_SELF'], -11) != "console.php") {
	exit();
}
else {
	$memberInfo = $member->get_info();
	$consoleObj->select($_GET['cID']);
	if(!$member->hasAccess($consoleObj)) {
		exit();
	}
}

$cID = $_GET['cID'];
$intAddEventCID = $consoleObj->findConsoleIDByName("Add Event");

$counter = 0;
$clickCounter = 0;
$eventObj = new Event($mysqli);

$intViewInvitesCID = $consoleObj->findConsoleIDByName("View Event Invitations");

$result = $mysqli->query("SELECT event_id FROM ".$dbprefix."events_members WHERE member_id = '".$memberInfo['member_id']."'");
while($row = $result->fetch_assoc()) {
	$arrEvents[] = $row['event_id'];
}

$sqlEvents = "('".implode("','", $arrEvents)."')";

if($eventObj->getManageAllStatus()) {
	$query = "SELECT * FROM ".$dbprefix."events ORDER BY title";
}
else {
	$query = "SELECT * FROM ".$dbprefix."events WHERE member_id = '".$memberInfo['member_id']."' OR event_id IN ".$sqlEvents." ORDER BY title";
}

$result = $mysqli->query($query);
while($row = $result->fetch_assoc()) {

	$row = filterArray($row);

	$arrPositionOptions['invitemembers'] = "· Invite Members
";
	$arrPositionOptions['manageinvites'] = "· Manage Invites
";
	$arrPositionOptions['editinfo'] = "· Edit Event Information
";
	$arrPositionOptions['eventpositions'] = "· Add Event Position
· Manage Event Positions
";
	$arrPositionOptions['attendenceconfirm'] = "· Manage Invites
";

	$dispEventTitle = $row['title'];
	if(strlen($dispEventTitle) >= 25) {
		$dispEventTitle = "".substr($dispEventTitle, 0, 20)."...";
	}

	$categoryCSS = "consoleCategory_clicked";
	$hideoptions = "";
	if($counter > 0) {
		$hideoptions = "style='display: none'";
		$categoryCSS = "consoleCategory";
	}

	$counter++;

	if($_GET['select'] == $row['event_id']) {
		$clickCounter = $counter;
	}

	$dispEventTitles .= "
".$dispEventTitle."
";
	$dispEventOptions .= "
";
	$dispEventOptions .= "

	Manage Event - ".$dispEventTitle."

	";
	if($row['member_id'] == $memberInfo['member_id'] || $eventObj->getManageAllStatus()) {
		// Event Creator
		$dispEventOptions .= "
			· Edit Event Information

			· Invite Members

			· Manage Invites

			· Add Event Position

			· Manage Event Positions

			· Delete This Event

		";

		if($row['startdate'] < time()) {

			$dispEventOptions .= "· Set Attendance
";

		}

	}
	else {
		// Invited Member

		$eventObj->select($row['event_id']);
		$eventObj->getEventMemberID($memberInfo['member_id'], true);
		$eventMemberInfo = $eventObj->objEventMember->get_info_filtered();

		if($eventMemberInfo['status'] == 1) {

			if($eventMemberInfo['position_id'] == 0 && $row['invitepermission'] == 1) {
				$dispEventOptions .= "· Invite Members
";
			}
			elseif($eventMemberInfo['position_id'] != 0 && $eventObj->objEventPosition->select($eventMemberInfo['position_id']) && $eventObj->objEventPosition->get_info("event_id") == $row['event_id']) {
				$eventPositionInfo = $eventObj->objEventPosition->get_info();
				foreach($arrPositionOptions as $key => $value) {

					if($eventPositionInfo[$key] == 1 && $key != "attendenceconfirm") {
						$dispEventOptions .= $value;
					}
					elseif($eventPositionInfo[$key] == 1 && $key == "attendenceconfirm" && $eventPositionInfo['manageinvites'] == 0) {
						$dispEventOptions .= $value;
					}

				}

				// Member has access to the attendenceconfirm privilege
				if($row['startdate'] < time() && $eventPositionInfo['attendenceconfirm'] == 1) {
					$dispEventOptions .= "· Set Attendance
";
				}

			}
		}

		$dispEventOptions .= "· Confirm Your Attendance
";
	}

	$dispEventOptions .= "
	· View Event Page

";

}

if($result->num_rows > 0) {
	echo "

			$dispEventTitles

			$dispEventOptions

	";

}

if($clickCounter != 0) {

	echo "

	";

}

if($result->num_rows == 0) {

	echo "

				You aren't going to any events and you haven't created any events!

Click Here to make an event!

	";

}

?>


text:
<?php
namespace App\Controller\admin;
use App\Controller\admin\AuthController;
use App\Model\admin\Auth;
class AdminController extends AuthController {
    function __construct(){
        parent::__construct();
    }
    public function indexAction() {
        return $this->redirect('login-admin');
    }
    public function homeAction(){
        $data['title']='Quản trị hệ thống';
        $data['fullname']=$this->app['session']->get('admin','');
    	return $this->render('admin/home/index.html.twig',$data);
    }

}


text:
package org.hsqldb;

import java.io.IOException;

import org.hsqldb.error.Error;
import org.hsqldb.error.ErrorCode;
import org.hsqldb.index.NodeAVL;
import org.hsqldb.index.NodeAVLDisk;
import org.hsqldb.lib.IntLookup;
import org.hsqldb.persist.PersistentStore;
import org.hsqldb.rowio.RowInputInterface;
import org.hsqldb.rowio.RowOutputInterface;

// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP)
// fredt@users 20020920 - patch 1.7.1 - refactoring to cut memory footprint
// fredt@users 20021205 - patch 1.7.2 - enhancements
// fredt@users 20021215 - doc 1.7.2 - javadoc comments
// boucherb@users - 20040411 - doc 1.7.2 - javadoc comments

/**
 *  In-memory representation of a disk-based database row object with  methods
 *  for serialization and de-serialization.

 *
 *  A CachedRow is normally part of a circular double linked list which
 *  contains all of the Rows currently in the Cache for the database. It is
 *  unlinked from this list when it is freed from the Cache to make way for
 *  other rows.

 *
 *  New class derived from Hypersonic SQL code and enhanced in HSQLDB.

 *
 * @author Fred Toussi (fredt@users dot sourceforge dot net)
 * @author Thomas Mueller (Hypersonic SQL Group)
 * @version 1.9.0
 * @since Hypersonic SQL
 */
public class RowAVLDisk extends RowAVL {

    public static final int NO_POS = -1;

    //
    int     storageSize;
    int     keepCount;
    boolean isInMemory;
    int     accessCount;

    /**
     *  Flag indicating unwritten data.
     */
    protected boolean hasDataChanged;

    /**
     *  Flag indicating Node data has changed.
     */
    boolean hasNodesChanged;

    /**
     *  Constructor for new Rows.  Variable hasDataChanged is set to true in
     *  order to indicate the data needs saving.
     *
     * @param t table
     * @param o row data
     */
    public RowAVLDisk(TableBase t, Object[] o) {

        super(t, o);

        setNewNodes();

        hasDataChanged = hasNodesChanged = true;
    }

    /**
     *  Constructor when read from the disk into the Cache.
     *
     * @param t table
     * @param in data source
     * @throws IOException
     */
    public RowAVLDisk(TableBase t, RowInputInterface in) throws IOException {

        super(t, null);

        position    = in.getPos();
        storageSize = in.getSize();

        int indexcount = t.getIndexCount();

        nPrimaryNode = new NodeAVLDisk(this, in, 0);

        NodeAVL n = nPrimaryNode;

        for (int i = 1; i < indexcount; i++) {
            n.nNext = new NodeAVLDisk(this, in, i);
            n       = n.nNext;
        }

        rowData = in.readData(table.getColumnTypes());
    }

    public NodeAVL insertNode(int index) {
        return null;
    }

    private void readRowInfo(RowInputInterface in) throws IOException {

        // for use when additional transaction info is attached to rows
    }

    /**
     * Sets flag for Node data change.
     */
    public synchronized void setNodesChanged() {
        hasNodesChanged = true;
    }

    public void updateAccessCount(int count) {
        accessCount = count;
    }

    public int getAccessCount() {
        return accessCount;
    }

    public int getStorageSize() {
        return storageSize;
    }

    public boolean isMemory() {
        return false;
    }

    /**
     * Sets the file position for the row
     *
     * @param pos position in data file
     */
    public void setPos(int pos) {

        position = pos;

        NodeAVL n = nPrimaryNode;

        while (n != null) {
            ((NodeAVLDisk) n).iData = position;
            n                       = n.nNext;
        }
    }

    /**
     * Sets flag for row data change.
     */
    public synchronized void setChanged() {
        hasDataChanged = true;
    }

    /**
     * Returns true if Node data has changed.
     *
     * @return boolean
     */
    public synchronized boolean hasChanged() {
        return hasNodesChanged || hasDataChanged;
    }

    /**
     * Returns the Table to which this Row belongs.
     *
     * @return Table
     */
    public TableBase getTable() {
        return table;
    }

    public void setStorageSize(int size) {
        storageSize = size;
    }

    /**
     * Returns true if any of the Nodes for this row is a root node.
     * Used only in Cache.java to avoid removing the row from the cache.
     *
     * @return boolean
     */
    public synchronized boolean isKeepInMemory() {
        return keepCount > 0;
    }

    /**
     * Only unlinks nodes. Is not a destroy() method
     */
    public void delete(PersistentStore store) {

        RowAVLDisk row = this;

        if (!row.keepInMemory(true)) {
            row = (RowAVLDisk) store.get(row, true);
        }

        super.delete(store);
        row.keepInMemory(false);
    }

    public void destroy() {
        nPrimaryNode = null;
        table        = null;
    }

    public synchronized boolean keepInMemory(boolean keep) {

        if (!isInMemory) {
            return false;
        }

        if (keep) {
            keepCount++;
        } else {
            keepCount--;

            if (keepCount < 0) {
                throw Error.runtimeError(ErrorCode.U_S0500,
                                         "RowAVLDisk - keep count");
            }
        }

        return true;
    }

    public synchronized boolean isInMemory() {
        return isInMemory;
    }

    public synchronized void setInMemory(boolean in) {

        isInMemory = in;

        if (in) {
            return;
        }

        NodeAVL n = nPrimaryNode;

        while (n != null) {
            n.setInMemory(in);

            n = n.nNext;
        }
    }

    /**
     * used in CachedDataRow
     */
    public void setNewNodes() {

        int indexcount = table.getIndexCount();

        nPrimaryNode = new NodeAVLDisk(this, 0);

        NodeAVL n = nPrimaryNode;

        for (int i = 1; i < indexcount; i++) {
            n.nNext = new NodeAVLDisk(this, i);
            n       = n.nNext;
        }
    }

    public int getRealSize(RowOutputInterface out) {

        int size = out.getSize((RowAVLDisk) this)
                   + table.getIndexCount() * NodeAVLDisk.SIZE_IN_BYTE;

        return size;
    }

    /**
     * Used exclusively by Cache to save the row to disk. New implementation in
     * 1.7.2 writes out only the Node data if the table row data has not
     * changed. This situation accounts for the majority of invocations as for
     * each row deleted or inserted, the Nodes for several other rows will
     * change.
     */
    public void write(RowOutputInterface out) {

        try {
            writeNodes(out);

            if (hasDataChanged) {
                out.writeData(rowData, table.colTypes);
                out.writeEnd();

                hasDataChanged = false;
            }
        } catch (IOException e) {}
    }

    public void write(RowOutputInterface out, IntLookup lookup) {

        out.writeSize(storageSize);

        NodeAVL rownode = nPrimaryNode;

        while (rownode != null) {
            ((NodeAVLDisk) rownode).write(out, lookup);

            rownode = rownode.nNext;
        }

        out.writeData(getData(), table.colTypes);
        out.writeEnd();
    }

    /**
     *  Writes the Nodes, immediately after the row size.
     *
     * @param out
     *
     * @throws IOException
     */
    private void writeNodes(RowOutputInterface out) throws IOException {

        out.writeSize(storageSize);

        NodeAVL n = nPrimaryNode;

        while (n != null) {
            n.write(out);

            n = n.nNext;
        }

        hasNodesChanged = false;
    }

    /**
     * Lifetime scope of this method depends on the operations performed on
     * any cached tables since this row or the parameter were constructed.
     * If only deletes or only inserts have been performed, this method
     * remains valid. Otherwise it can return invalid results.
     *
     * @param obj row to compare
     * @return boolean
     */
    public boolean equals(Object obj) {

        if (obj == this) {
            return true;
        }

        if (obj instanceof RowAVLDisk) {
            return ((RowAVLDisk) obj).position == position;
        }

        return false;
    }

    /**
     * Hash code is valid only until a modification to the cache
     *
     * @return file position of row
     */
    public int hashCode() {
        return position;
    }
}


text:
/*=========================================================================
 *
 *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
 *
 *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
 *
 *  For complete copyright, license and disclaimer of warranty information
 *  please refer to the NOTICE file at the top of the ITK source tree.
 *
 *=========================================================================*/
#ifndef itkAutoPointerDataObjectDecorator_h
#define itkAutoPointerDataObjectDecorator_h

#include <memory>
#include "itkDataObject.h"
#include "itkObjectFactory.h"

namespace itk
{
/** \class AutoPointerDataObjectDecorator
 * \brief Decorates any pointer to a simple object with a DataObject API using
 * AutoPointer semantics.
 *
 * AutoPointerDataObjectDecorator decorates a pointer to an object
 * with a DataObject API. This allows a pointer to an object to be
 * encapsulated in a DataObject and passed through the pipeline. This
 * object differs from SimpleDataObjectDecorator in that the decorator
 * takes control of deleting the pointer upon destruction.
 *
 * The decorator provides two methods Set() and Get() to access the
 * decorated object (referred internally as the component).
 *
 * Note that when an instance of SimpleDataObjectDecorator is created,
 * the component is initialized with its default constructor (i.e. a
 * null pointer).
 *
 * \sa SimpleDataObjectDecorator
 * \sa DataObjectDecorator
 * \ingroup ITKSystemObjects
 *
 * \ingroup ITKCommon
 */
template< typename T >
class ITK_TEMPLATE_EXPORT AutoPointerDataObjectDecorator:public DataObject
{
public:
  /** Standard typedefs. */
  typedef AutoPointerDataObjectDecorator Self;
  typedef DataObject                     Superclass;
  typedef SmartPointer< Self >           Pointer;
  typedef SmartPointer< const Self >     ConstPointer;

  /** Typedef for the component type (object being decorated) */
  typedef T                  ComponentType;
  typedef std::auto_ptr< T > ComponentPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(AutoPointerDataObjectDecorator, DataObject);

  /** Set the contained object */
  virtual void Set(T *val);

  /** Get the contained object */
  virtual T * Get() { return m_Component.get(); }
  virtual const T * Get() const { return m_Component.get(); }

protected:
  AutoPointerDataObjectDecorator();
  ~AutoPointerDataObjectDecorator();
  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

protected:

private:
  ITK_DISALLOW_COPY_AND_ASSIGN(AutoPointerDataObjectDecorator);

  ComponentPointer m_Component;
};
} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkAutoPointerDataObjectDecorator.hxx"
#endif

#endif


text:
import Control.Concurrent.Async ()

main :: IO ()
main = pure ()


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">

<TITLE>
gravity.plugins (Gravity Framework (Version 1.0-beta-1))
</TITLE>
<META NAME="keywords" CONTENT="gravity.plugins package">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

gravity.plugins

Classes

BshPlugin

BshPluginHelper

MutableContainerAdapter


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>jquery-stepProgressBar by mickaelr</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen">
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
    <link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen">

    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" type="text/css" href="src/jquery.stepProgressBar.css">
    <link rel="stylesheet" type="text/css" href="prism/prism.css">

jquery-stepProgressBar

A jQuery / CSS progress bar that can display several steps

      View on GitHub
      Download .zip
      Download .tar.gz

        StepProgressBar [IN PROGRESS]

Progress bars are a bit limited when you want to display several steps on it (usually the bar starts at 0 and finishes at 100, so current value is in percents).

The aim of this plugin is to easily build fully customizable progress bar, that can handle more than one single step.

        License

The plugin is under MIT License

Quickstart

          Include jQuery and stepProgressBar css and js in your project:

<link rel="stylesheet" type="text/css" href="path/to/stepProgressBar/jquery.stepProgressBar.css">
<script type="text/javascript" src="path/to/jquery/jquery.min.js"></script>
<script type="text/javascript" src="path/to/stepProgressBar/jquery.stepProgressBar.js"></script>

Bar options

              Name
              Type
              Default
              Description

              currentValue
              number
              0
              Progress value we want to display on the bar

              steps
              array
              []
              The different progress steps (see "Step options" section)

              rounded
              boolean
              true
              To switch between squared/rounded bar style

              unit
              string
              ''
              The progress unit

Step options

              Name
              Type
              Default
              Description

              value
              number
              undefined
              Step value

              topLabel
              html string
              undefined
              The label we want to display for that step above the bar

              bottomLabel
              html string
              undefined
              The label we want to display for that step below the bar

              mouseOver
              function
              function() {}
              (not implemented yet) A function executed on step mouseover

              click
              function
              function() {}
              (not implemented yet) A function executed on step click

Methods

              Method
              Description
              Usage

              getCurrentValue
              Return number corresponding to current progress value

              setCurrentValue
              Set the bar progress value with a number

              findStep
              Find a step depending on its value

              addStep
              Add a step

              removeStepWithValue
              Remove a step depending on its value

Events

[not implemented yet]

Examples

Default

<div id=".step-progressbar-1"></div>

$('#.step-progressbar-1').stepProgressBar({
  currentValue: 110,
  steps: [
    { value: 10 },
    {
      topLabel: '50 custom unit',
      value: 50,
      bottomLabel: '<i class="material-icons">thumb_up</i>'
    },
    {
      value: 150,
      bottomLabel: '<i class="material-icons">card_giftcard</i>'
    },
    {
      value: 200,
      bottomLabel: '<i class="material-icons">star</i>',
      mouseOver: function() { alert('mouseOver'); },
      click: function() { alert('click'); }
    }
  ],
  unit: '€'
});

Test it:

        get current value

        set current value to 190

        find step with value = 150 (see in console)

        add step with value = 250

        remove step with value = 50

SASS variables

              Name
              Description
              Default

              $progressbar-height
              progressbar's height
              50px

              $progressbar-color
              progressbar's bar color
              #0E97C4

              $progressbar-background
              progressbar's background color
              #FFFFFF

              $progressbar-border-width
              progressbar's border width
              3px

              $progressbar-border-style
              progressbar's border style
              solid

              $progressbar-border-color
              progressbar's border color
              #CCCCCC

              $progressbar-step-width
              progressbar's step width
              $progressbar-border-width

              $progressbar-step-style
              progressbar's step style
              dashed

              $progressbar-step-color
              progressbar's step color
              $progressbar-border-color

              $progressbar-inner-border-width
              progressbar's inner border (between border and bar) width
              2px

              $progressbar-inner-border-style
              progressbar's inner border style
              solid

              $progressbar-inner-border-color
              progressbar's inner border color
              $progressbar-background

              $progressbar-toplabel-font-color
              progressbar's top label color
              #BBBBBB

              $progressbar-toplabel-font-size
              progressbar's top label font size
              16px

              $progressbar-toplabel-margin-top
              progressbar's top label margin-top
              5px

              $progressbar-toplabel-margin-bottom
              progressbar's top label margin-bottom
              5px

              $progressbar-bottomlabel-font-color
              progressbar's bottom label color
              #BBBBBB

              $progressbar-bottomlabel-font-size
              progressbar's bottom label font size
              16px

              $progressbar-bottomlabel-margin-top
              progressbar's bottom label margin-top
              5px

              $progressbar-bottomlabel-margin-bottom
              progressbar's bottom label margin-bottom
              5px

        jquery-stepProgressBar is maintained by mickaelr.

        This page was generated by GitHub Pages using the Cayman theme by Jason Long.


text:
#ifndef _GMLREADER_H_INCLUDED
#define _GMLREADER_H_INCLUDED

#include "cpl_port.h"
#include "cpl_vsi.h"
#include "cpl_minixml.h"

#include <vector>

typedef enum {
    GMLPT_Untyped = 0,
    GMLPT_String = 1,
    GMLPT_Integer = 2,
    GMLPT_Real = 3,
    GMLPT_Complex = 4,
    GMLPT_StringList = 5,
    GMLPT_IntegerList = 6,
    GMLPT_RealList = 7
} GMLPropertyType;

/************************************************************************/
/*                           GMLPropertyDefn                            */
/************************************************************************/

typedef struct
{
    int     nSubProperties;
    char**  papszSubProperties;
    char*   aszSubProperties[2]; /* Optimization in the case of nSubProperties == 1 */
} GMLProperty;

class CPL_DLL GMLPropertyDefn
{
    char             *m_pszName;
    GMLPropertyType   m_eType;
    int               m_nWidth;
    int               m_nPrecision;
    char             *m_pszSrcElement;
    size_t            m_nSrcElementLen;
    int               m_nIndex;

public:

        GMLPropertyDefn( const char *pszName, const char *pszSrcElement=NULL );
       ~GMLPropertyDefn();

    const char *GetName() const { return m_pszName; }

    GMLPropertyType GetType() const { return m_eType; }
    void        SetType( GMLPropertyType eType ) { m_eType = eType; }
    void        SetWidth( int nWidth) { m_nWidth = nWidth; }
    int         GetWidth() const { return m_nWidth; }
    void        SetPrecision( int nPrecision) { m_nPrecision = nPrecision; }
    int         GetPrecision() const { return m_nPrecision; }
    void        SetSrcElement( const char *pszSrcElement );
    const char *GetSrcElement() const { return m_pszSrcElement; }
    size_t      GetSrcElementLen() const { return m_nSrcElementLen; }
    void        SetAttributeIndex( int nIndex ) { m_nIndex = nIndex; }
    int         GetAttributeIndex() const { return m_nIndex; }

    void        AnalysePropertyValue( const GMLProperty* psGMLProperty );

    static bool IsSimpleType( GMLPropertyType eType )
    { return eType == GMLPT_String || eType == GMLPT_Integer || eType == GMLPT_Real; }
};

/************************************************************************/
/*                           GMLFeatureClass                            */
/************************************************************************/
class CPL_DLL GMLFeatureClass
{
    char        *m_pszName;
    char        *m_pszElementName;
    int          n_nNameLen;
    int          n_nElementNameLen;
    char        *m_pszGeometryElement;
    int         m_nPropertyCount;
    GMLPropertyDefn **m_papoProperty;

    int         m_bSchemaLocked;

    int         m_nFeatureCount;

    char        *m_pszExtraInfo;

    int         m_bHaveExtents;
    double      m_dfXMin;
    double      m_dfXMax;
    double      m_dfYMin;
    double      m_dfYMax;

    int         m_nGeometryType;
    int         m_nGeometryIndex;

    char       *m_pszSRSName;
    int         m_bSRSNameConsistant;

public:
            GMLFeatureClass( const char *pszName = "" );
           ~GMLFeatureClass();

    const char *GetElementName() const;
    size_t      GetElementNameLen() const;
    void        SetElementName( const char *pszElementName );

    const char *GetGeometryElement() const { return m_pszGeometryElement; }
    void        SetGeometryElement( const char *pszElementName );

    const char *GetName() const { return m_pszName; }
    void        SetName(const char* pszNewName);
    int         GetPropertyCount() const { return m_nPropertyCount; }
    GMLPropertyDefn *GetProperty( int iIndex ) const;
    int GetPropertyIndex( const char *pszName ) const;
    GMLPropertyDefn *GetProperty( const char *pszName ) const
        { return GetProperty( GetPropertyIndex(pszName) ); }
    int         GetPropertyIndexBySrcElement( const char *pszElement, int nLen ) const;

    int         AddProperty( GMLPropertyDefn * );

    int         IsSchemaLocked() const { return m_bSchemaLocked; }
    void        SetSchemaLocked( int bLock ) { m_bSchemaLocked = bLock; }

    const char  *GetExtraInfo();
    void        SetExtraInfo( const char * );

    int         GetFeatureCount();
    void        SetFeatureCount( int );

    int         HasExtents() const { return m_bHaveExtents; }
    void        SetExtents( double dfXMin, double dfXMax,
                            double dFYMin, double dfYMax );
    int         GetExtents( double *pdfXMin, double *pdfXMax,
                            double *pdFYMin, double *pdfYMax );

    int         GetGeometryType() const { return m_nGeometryType; }
    void        SetGeometryType( int nNewType ) { m_nGeometryType = nNewType; }
    int         GetGeometryAttributeIndex() const { return m_nGeometryIndex; }
    void        SetGeometryAttributeIndex( int nGeometryIndex ) { m_nGeometryIndex = nGeometryIndex; }

    void        SetSRSName( const char* pszSRSName );
    void        MergeSRSName( const char* pszSRSName );
    const char *GetSRSName() { return m_pszSRSName; }

    CPLXMLNode *SerializeToXML();
    int         InitializeFromXML( CPLXMLNode * );
};

/************************************************************************/
/*                              GMLFeature                              */
/************************************************************************/

class CPL_DLL GMLFeature
{
    GMLFeatureClass *m_poClass;
    char            *m_pszFID;

    int              m_nPropertyCount;
    GMLProperty     *m_pasProperties;

    int              m_nGeometryCount;
    CPLXMLNode     **m_papsGeometry; /* NULL-terminated. Alias to m_apsGeometry if m_nGeometryCount <= 1 */
    CPLXMLNode      *m_apsGeometry[2]; /* NULL-terminated */

    // string list of named non-schema properties - used by NAS driver.
    char           **m_papszOBProperties;

public:
                    GMLFeature( GMLFeatureClass * );
                   ~GMLFeature();

    GMLFeatureClass*GetClass() const { return m_poClass; }

    void            SetGeometryDirectly( CPLXMLNode* psGeom );
    void            AddGeometry( CPLXMLNode* psGeom );
    const CPLXMLNode* const * GetGeometryList() const { return m_papsGeometry; }

    void            SetPropertyDirectly( int i, char *pszValue );

    const GMLProperty*GetProperty( int i ) const { return (i < m_nPropertyCount) ? &m_pasProperties[i] : NULL; }

    const char      *GetFID() const { return m_pszFID; }
    void             SetFID( const char *pszFID );

    void             Dump( FILE *fp );

    // Out of Band property handling - special stuff like relations for NAS.
    void             AddOBProperty( const char *pszName, const char *pszValue );
    const char      *GetOBProperty( const char *pszName );
    char           **GetOBProperties();
};

/************************************************************************/
/*                              IGMLReader                              */
/************************************************************************/
class CPL_DLL IGMLReader
{
public:
    virtual     ~IGMLReader();

    virtual int  IsClassListLocked() const = 0;
    virtual void SetClassListLocked( int bFlag ) = 0;

    virtual void SetSourceFile( const char *pszFilename ) = 0;
    virtual void SetFP( VSILFILE* fp ) { }
    virtual const char* GetSourceFileName() = 0;

    virtual int  GetClassCount() const = 0;
    virtual GMLFeatureClass *GetClass( int i ) const = 0;
    virtual GMLFeatureClass *GetClass( const char *pszName ) const = 0;

    virtual int        AddClass( GMLFeatureClass *poClass ) = 0;
    virtual void       ClearClasses() = 0;

    virtual GMLFeature *NextFeature() = 0;
    virtual void       ResetReading() = 0;

    virtual int  LoadClasses( const char *pszFile = NULL ) = 0;
    virtual int  SaveClasses( const char *pszFile = NULL ) = 0;

    virtual int  ResolveXlinks( const char *pszFile,
                                int* pbOutIsTempFile,
                                char **papszSkip = NULL,
                                const int bStrict = FALSE ) = 0;

    virtual int  HugeFileResolver( const char *pszFile,
                                   int pbSqlitIsTempFile,
                                   int iSqliteCacheMB ) = 0;

    virtual int PrescanForSchema( int bGetExtents = TRUE ) = 0;
    virtual int PrescanForTemplate( void ) = 0;

    virtual int HasStoppedParsing() = 0;

    virtual void  SetGlobalSRSName( const char* pszGlobalSRSName ) {}
    virtual const char* GetGlobalSRSName() = 0;
    virtual int CanUseGlobalSRSName() = 0;

    virtual int SetFilteredClassName(const char* pszClassName) = 0;
    virtual const char* GetFilteredClassName() = 0;

    virtual int IsSequentialLayers() const { return FALSE; }
};

IGMLReader *CreateGMLReader(int bUseExpatParserPreferably,
                            int bInvertAxisOrderIfLatLong,
                            int bConsiderEPSGAsURN,
                            int bGetSecondaryGeometryOption);

#endif /* _GMLREADER_H_INCLUDED */


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Postgresql 学习笔记一 - learning & writings</title>
  <meta name="author" content="lds">

  <meta name="description" content="">

  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="canonical" href="http://li.sdutlinux.org/old/2013/02/27/postgres-start-learn/index.html">
  <link href="/old/favicon.png" rel="icon">
  <link href="/old/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">

  <link href="/atom.xml" rel="alternate" title="learning & writings" type="application/atom+xml">

<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">

  <hgroup>

learning & writings

lidashuang

</hgroup>

RSS

<form action="http://google.com/search" method="get">
  <fieldset role="search">
    <input type="hidden" name="q" value="site:li.sdutlinux.org" />
    <input class="search" type="text" name="q" results="0" placeholder="Search"/>
  </fieldset>
</form>

Blog

Archives

Postgresql 学习笔记一

<time datetime="2013-02-27T00:00:00+08:00" pubdate data-updated="true"></time>

         | Comments

登录

su -  postgres
psql

创建用户

postgres=# CREATE USER lds with password '123';

创建数据库

 CREATE DATABASE hello;

列出所有数据库

postgres=# \l
                         List of databases
 Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges
-----------+----------+-----------+---------+-------+-----------------------
 hello     | postgres | SQL_ASCII | C       | C     | =Tc/postgres         +
           |          |           |         |       | postgres=CTc/postgres+
           |          |           |         |       | lds=CTc/postgres
 postgres  | postgres | SQL_ASCII | C       | C     |
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
(4 rows)

分配权限

postgres=# GRANT ALL PRIVILEGES ON DATABASE hello to lds;

删除用户

postgres=# DROP  USER lds;

显示已有用户

postgres=# \du
                           List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
postgres   | Superuser, Create role, Create DB, Replication | {}

Posted by lds

<time datetime="2013-02-27T00:00:00+08:00" pubdate data-updated="true"></time>

    postgres

  Tweet

        « padrino项目中使用settinglogic

        Postgresql 数据库和表 »

Recent Posts

        golint---golang代码质量检测

        Elixir Process 模块笔记

        Rails nginx and thin conf

GitHub Repos

Status updating...

  @lidashuang on GitHub

  Copyright © 2015 - lds -
  Powered by Octopress. Design by Octopress Themes.


text:
//
//  ========================================================================
//  Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
//  ------------------------------------------------------------------------
//  All rights reserved. This program and the accompanying materials
//  are made available under the terms of the Eclipse Public License v1.0
//  and Apache License v2.0 which accompanies this distribution.
//
//      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//

package org.eclipse.jetty.osgi.equinoxtools;

import javax.servlet.ServletException;

import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxChattingSupport;
import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleContinuationServlet;
import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleSyncServlet;
import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleWebSocketServlet;
import org.eclipse.jetty.osgi.equinoxtools.console.WebConsoleSession;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.osgi.framework.console.ConsoleSession;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;

/**
 * When started will register on the HttpService 3 servlets for 3 different styles of equinox consoles.
 */
public class WebEquinoxToolsActivator implements BundleActivator
{
    private static final Logger LOG = Log.getLogger(WebEquinoxToolsActivator.class);

    private static BundleContext context;
    public static BundleContext getContext()
    {
        return context;
    }

    private HttpService _httpService;
    private ServiceTracker _tracker;
    private EquinoxChattingSupport _equinoxChattingSupport;

    /*
     * (non-Javadoc)
     *
     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public void start(BundleContext bundleContext) throws Exception
    {
        WebEquinoxToolsActivator.context = bundleContext;

        ServiceTrackerCustomizer httpServiceTrackerCustomizer = new ServiceTrackerCustomizer()
        {
            public void removedService(ServiceReference reference, Object service)
            {
                _httpService = null;
            }

            public void modifiedService(ServiceReference reference, Object service)
            {
                _httpService = (HttpService)context.getService(reference);
            }

            public Object addingService(ServiceReference reference)
            {
                _httpService = (HttpService)context.getService(reference);
                try
                {
                    //TODO; some effort to use the same console session on the 2 async console servlets?

                    //websocket:
//                    WebConsoleSession wsSession = new WebConsoleSession();
//                    WebEquinoxConsoleActivator.context.registerService(ConsoleSession.class.getName(), wsSession, null);
//                    EquinoxChattingSupport wsEquinoxChattingSupport = new EquinoxChattingSupport(wsSession);
                    _httpService.registerResources("/equinoxconsole/ws/index.html","/equinoxconsole/ws/index.html",null);
                    _httpService.registerServlet("/equinoxconsole/ws",new EquinoxConsoleWebSocketServlet(/*wsSession, wsEquinoxChattingSupport*/),null,null);

                    //continuations:
//                    WebConsoleSession contSession = new WebConsoleSession();
//                    WebEquinoxConsoleActivator.context.registerService(ConsoleSession.class.getName(), contSession, null);
//                    EquinoxChattingSupport contEquinoxChattingSupport = new EquinoxChattingSupport(contSession);
                    _httpService.registerResources("/equinoxconsole/index.html","/equinoxconsole/index.html",null);
                    _httpService.registerServlet("/equinoxconsole",new EquinoxConsoleContinuationServlet(/*contSession, contEquinoxChattingSupport*/),null,null);

                    //legacy synchroneous; keep it in a separate console session.
                    WebConsoleSession syncSession = new WebConsoleSession();
                    WebEquinoxToolsActivator.context.registerService(ConsoleSession.class.getName(), syncSession, null);
                    _httpService.registerServlet("/equinoxconsole/sync",new EquinoxConsoleSyncServlet(syncSession),null,null);
                }
                catch (ServletException e)
                {
                    LOG.warn(e);
                }
                catch (NamespaceException e)
                {
                    LOG.warn(e);
                }
                return _httpService;
            }
        };

        _tracker = new ServiceTracker(context,HttpService.class.getName(),httpServiceTrackerCustomizer);
        _tracker.open();
    }

    /*
     * (non-Javadoc)
     *
     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
     */
    public void stop(BundleContext bundleContext) throws Exception
    {
        _tracker.close();
        WebEquinoxToolsActivator.context = null;
    }

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth-parent</artifactId>
    <version>2.0.7.BUILD-SNAPSHOT</version>
  </parent>

  <artifactId>spring-security-oauth-tests</artifactId>
  <name>OAuth for Spring Security - Integration Tests</name>
  <description>Test Projects for OAuth Support for Spring Security</description>
  <packaging>pom</packaging>

  <modules>
    <module>annotation</module>
    <module>xml</module>
  </modules>

  <url>https://github.com/spring-projects/spring-security-oauth/tests</url>

  <build>
	<plugins>
	  <plugin>
		<!--skip deploy (this is just a test module) -->
		<artifactId>maven-deploy-plugin</artifactId>
		<version>2.6</version>
		<configuration>
		  <skip>true</skip>
		</configuration>
	  </plugin>
	</plugins>
  </build>

  <distributionManagement>

    <site>
      <id>static.springframework.org</id>
      <url>scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-security/oauth/tests</url>
    </site>

  </distributionManagement>

</project>


text:
from JumpScale import j
import telegram
import datetime
from telegrambot.Repo import AYS_REPO_DIR
# from JumpScale.baselib.atyourservice.robot.ActionRequest import *

class RunMgmt(object):

    def __init__(self, bot):
        self.bot = bot
        self.rootpath = bot.rootpath
        self.callbacks = bot.question_callbacks

    #
    # # helpers
    # def _blueprintsPath(self, repo):
    #     return '%s/%s/%s/blueprints' % (self.rootpath, repo)

    def _currentRepoName(self, username):
        return self.bot.repo_mgmt._currentRepoName(username)

    def _currentRepo(self, username):
        return j.atyourservice.repoGet(j.sal.fs.joinPaths(AYS_REPO_DIR, self._currentRepoName(username)))

    def _createname(self, run):
        return datetime.datetime.fromtimestamp(run.dictFiltered["lastModDate"]).strftime('%c')

    def _runlist(self, username, executed="all"):
        repo = self._currentRepo(username)
        runs = []
        for run in repo.runsList():
            if run.dictFiltered['state'] == "ok" and executed == "executed":
                runs.append(self._createname(run))
            elif run.dictFiltered['state'] == "new" and executed == "new":
                runs.append(self._createname(run))
            elif executed == "all":
                runs.append(self._createname(run))
        return runs

    def _getrunid(self, name, repo):
        runs = j.data.serializer.json.loads(self.bot._rediscl.hget('telegrambot.runs', repo.name))
        for run_id in runs:
            run = repo.runGet(run_id)
            if self._createname(run).strip() == name.strip():
                return run.key

    # def _currentBlueprintsPath(self, username):
    #     return self._blueprintsPath(self._currentRepoName(username))

    def create(self, bot, update):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        runs = []
        try:
            run = repo.runCreate()
            run.save()
            runs_str = self.bot._rediscl.hget("telegrambot.runs", repo.name)
            if runs_str:
                runs.extend(j.data.serializer.json.loads(runs_str))
            runs.append(run.key)
            self.bot._rediscl.hset("telegrambot.runs", repo.name, j.data.serializer.json.dumps(runs))
            msg = "run for repo %s has completed creation. to execute, use;\n `/run execute`" % repo.name
        except Exception as e:
            msg = 'Error during run creation'
            self.bot.logger.error(e.message)
        finally:
            self.bot.sendMessage(
                chat_id=chat_id,
                text=msg)

    def simulate(self, bot, update, run_id):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        run = repo.runGet(run_id).objectGet()
        self.bot.sendMessage(
            chat_id=chat_id,
            text=run.__str__())

    def execute(self, bot, update, run_id):
        import ipdb; ipdb.set_trace()
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        run = repo.runGet(run_id).objectGet()
        aysconn = j.core.db.connection_pool.connection_kwargs
        if aysconn.get('host', None):
            host, port, socket = aysconn['host'], aysconn['port'], None
        else:
            host, port, socket = None, None, aysconn['path']

        ayscl = j.clients.atyourservice.get(host, port, socket)
        try:
            ayscl.execute_run(run)
            msg = "run for repo %s has started execution. to view state use ```/run inspect %s```" % (repo.name, run_id)
        except Exception as e:
            msg = 'Error during run execution,\n Error: %s' % str(e)
            self.bot.logger.error(e.message)
        finally:
            self.bot.sendMessage(
                chat_id=chat_id,
                text=msg)

    def list(self, bot, update, executed='all'):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.TYPING)
        runs = self._runlist(username, executed)
        if not runs:
            self.bot.sendMessage(chat_id=update.message.chat_id,
                                 text="Sorry, this repository has not had any runs yet. :(;\n to create one use `/run create`",
                                 parse_mode=telegram.ParseMode.MARKDOWN)
            return
        runs_list = []
        for run in runs:
            runs_list.append('- %s' % run.replace("_", "\_"))

        msg = '\n'.join(runs_list)
        self.bot.sendMessage(chat_id=update.message.chat_id, text=msg, parse_mode=telegram.ParseMode.MARKDOWN)

    def inspect(self, bot, update, run_id):
        username = update.message.from_user.username
        repo = self._currentRepo(username)
        run = repo.runGet(run_id)
        data = ''
        # data = j.data.serializer.yaml.dumps(run.dictFiltered)

        def create_steps():
            steps = ''
            for step in run.dictFiltered['steps']:
                steps += '    - %s\n' % step['number']
                for name, val in step.items():
                    if name == "jobs":
                        steps += '        - %s :\n' % name
                        for job in val:
                            steps += '            - %s :\n' % job['actionName']
                            for k, v in job.items():
                                steps += '               %s  =  %s\n' % (k, v)
                    else:
                        steps += '        - %s   =  %s \n' % (name, val)
            return steps

        for key, value in run.dictFiltered.items():
            if key == 'repo':
                value = repo.name
            elif key == 'steps':
                data += '- %s\n' % key
                data += create_steps()
                continue
            elif key == 'epoch':
                key = "Creation time"
                value = datetime.datetime.fromtimestamp(value).strftime('%c')
            elif key == 'lastModDate':
                value = self._createname(run)

            data += '- %s\n' % key
            data += '    - %s\n' % value

        self.bot.sendMessage(
            chat_id=update.message.chat_id,
            text=data,
            parse_mode="HTML",
            reply_markup=telegram.ReplyKeyboardHide())

    def choose_action(self, bot, update):
        self.callbacks[update.message.from_user.username] = self.dispatch_choice
        choices = ['create', 'simulate', 'execute', 'inspect', 'list']
        reply_markup = telegram.ReplyKeyboardMarkup([choices], resize_keyboard=True, one_time_keyboard=True)
        return self.bot.sendMessage(chat_id=update.message.chat_id,
                                    text="What do you want to do ?", reply_markup=reply_markup)

    def dispatch_choice(self, bot, update):
        message = update.message
        username = update.message.from_user.username
        repo = self._currentRepo(username)
        if message.text == 'list':
            self.list(bot, update, repo)
        elif message.text == 'create':
            self.create_prompt(bot, update, repo)
        elif message.text == 'simulate':
            self.simulate_prompt(bot, update)
        elif message.text in ['execute', 'exec']:
            self.execute_prompt(bot, update)
        elif message.text in ['inspect', 'see']:
            self.inspect_prompt(bot, update)

    def execute_prompt(self, bot, update):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        run_list = self._runlist(username, "new")

        def cb(bot, update):
            run_id = self._getrunid(update.message.text, repo)
            self.execute(bot, update, run_id)

        self.callbacks[username] = cb
        if not run_list:
            self.bot.sendMessage(chat_id=update.message.chat_id,
                                 text="Sorry, this repository has not had any runs yet. :(;\n to create one use `/run create`",
                                 parse_mode=telegram.ParseMode.MARKDOWN)
            return
        reply_markup = telegram.ReplyKeyboardMarkup([run_list], resize_keyboar=True, one_time_keyboard=True)
        self.bot.sendMessage(
            chat_id=chat_id,
            text="Click on the run you want to execute",
            reply_markup=reply_markup)

    def inspect_prompt(self, bot, update):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        run_list = self._runlist(username)

        def cb(bot, update):
            run_id = self._getrunid(update.message.text, repo)
            self.inspect(bot, update, run_id)

        self.callbacks[username] = cb
        if not run_list:
            self.bot.sendMessage(chat_id=update.message.chat_id,
                                 text="Sorry, this repository has not had any runs yet. :(;\n to create one use `/run create`",
                                 parse_mode=telegram.ParseMode.MARKDOWN)
            return
        reply_markup = telegram.ReplyKeyboardMarkup([run_list], resize_keyboar=True, one_time_keyboard=True)
        self.bot.sendMessage(
            chat_id=chat_id,
            text="Click on the run you want to execute",
            reply_markup=reply_markup)

    def simulate_prompt(self, bot, update):
        username = update.message.from_user.username
        chat_id = update.message.chat_id
        repo = self._currentRepo(username)
        run_list = self._runlist(username)

        def cb(bot, update):
            run_id = self._getrunid(update.message.text, repo)
            self.simulate(bot, update, run_id)

        self.callbacks[username] = cb
        if not run_list:
            self.bot.sendMessage(chat_id=update.message.chat_id,
                                 text="Sorry, this repository has not had any runs yet. :(;\n to create one use `/run create`",
                                 parse_mode=telegram.ParseMode.MARKDOWN)
            return
        reply_markup = telegram.ReplyKeyboardMarkup([run_list], resize_keyboar=True, one_time_keyboard=True)
        self.bot.sendMessage(
            chat_id=chat_id,
            text="Click on the run you want to simulate",
            reply_markup=reply_markup)

    # Handler for robot
    def handler(self, bot, update, args):
        username = update.message.from_user.username

        self.bot.logger.debug('service management for: %s' % username)
        if not self.bot.repo_mgmt._userCheck(bot, update):
            return

        if not self._currentRepo(username):
            message = "Sorry, you are not working on a repo currently, use `/repo` to select a repository"
            return self.bot.sendMessage(chat_id=update.message.chat_id, text=message, parse_mode="Markdown")

        # no arguments
        if len(args) == 0:
            self.choose_action(bot, update)
            return

        if args[0] == "list":
            if len(args) == 1:
                return self.list(bot, update)
            elif len(args) >= 2:
                return self.list(bot, update, args[1])

        if args[0] in ['create', 'add']:
            return self.create(bot, update)
        if args[0] in ["execute", "exec"]:
            if len(args) == 1:
                return self.execute_prompt(bot, update)
            elif len(args) >= 2:
                return self.execute(bot, update, args[1])
        if args[0] in ["simulate", "sim"]:
            if len(args) == 1:
                return self.simulate_prompt(bot, update)
            elif len(args) >= 2:
                return self.simulate(bot, update, args[1])
        if args[0] in ['inspect', 'see', 'show']:
            if len(args) == 1:
                return self.inspect_prompt(bot, update)
            elif len(args) >= 2:
                return self.inspect(bot, update, args[1])