text:
import { Component, OnInit } from '@angular/core';
import { BlogService } from '../service/blog.service';
import { Category } from '../service/blog-category.model'
import * as moment from 'moment';

/**
 * This class represents the toolbar component.
 */
@Component({
  moduleId: module.id,
  selector: 'ni-blog-post-categories',
  templateUrl: 'blog-post-categories.component.html',
  providers: [BlogService],
  styleUrls: []
})
export class BlogPostCategoriesComponent {
    public categories:Category[];
    public errorMessage:string;

    constructor(public blogPostService:BlogService) {}

    ngOnInit() {
        //do nothing
        this.blogPostService.getCategories()
            .subscribe(
                (categories) => {this.categories = categories},
                error => this.errorMessage = <any>error
            );
    }

}


text:
import time
from functional_tests import FunctionalTest, ROOT, USERS
from selenium.webdriver.support.ui import WebDriverWait
import functional_tests

class AnswerQuestion (FunctionalTest):

    def setUp(self):
        self.url = ROOT + '/default/user/login'
        get_browser=self.browser.get(self.url)

        username = self.browser.find_element_by_name("username")
        username.send_keys(USERS['USER2'])

        password = self.browser.find_element_by_name("password")
        password.send_keys(USERS['PASSWORD2'])

        submit_button = self.browser.find_element_by_css_selector("#submit_record__row input")
        submit_button.click()
        time.sleep(1)

        self.url = ROOT + "/review/index/action/myy"
        get_browser=self.browser.get(self.url)

    def test_action_review(self):
        self.browser.find_element_by_id("viewscope_showscope").click()
        time.sleep(1)
        self.browser.find_element_by_id("sortorder1 Priority").click()
        time.sleep(1)
        self.browser.find_element_by_css_selector("input.btn").click()
        time.sleep(2)
        self.browser.find_element_by_link_text("A").click()

redpajama_set_name: RedPajamaGithub


text:
This allows you to build your static assets through webpack before testing.

## Installation

The easiest way is to keep `wdio-webpack-service` as a devDependency in your `package.json`.

```json
{
  "devDependencies": {
    "wdio-webpack-service": "^1.0.0"
  }
}
```

You can simple do it by:

```bash
npm install wdio-webpack-service --save-dev
```

Instructions on how to install `WebdriverIO` can be found [here.](http://webdriver.io/guide/getstarted/install.html)

## Configuration

In order to use the static server service you need to add `webpack` to your service array:

```js
// wdio.conf.js
export.config = {
  // ...
  services: ['webpack'],
  // ...
};
```

## Options

### webpackConfig (required)

The configuration for webpack to use in order to build the bundle. See [webpack's documentation](http://webpack.github.io/docs/configuration.html) for more information.

Type: `Object`

### webpackDriverConfig

This option lets you override some of the settings in you webpack config for the driver. You can use this to change things like where the files are placed. The configurations are merged using the [`webpack-merge`](https://github.com/survivejs/webpack-merge) project and the smart strategy.

Type: `Object`

### webpackLog

Debugging logs, will print mount points and requests. When `webpackLogs` is set to `true` it will print into the console. Otherwise a string will be treated as the log folder.

Type: `Boolean` or `String`

----

For more information on WebdriverIO see the [homepage](http://webdriver.io).


text:
package org.meluskyc.codebriefcase.server;

import android.content.ContentResolver;
import android.database.Cursor;

import org.meluskyc.codebriefcase.database.CodeBriefcaseContract.Tag;
import org.meluskyc.codebriefcase.utils.AppUtils;

import java.io.ByteArrayInputStream;
import java.util.Map;

import fi.iki.elonen.NanoHTTPD;

public class TagsHandler extends WebRouter.DefaultHandler {
    @Override
    public String getText() {
        throw new IllegalStateException();
    }

    @Override
    public String getMimeType() {
        return "application/json";
    }

    @Override
    public NanoHTTPD.Response.IStatus getStatus() {
        return NanoHTTPD.Response.Status.OK;
    }

    /*
    GET /api/tags      all tags
     */
    @Override
    public NanoHTTPD.Response get(WebRouter.UriResource uriResource, Map<String, String> urlParams,
                                  NanoHTTPD.IHTTPSession session) {
        ContentResolver cr = WebServer.getContext().getContentResolver();
        Cursor c = null;
        String text = null;

        c = cr.query(Tag.CONTENT_URI,
                new String[]{Tag.TAG_NAME}, null, null,
                Tag.TAG_NAME + " ASC");
        text = AppUtils.cur2Json(c).toString();

        ByteArrayInputStream inp = new ByteArrayInputStream(text.getBytes());
        int size = text.getBytes().length;
        return NanoHTTPD.newFixedLengthResponse(getStatus(), getMimeType(), inp, size);
    }
}


text:
'use strict';
import koa from 'koa';
import koaHelmet from 'koa-helmet';
import koaRouter from 'koa-router';
import koaBodyParser from 'koa-bodyparser';
import koaStatic from 'koa-static';
import cors from 'kcors';
import { graphqlKoa, graphiqlKoa  } from 'apollo-server-koa';
import schema from './data/graphql/schema';
import { connectToDatabase } from './modules/databaseConnection';
import imageUpload from './modules/imageUpload';
import imageDelete from './modules/imageDelete';

// Quick check to confirm that we've loaded .env
if (!process.env.PROD_DB_URI) {
  throw new Error('Environment variables not loaded.');
}
connectToDatabase(process.env.PROD_DB_URI);

const app = new koa();
const router = new koaRouter();

// set various more secure http headers
app.use(koaHelmet());

if (process.env.NODE_ENV === 'test') {
  // enable cors (all origins/methods)
  app.use(cors());
}
// serve public directory
app.use(koaStatic(process.env.APP_ROOT + process.env.PUBLIC_DIR));

// apollo client only uses post. See apollo-client issue #813 for context.
router.post('/graphql', koaBodyParser(), graphqlKoa({ schema }));

if (process.env.NODE_ENV === 'test') {
  router.get('/graphiql', graphiqlKoa({ endpointURL: '/graphql' }));
}

// Small REST API for image uploads and deletions
router.post('/image_upload', imageUpload());
router.post('/image_delete', imageDelete());

// router.use('/', async (ctx, next) => {
//   ctx.body = 'You are messing around with koa stuff and should remove this. (404 is koa\'s default response status)';
//   await next(); // not needed anymore? mess around more w/ koa routes
// });

app.use(router.routes());
app.use(router.allowedMethods());
app.listen(process.env.PORT);

// export default app; // for tests?


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
N. Amer. Fl. (New York) 7(4): 262 (1920)

#### Original name
Uromyces plumbarius Peck

### Remarks
null


text:
.category-header {
	margin-top: 40px;
	margin-bottom: 40px;
	text-align: center;
	color: #209687;
	text-transform: uppercase;
}


text:
package org.apache.sqoop.util;

import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.sqoop.manager.ConnManager;

/**
 * Utility class; returns the locations of various jars.
 */
public final class Jars {

  public static final Log LOG = LogFactory.getLog(
      Jars.class.getName());

  private Jars() {
  }

  /**
   * @return the path to the main Sqoop jar.
   */
  public static String getSqoopJarPath() {
    return getJarPathForClass(Jars.class);
  }

  /**
   * Return the jar file path that contains a particular class.
   * Method mostly cloned from o.a.h.mapred.JobConf.findContainingJar().
   */
  public static String getJarPathForClass(Class<? extends Object> classObj) {
    ClassLoader loader = classObj.getClassLoader();
    String classFile = classObj.getName().replaceAll("\\.", "/") + ".class";
    try {
      for (Enumeration<URL> itr = loader.getResources(classFile);
          itr.hasMoreElements();) {
        URL url = (URL) itr.nextElement();
        if ("jar".equals(url.getProtocol())) {
          String toReturn = url.getPath();
          if (toReturn.startsWith("file:")) {
            toReturn = toReturn.substring("file:".length());
          }
          // URLDecoder is a misnamed class, since it actually decodes
          // x-www-form-urlencoded MIME type rather than actual
          // URL encoding (which the file path has). Therefore it would
          // decode +s to ' 's which is incorrect (spaces are actually
          // either unencoded or encoded as "%20"). Replace +s first, so
          // that they are kept sacred during the decoding process.
          toReturn = toReturn.replaceAll("\\+", "%2B");
          toReturn = URLDecoder.decode(toReturn, "UTF-8");
          return toReturn.replaceAll("!.*$", "");
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return null;
  }

  /**
   * Return the path to the jar containing the JDBC driver
   * for a ConnManager.
   */
  public static String getDriverClassJar(ConnManager mgr) {
    if (null == mgr) {
      return null;
    }

    String driverClassName = mgr.getDriverClass();
    if (null == driverClassName) {
      return null;
    }

    try {
      Class<? extends Object> driverClass = Class.forName(driverClassName);
      return getJarPathForClass(driverClass);
    } catch (ClassNotFoundException cnfe) {
      LOG.warn("No such class " + driverClassName + " available.");
      return null;
    }
  }

}


text:
///////////////////////////////////////////////////////////////////////////
// Copyright 2015 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the 'License');
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define(['dojo/_base/declare',
    'dijit/_WidgetsInTemplateMixin',
    'dijit/form/Select',
    'dijit/form/ValidationTextBox',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/dom-style',
    'dojo/dom-construct',
    'dojo/on',
    'dojo/dom',
    'dojox/gfx',
    'dojo/query',
    'dojo/_base/Color',
    'dijit/registry',
    'esri/symbols/jsonUtils',
    'esri/request',
    'esri/Color',
    'jimu/dijit/SymbolPicker',
    'jimu/BaseWidget',
    'jimu/dijit/TabContainer3',
    'jimu/utils',
    'jimu/dijit/SimpleTable',
    'jimu/dijit/Message',
    'jimu/dijit/ColorPicker',
    'dojo/_base/array',
    'esri/symbols/SimpleMarkerSymbol',
    'esri/symbols/SimpleLineSymbol',
    'esri/symbols/PictureMarkerSymbol',
    'dojo/text!./MySymbolPicker.html',
    'dojo/Evented'
],
  function (declare,
    _WidgetsInTemplateMixin,
    Select,
    ValidationTextBox,
    lang,
    html,
    domStyle,
    domConstruct,
    on,
    dom,
    gfx,
    query,
    Color,
    registry,
    jsonUtils,
    esriRequest,
    _Color,
    SymbolPicker1,
    BaseWidget,
    TabContainer,
    jimuUtils,
    Table,
    Message,
    ColorPicker,
    array,
    SimpleMarkerSymbol,
    SimpleLineSymbol,
    PictureMarkerSymbol,
    template,
    Evented) {
    return declare([BaseWidget, _WidgetsInTemplateMixin, Evented], {
      templateString: template,
      baseClass: 'jimu-widget-InfoSummary-setting',
      nls: null,
      row: null,
      layerInfo: null,
      clusteringEnabled: null,
      symbolInfo: null,
      symbolType: "",
      map: null,
      supportsDynamic: true,
      tabContainer: null,
      field_options: [],
      groupFeaturesEnabled: false,
      lyrSymbolSet: [],
      _highLightColor: '#ffffff',
      panelHTML: null,
      svg: null,

      /*jshint unused:false*/
      constructor: function ( /*Object*/ options) {
        this.nls = options.nls;
        this.row = options.callerRow;
        this.layerInfo = options.layerInfo;
        this.renderer = options.layerInfo.renderer;
        this.geometryType = options.layerInfo.geometryType;
        this.symbolInfo = options.symbolInfo;
        this.map = options.map;
        this.ac = options.ac;
        this.layerId = options.value;
        this.supportsDynamic = options.layerInfo.supportsDynamic;
        this.fields = options.layerInfo.fields;
        this.hidePanel = options.hidePanel;
      },

      postMixInProperties: function(){
        this.inherited(arguments);
        this.nls.common = window.jimuNls.common;
      },

      postCreate: function () {
        this.inherited(arguments);
        this._setFields(this.fields);
        this._initTabControl();
        this._initSymbolPickerTab(this.geometryType);
        this._initFeatureOptionsTab();
        if (!this.hidePanel) {
          this.own(on(this.btnAddField, 'click', lang.hitch(this, this._addFieldRow,
            this.fieldOptionsTable, 'loSelect')));
          html.removeClass(this.btnAddField, "btn-add-section-disabled");
          html.addClass(this.btnAddField, "btn-add-section");
          html.removeClass(this.iconOptionsTextLabel, 'text-disabled');
          html.removeClass(this.featureOptionsTextLabel, 'text-disabled');
          html.removeClass(this.groupOptionsTextLabel, 'text-disabled');
          html.removeClass(this.chkGroupLabel, 'text-disabled');
          html.removeClass(this.rdoLayerIconLabel, 'text-disabled');
          html.removeClass(this.rdoCustomIconLabel, 'text-disabled');
        } else {
          html.removeClass(this.btnAddField, "btn-add-section");
          html.addClass(this.btnAddField, "btn-add-section-disabled");
          html.addClass(this.iconOptionsTextLabel, 'text-disabled');
          html.addClass(this.featureOptionsTextLabel, 'text-disabled');
          html.addClass(this.groupOptionsTextLabel, 'text-disabled');
          html.addClass(this.chkGroupLabel, 'text-disabled');
          html.addClass(this.rdoLayerIconLabel, 'text-disabled');
          html.addClass(this.rdoCustomIconLabel, 'text-disabled');
        }
        this.chkGroup.set('disabled', this.hidePanel);
        this.rdoLayerIcon.set('disabled', this.hidePanel);
        this.rdoCustomIcon.set('disabled', this.hidePanel);
      },

      _setFields: function(fields){
        if (fields) {
          this.field_options = [];
          var nulls = ["", " ", undefined, null];
          for (var i = 0; i < fields.length; i++) {
            this.field_options.push({
              value: fields[i].name,
              label: nulls.indexOf(fields[i].alias) === -1 ? fields[i].alias : fields[i].name
            });
          }
        }
      },

      _initTabControl: function() {
        this.tabContainer = new TabContainer({
          tabs: [{
            title: this.nls.symbolOptions,
            content: this.symbolPickerContainer
          }, {
            title: this.nls.panelFeatureDisplay,
            content: this.panelFeatureDisplayContainer
          }],
          isNested: true
        }, this.tabParent);
        this.tabContainer.startup();
      },

      _initSymbolPickerTab: function (geom) {
        var geoType = jimuUtils.getTypeByGeometryType(geom);
        this._loadLayerSymbol();
        if (this.supportsDynamic) {
          this._initSymbolPicker(geoType);
        }
        this._initClusterSymbolPicker(geoType);
        this._addEventHandlers(geoType);
        this._initUI();
      },

      _initFeatureOptionsTab: function () {
        this.isInitalLoad = true;
        this.fieldLoadCount = 0;
        var fields = [{
          name: "field",
          title: this.nls.selectField,
          "class": "label",
          type: "empty",
          width: "100px"
        }, {
          name: "label",
          "class": "label",
          title: this.nls.fieldLabel,
          type: "empty",
          width: "100px"
        }, {
          name: "actions",
          "class": "label",
          title: this.nls.actions,
          type: "actions",
          actions: ["up", "down", "delete"],
          width: "50px"
        }];

        this.fieldOptionsTable = new Table({
          fields: fields,
          selectable: false,
          autoHeight: true
        });

        this.fieldOptionsTable.placeAt(this.fieldOptions);
        this.fieldOptionsTable.startup();
        this.fieldOptionsTable.on('row-delete', lang.hitch(this, this._rowDeleted));

        var grpFields = [{
          name: "field",
          title: this.nls.selectField,
          "class": "label",
          type: "empty",
          width: "160px"
        }, {
          name: "label",
          "class": "label",
          title: this.nls.fieldLabel,
          type: "empty",
          width: "160px"
        }];

        this.groupOptionsTable = new Table({
          fields: grpFields,
          selectable: false,
          autoHeight: true
        });

        this.groupOptionsTable.placeAt(this.groupFieldOptions);
        this.groupOptionsTable.startup();

        if (this.symbolInfo && this.symbolInfo.featureDisplayOptions &&
          this.symbolInfo.featureDisplayOptions.fields) {
          var featureOPtions = this.symbolInfo.featureDisplayOptions;
          this.groupFeaturesEnabled = featureOPtions.groupEnabled;
          this.chkGroup.set("checked", this.groupFeaturesEnabled);
          for (var i = 0; i < featureOPtions.fields.length; i++) {
            var field = featureOPtions.fields[i];
            this._populateLayerRow(this.fieldOptionsTable, field, 'loSelect');
          }
          var groupField = featureOPtions.groupField;
          this._populateLayerRow(this.groupOptionsTable, groupField, 'goSelect');
        } else {
          this._addFieldRow(this.groupOptionsTable, 'goSelect');
        }
        this.isInitalLoad = false;
      },

      _rowDeleted: function(table){
        if (this.fieldOptionsTable.getRows().length < 3) {
          html.removeClass(this.btnAddField, "btn-add-section-disabled");
          html.addClass(this.btnAddField, "btn-add-section");
        }
      },

      _populateLayerRow: function (table, field, css) {
        this.fieldLoadCount += 1;
        var result = table.addRow({});
        if (result.success && result.tr) {
          var tr = result.tr;
          this._addFieldsOption(tr, css);
          this._addLabelOption(tr);
          tr.selectFields.set("value", field.name);
          tr.labelText.set("value", field.label);
        }
      },

      _addFieldRow: function (table, css) {
        if (table === this.fieldOptionsTable) {
          if (table.getRows().length >= 3) {
            html.removeClass(this.btnAddField, "btn-add-section");
            html.addClass(this.btnAddField, "btn-add-section-disabled");
            new Message({
              message: this.nls.max_records
            });
            return;
          }
        }

        this.isInitalLoad = false;
        var result = table.addRow({});
        if (result.success && result.tr) {
          var tr = result.tr;
          this._addFieldsOption(tr, css);
          this._addLabelOption(tr);
        }
      },

      _addFieldsOption: function (tr, css) {
        var lyrFields = lang.clone(this.field_options);
        var td = query('.simple-table-cell', tr)[0];
        if (td) {
          html.setStyle(td, "verticalAlign", "middle");
          html.setStyle(td, "line-height", "inherit");
          var selFields = new Select({
            style: {
              width: "100%",
              height: "28px"
            },
            "class": css,
            options: lyrFields
          });
          selFields.placeAt(td);
          selFields.startup();
          tr.selectFields = selFields;
          this.own(on(selFields, 'change', lang.hitch(this, function () {
            if (this.fieldLoadCount && this.fieldLoadCount > 0) {
              this.fieldLoadCount -= 1;
            } else {
              tr.labelText.set('value', "");
            }
            tr.cells[0].title = tr.cells[0].innerText;
          })));
          tr.cells[0].title = tr.cells[0].innerText;
        }
      },

      _addLabelOption: function(tr){
        var td = query('.simple-table-cell', tr)[1];
        html.setStyle(td, "verticalAlign", "middle");
        html.setStyle(td, "line-height", "inherit");
        var labelTextBox = new ValidationTextBox({
          style: {
            width: "100%",
            height: "28px"
          }
        });
        labelTextBox.placeAt(td);
        labelTextBox.startup();
        tr.labelText = labelTextBox;
      },

      _initUI: function () {
        if (typeof (this.symbolInfo) !== 'undefined') {
          //set retained symbol properties
          this.symbolType = this.symbolInfo.symbolType;
          this.clusterType = this.symbolInfo.clusterType;
          this.iconType = this.symbolInfo.iconType;
          this.displayFeatureCount = this.symbolInfo.displayFeatureCount;
          this.clusteringEnabled = this.symbolInfo.clusteringEnabled;
          this.userDefinedSymbol = this.symbolInfo.userDefinedSymbol;
          this._highLightColor = this.symbolInfo._highLightColor;
          switch (this.symbolInfo.symbolType) {
            case 'LayerSymbol':
              if (this.symbolInfo.symbolOverride) {
                this.userDefinedSymbol = true;
                this.rdoEsriSym.set('checked', true);
                this._rdoLayerSymChanged(false);
                this._rdoCustomSymChanged(false);
                this.symbolPicker.showBySymbol(jsonUtils.fromJson(this.symbolInfo.symbol));
              } else {
                this.rdoLayerSym.set('checked', true);
                this._rdoEsriSymChanged(false);
                this._rdoCustomSymChanged(false);
              }
              break;
            case 'EsriSymbol':
              this.userDefinedSymbol = true;
              this.rdoEsriSym.set('checked', true);
              this._rdoLayerSymChanged(false);
              this._rdoCustomSymChanged(false);
              this.symbolPicker.showBySymbol(jsonUtils.fromJson(this.symbolInfo.symbol));
              break;
            case 'CustomSymbol':
              this.userDefinedSymbol = true;
              this.rdoCustomSym.set('checked', true);
              this._rdoEsriSymChanged(false);
              this._rdoLayerSymChanged(false);
              this._createImageDataDiv(this.symbolInfo.symbol, true, this.customSymbolPlaceholder);
              break;
          }

          //set retained cluster options
          switch (this.symbolInfo.clusterType) {
            case 'ThemeCluster':
              this.userDefinedSymbol = true;
              //this.rdoThemeCluster.set('checked', true);
              this.clusterType = 'ThemeCluster';
              break;
            case 'CustomCluster':
              this.userDefinedSymbol = true;
              //this.rdoCustomCluster.set('checked', true);
              this.clusterType = 'CustomCluster';
              this.chkClusterCnt.set('checked', this.displayFeatureCount);
              this.colorPicker.setColor(new Color(this._highLightColor));
              break;
          }

          switch (this.symbolInfo.iconType) {
            case 'LayerIcon':
              this.rdoLayerIcon.set('checked', true);
              break;
            case 'CustomIcon':
              this.userDefinedSymbol = true;
              this.rdoCustomIcon.set('checked', true);

              if (this.symbolInfo.icon) {
                this.updateImg();
                var icon = jsonUtils.fromJson(this.symbolInfo.icon);
                this._createImageDataDiv(icon, true, this.customIconPlaceholder);
              }
              break;
          }

          //set cluster options properties
          if (typeof (this.symbolInfo.clusterType) !== 'undefined') {
            if (this.symbolInfo.clusterType === "CustomCluster") {
              //this.rdoCustomCluster.set('checked', true);
              if (this.symbolInfo.clusterSymbol) {
                this.clusterPicker.showBySymbol(jsonUtils.fromJson(this.symbolInfo.clusterSymbol));
              }
            } else {
              //this.rdoThemeCluster.set('checked', true);
            }
            this.userDefinedSymbol = true;
          }
          this.chkClusterSym.set('checked', this.symbolInfo.clusteringEnabled);
          this._chkClusterChanged(this.symbolInfo.clusteringEnabled);
        } else {
          //default state
          this.rdoLayerSym.set('checked', true);
          this._rdoEsriSymChanged(false);
          this._rdoCustomSymChanged(false);
          this.chkClusterSym.set('checked', false);
          this.chkClusterCnt.set('checked', false);
          //this.rdoCustomCluster.set('checked', true);
          this.rdoLayerIcon.set('checked', true);
          this._rdoCustomIconChanged(false);
          this.symbolType = "LayerSymbol";
          this.iconType = "LayerIcon";
          this.clusteringEnabled = false;
          this.userDefinedSymbol = false;
        }

        if (this.geometryType !== 'esriGeometryPoint' || !this.supportsDynamic) {
          domStyle.set(this.parent_div_uploadCustomSymbol, "display", "none");
          if (!this.supportsDynamic) {
            domStyle.set(this.div_rdoEsriSym, "display", "none");
          }
        }
      },

      updateImg: function () {
        if (this.symbolInfo.icon.toString().indexOf('<img') > -1) {
          var img = document.createElement('div');
          img.innerHTML = this.symbolInfo.icon;
          var icon = new PictureMarkerSymbol(img.children[0].src, 26, 26);
          this.symbolInfo.icon = icon.toJson();
          img.remove();
        }
      },

      _addEventHandlers: function (geoType) {
        if (geoType === 'point') {
          this.own(on(this.uploadCustomSymbol, 'click', lang.hitch(this, function () {
            this._editIcon("Symbol");
          })));
        }

        this.own(on(this.uploadCustomIcon, 'click', lang.hitch(this, function () {
          this._editIcon("Icon");
        })));

        this.btnOk.innerText = this.nls.common.ok;
        this.own(on(this.btnOk, 'click', lang.hitch(this, function () {
          this._setSymbol();
          this.emit('ok', this.symbolInfo);
        })));

        this.btnCancel.innerText = this.nls.common.cancel;
        this.own(on(this.btnCancel, 'click', lang.hitch(this, function () {
          this.emit('cancel');
        })));
      },

      _setSymbol: function () {
        //regardless of type we need to get and store in a common way
        var symbol;
        switch (this.symbolType) {
          case 'LayerSymbol':
            symbol = this.symbol;
            break;
          case 'EsriSymbol':
            this.userDefinedSymbol = true;
            symbol = this.symbolPicker.getSymbol();
            break;
          case 'CustomSymbol':
            this.userDefinedSymbol = true;
            if (this.customSymbolPlaceholder.children.length > 0) {
              if (typeof (this.customSymbolPlaceholder.children[0].src) !== 'undefined') {
                symbol = new PictureMarkerSymbol(this.customSymbolPlaceholder.children[0].src, 26, 26);
              } else {
                symbol = jsonUtils.fromJson(this.symbolInfo.symbol);
              }
            }
            break;
        }

        var icon;
        if (this.iconType === "LayerIcon") {
          icon = symbol;
        } else {
          if (this.customIconPlaceholder.children.length > 0) {
            if (typeof (this.customIconPlaceholder.children[0].src) !== 'undefined') {
              html.removeClass(this.customIconPlaceholder.firstChild, 'customPlaceholder');
              html.addClass(this.customIconPlaceholder.firstChild, 'customPlaceholderSettings');
              icon = new PictureMarkerSymbol(this.customIconPlaceholder.children[0].src, 26, 26);
            } else {
              //this.updateImg();
              icon = jsonUtils.fromJson(this.symbolInfo.icon);
            }
          }
        }

        if (this.clusteringEnabled && this.geometryType === 'esriGeometryPoint') {
          if (this.clusterType === "ThemeCluster") {
            this.clusterSymbol = "custom";
          } else {
            this.clusterSymbol = this.clusterPicker.getSymbol().toJson();
          }
          this.userDefinedSymbol = true;
        } else {
          this.clusterSymbol = undefined;
          this.clusteringEnabled = false;
        }

        if (symbol) {
          if (typeof (symbol.toJson) !== 'undefined') {
            symbol = symbol.toJson();
          }
        }

        var ssss;
        if (this.customIconPlaceholder.children.length > 0) {
          ssss = this.customIconPlaceholder.children[0].src;
        } else if (this.layerSym.children.length > 0) {
          ssss = this.layerSym.children[0].innerHTML;
        }
        else {
          ssss = this.customIconPlaceholder.outerHTML;
        }

        if (typeof (icon) !== 'undefined') {
          var isCustom = this.iconType !== "LayerIcon" || this.symbolType === 'CustomSymbol';
          this._createImageDataDiv2(icon, 44, 44, true, isCustom);
          this._createImageDataDiv2(icon, 28, 28, false, isCustom);
        }

        this.symbolInfo = {
          symbolType: this.symbolType,
          symbol: symbol,
          clusterSymbol: this.clusterSymbol,
          clusteringEnabled: this.clusteringEnabled,
          displayFeatureCount: this.displayFeatureCount,
          _highLightColor: this.colorPicker.color.toHex(),
          icon: icon && icon.toJson ? icon.toJson() : icon,
          clusterType: this.clusterType,
          iconType: this.iconType,
          renderer: this.renderer,
          s: ssss,
          svg: this.svg,
          panelHTML: this.panelHTML,
          userDefinedSymbol: this.userDefinedSymbol ? this.userDefinedSymbol : false,
          layerId: this.layerId,
          selectedId: this.selectedID,
          featureDisplayOptions: {
            groupEnabled: this.groupFeaturesEnabled,
            fields: this.fieldOptionsTable ? this._getFields(this.fieldOptionsTable) : null,
            groupField: this.groupOptionsTable ? this._getFields(this.groupOptionsTable)[0] : null
          }
        };
      },

      _getFields: function(table){
        var trs = table.getRows();
        var flds = [];
        array.forEach(trs, function (tr) {
          if (tr.selectFields) {
            flds.push({
              name: tr.selectFields.value,
              label: tr.labelText.value
            });
          }
        });
        return flds;
      },

      _rdoLayerSymChanged: function (v) {
        if (v) {
          this.symbolType = "LayerSymbol";
          if (this.selectedID) {
            this.setLayerSymbol(dom.byId(this.selectedID));
          }
        }
        html.setStyle(this.layerSym, 'display', v ? "block" : "none");
      },

      _rdoEsriSymChanged: function (v) {
        if (v) {
          this.symbolType = "EsriSymbol";
        }
        html.setStyle(this.symbolPicker.domNode, 'display', v ? "block" : "none");
      },

      _rdoCustomSymChanged: function (v) {
        if (v) {
          this.symbolType = "CustomSymbol";
        }
        html.setStyle(this.customSymbolDIV, 'display', v ? "block" : "none");
      },

      _chkClusterChanged: function (v) {
        this.clusteringEnabled = v;
        html.setStyle(this.grpClusterOptions, 'display', v ? "block" : "none");
        html.setStyle(this.featureFont, 'display', v ? "block" : "none");
        html.setStyle(this.clusterPickerContainer, 'display', v ? "block" : "none");
        if (v) {
          if (typeof (this.clusterType) === 'undefined') {
            this.clusterType = "CustomCluster";
            //this.rdoCustomCluster.set('checked', true);
          }
        }
      },

      _chkClusterCntChanged: function(v){
        this.displayFeatureCount = v;
        html.setStyle(this.featureFont, 'display', v ? "block" : "none");
      },

      //_rdoThemeClusterChanged: function (v) {
      //  if (v) {
      //    this.clusterType = "ThemeCluster";
      //    html.setStyle(this.clusterPicker.domNode, 'display', !v ? "block" : "none");
      //  }
      //},

      //_rdoCustomClusterChanged: function (v) {
      //  if (v) {
      //    this.clusterType = "CustomCluster";
      //    html.setStyle(this.clusterPicker.domNode, 'display', v ? "block" : "none");
      //  }
      //},

      _rdoLayerIconChanged: function (v) {
        if (v) {
          this.iconType = "LayerIcon";
        }
        html.setStyle(this.uploadCustomIcon, 'display', !v ? "block" : "none");
        html.setStyle(this.customIconPlaceholder, 'display', !v ? "block" : "none");
      },

      _rdoCustomIconChanged: function (v) {
        if (v) {
          this.iconType = "CustomIcon";
        }
        html.setStyle(this.uploadCustomIcon, 'display', v ? "block" : "none");
        html.setStyle(this.customIconPlaceholder, 'display', v ? "block" : "none");
      },

      _initSymbolPicker: function (geoType) {
        var symType = '';
        if (geoType === 'point') {
          symType = 'marker';
        }
        else if (geoType === 'polyline') {
          symType = 'line';
        }
        else if (geoType === 'polygon') {
          symType = 'fill';
        }
        this.symbolPicker.showByType(symType);
      },

      _initClusterSymbolPicker: function (geoType) {
        if (geoType === 'point') {
          this.clusterPicker.showByType('fill');
        }
        var d = geoType === 'point' ? 'block' : 'none';
        domStyle.set(this.parent_div_clusterOptions, "display", d);
      },

      _loadLayerSymbol: function () {
        //TODO check for MapServer renderer types other than just classBreaks and uniqueValues..
        if (typeof (this.renderer) !== 'undefined') {
          var renderer = this.renderer;
          var sym;
          var ren;
          if (typeof (renderer.symbol) !== 'undefined') {
            this._createImageDataDiv(renderer.symbol, true, this.layerSym);
          } else if (typeof (renderer.infos) !== 'undefined') {
            ren = renderer.infos;
          } else if (typeof (renderer.uniqueValueInfos) !== 'undefined') {
            ren = renderer.uniqueValueInfos;
          } else if (typeof (renderer.classBreakInfos) !== 'undefined') {
            ren = renderer.classBreakInfos;
          } else if (renderer.type && renderer.type === 'heatmap' && renderer.colorStops) {
            var colors = renderer.colorStops;
            var infos = [];
            if (colors && colors.length >= 1) {
              var _c = colors[0].color;
              var c = _Color.fromArray([_c.r, _c.g, _c.b]);
              infos.push({
                symbol: new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
                  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, c), c)
              });
              if (colors.length > 2) {
                _c = colors[colors.length - 1].color;
                c = _Color.fromArray([_c.r, _c.g, _c.b]);
                infos.push({
                  symbol: new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
                    new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, c), c)
                });
              }
            }
            if (infos.length > 0) {
              this.layerSym.appendChild(this._createCombinedImageDataDiv(infos));
            } else {
              this._createImageDataDiv2(undefined, 44, 44, true, false);
              this._createImageDataDiv2(undefined, 28, 28, false, false);
            }
          } else {
            this.rdoEsriSym.set('checked', true);
            this.symbolType = "EsriSymbol";
            this.iconType = "LayerIcon";
            this._initSymbolPicker(jimuUtils.getTypeByGeometryType(this.geometryType));
            this._setFields(this.fields);
            this._setSymbol();
            this.symbolInfo.symbolType = "LayerSymbol";
            this.symbolInfo.symbolOverride = true;
          }
          if (ren) {
            this.layerSym.innerHTML = "<div></div>";
            this.layerSym.appendChild(this._createCombinedImageDataDiv(ren));
            html.setStyle(this.layerSym, "cursor", "pointer");
          }
        }
      },

      _createImageDataDiv2: function (sym, w, h, isPanel, isCustom) {
        var a;
        if (typeof (sym) === "string") {
          a = domConstruct.create("div", { 'class': "imageDataGFX", 'innerHTML': sym });
          if (isPanel) {
            this.panelHTML = a.innerHTML;
          } else {
            this.svg = a;
          }
        } else if (typeof (sym) === 'undefined') {
          a = domConstruct.create("div", { 'class': "imageDataGFX" });
          a.innerHTML = '<div></div>';
          if (isPanel) {
            this.panelHTML = a.innerHTML;
          } else {
            this.svg = a;
          }
        } else {
          var symbol = jsonUtils.fromJson(sym);
          if (!symbol) {
            symbol = sym;
          }

          if (symbol) {
            var height = h;
            var width = w;
            if (symbol.height && symbol.width) {
              var ar = symbol.width / symbol.height;
              if (symbol.height > symbol.width) {
                width = w * ar;
              } else if (symbol.width > symbol.height) {
                height = width / ar;
              }
            }
            if (typeof (symbol.setWidth) !== 'undefined') {
              if (typeof (symbol.setHeight) !== 'undefined') {
                symbol.setWidth(isCustom ? width - (width * 0.25) : width);
                symbol.setHeight(isCustom ? height - (height * 0.25) : height);
              } else {
                symbol.setWidth(2);
              }
            } else if (typeof (symbol.size) !== 'undefined') {
              if (symbol.size > 20) {
                symbol.setSize(20);
              }
            }
            a = domConstruct.create("div", { 'class': "imageDataGFX" });
            var mySurface = gfx.createSurface(a, width, height);
            var descriptors = jsonUtils.getShapeDescriptors(symbol);
            var shape = mySurface.createShape(descriptors.defaultShape)
                          .setFill(descriptors.fill)
                          .setStroke(descriptors.stroke);
            shape.applyTransform({ dx: width / 2, dy: height / 2 });
            if (isPanel) {
              this.panelHTML = a.innerHTML;
            } else {
              this.svg = a;
            }
          } else if (typeof (sym.url) !== 'undefined') {
            a = domConstruct.create("div", { 'class': "imageDataGFX" });
            domStyle.set(a, "background-image", "url(" + sym.url + ")");
            domStyle.set(a, "background-repeat", "no-repeat");
            if (isPanel) {
              this.panelHTML = a.innerHTML;
            } else {
              this.svg = a;
            }
          }
        }
        return a;
      },

      _createImageDataDiv: function (sym, convert, node) {
        var a = domConstruct.create("div", { 'class': "imageDataGFX-display" }, node);
        var symbol = convert ? jsonUtils.fromJson(sym) : sym;
        if (!symbol) {
          symbol = sym;
        }
        this.symbol = symbol;
        var height = 26;
        var width = 26;
        if (symbol.height && symbol.width) {
          if (symbol.height > symbol.width) {
            var ar = symbol.width / symbol.height;
            height = 26;
            width = 26 * ar;
          }
        }
        var mySurface = gfx.createSurface(a, width, height);
        var descriptors = jsonUtils.getShapeDescriptors(this.setSym(symbol, width, height));
        var shape = mySurface.createShape(descriptors.defaultShape)
                      .setFill(descriptors.fill)
                      .setStroke(descriptors.stroke);
        shape.applyTransform({ dx: width / 2, dy: height / 2 });
        this.svg = a.firstChild;
        return a;
      },

      _createCombinedImageDataDiv: function (infos) {
        var a = domConstruct.create("div", { 'class': "imageDataGFXMulti" }, this.customSymbolPlaceholder);
        this.lyrSymbolSet = [];
        var isDefault = this.symbolInfo && this.symbolInfo.selectedId ? false : true;
        for (var i = 0; i < infos.length; i++) {
          var sym = infos[i].symbol;
          var symbol = jsonUtils.fromJson(sym);
          if (!symbol) {
            symbol = sym;
          }
          if (typeof (this.symbol) === 'undefined') {
            this.symbol = symbol;
          }
          this.lyrSymbolSet.push(symbol);

          var height = 26;
          var width = 26;
          if (symbol.height && symbol.width) {
            if (symbol.height > symbol.width) {
              var ar = symbol.width / symbol.height;
              height = 26;
              width = 26 * ar;
            }
          }

          var b = domConstruct.create("div", {
            'class': "imageDataGFX imageDataGFX2",
            'id': "imageGFX_" + i,
            onclick: lang.hitch(this, this.layerSymbolClick)
          }, a);

          var mySurface = gfx.createSurface(b, width, height);
          var descriptors = jsonUtils.getShapeDescriptors(this.setSym(symbol, width, height));
          var shape = mySurface.createShape(descriptors.defaultShape)
                        .setFill(descriptors.fill)
                        .setStroke(descriptors.stroke);
          shape.applyTransform({ dx: width / 2, dy: height / 2 });
          a.insertBefore(b, a.firstChild);
          a.appendChild(b);
          if (isDefault || (this.symbolInfo && b.id === this.symbolInfo.selectedId)) {
            this.setLayerSymbol(b);
            isDefault = false;
          }
          if (mySurface.rawNode) {
            html.setStyle(mySurface.rawNode, 'display', "block");
            html.setStyle(mySurface.rawNode, 'margin', "auto");
          }
        }
        return a;
      },

      layerSymbolClick: function (evt) {
        this.setLayerSymbol(evt.currentTarget);
      },

      setLayerSymbol: function (elm) {
        var idx;
        for (var i = 0; i < elm.parentElement.children.length; i++) {
          var child = elm.parentElement.children[i];
          html.removeClass(child, "lyrSymbolSelected");
          if (child.id === elm.id) {
            idx = i;
          }
        }
        html.addClass(elm, "lyrSymbolSelected");
        this.selectedID = elm.id;
        this.svg = elm;
        this.panelHTML = elm.innerHTML;
        this.symbol = this.lyrSymbolSet[idx];
      },

      setSym: function (symbol, width, height) {
        if (typeof (symbol.setWidth) !== 'undefined') {
          if (this.geometryType === 'esriGeometryPoint') {
            symbol.setWidth(width);
          }
          if (typeof (symbol.setHeight) !== 'undefined') {
            symbol.setHeight(height);
          }
        } else {
          //used for point symbols from hosted services
          if (typeof (symbol.size) !== 'undefined') {
            if (symbol.size > 20) {
              symbol.setSize(20);
            }
          }
          //used for point symbols from MapServer services
          if (typeof (symbol.width) !== 'undefined') {
            symbol.width = width;
          }
          if (typeof (symbol.height) !== 'undefined') {
            symbol.height = height;
          }
        }

        return symbol;
      },

      _editIcon: function (type) {
        this.fileInput.value = null;
        var reader = new FileReader();
        reader.onload = lang.hitch(this, function () {
          var node;
          var title;
          if (type === "Symbol") {
            node = this.customSymbolPlaceholder;
            title = this.nls.editCustomSymbol;
          } else {
            node = this.customIconPlaceholder;
            title = this.nls.editCustomIcon;
          }
          node.innerHTML = "<div></div>";

          var a = domConstruct.create("div", {
            'class': "customPlaceholder",
            innerHTML: ['<img class="customPlaceholder" src="', reader.result, '"/>'].join(''),
            title: title
          });

          node.innerHTML = a.innerHTML;
        });

        this.fileInput.onchange = lang.hitch(this, function () {
          var f = this.fileInput.files[0];
          reader.readAsDataURL(f);
        });

        this.fileInput.click();
      },

      _chkGroupChanged: function(v){
        this.groupFeaturesEnabled = v;
        html.setStyle(this.groupFieldOptions, 'display', v ? "inline-block" : "none");
      },

      destroy: function () {
        this.symbolInfo = null;
        this.tabContainer.destroyRecursive();
      }
    });
  });


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Common.Commands
{
    public class ActionCommand<T> : ICommand
    {
        public Predicate<T> CanExecuteDelegate { get; set; }
        public Action<T> ExecuteDelegate { get; set; }

        #region ICommand Members

        public ActionCommand() { }
        public ActionCommand(Predicate<T> canExecuteDelegate, Action<T> executeDelegate)
        {
            CanExecuteDelegate = canExecuteDelegate;
            ExecuteDelegate = executeDelegate;
        }

        public bool CanExecute(object parameter)
        {
            if (parameter != null && parameter.GetType() != typeof(T))
                throw new Exception("Wrong type!");

            if (CanExecuteDelegate != null)
                return CanExecuteDelegate((T)parameter);
            return true;// if there is no can execute default to true
        }

        public event EventHandler CanExecuteChanged
        {
            add { CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value; }
        }

        public void Execute(object parameter)
        {

            if (parameter != null && parameter.GetType() != typeof(T))
                throw new Exception("Wrong type!");

            if (ExecuteDelegate != null)
                ExecuteDelegate((T)parameter);
        }

        #endregion
    }
}


text:
//
//  MOSFileBackedExecutable.m
//  Tricky68k
//
//  Created by Daniele Cattaneo on 01/08/17.
//  Copyright © 2017 Daniele Cattaneo. All rights reserved.
//

#import "MOSFileBackedExecutable.h"
#import "PlatformSupport.h"

@implementation MOSFileBackedExecutable

- (instancetype)initWithPersistentURL:(NSURL *)rep error:(NSError **)errptr
{
  self = [super init];
  _executableFile = rep;
  MOSDbgLog(@"MOSFileBackedExecutable: acquired %@", rep);
  return self;
}

- (instancetype)initWithURL:(NSURL *)rep error:(NSError **)errptr
{
  self = [super init];
  NSFileManager *fm = [NSFileManager defaultManager];
  _executableFile = [NSURL URLWithTemporaryFilePathWithExtension:@"o"];
  BOOL res = [fm copyItemAtURL:rep toURL:_executableFile error:errptr];
  if (res) {
    MOSDbgLog(@"MOSFileBackedExecutable: created %@ (from %@)", _executableFile, rep);
    return self;
  }
  return nil;
}

- (BOOL)writeToURL:(NSURL *)outf error:(NSError **)errptr
{
  /* Q: Why are you using NSData instead of NSFileManager or copyfile(3)? This
   *    way you are missing out on all the APFS awesomeness!
   * A: Because NEITHER of them actually returns ANY usable ERROR CODE.
   *    IN 2017. * angrily punches a fist through the air * NSFileManager
   *    always returns a non-descript error with an underlying NSError of
   *    EIO, which is useless (and a lie unless your disk is broken,
   *    so it's even a dangerous lie to tell). copyfile(3) is meant to return
   *    an error in errno, but for some reason we actually always get zero...
   *    which is a problem of errno more than copyfile(3) but come on, everyone
   *    knows about that and designs their APIs so that they return an error
   *    code instead of relying on errno in 2017... But, the authors of
   *    copyfile are not capable of doing that. I must assume AppKit and the
   *    POSIX layer are both maintained by the worst interns imaginable.
   *    Now my faith in humanity has dropped to a new low, thanks Apple. */
  NSData *tmp = [NSData dataWithContentsOfURL:self.executableFile
    options:NSDataReadingMappedAlways error:errptr];
  if (!tmp)
    return NO;
  if (![tmp writeToURL:outf options:0 error:errptr])
    return NO;
  return YES;
}

- (void)dealloc
{
  unlink([self.executableFile fileSystemRepresentation]);
  MOSDbgLog(@"MOSFileBackedExecutable: deleted %@", self.executableFile);
}

@end


text:
package org.apache.camel.component.mybatis;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.util.ObjectHelper;

/**
 * Performs a query, poll, insert, update or delete in a relational database using MyBatis.
 */
@UriEndpoint(firstVersion = "2.7.0", scheme = "mybatis", title = "MyBatis", syntax = "mybatis:statement", label = "database,sql")
public class MyBatisEndpoint extends BaseMyBatisEndpoint {

    @UriPath @Metadata(required = true)
    private String statement;
    @UriParam(label = "producer")
    private StatementType statementType;
    @UriParam(label = "consumer", description = "Enables or disables transaction. If enabled then if processing an exchange failed then the consumer"
        + "break out processing any further exchanges to cause a rollback eager.")
    private boolean transacted;
    @UriParam(label = "consumer", defaultValue = "0")
    private int maxMessagesPerPoll;
    @UriParam(label = "consumer", optionalPrefix = "consumer.")
    private String onConsume;
    @UriParam(label = "consumer", optionalPrefix = "consumer.", defaultValue = "true")
    private boolean useIterator = true;
    @UriParam(label = "consumer", optionalPrefix = "consumer.")
    private boolean routeEmptyResultSet;
    @UriParam(label = "consumer,advanced")
    private MyBatisProcessingStrategy processingStrategy = new DefaultMyBatisProcessingStrategy();

    public MyBatisEndpoint() {
    }

    public MyBatisEndpoint(String endpointUri, Component component, String statement) {
        super(endpointUri, component);
        this.statement = statement;
    }

    public Producer createProducer() throws Exception {
        ObjectHelper.notNull(statementType, "statementType", this);
        ObjectHelper.notNull(statement, "statement", this);
        return new MyBatisProducer(this);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        ObjectHelper.notNull(statement, "statement", this);
        MyBatisConsumer consumer = new MyBatisConsumer(this, processor);
        consumer.setMaxMessagesPerPoll(getMaxMessagesPerPoll());
        consumer.setOnConsume(getOnConsume());
        consumer.setUseIterator(isUseIterator());
        consumer.setRouteEmptyResultSet(isRouteEmptyResultSet());
        configureConsumer(consumer);
        return consumer;
    }

    public String getStatement() {
        return statement;
    }

    /**
     * The statement name in the MyBatis XML mapping file which maps to the query, insert, update or delete operation you wish to evaluate.
     */
    public void setStatement(String statement) {
        this.statement = statement;
    }

    public StatementType getStatementType() {
        return statementType;
    }

    /**
     * Mandatory to specify for the producer to control which kind of operation to invoke.
     */
    public void setStatementType(StatementType statementType) {
        this.statementType = statementType;
    }

    public boolean isTransacted() {
        return transacted;
    }

    /**
     * Enables or disables transaction. If enabled then if processing an exchange failed then the consumer
     + break out processing any further exchanges to cause a rollback eager
     */
    public void setTransacted(boolean transacted) {
        this.transacted = transacted;
    }

    public MyBatisProcessingStrategy getProcessingStrategy() {
        return processingStrategy;
    }

    /**
     * To use a custom MyBatisProcessingStrategy
     */
    public void setProcessingStrategy(MyBatisProcessingStrategy processingStrategy) {
        this.processingStrategy = processingStrategy;
    }

    public int getMaxMessagesPerPoll() {
        return maxMessagesPerPoll;
    }

    /**
     * This option is intended to split results returned by the database pool into the batches and deliver them in multiple exchanges.
     * This integer defines the maximum messages to deliver in single exchange. By default, no maximum is set.
     * Can be used to set a limit of e.g. 1000 to avoid when starting up the server that there are thousands of files.
     * Set a value of 0 or negative to disable it.
     */
    public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
        this.maxMessagesPerPoll = maxMessagesPerPoll;
    }

    public String getOnConsume() {
        return onConsume;
    }

    /**
     * Statement to run after data has been processed in the route
     */
    public void setOnConsume(String onConsume) {
        this.onConsume = onConsume;
    }

    public boolean isUseIterator() {
        return useIterator;
    }

    /**
     * Process resultset individually or as a list
     */
    public void setUseIterator(boolean useIterator) {
        this.useIterator = useIterator;
    }

    public boolean isRouteEmptyResultSet() {
        return routeEmptyResultSet;
    }

    /**
     * Whether allow empty resultset to be routed to the next hop
     */
    public void setRouteEmptyResultSet(boolean routeEmptyResultSet) {
        this.routeEmptyResultSet = routeEmptyResultSet;
    }
}


text:
import {getValue} from "@tsed/core";
import {OpenSpec3} from "@tsed/openspec";
import {mapOpenSpecInfo} from "./mapOpenSpecInfo";

/**
 * @ignore
 * @param spec
 * @param version
 * @param specVersion
 */
export function mapOpenSpec3(spec: any, {specVersion}: any): Partial<OpenSpec3> {
  const {servers, paths, components, security, tags, externalDocs} = spec;

  return {
    openapi: specVersion,
    info: mapOpenSpecInfo(getValue(spec, "info", {})),
    servers,
    paths,
    components,
    security,
    tags,
    externalDocs
  };
}


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

    <title>I-Index</title>
    <meta name="date" content="2015-01-18">
    <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I L M N O P Q R S T U V W X Y

I

i
            - Variable in class parking.implementation.business.logistic.simple.SimpleParkingSpotIdProvider

id -
            Variable in class parking.api.business.parking.Parking

id - Variable in class
            parking.api.business.parkingspot.BaseParkingSpot

idLabel - Variable in
            class parking.implementation.gui.stages.SpotStage

idProvider
            - Variable in class parking.implementation.business.logistic.simple.SimpleParkingSpotFactory

INFINITE -
            Static variable in class parking.api.business.Booking

info
            - Variable in class parking.implementation.gui.stages.InvoiceStage

infos - Variable in class
            parking.implementation.gui.controls.ButtonSpot

init() - Method in class
            parking.implementation.gui.stages.ClientStage

init() - Method in class
            parking.implementation.gui.stages.InvoiceStage

init() - Method in class
            parking.implementation.gui.stages.VehicleStage

InnerHelper(ArrayList<Class>)
            - Constructor for class parking.api.business.helper.ParkingSpotTypeByVehicleTypePriorityMap.InnerHelper

instance -
            Static variable in class parking.api.business.parking.ParkingApplicationManager

instance - Static variable
            in class parking.implementation.gui.ClientManager

interval -
            Variable in class parking.api.business.Booking

Invoice - Class in parking.api.business.invoices

Created by loic on 17/01/15.

Invoice(int,
            double, Object) - Constructor for class parking.api.business.invoices.Invoice

invoice
            - Variable in class parking.api.business.invoices.InvoiceExporterTest

invoice -
            Variable in class parking.implementation.business.invoices.TranslatedExporter

invoice
            - Variable in class parking.implementation.gui.stages.InvoiceStage

InvoiceExporter
            - Interface in parking.api.business.invoices

Created by Thomas on 17/01/2015.

invoiceExporter
            - Variable in class parking.implementation.business.invoices.HTMLExporter

invoiceExporter
            - Variable in class parking.implementation.business.invoices.SFTPUploader

InvoiceExporterTest
            - Class in parking.api.business.invoices

Created by Thomas on 18/01/2015.

InvoiceExporterTest()
            - Constructor for class parking.api.business.invoices.InvoiceExporterTest

invoiceNumber
            - Variable in class parking.api.business.invoices.Invoice

invoiceNumber
            - Variable in class parking.implementation.gui.stages.InvoiceStage

invoicePrice
            - Variable in class parking.api.business.invoices.Invoice

InvoiceStage -
            Class in parking.implementation.gui.stages

Created by loic on 18/01/15.

InvoiceStage(Window,
            ParkingSpot, Invoice) - Constructor for class parking.implementation.gui.stages.InvoiceStage

InvoiceStrategy
            - Interface in parking.api.business.invoices

Created by loic on 17/01/15.

isBooked()
            - Method in class parking.api.business.parkingspot.BaseParkingSpot

isBooked()
            - Method in interface parking.api.business.parkingspot.ParkingSpot

Checks if the parking spot is booked.

isOptimalParkingSpotForVehicle(ParkingSpot,
            Vehicle) - Method in interface parking.api.business.parkingspot.VehicleParkingStrategy

Check if the vehicle is in the best parking post

isOptimalParkingSpotForVehicle(ParkingSpot,
            Vehicle) - Method in class parking.implementation.business.logistic.simple.SimpleVehicleParkingStrategy

isOwnedBy(Object)
            - Method in class parking.api.business.Booking

Check the owner of the booking

isVehicleParked()
            - Method in class parking.api.business.parkingspot.BaseParkingSpot

isVehicleParked()
            - Method in interface parking.api.business.parkingspot.ParkingSpot

Whether a vehicle is parked

iterator() - Method in class
            parking.api.business.parking.Parking

iterator() -
            Method in class parking.api.business.parking.ParkingApplicationManager

iterator()
            - Method in class parking.implementation.gui.ClientManager

    A B C D E F G H I L M N O P Q R S T U V W X Y

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
/// <reference path="../../../jqwidgets-ts/jqwidgets.d.ts" />
function createKnob(selector) {
    // initialization options - validated in typescript
    // jqwidgets.KnobOptions has generated TS definition
    let options: jqwidgets.KnobOptions = {
        value: 60,
        min: 0,
        max: 100,
        startAngle: 120,
        endAngle: 420,
        snapToStep: true,
        rotation: 'clockwise',
        style: {
            stroke: '#dfe3e9', strokeWidth: 3,
            fill: { color: '#fefefe', gradientType: "linear", gradientStops: [[0, 1], [50, 0.9], [100, 1]] }
        },
        marks: {
            colorRemaining: { color: 'grey', border: 'grey' },
            colorProgress: { color: '#00a4e1', border: '#00a4e1' },
            type: 'line',
            offset: '71%',
            thickness: 3,
            size: '6%',
            majorSize: '9%',
            majorInterval: 10,
            minorInterval: 2
        },
        labels: {
            offset: '88%',
            step: 10,
            visible: true
        },
        progressBar: {
            style: { fill: '#00a4e1', stroke: 'grey' },
            size: '9%',
            offset: '60%',
            background: { fill: 'grey', stroke: 'grey' }
        },
        pointer: { type: 'arrow', style: { fill: '#00a4e1', stroke: 'grey' }, size: '59%', offset: '49%', thickness: 20 }
    };

    // creates an instance
    let myKnob: jqwidgets.jqxKnob = jqwidgets.createInstance(selector, 'jqxKnob', options);
    myKnob.setOptions(options);

    let input = document.createElement("div");
    input.setAttribute("class", "inputField");
    input.setAttribute("id", "numberInput");
    document.body.appendChild(input);

    let inputOptions: jqwidgets.NumberInputOptions = {
        width: 180,
        height: '40px',
        decimal: 60,
        min: 0,
        max: 100,
        textAlign: 'center',
        decimalDigits: 1,
        inputMode: 'simple'
    };

    // create an instance of jqxNumberInput with selector - '#numberInput'
    let myNumberInput: jqwidgets.jqxNumberInput = jqwidgets.createInstance('#numberInput', 'jqxNumberInput', inputOptions);

    myNumberInput.setOptions(inputOptions);

    // you can add event
    myNumberInput.addEventHandler('mousedown', function (event) {
        event.stopPropagation();
    });

    myNumberInput.addEventHandler('keyup', function () {
        let val: any = myNumberInput.val;
        myKnob.val(val);
    });

    myNumberInput.addEventHandler('change', function ()
    {
        let val: any = myNumberInput.val;
        myKnob.val(val);
    });

    myKnob.addEventHandler('change', function (event) {
        if (event.args.changeSource == 'propertyChange' || event.args.changeSource == 'val') { return; }
        myNumberInput.val(event.args.value);
    });

    // you can update value
    myKnob.val(25);
}


text:
({
    /**
     * Note that this test file operates in system mode (objects are not Lockerized) so the tests delegate logic and
     * verification to the controller and helper files, which operate in user mode.
     */

    // LockerService not supported on older IE
    browsers: ["-IE8", "-IE9", "-IE10", "-IE11"],

    setUp: function(cmp) {
        cmp.set("v.testUtils", $A.test);
    },

    testFacetFromAnotherNamespaceIsSecureComponentRef: {
        test: function(cmp) {
            cmp.testFacetFromAnotherNamespaceIsSecureComponentRef();
        }
    },

    testUnexposedPlatformAPIs: {
        test: function(cmp) {
            var unexposedPlatformApis = ["addHandler", "destroy", "getSuper", "getElement", "getElements", "getReference",
                                         "clearReference", "getConcreteComponent", "autoDestroy", "isConcrete",
                                         "addValueProvider", "getEvent", "find", "getElements"];
            cmp.testUnexposedPlatformAPIs(unexposedPlatformApis);
        }
    },

    testGetCThrowsError: {
        test: function(cmp) {
            cmp.testGetCThrowsError();
        }
    },

    testGetFacetActionThrowsError: {
        test: function(cmp) {
            cmp.testGetFacetActionThrowsError();
        }
    }
})


text:
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace SOURCE.Domaine
{
    public partial class TraductionFonction
    {

        [DataMember]
        public long ID { get; set; }

        [DataMember]
        public virtual Fonction Fonction { get; set; }

        [DataMember]
        public long FonctionID { get; set; }

        [DataMember]
        public virtual Langue Langue { get; set; }

        [DataMember]
        public long LangueID { get; set; }

        [DataMember]
		[StringLength(255)]
        public string Libelle { get; set; }

        [DataMember]
		[StringLength(255)]
        public string LibelleCourt { get; set; }

        [DataMember]
        public Nullable<int> Ordre { get; set; }
    }
}


text:
package org.elasticsearch.river.dropbox.test;

import java.util.ArrayList;
import java.util.Arrays;

import org.junit.Assert;
import org.junit.Test;

import fr.pilato.elasticsearch.river.dropbox.river.DropBoxRiverUtil;

public class DropboxMatchFilesTest {

	@Test
	public void exclude_only() throws Exception {
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("test.doc", new ArrayList<String>(), Arrays.asList("*.doc")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("test.xls", new ArrayList<String>(), Arrays.asList("*.doc")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("my.doc.xls", new ArrayList<String>(), Arrays.asList("*.doc")));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("my.doc.xls", new ArrayList<String>(), Arrays.asList("*.doc","*.xls")));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("my.doc.xls", new ArrayList<String>(), Arrays.asList("my.d?c*.xls")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("my.douc.xls", new ArrayList<String>(), Arrays.asList("my.d?c*.xls")));
	}

	@Test
	public void include_only() throws Exception {
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("test.doc", Arrays.asList("*.doc"), new ArrayList<String>()));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("test.xls", Arrays.asList("*.doc"), new ArrayList<String>()));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("my.doc.xls", Arrays.asList("*.doc"), new ArrayList<String>()));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("my.doc.xls", Arrays.asList("my.d?c*.xls"), new ArrayList<String>()));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("my.douc.xls", Arrays.asList("my.d?c*.xls"), new ArrayList<String>()));
	}

	@Test
	public void include_exclude() throws Exception {
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("test.doc", Arrays.asList("*.xls"), Arrays.asList("*.doc")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("test.xls", Arrays.asList("*.xls"), Arrays.asList("*.doc")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("my.doc.xls", Arrays.asList("*.xls"), Arrays.asList("*.doc")));
		Assert.assertFalse(DropBoxRiverUtil.isIndexable("my.doc.xls", Arrays.asList("*.xls"), Arrays.asList("my.d?c*.xls")));
		Assert.assertTrue(DropBoxRiverUtil.isIndexable("my.douc.xls", Arrays.asList("*.xls"), Arrays.asList("my.d?c*.xls")));
	}

}


text:
import { dexieReplaceIfStartsWithPipe, DEXIE_DOCS_TABLE_NAME, fromDexieToStorage } from './dexie-helper';
import { RxStorageDexieStatics } from './rx-storage-dexie';
export var dexieCount = function dexieCount(instance, preparedQuery) {
  try {
    return Promise.resolve(instance.internals).then(function (state) {
      var queryPlan = preparedQuery.queryPlan;
      var queryPlanFields = queryPlan.index;
      var keyRange = getKeyRangeByQueryPlan(queryPlan, state.dexieDb._options.IDBKeyRange);
      var count = -1;
      return Promise.resolve(state.dexieDb.transaction('r', state.dexieTable, function (dexieTx) {
        try {
          var tx = dexieTx.idbtrans;
          var store = tx.objectStore(DEXIE_DOCS_TABLE_NAME);
          var index;
          if (queryPlanFields.length === 1 && queryPlanFields[0] === instance.primaryPath) {
            index = store;
          } else {
            var indexName;
            if (queryPlanFields.length === 1) {
              indexName = dexieReplaceIfStartsWithPipe(queryPlanFields[0]);
            } else {
              indexName = '[' + queryPlanFields.map(function (field) {
                return dexieReplaceIfStartsWithPipe(field);
              }).join('+') + ']';
            }
            index = store.index(indexName);
          }
          var request = index.count(keyRange);
          return Promise.resolve(new Promise(function (res, rej) {
            request.onsuccess = function () {
              res(request.result);
            };
            request.onerror = function (err) {
              return rej(err);
            };
          })).then(function (_Promise) {
            count = _Promise;
          });
        } catch (e) {
          return Promise.reject(e);
        }
      })).then(function () {
        return count;
      });
    });
  } catch (e) {
    return Promise.reject(e);
  }
};
/**
 * Runs mango queries over the Dexie.js database.
 */
export var dexieQuery = function dexieQuery(instance, preparedQuery) {
  try {
    return Promise.resolve(instance.internals).then(function (state) {
      var query = preparedQuery.query;
      var skip = query.skip ? query.skip : 0;
      var limit = query.limit ? query.limit : Infinity;
      var skipPlusLimit = skip + limit;
      var queryPlan = preparedQuery.queryPlan;
      var queryMatcher = false;
      if (!queryPlan.selectorSatisfiedByIndex) {
        queryMatcher = RxStorageDexieStatics.getQueryMatcher(instance.schema, preparedQuery);
      }
      var keyRange = getKeyRangeByQueryPlan(queryPlan, state.dexieDb._options.IDBKeyRange);
      var queryPlanFields = queryPlan.index;
      var rows = [];
      return Promise.resolve(state.dexieDb.transaction('r', state.dexieTable, function (dexieTx) {
        try {
          /**
           * TODO here we use the native IndexedDB transaction
           * to get the cursor.
           * Instead we should not leave Dexie.js API and find
           * a way to create the cursor with Dexie.js.
           */
          var tx = dexieTx.idbtrans;

          // const nativeIndexedDB = state.dexieDb.backendDB();
          // const trans = nativeIndexedDB.transaction([DEXIE_DOCS_TABLE_NAME], 'readonly');

          var store = tx.objectStore(DEXIE_DOCS_TABLE_NAME);
          var index;
          if (queryPlanFields.length === 1 && queryPlanFields[0] === instance.primaryPath) {
            index = store;
          } else {
            var indexName;
            if (queryPlanFields.length === 1) {
              indexName = dexieReplaceIfStartsWithPipe(queryPlanFields[0]);
            } else {
              indexName = '[' + queryPlanFields.map(function (field) {
                return dexieReplaceIfStartsWithPipe(field);
              }).join('+') + ']';
            }
            index = store.index(indexName);
          }
          var cursorReq = index.openCursor(keyRange);
          return Promise.resolve(new Promise(function (res) {
            cursorReq.onsuccess = function (e) {
              var cursor = e.target.result;
              if (cursor) {
                // We have a record in cursor.value
                var docData = fromDexieToStorage(cursor.value);
                if (!docData._deleted && (!queryMatcher || queryMatcher(docData))) {
                  rows.push(docData);
                }

                /**
                 * If we do not have to manually sort
                 * and have enough documents,
                 * we can abort iterating over the cursor
                 * because we already have every relevant document.
                 */
                if (queryPlan.sortFieldsSameAsIndexFields && rows.length === skipPlusLimit) {
                  res();
                } else {
                  cursor["continue"]();
                }
              } else {
                // Iteration complete
                res();
              }
            };
          })).then(function () {});
        } catch (e) {
          return Promise.reject(e);
        }
      })).then(function () {
        if (!queryPlan.sortFieldsSameAsIndexFields) {
          var sortComparator = RxStorageDexieStatics.getSortComparator(instance.schema, preparedQuery);
          rows = rows.sort(sortComparator);
        }

        // apply skip and limit boundaries.
        rows = rows.slice(skip, skipPlusLimit);

        /**
         * Comment this in for debugging to check all fields in the database.
         */
        // const docsInDb = await state.dexieTable.filter(queryMatcher).toArray();
        // let documents = docsInDb
        //     .map(docData => stripDexieKey(docData))
        //     .sort(sortComparator);
        // if (preparedQuery.skip) {
        //     documents = documents.slice(preparedQuery.skip);
        // }
        // if (preparedQuery.limit && documents.length > preparedQuery.limit) {
        //     documents = documents.slice(0, preparedQuery.limit);
        // }

        return {
          documents: rows
        };
      });
    });
  } catch (e) {
    return Promise.reject(e);
  }
};
export function getKeyRangeByQueryPlan(queryPlan, IDBKeyRange) {
  if (!IDBKeyRange) {
    if (typeof window === 'undefined') {
      throw new Error('IDBKeyRange missing');
    } else {
      IDBKeyRange = window.IDBKeyRange;
    }
  }
  var ret;
  /**
   * If index has only one field,
   * we have to pass the keys directly, not the key arrays.
   */
  if (queryPlan.index.length === 1) {
    ret = IDBKeyRange.bound(queryPlan.startKeys[0], queryPlan.endKeys[0], queryPlan.inclusiveStart, queryPlan.inclusiveEnd);
  } else {
    ret = IDBKeyRange.bound(queryPlan.startKeys, queryPlan.endKeys, queryPlan.inclusiveStart, queryPlan.inclusiveEnd);
  }
  return ret;
}
//# sourceMappingURL=dexie-query.js.map


text:
// Google Cloud Messaging Helper.
// Centralized class for the logic and settings of GCM within Klaxon.
package org.nerdcircus.android.klaxon;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.gcm.GoogleCloudMessaging;

import java.io.IOException;
import java.net.*;

public class GcmHelper {

    public static String TAG = "GcmHelper";
    public static String USER_AGENT = "Klaxon-GCM/1.0";
    public static String MY_TRANSPORT = "gcm";

    // Appengine authentication
    private static final String AUTH_URL = "/_ah/login";
    private static final String AUTH_TOKEN_TYPE = "ah";

    // GCM gateway urls.
    private static final String REGISTER_URL = "/register";
    private static final String UNREGISTER_URL = "/unregister";
    private static final String TEST_URL = "/test";

    // Preference Names.
    // TODO: pull these from Resources instead.
    public static final String PREF_URL = "c2dm_register_url";
    public static final String PREF_ACCOUNT = "c2dm_register_account";
    public static final String PREF_TOKEN = "c2dm_token";
    public static final String PREF_SENDER = "c2dm_sender";

    // Request codes.
    public static final int RC_NOPLAY = 1;
    public static final int RC_AUTH_NEEDED = 2;

    // Desired Interface
    // getRegisterUrl: base_url + /register
    // etc.
    // Register
    // Unregister
    // SendTestMessage
    // Reply

    // Members.
    private Context mContext;
    private SharedPreferences mPrefs;
    private Boolean mHaveAnnoyedAboutPlayServices = false;

    public GcmHelper(Context context) {
      Log.d(TAG, "initializing new GcmHelper");
      mContext = context;
      mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
      //use cookies.
      CookieHandler.setDefault(new CookieManager());
    }

    public String getRegisterUrl(){
      return (mPrefs.getString(PREF_URL, "") + REGISTER_URL);
    }
    public String getUnregisterUrl(){
      return (mPrefs.getString(PREF_URL, "") + UNREGISTER_URL);
    }
    public String getTestUrl(){
      return mPrefs.getString(PREF_URL, "") + TEST_URL;
    }
    public String getAuthUrl(){
      return mPrefs.getString(PREF_URL,"") + AUTH_URL;
    }

    public String getAccountName(){
      return mPrefs.getString(PREF_ACCOUNT,"");
    }

    /** Request a URL, authenticating as needed.
     * this method uses HttpURLConnection. */
    private HttpURLConnection HttpRequest(URL requrl){
      HttpURLConnection conn = null;
      try {
        conn = (HttpURLConnection)requrl.openConnection();
        conn.setRequestProperty("User-Agent", USER_AGENT);
        Log.d(TAG, "req url: " + requrl.toString());
        Log.d(TAG, "response url: " + conn.getURL());
        Log.d(TAG, "Response: " + conn.getResponseCode());
        if(! requrl.getHost().equals(conn.getURL().getHost())){
            Log.d(TAG, "looks like we were redirected. Auth.");
            conn.disconnect();
            // Get the auth token, and use it.
            String authToken = this.getAuthToken();
            URL authurl = new URL(getAuthUrl() + "?continue=" +
                    URLEncoder.encode(requrl.toString(), "UTF-8") +
                    "&auth=" + authToken);
            Log.d(TAG, "Auth url: " + authurl.toString());
            conn = (HttpURLConnection)authurl.openConnection();
            conn.getInputStream(); // Don't care what we get back. metadata is enough.
            Log.d(TAG, "response url: " + conn.getURL());
            Log.d(TAG, "Response: " + conn.getResponseCode());
        }
        return conn;
      } catch (Exception e) {
          Log.w(TAG, "HTTP Request exception!", e);
      }
      return conn;
    }

    // Device has registered with GCM, now send the registration info to our server, and save it.
    public void register(String deviceRegistrationID) {
        try {
            Log.d(TAG, "Registering!");
            URL requrl = new URL(getRegisterUrl() + "?token=" + deviceRegistrationID);

            //make httpurlconnection request
            HttpURLConnection conn = HttpRequest(requrl);
            if(conn.getResponseCode() == 200){
                SharedPreferences.Editor editor = mPrefs.edit();
                editor.putString("c2dm_token", deviceRegistrationID);
                Log.w(TAG, "Commiting token");
                editor.commit();
            }
        } catch (Exception e) {
            Log.w(TAG, "Registration exception!",e);
        }
    }

    public void unregister(String deviceRegistrationID) {
        try {
            Log.d(TAG, "UN-Registering!");
            // Drop the old token on the floor.
            SharedPreferences.Editor editor = mPrefs.edit();
            editor.remove("c2dm_token");
            editor.commit();
            // Try to notify the server to drop it, too.
            URL req = new URL(getUnregisterUrl() + "?token=" + deviceRegistrationID);
            HttpRequest(req);
        } catch (Exception e) {
            Log.w(TAG, "Oh well, de-registration failed. no big deal.", e);
        }
    }

    public boolean reply(String url, String reply_text){
      Uri.Builder ub = Uri.parse(url).buildUpon();
      ub.appendQueryParameter("reply", reply_text);
      Log.d(TAG, "Url: " + url);
      try {
        URL req = new URL(ub.build().toString());
        HttpURLConnection res = HttpRequest(req);
        if(res.getResponseCode() == 200)
          return true;
      } catch (Exception e) {
        Log.e(TAG, "something is wrong with reply: " + e.getMessage(), e);
      }
      return false;
    }

    private String getAuthToken(){
      return getAuthTokenBlocking();
    }

    private String getAuthTokenBlocking() {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
      String acctname = prefs.getString(PREF_ACCOUNT, "");
      String token = null;
      try {
        token = GoogleAuthUtil.getToken(mContext, acctname, AUTH_TOKEN_TYPE);
      } catch (GooglePlayServicesAvailabilityException playEx) {
        Dialog alert = GooglePlayServicesUtil.getErrorDialog(
            playEx.getConnectionStatusCode(),
            (Activity)mContext,
            GcmHelper.RC_NOPLAY);
        alert.show();
        return null;
      } catch (UserRecoverableAuthException userAuthEx) {
            // Start the user recoverable action using the intent returned by
            // getIntent()
            ((Activity)mContext).startActivityForResult(
                    userAuthEx.getIntent(),
                    RC_AUTH_NEEDED);
            return null;
      } catch (IOException transientEx) {
            // network or server error, the call is expected to succeed if you try again later.
            // Don't attempt to call again immediately - the request is likely to
            // fail, you'll hit quotas or back-off.
            Log.e(TAG, "something is borked.", transientEx);
            return null;
      } catch (GoogleAuthException authEx) {
            // Failure. The call is not expected to ever succeed so it should not be
            // retried.
            Log.e(TAG, "unrecoverable.", authEx);
            return null;
      }
      if(token != null){
        Log.d(TAG, "we got an auth token!");
        return token;
      }
      return null;
    }
    /* Register both legs of GCM registration - GCM, and our own server */
    void registerBothLegsBlocking(String sender){
        GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(mContext);
        try{
            String registrationid = gcm.register(sender);
            this.register(registrationid);
        } catch(IOException e){
            Log.e(TAG, "registration failed: " + e.getMessage(), e);
        }
    }

    /* UnRegister both legs of GCM registration - GCM, and our own server */
    void unregisterBothLegsBlocking(String registrationId){
        GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(mContext);
        try{
            gcm.unregister();
            this.unregister(registrationId);
        } catch(IOException e){
            Log.e(TAG, "registration failed: " + e.getMessage(), e);
        }
    }

    void registerWithGcmAsync(String... senders){
      //TODO: figure out why <Void,Void,Void> throws ClassCastException
      AsyncTask task = new AsyncTask<String,Object,Boolean>() {
        @Override
        protected Boolean doInBackground(String... params){
          GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(mContext);
          try {
            gcm.register(params);
            return true;
          } catch(IOException e){
            Log.e(TAG, "registration failed: " + e.getMessage(), e);
            return false;
          }
        }
      };
      task.execute((Object[])senders);
    }

    void unregisterWithGcmAsync(String... senders){
      //TODO: figure out why <Void,Void,Void> throws ClassCastException
      AsyncTask task = new AsyncTask<Object,Object,Void>() {
        @Override
        protected Void doInBackground(Object... params){
          GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(mContext);
          try {
            gcm.unregister();
          } catch(IOException e){
            Log.e(TAG, "registration failed: " + e.getMessage(), e);
          }
          return null;
        }
      };
      task.execute((Object[])null);
    }

    void maybePromptForLoginPermission(){
      // Check for an auth token. if none exists, use the provided activity context to request one.
      String acctname = mPrefs.getString(PREF_ACCOUNT, "");
      String token  = mPrefs.getString(PREF_TOKEN, "");
      if(acctname.length() == 0 || token.length() == 0){
        //user not registered for gcm. do nothing.
        return;
      }
      //TODO: figure out why <Void,Void,Void> throws ClassCastException
      AsyncTask task = new AsyncTask<Object,Object,String>() {
        @Override
        protected String doInBackground(Object... params){
          return getAuthTokenBlocking();
        }
      };
      task.execute();
    }

    private String getAuthToken(Context context, String accountName) {
        //TODO: validate that the account still appears in GetAccountsByType().
        Account account = new Account(accountName, "com.google");
        String authToken = null;
        try {
          AccountManager accountManager = AccountManager.get(context);
          authToken = accountManager.blockingGetAuthToken(account, AUTH_TOKEN_TYPE, true);
          //AccountManagerFuture amf = accountManager.getAuthToken(account, AUTH_TOKEN_TYPE, null, (Activity) context, new OnAuthToken(mContext), null);
          //Bundle result = (Bundle) amf.getResult();
          //Log.d(TAG, "auth: " + result.get(AccountManager.KEY_AUTHTOKEN).toString());
          //authToken = result.get(AccountManager.KEY_AUTHTOKEN).toString();
        } catch (OperationCanceledException e) {
            Log.w(TAG, e.getMessage());
        } catch (AuthenticatorException e) {
            Log.w(TAG, e.getMessage());
        } catch (IOException e) {
            Log.w(TAG, e.getMessage());
        }
        return authToken;
            /*
            AccountManagerFuture amf = accountManager.getAuthToken(
                account,
                AUTH_TOKEN_TYPE,
                true,
                new OnAuthToken(mContext),
                null);
            Log.d(TAG, "Got amf.");
        return authToken;
        */
    }

    public void invalidateAuthToken(Context context){
      Log.d(TAG, "invalidating token.");
      // For debugging only.
      AccountManager accountManager = AccountManager.get(context);
      //String accountname = PreferenceManager.getDefaultSharedPreferences(context).getString(PREF_ACCOUNT,"");
      //Account account = new Account(accountname, "com.google");
      accountManager.invalidateAuthToken("com.google", null);
      GoogleAuthUtil.invalidateToken(mContext, this.getAuthToken());
    }

    /** Check for the availability of play services. */
    public boolean checkForPlayServices(boolean haveShownDialog){
      int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
      if(status==ConnectionResult.SUCCESS){
        Log.d(TAG, "play services succeeded.");
        return true;
      } else if(!haveShownDialog){
        Log.d(TAG, "trying to show dialog..");
        GooglePlayServicesUtil.getErrorDialog(status, (Activity)mContext, RC_NOPLAY).show();
      }
      Log.d(TAG, "play services FAILED..");
      return false;
    }

}


text:
<?php

namespace Detail\Mail\Driver\Bernard;

use Detail\Bernard\Message\Messenger;
use Detail\Mail\Driver\DriverInterface;
use Detail\Mail\Message\MessageInterface;

class BernardDriver implements
    DriverInterface
{
    /**
     * @var Messenger
     */
    protected $messenger;

    /**
     * @var string
     */
    protected $queueName = 'mail';

    /**
     * @return Messenger
     */
    public function getMessenger()
    {
        return $this->messenger;
    }

    /**
     * @param Messenger $messenger
     */
    public function setMessenger(Messenger $messenger)
    {
        $this->messenger = $messenger;
    }

    /**
     * @return string
     */
    public function getQueueName()
    {
        return $this->queueName;
    }

    /**
     * @param string $queueName
     */
    public function setQueueName($queueName)
    {
        $this->queueName = $queueName;
    }

    /**
     * @param Messenger $messenger
     * @param string $queueName
     */
    public function __construct(Messenger $messenger, $queueName = null)
    {
        $this->setMessenger($messenger);

        if ($queueName !== null) {
            $this->setQueueName($queueName);
        }
    }

    /**
     * @param MessageInterface $message Message
     */
    public function send(MessageInterface $message)
    {
        $messenger = $this->getMessenger();
        $bernardMessage = $messenger->encodeMessage($message, $this->getQueueName());
        $messenger->produce($bernardMessage);
    }
}


text:
from setuptools import setup

setup(
    name             = 'tornado-backdoor',
    version          = '0.1.0',
    url              = 'https://github.com/saghul/tornado-backdoor',
    author           = 'Saúl Ibarra Corretgé',
    author_email     = 'saghul@gmail.com',
    description      = 'Interactive interpreter over TCP for Tornado',
    long_description = open('README.rst', 'r').read(),
    packages         = ['tornado_backdoor'],
    classifiers      = [
          "Development Status :: 4 - Beta",
          "Intended Audience :: Developers",
          "License :: OSI Approved :: MIT License",
          "Programming Language :: Python",
          "Programming Language :: Python :: 2.6",
          "Programming Language :: Python :: 2.7",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 3.0",
          "Programming Language :: Python :: 3.1",
          "Programming Language :: Python :: 3.2"
    ]
)


text:
import Controller from '@ember/controller';
import { not } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { task, timeout } from 'ember-concurrency';

export default Controller.extend({
  flashMessages: service(),
  isDisabled: not(
    'model.permissions.write',
  ),
  autosave: task(function* (property, value){
    this.model.set(property, value);
    yield timeout(1000);
    try {
      yield this.model.save();
      this.flashMessages.success("Saved");
    } catch(e) {
      e.errors.forEach((error) => {
        this.flashMessages.danger(error.detail);
      })
    }
  }).restartable(),
});


text:
package scripts.testscripts;

import bio.terra.datarepo.api.RepositoryApi;
import bio.terra.datarepo.client.ApiClient;
import bio.terra.datarepo.model.BulkLoadArrayRequestModel;
import bio.terra.datarepo.model.BulkLoadArrayResultModel;
import bio.terra.datarepo.model.BulkLoadFileModel;
import bio.terra.datarepo.model.DataDeletionGcsFileModel;
import bio.terra.datarepo.model.DataDeletionRequest;
import bio.terra.datarepo.model.DataDeletionTableModel;
import bio.terra.datarepo.model.DatasetModel;
import bio.terra.datarepo.model.DeleteResponseModel;
import bio.terra.datarepo.model.IngestRequestModel;
import bio.terra.datarepo.model.IngestResponseModel;
import bio.terra.datarepo.model.JobModel;
import com.google.api.client.util.Charsets;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.TableResult;
import com.google.cloud.storage.BlobId;
import common.utils.BigQueryUtils;
import common.utils.FileUtils;
import common.utils.StorageUtils;
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import runner.config.TestUserSpecification;
import scripts.testscripts.baseclasses.SimpleDataset;
import scripts.utils.BulkLoadUtils;
import scripts.utils.DataRepoUtils;

public class SoftDeleteDataset extends SimpleDataset {
  private static final Logger logger = LoggerFactory.getLogger(SoftDeleteDataset.class);

  /** Public constructor so that this class can be instantiated via reflection. */
  public SoftDeleteDataset() {
    super();
  }

  private DataDeletionRequest dataDeletionRequest;
  private static List<BlobId> scratchFiles = new ArrayList<>();

  public void setup(List<TestUserSpecification> testUsers) throws Exception {
    // create the profile and dataset
    super.setup(testUsers);

    // get the ApiClient for the dataset creator
    ApiClient datasetCreatorClient = DataRepoUtils.getClientForTestUser(datasetCreator, server);
    RepositoryApi repositoryApi = new RepositoryApi(datasetCreatorClient);

    // load data into the new dataset
    // note that there's a fileref in the dataset
    // ingest a file -- TODO CannedTestData.getMeA1KBFile
    URI sourceUri = new URI("gs://jade-testdata/fileloadprofiletest/1KBfile.txt");

    String targetPath = "/testrunner/softDel/" + FileUtils.randomizeName("") + ".txt";

    BulkLoadFileModel fileLoadModel =
        new BulkLoadFileModel()
            .sourcePath(sourceUri.toString())
            .description("softDel")
            .mimeType("text/plain")
            .targetPath(targetPath);
    String loadTag = FileUtils.randomizeName("softDelTest");
    BulkLoadArrayRequestModel fileLoadModelArray =
        new BulkLoadArrayRequestModel()
            .profileId(datasetSummaryModel.getDefaultProfileId())
            .loadTag(loadTag)
            .maxFailedFileLoads(0);
    fileLoadModelArray.addLoadArrayItem(fileLoadModel);

    JobModel ingestFileJobResponse =
        repositoryApi.bulkFileLoadArray(datasetSummaryModel.getId(), fileLoadModelArray);
    ingestFileJobResponse =
        DataRepoUtils.waitForJobToFinish(repositoryApi, ingestFileJobResponse, datasetCreator);
    BulkLoadArrayResultModel bulkLoadArrayResultModel =
        DataRepoUtils.expectJobSuccess(
            repositoryApi, ingestFileJobResponse, BulkLoadArrayResultModel.class);

    String jsonFileName = FileUtils.randomizeName("this-better-pass") + ".json";
    String dirInCloud = "scratch/softDel";
    String fileRefName = dirInCloud + "/" + jsonFileName;

    String scratchFileBucketName = "jade-testdata";
    BlobId scratchFileTabularData =
        BulkLoadUtils.writeScratchFileForIngestRequest(
            server.testRunnerServiceAccount,
            bulkLoadArrayResultModel,
            scratchFileBucketName,
            fileRefName);
    IngestRequestModel ingestRequest =
        BulkLoadUtils.makeIngestRequestFromScratchFile(scratchFileTabularData);
    scratchFiles.add(scratchFileTabularData); // make sure the scratch file gets cleaned up later

    JobModel ingestTabularDataJobResponse =
        repositoryApi.ingestDataset(datasetSummaryModel.getId(), ingestRequest);

    ingestTabularDataJobResponse =
        DataRepoUtils.waitForJobToFinish(
            repositoryApi, ingestTabularDataJobResponse, datasetCreator);
    IngestResponseModel ingestResponse =
        DataRepoUtils.expectJobSuccess(
            repositoryApi, ingestTabularDataJobResponse, IngestResponseModel.class);
    logger.info("Successfully loaded data into dataset: {}", ingestResponse.getDataset());

    UUID datasetId = datasetSummaryModel.getId();
    DatasetModel datasetModel = repositoryApi.retrieveDataset(datasetId, Collections.emptyList());
    String dataProject = datasetModel.getDataProject();
    String tableName = datasetModel.getSchema().getTables().get(0).getName();

    // get row ids for table
    String sqlQuery =
        BigQueryUtils.buildSelectQuery(
            dataProject,
            BigQueryUtils.getDatasetName(datasetModel.getName()),
            tableName,
            "datarepo_row_id",
            1L);
    BigQuery bigQueryClient =
        BigQueryUtils.getClientForTestUser(datasetCreator, datasetModel.getDataProject());
    TableResult result = BigQueryUtils.queryBigQuery(bigQueryClient, sqlQuery);
    List<String> rowIds =
        StreamSupport.stream(result.getValues().spliterator(), false)
            .map(fieldValues -> fieldValues.get(0).getStringValue())
            .collect(Collectors.toList());

    logger.info("Successfully retrieved row ids for table: {}", tableName);

    // write to GCS
    String csvFileName = FileUtils.randomizeName("this-too-better-pass") + ".csv";
    String csvFileRefName = dirInCloud + "/" + csvFileName;

    ByteArrayOutputStream output = new ByteArrayOutputStream();
    for (String line : rowIds) {
      output.write((line + "\n").getBytes(Charsets.UTF_8));
    }
    byte[] bytes = output.toByteArray();

    BlobId scratchFileSoftDeleteRows =
        StorageUtils.writeBytesToFile(
            StorageUtils.getClientForServiceAccount(server.testRunnerServiceAccount),
            scratchFileBucketName,
            csvFileRefName,
            bytes);
    scratchFiles.add(scratchFileSoftDeleteRows); // make sure the scratch file gets cleaned up later
    String gcsPath = StorageUtils.blobIdToGSPath(scratchFileSoftDeleteRows);

    // build the deletion request with pointers to the file with row ids to soft delete
    DataDeletionGcsFileModel deletionGcsFileModel =
        new DataDeletionGcsFileModel()
            .fileType(DataDeletionGcsFileModel.FileTypeEnum.CSV)
            .path(gcsPath);
    DataDeletionTableModel deletionTableFile =
        new DataDeletionTableModel().tableName(tableName).gcsFileSpec(deletionGcsFileModel);
    List<DataDeletionTableModel> dataDeletionTableModels =
        Collections.singletonList(deletionTableFile);
    dataDeletionRequest =
        new DataDeletionRequest()
            .deleteType(DataDeletionRequest.DeleteTypeEnum.SOFT)
            .specType(DataDeletionRequest.SpecTypeEnum.GCSFILE)
            .tables(dataDeletionTableModels);
  }

  public void userJourney(TestUserSpecification testUser) throws Exception {
    ApiClient apiClient = DataRepoUtils.getClientForTestUser(testUser, server);
    RepositoryApi repositoryApi = new RepositoryApi(apiClient);

    // send off the soft delete request
    JobModel softDeleteJobResponse =
        repositoryApi.applyDatasetDataDeletion(datasetSummaryModel.getId(), dataDeletionRequest);
    softDeleteJobResponse =
        DataRepoUtils.waitForJobToFinish(repositoryApi, softDeleteJobResponse, datasetCreator);
    DeleteResponseModel deleteResponseModel =
        DataRepoUtils.expectJobSuccess(
            repositoryApi, softDeleteJobResponse, DeleteResponseModel.class);
    logger.debug(
        "Successfully soft deleted rows from dataset: {} with state {}",
        datasetSummaryModel.getName(),
        deleteResponseModel.getObjectState());
  }

  public void cleanup(List<TestUserSpecification> testUsers) throws Exception {
    // delete the profile and dataset
    super.cleanup(testUsers);

    // delete the scratch files used for ingesting tabular data and soft delete rows
    StorageUtils.deleteFiles(
        StorageUtils.getClientForServiceAccount(server.testRunnerServiceAccount), scratchFiles);
  }
}