text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl\imgIEncoder.idl
 */

#ifndef __gen_imgIEncoder_h__
#define __gen_imgIEncoder_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

#ifndef __gen_nsIAsyncInputStream_h__
#include "nsIAsyncInputStream.h"
#endif

#ifndef __gen_nsIEventTarget_h__
#include "nsIEventTarget.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    imgIEncoder */
#define IMGIENCODER_IID_STR "4baa2d6e-fee7-42df-ae3f-5fbebc0c267c"

#define IMGIENCODER_IID \
  {0x4baa2d6e, 0xfee7, 0x42df, \
    { 0xae, 0x3f, 0x5f, 0xbe, 0xbc, 0x0c, 0x26, 0x7c }}

class NS_NO_VTABLE imgIEncoder : public nsIAsyncInputStream {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(IMGIENCODER_IID)

  enum {
    INPUT_FORMAT_RGB = 0U,
    INPUT_FORMAT_RGBA = 1U,
    INPUT_FORMAT_HOSTARGB = 2U
  };

  /* void initFromData ([array, size_is (length), const] in uint8_t data, in unsigned long length, in uint32_t width, in uint32_t height, in uint32_t stride, in uint32_t inputFormat, in AString outputOptions); */
  NS_IMETHOD InitFromData(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t inputFormat, const nsAString & outputOptions) = 0;

  /* void startImageEncode (in uint32_t width, in uint32_t height, in uint32_t inputFormat, in AString outputOptions); */
  NS_IMETHOD StartImageEncode(uint32_t width, uint32_t height, uint32_t inputFormat, const nsAString & outputOptions) = 0;

  /* void addImageFrame ([array, size_is (length), const] in uint8_t data, in unsigned long length, in uint32_t width, in uint32_t height, in uint32_t stride, in uint32_t frameFormat, in AString frameOptions); */
  NS_IMETHOD AddImageFrame(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t frameFormat, const nsAString & frameOptions) = 0;

  /* void endImageEncode (); */
  NS_IMETHOD EndImageEncode(void) = 0;

  /* [noscript] unsigned long getImageBufferUsed (); */
  NS_IMETHOD GetImageBufferUsed(uint32_t *_retval) = 0;

  /* [noscript] charPtr getImageBuffer (); */
  NS_IMETHOD GetImageBuffer(char **_retval) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(imgIEncoder, IMGIENCODER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_IMGIENCODER \
  NS_IMETHOD InitFromData(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t inputFormat, const nsAString & outputOptions) override; \
  NS_IMETHOD StartImageEncode(uint32_t width, uint32_t height, uint32_t inputFormat, const nsAString & outputOptions) override; \
  NS_IMETHOD AddImageFrame(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t frameFormat, const nsAString & frameOptions) override; \
  NS_IMETHOD EndImageEncode(void) override; \
  NS_IMETHOD GetImageBufferUsed(uint32_t *_retval) override; \
  NS_IMETHOD GetImageBuffer(char **_retval) override;

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_IMGIENCODER(_to) \
  NS_IMETHOD InitFromData(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t inputFormat, const nsAString & outputOptions) override { return _to InitFromData(data, length, width, height, stride, inputFormat, outputOptions); } \
  NS_IMETHOD StartImageEncode(uint32_t width, uint32_t height, uint32_t inputFormat, const nsAString & outputOptions) override { return _to StartImageEncode(width, height, inputFormat, outputOptions); } \
  NS_IMETHOD AddImageFrame(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t frameFormat, const nsAString & frameOptions) override { return _to AddImageFrame(data, length, width, height, stride, frameFormat, frameOptions); } \
  NS_IMETHOD EndImageEncode(void) override { return _to EndImageEncode(); } \
  NS_IMETHOD GetImageBufferUsed(uint32_t *_retval) override { return _to GetImageBufferUsed(_retval); } \
  NS_IMETHOD GetImageBuffer(char **_retval) override { return _to GetImageBuffer(_retval); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_IMGIENCODER(_to) \
  NS_IMETHOD InitFromData(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t inputFormat, const nsAString & outputOptions) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitFromData(data, length, width, height, stride, inputFormat, outputOptions); } \
  NS_IMETHOD StartImageEncode(uint32_t width, uint32_t height, uint32_t inputFormat, const nsAString & outputOptions) override { return !_to ? NS_ERROR_NULL_POINTER : _to->StartImageEncode(width, height, inputFormat, outputOptions); } \
  NS_IMETHOD AddImageFrame(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t frameFormat, const nsAString & frameOptions) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddImageFrame(data, length, width, height, stride, frameFormat, frameOptions); } \
  NS_IMETHOD EndImageEncode(void) override { return !_to ? NS_ERROR_NULL_POINTER : _to->EndImageEncode(); } \
  NS_IMETHOD GetImageBufferUsed(uint32_t *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetImageBufferUsed(_retval); } \
  NS_IMETHOD GetImageBuffer(char **_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetImageBuffer(_retval); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public imgIEncoder
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_IMGIENCODER

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS(_MYCLASS_, imgIEncoder)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* void initFromData ([array, size_is (length), const] in uint8_t data, in unsigned long length, in uint32_t width, in uint32_t height, in uint32_t stride, in uint32_t inputFormat, in AString outputOptions); */
NS_IMETHODIMP _MYCLASS_::InitFromData(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t inputFormat, const nsAString & outputOptions)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void startImageEncode (in uint32_t width, in uint32_t height, in uint32_t inputFormat, in AString outputOptions); */
NS_IMETHODIMP _MYCLASS_::StartImageEncode(uint32_t width, uint32_t height, uint32_t inputFormat, const nsAString & outputOptions)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void addImageFrame ([array, size_is (length), const] in uint8_t data, in unsigned long length, in uint32_t width, in uint32_t height, in uint32_t stride, in uint32_t frameFormat, in AString frameOptions); */
NS_IMETHODIMP _MYCLASS_::AddImageFrame(const uint8_t *data, uint32_t length, uint32_t width, uint32_t height, uint32_t stride, uint32_t frameFormat, const nsAString & frameOptions)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void endImageEncode (); */
NS_IMETHODIMP _MYCLASS_::EndImageEncode()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* [noscript] unsigned long getImageBufferUsed (); */
NS_IMETHODIMP _MYCLASS_::GetImageBufferUsed(uint32_t *_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* [noscript] charPtr getImageBuffer (); */
NS_IMETHODIMP _MYCLASS_::GetImageBuffer(char **_retval)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#endif /* __gen_imgIEncoder_h__ */


text: export declare function escapeRegex(string: string): string;

redpajama_set_name: RedPajamaGithub


text:
using Microsoft.Recognizers.Text.Number.English;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace Microsoft.Recognizers.Text.Number.Tests
{
    [TestClass]
    public class TestNumberRecognizerInitialization
    {
        private const string TestInput = "one";

        private const string EnglishCulture = Culture.English;
        private const string SpanishCulture = Culture.Spanish;
        private const string InvalidCulture = "vo-id";

        private readonly IModel controlModel;

        public TestNumberRecognizerInitialization()
        {
            controlModel = new NumberModel(
                    AgnosticNumberParserFactory.GetParser(AgnosticNumberParserType.Number, new EnglishNumberParserConfiguration()),
                    NumberExtractor.GetInstance(NumberMode.PureNumber));
        }

        [TestMethod]
        public void WithoutCulture_UseTargetCulture()
        {
            var recognizer = new NumberRecognizer(EnglishCulture);
            var testedModel = recognizer.GetNumberModel();

            TestNumber(testedModel, controlModel, TestInput);
        }

        [TestMethod]
        public void WithOtherCulture_NotUseTargetCulture()
        {
            var recognizer = new NumberRecognizer(SpanishCulture);
            var testedModel = recognizer.GetNumberModel(EnglishCulture);

            TestNumber(testedModel, controlModel, TestInput);
        }

        [TestMethod]
        public void WithInvalidCulture_UseTargetCulture()
        {
            var recognizer = new NumberRecognizer(EnglishCulture);
            var testedModel = recognizer.GetNumberModel(InvalidCulture);

            TestNumber(testedModel, controlModel, TestInput);
        }

        [TestMethod]
        public void WithInvalidCulture_AlwaysUseEnglish()
        {
            var recognizer = new NumberRecognizer();
            var testedModel = recognizer.GetNumberModel(InvalidCulture);

            TestNumber(testedModel, controlModel, TestInput);
        }

        [TestMethod]
        public void WithoutTargetCultureAndWithoutCulture_FallbackToEnglishCulture()
        {
            var recognizer = new NumberRecognizer();
            var testedModel = recognizer.GetNumberModel();

            TestNumber(testedModel, controlModel, TestInput);
        }

        [TestMethod]
        public void WithInvalidCultureAndWithoutFallback_ThrowError()
        {
            var recognizer = new NumberRecognizer();
            Assert.ThrowsException<ArgumentException>(() => recognizer.GetNumberModel(InvalidCulture, fallbackToDefaultCulture: false));
        }

        [TestMethod]
        public void WithInvalidCultureAsTargetAndWithoutFallback_ThrowError()
        {
            var recognizer = new NumberRecognizer(InvalidCulture);
            Assert.ThrowsException<ArgumentException>(() => recognizer.GetNumberModel(fallbackToDefaultCulture: false));
        }

        [TestMethod]
        public void InitializationWithIntOption_ResolveOptionsEnum()
        {
            var recognizer = new NumberRecognizer(EnglishCulture, 0);
            Assert.IsTrue(recognizer.Options.HasFlag(NumberOptions.None));
        }

        [TestMethod]
        public void InitializationWithInvalidOptions_ThrowError()
        {
            Assert.ThrowsException<ArgumentOutOfRangeException>(() => new NumberRecognizer(EnglishCulture, -1));
        }

        private void TestNumber(IModel testedModel, IModel controlModel, string source)
        {
            var expectedResults = controlModel.Parse(source);
            var actualResults = testedModel.Parse(source);

            Assert.AreEqual(expectedResults.Count, actualResults.Count, source);
            Assert.IsTrue(expectedResults.Count > 0, source);

            foreach (var tuple in Enumerable.Zip(expectedResults, actualResults, Tuple.Create))
            {
                var expected = tuple.Item1;
                var actual = tuple.Item2;

                Assert.AreEqual(expected.TypeName, actual.TypeName, source);
                Assert.AreEqual(expected.Text, actual.Text, source);

                Assert.AreEqual(expected.Resolution[ResolutionKey.Value], actual.Resolution[ResolutionKey.Value], source);
            }
        }
    }
}


text:
dojo.provide("pentaho.common.FieldList");

/**
 * Creates a list of fields from a
 */
dojo.declare(
    "pentaho.common.FieldList",
    [dijit._Widget, dijit._Templated],
{
  templateString: '

',
  datasource: undefined,
  connectHandles: [],
  enableDragDrop: true,
  singleSelect: false,
  getLocaleString: undefined,
  filters: [],
  categorize: true,
  categoryClassMap: {},
  usedCategoryIds: {},

  sanitizeIdAndClassNames: function(name) {
    if(name != null){
      return dojox.html.entities.encode(name).replace(/ /g,"_");
    }
    else{
      return '';
    }
  },

  generateUniqueClassName: function(categoryId) {
    var gen = function(){ return Math.round(Math.random() * 100000);};
    var className = "category" + gen();
    while(this.usedCategoryIds[className]){
      className = gen();
    }
    this.usedCategoryIds[className] = true;
    return "" + className;
  },

  getCategoryClassName: function(categoryId) {
    var className = this.categoryClassMap[categoryId];
    if (!className) {
      className = this.generateUniqueClassName(categoryId);
      this.categoryClassMap[categoryId] = className;
    }
    return className;
  },

  /**
   * Function to call when a field's oncontextmenu event is received
   * The default implementation is provided here. Call registerFieldContextMenuCallback
   * to override it.
   */
  fieldContextMenuCallback: function fieldContextMenuShow(event) {
        if( !this.fieldContextMenu ) {
            return;
        }
        dojo.stopEvent(event);
        var x = event.pageX;
        var y = event.pageY;
        this.fieldContextMenu._scheduleOpen(event.target, null, {x: x, y: y});
    },

  /**
   * Function to handle adding a field. Will receive the fieldId as the only parameter.
   */
  doubleClickCallback: undefined,

  /**
   * Function to handle adding a field. Will receive the fieldId as the only parameter.
   */
  clickCallback: undefined,

  /**
   * The dojo.dnd.Source container for the fields
   */
  dndObj: undefined,

  /**
   * The dojo.dnd.Selector object used if enableDragDrop is false
   */
  selector: undefined,

  /**
   * A callback function so we can notify someone, if desired, when expand/collapse happens
   */
  expandCollapseCategoryCallback: undefined,

  /**
   * Function to handle disabling the selection of text.
   * The default implementation is provided here. Call registerTextSelectionDisabler
   * to override it.
   */
  textSelectionDisabler: function(target){
    if (typeof target.onselectstart!="undefined") { //IE route
        this.connectHandles.push(dojo.connect(target, "onselectstart", function() { return false; }));
    }
    else if (typeof target.style.MozUserSelect!="undefined") { //Firefox route
        target.style.MozUserSelect="none"
    } else { //All other route (ie: Opera)
        this.connectHandles.push(this.connect(target, "onmousedown", function() { return false; }));
    }
    target.style.cursor = "default"
  },

  registerLocalizationLookup: function(f) {
    this.getLocaleString = f;
    this._localize();
  },

  registerTextSelectionDisabler: function(f) {
    this.textSelectionDisabler = f;
  },

  registerFieldContextMenuCallback: function(f) {
    this.fieldContextMenuCallback = f;
  },

  registerDoubleClickCallback: function(f) {
    this.doubleClickCallback = f;
  },

  registerClickCallback: function(f) {
    this.clickCallback = f;
  },

  registerExpandCollapseCategoryCallback: function(f) {
	this.expandCollapseCategoryCallback = f;
  },

  _localize: function() {
  },

  _addItemClass: function(node, type){
    // summary:
    //		adds a class with prefix "dojoDndItem"
    // node: Node
    //		a node
    // type: String
    //		a variable suffix for a class name
    dojo.addClass(node, "dojoDndItem" + type);
    if(type == 'Selected' || type == 'Anchor'){
        dojo.addClass(node, "pentaho-listitem-selected");
        dojo.removeClass(node, 'pentaho-listitem-hover');
    }
  },

  _removeItemClass: function(node, type){
    // summary:
    //		removes a class with prefix "dojoDndItem"
    // node: Node
    //		a node
    // type: String
    //		a variable suffix for a class name
    dojo.removeClass(node, "dojoDndItem" + type);
    if(type == 'Selected' || type == 'Anchor'){
        dojo.removeClass(node, "pentaho-listitem-selected");
        dojo.removeClass(node, 'pentaho-listitem-hover');
    }
  },

  unload: function() {
    if (this.dndObj) {
      this.dndObj.destroy();
    }
    dojo.forEach(this.connectHandles, function(handle) {
      dojo.disconnect(handle);
    });
    this.connectHandles = [];
    dojo.empty(this.containerNode);

    this.categoryClassMap = {};
    this.usedCategoryIds = {};
  },

  configureFor: function(datasource) {
    this.unload();

    this.dndObj = new dojo.dnd.Source(this.containerNode,
      {
        "copyOnly": true,
        "accept": "",
        "selfAccept": false,
        "singular": this.singleSelect,
        "creator": dojo.hitch(this, this._dndItemCreator)
      });

    if(!this.enableDragDrop) {
        this.selector = new dojo.dnd.Selector(this.containerNode,
        {
          "copyOnly": true,
          "accept": "",
          "selfAccept": false,
          "singular": this.singleSelect,
          "creator": dojo.hitch(this, this._dndItemCreator)
        });
        this.selector._addItemClass = this._addItemClass;
        this.selector._removeItemClass = this._removeItemClass;
    }

    this.dndObj._addItemClass = this._addItemClass;
    this.dndObj._removeItemClass = this._removeItemClass;

    if(!this.categorize) {
      var fields = this.getFields(datasource, null, this.filters);
      this.addFields( fields, this.containerNode, '' );
      return;
    }

    var addedCategories = [];

    var categories = this.getCategories(datasource);

    dojo.forEach(categories, function(category, idx) {
      if (dojo.indexOf(addedCategories, category.id) != -1) {
        return;
      }
      var fields = this.getFields(datasource, category, this.filters);
      if(fields.length == 0) {
        // there are no fields for this category with the current filters
        return;
      }
      var catId = this.getCategoryClassName(category.id);
      addedCategories.push(category.id);
      // create div for category
      var categoryDiv = dojo.create("div",
        {
          "id": catId
        }, this.containerNode);

      // create +- expand/collapse indicator
      var categoryIndicator = dojo.create("div",
        {
          "id": catId + "-indicator",
          "class": "categoryIndicator treenode-open",
          "categoryId": catId
        }, categoryDiv);
      this.connectHandles.push(dojo.connect(categoryIndicator, 'onclick', this, this.expandCollapseCategory));

      // create span for categoryName to display text
      var categoryNameSpan = dojo.create("span",
        {
          "id": catId + "-span",
          "class": "treenode-branch-label",
          "innerHTML": category.name,
          "categoryId": catId
        }, categoryDiv);
      this.textSelectionDisabler(categoryNameSpan);
      this.connectHandles.push(dojo.connect(categoryNameSpan, 'ondblclick', this, this.expandCollapseCategory));

      // create DND field list for this category
      var categoryFieldsDiv = dojo.create("div",
        {
          "id": catId + "-fields"
        }, categoryDiv);

      this.addFields( fields, categoryFieldsDiv, catId );

    }, this);
  },

  addFields: function( fields, parent, parentId ) {
      var items = [];
      dojo.forEach(fields, function(field) {
        var item = {
            "categoryId": parentId,
            "displayName": field.name,
            "fieldId": field.id,
            "dataType": field.dataType,
            "type": ["treenode-leaf-label"],
            "description": field.description
          };
        if(field.hiddenForUser != "true"){
          items.push(item);
          this.dndObj.setItem("field-" + item.fieldId, { "data": item, "type": "treenode-leaf-label", "fieldId": item.fieldId });
        }
      }, this);
      if(this.enableDragDrop) {
        this.dndObj.insertNodes(false, items, false, parent);
      } else {
        // add the fields without the DnD stuff
        for(var idx=0; idx<items.length; idx++) {
            var x = this._dndItemCreator(items[idx],'');
            parent.appendChild(x.node);
            this.selector.setItem("field-" + items[idx].fieldId, { "data": items[idx], "type": "treenode-leaf-label", "fieldId": items[idx].fieldId });
            this.connectHandles.push(dojo.connect(x.node, 'onmousedown', this, this.onMouseDown));
            this.connectHandles.push(dojo.connect(x.node, 'onmouseup', this, this.onMouseUp));
        }
      }
  },

  onMouseDown: function(e) {
    this.selector.current = e.target;
    this.selector.onMouseDown(e);
  },

  onMouseUp: function(e) {
    this.selector.current = e.target;
    this.selector.onMouseUp(e);
  },

  _dndItemCreator: function(item, hint) {
    var props = {
        "id": "field-" + this.sanitizeIdAndClassNames(item.fieldId),
        "innerHTML": item.displayName,
        "fieldId": item.fieldId,
        "class": item.categoryId
    };
    if(item.description) {
        props.title = item.description;
    } else {
    	props.title = item.fieldId;
    }
    var div = dojo.create("div", props);
    if (hint === "avatar") {
      dojo.addClass(div, "dragDropAvatar");
    } else {
      dojo.addClass(div, "field");
      dojo.addClass(div, "treenode-leaf-label");
      dojo.addClass(div, "pentaho-listitem");
      // Wire up interaction
      this.connectHandles.push(dojo.connect(div, "oncontextmenu", this, function(event) {
        this.updateSelectionForContextMenu(item.fieldId);
        if(this.fieldContextMenuCallback) {
            this.fieldContextMenuCallback(event);
        }
      }));
      this.connectHandles.push(dojo.connect(div, 'ondblclick', this, function(event) {
        if(this.doubleClickCallback) {
            this.doubleClickCallback(item.fieldId);
        }
      }));
      this.connectHandles.push(dojo.connect(div, 'onmouseover', this, function(event) {
        this.onFieldMouseOver(event);
      }));
      this.connectHandles.push(dojo.connect(div, 'onmouseout', this, function(event) {
        this.onFieldMouseOut(event);
      }));
      this.connectHandles.push(dojo.connect(div, 'onclick', this, function(event) {
        this.onFieldClick(event);
      }));
    }
    return {node: div, data: item, type: ["treenode-leaf-label"]};
  },

  onFieldClick: function(event) {
    if(this.selector) {
        this.selector.onClick(event);
    }
    if(this.clickCallback) {
        this.clickCallback(event);
    }
  },

  onFieldMouseOver: function(event) {
    if(this.selector) {
        this.selector.onMouseOver(event);
    }
    if(!dojo.hasClass(event.target,'pentaho-listitem-selected')) {
        dojo.addClass(event.target, 'pentaho-listitem-hover');
        dojo.removeClass(event.target, 'pentaho-listitem');
    }
  },

  onFieldMouseOut: function(event) {
    if(this.selector) {
        this.selector.onMouseOut(event);
    }
    if(!dojo.hasClass(event.target,'pentaho-listitem-selected')) {
        dojo.addClass(event.target, 'pentaho-listitem');
        dojo.removeClass(event.target, 'pentaho-listitem-hover');
    } else {
        dojo.removeClass(event.target, 'pentaho-listitem-hover');
        dojo.addClass(event.target, 'pentaho-listitem-selected');
    }
  },

  _elementComparator: function(a, b) {
    if (a.name < b.name) {
      return -1;
    } else if (a.name == b.name) {
      return 0;
    } else {
      return 1;
    }
  },

  getCategories: function(datasource) {
    var categories = [];
    dojo.forEach(datasource.getAllElements(), function(element) {
      if (element.elementType == pentaho.pda.Column.ELEMENT_TYPES.CATEGORY && categories[element] == null) {
        categories.push(element);
      }
    });
    return categories;
  },

  getFields: function(datasource, category, filters) {
    var fields = [];
    var elements = datasource.getAllElements();
    dojo.forEach(datasource.getAllElements(), function(element) {
      if (element.isQueryElement && ( category == null || element.parent == category) && fields[element] == null) {

        if(filters && filters.length > 0) {
            // apply the filters
            var ok = true;
            for(var filterNo=0; filterNo<filters.length; filterNo++) {
                var values = filters[filterNo].values;
                var filterOk = false;
                for(var valueNo=0; valueNo<values.length; valueNo++) {
                    if(element[filters[filterNo].type] == values[valueNo]) {
                        filterOk = true;
                        break;
                    }
                }
                ok = ok && filterOk;
                if(!ok) {
                    break;
                }
            }
            if(ok) {
                fields.push(element);
            }
        } else {
            fields.push(element);
        }
      }
    });
    return fields;
  },

  expandCollapseCategory: function (eventElement) {
    var categoryId = dojo.attr(eventElement.target, "categoryId");
    var node = dojo.byId(categoryId + "-fields");
    var indicatorNode = dojo.byId(categoryId + "-indicator");
    var collapsed = dojo.attr(indicatorNode, "collapsed") != "true";
    if (collapsed) {
      dojo.addClass(indicatorNode,'treenode-closed');
      dojo.removeClass(indicatorNode,'treenode-open');
    } else {
      dojo.addClass(indicatorNode,'treenode-open');
      dojo.removeClass(indicatorNode,'treenode-closed');
    }
    dojo.attr(indicatorNode, "collapsed", "" + collapsed);

    var fields = dojo.query("." + categoryId, this.containerNode);
    if (collapsed) {
      fields.addClass("hidden")
    } else {
      fields.removeClass("hidden");
    }

    if (this.expandCollapseCategoryCallback) {
      this.expandCollapseCategoryCallback(collapsed);
    }
  },

  updateFilterIndicators: function(filters) {
    // Remove all filter indicators
    dojo.query(".treenode-leaf-label", this.containerNode).removeClass("fieldlist-filtered-field");
    // Add filter icons to fields that are filtered
    if (!filters) {
      return;
    }
    // For all active filters add the fieldFiltered class to the field list div for the column that's filtered
    dojo.forEach(filters, function(filter) {
      var fieldDiv = dojo.byId("field-" + this.sanitizeIdAndClassNames(filter.column));
      if(fieldDiv != null){
        dojo.addClass(fieldDiv, "fieldlist-filtered-field");
      }
    }, this);
  },

  /**
   * If the item we invoked the context menu over is not selected make it the only selection.
   */
  updateSelectionForContextMenu: function(fieldId) {
    var selected = false;
    this.dndObj.forInSelectedItems(function(item, id) {
      if (item.data.fieldId === fieldId) {
        selected = true;
      }
    });

    var id = "field-" + fieldId;
    var node = dojo.byId(id);
    if (!selected) {
      this.clearSelection();
      // Logic borrowed from dojo.dnd.Selector.selectAll
      this.dndObj._addItemClass(node, "pentaho-listitem-selected")
      this.dndObj.selection[id] = 1;
    }
    // Update anchor
    if (this.dndObj.anchor) {
      this.dndObj._addItemClass(this.dndObj.anchor, "pentaho-listitem-selected");
    }
    this.dndObj._removeAnchor();
    this.dndObj._addItemClass(node, "Anchor");
    this.dndObj.anchor = node;
  },

  getSelectedItems: function() {
    if (this.dndObj && this.enableDragDrop) {
      var items = [];
      this.dndObj.forInSelectedItems(function(item) {
        items.push(item.data);
      });
      return items;
    }
    if (this.selector && !this.enableDragDrop) {
      var items = [];
      this.selector.forInSelectedItems(function(item) {
        items.push(item.data);
      }, this);
      return items;
    }
  },

  clearSelection: function() {
    if (this.dndObj && this.enableDragDrop) {
      this.dndObj.selectNone();
    }
    if(this.selector) {
      this.selector.selectNone();
    }
  },

  addFilter: function( filter ) {
    this.filters.push(filter);
  },

  clearFilters: function() {
    this.filters = [];
  },

  setCategorized: function( categorize ) {
    this.categorize = categorize;
  },

  setEnableDragDrop: function( enableDragDrop ) {
    this.enableDragDrop = enableDragDrop;
  },

  setContextMenu: function( fieldContextMenu ) {
    this.fieldContextMenu = fieldContextMenu;
  }

});


text:
package io.shardingsphere.shardingproxy.transport.mysql.packet.handshake;

import com.google.common.primitives.Bytes;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public final class AuthPluginDataTest {

    @Test
    public void assertGetAuthPluginData() {
        byte[] actualPart1 = {106, 105, 55, 122, 117, 98, 115, 109};
        byte[] actualPart2 = {68, 102, 53, 122, 65, 49, 84, 79, 85, 115, 116, 113};
        AuthPluginData actual = new AuthPluginData(actualPart1, actualPart2);
        assertThat(actual.getAuthPluginDataPart1(), is(actualPart1));
        assertThat(actual.getAuthPluginDataPart2(), is(actualPart2));
        assertThat(actual.getAuthPluginData(), is(Bytes.concat(actualPart1, actualPart2)));
    }

    @Test
    public void assertGetAuthPluginDataWithoutArguments() {
        AuthPluginData actual = new AuthPluginData();
        assertThat(actual.getAuthPluginDataPart1().length, is(8));
        assertThat(actual.getAuthPluginDataPart2().length, is(12));
        assertThat(actual.getAuthPluginData().length, is(20));
    }
}


text:
export { andorra } from './lib/es6/lib/countries/andorra';
export { austria } from './lib/es6/lib/countries/austria';
export { belgium } from './lib/es6/lib/countries/belgium';
export { brazil } from './lib/es6/lib/countries/brazil';
export { bulgaria } from './lib/es6/lib/countries/bulgaria';
export { croatia } from './lib/es6/lib/countries/croatiat';
export { cyprus } from './lib/es6/lib/countries/cyprus';
export { czechRepublic } from './lib/es6/lib/countries/czechRepublic';
export { denmark } from './lib/es6/lib/countries/denmark';
export { estonia } from './lib/es6/lib/countries/estonia';
export { europe } from './lib/es6/lib/countries/europe';
export { finland } from './lib/es6/lib/countries/finland';
export { france } from './lib/es6/lib/countries/france';
export { germany } from './lib/es6/lib/countries/germany';
export { greece } from './lib/es6/lib/countries/greece';
export { hungary } from './lib/es6/lib/countries/hungary';
export { ireland } from './lib/es6/lib/countries/ireland';
export { italy } from './lib/es6/lib/countries/italy';
export { latvia } from './lib/es6/lib/countries/latvia';
export { lithuania } from './lib/es6/lib/countries/lithuania';
export { luxembourg } from './lib/es6/lib/countries/luxembourg';
export { malta } from './lib/es6/lib/countries/malta';
export { netherlands } from './lib/es6/lib/countries/netherlands';
export { norway } from './lib/es6/lib/countries/norway';
export { poland } from './lib/es6/lib/countries/poland';
export { portugal } from './lib/es6/lib/countries/portugal';
export { romania } from './lib/es6/lib/countries/romania';
export { russia } from './lib/es6/lib/countries/russia';
export { serbia } from './lib/es6/lib/countries/serbia';
export { slovakiaRepublic } from './lib/es6/lib/countries/slovakiaRepublic';
export { slovenia } from './lib/es6/lib/countries/slovenia';
export { spain } from './lib/es6/lib/countries/spain';
export { sweden } from './lib/es6/lib/countries/sweden';
export { switzerland } from './lib/es6/lib/countries/switzerland';
export { unitedKingdom } from './lib/es6/lib/countries/unitedKingdom';
export { countries } from './lib/es6';

export { checkVAT } from './lib/es6';


text:
<?php

namespace PH7\Framework\File;

use PH7\Framework\Error\CException\PH7RuntimeException;

class MissingProgramException extends PH7RuntimeException
{
}


text:
This gem does the following:

* provide an interface between your application and the Dropbox Datastore API using the HTTPS calls as they have been described here https://www.dropbox.com/developers/datastore/docs/http. It's currently a subset of all the commands as I'm not actually using all of them myself. Feel free to add to them.

* contains a number of simple hooks you can use to make your Rails app Dropbox Datastore ready

* provide a simple wrapper over the records that will allow you to query them sort of like you would with ActiveRecord (but much more rudimentary)

## Supported operations:

* list_datastores
* get_datastore
* create_local (get_or_create_datastore)
* create_global (create_datastore)
* delete_datastore
* get_deltas
* put_delta
* get_snapshot

The only unsupported operation as of yet is `await`

## Installation

Add this line to your application's Gemfile:

    gem 'dropbox_store'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install dropbox_store

## Usage

Create an initializer with the following content:

	DROPBOX_KEY = "--"
	DROPBOX_SECRET = "--"
	DROPBOX_REDIRECT_URL = "http://localhost:3000/dropbox_token"

You should probably set the redirect url depending on the environment you're running stuff on, I'll leave that up to you though.

Add the following lines to your ApplicationController:

	include DropboxStore::TokenFilter

Add to the controllers that definitely need a dropbox token the following:

	before_filter :requires_token

This adds a function to your application controller that keeps track of whether we have gotten a authorization code from Dropbox yet, if not a redirect will take place once the before_filter has been run.

Create a dropbox_controller.rb and put the following inside:

	class DropboxController < ApplicationController

		include DropboxStore::TokenAction

	end

Then add something like this to your routes.rb and have that be the redirect_url you setup in your Dropbox app settings:

	get '/dropbox_token' => "dropbox#get_token"

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include "../include/redchat.h"
#include "../include/utils.h"

/* Internal functions for the server unit. */

/* Stores a received message. */
static int store_message(struct message received_msg, char *src_address) {
  struct stored_message *stored_msg = NULL;

  if (n_msgs == MAX_STORED_MSGS) {
    return E_MESSAGE_STORAGE_FULL;
  }

  /* Allocates memory for the received message and copies data */
  stored_msg = (struct stored_message *) malloc(sizeof(struct stored_message));
  if (!stored_msg) {
    return E_CANT_ALLOC_MESSAGE;
  }

  /* Translates message struct to stored_message struct, adding the extra
   * information necessary */
  /* TODO: Fix broken non null-terminated strings */
  stored_msg->time_sent = received_msg.time_sent;
  stored_msg->time_received = time(NULL);
  stored_msg->read = FALSE;
  stored_msg->src_address = strndup(src_address, MAX_ADDRESS_SIZE);
  /* Missing non terminated string here! Message is received but can't
   * be passed!
   * stored_msg->text = strndup(received_msg.text, MAX_MESSAGE_SIZE);
   */

  /* Stores the message */
  messages[n_msgs] = stored_msg;
  n_msgs++;
  n_unread_msgs++;

  return OK;
}

/* Server unit thread main function. */
void *server_unit() {
  int rc;
  int true_int = 1;
  int sock_server, connection;
  int sin_size = sizeof(struct sockaddr_in);
  struct sockaddr_in server_addr, client_addr;
  struct message received_msg;
  char *client_addr_string = NULL;

  /* Starts listening for connections on default port */
  if ((sock_server = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    debugerr(COLOR_YELLOW, "Server", "Couldn't create server socket");
    pthread_exit((void *) E_CANT_CREATE_SERVER_SOCKET);
  }

  /* Sets up the server socket */
  if (setsockopt(sock_server, SOL_SOCKET, SO_REUSEADDR, &true_int,
      sizeof(int)) == -1) {
    debugerr(COLOR_YELLOW, "Server", "Couldn't set socket options");
    pthread_exit((void *) E_CANT_SET_SERVER_SOCKOPTS);
  }

  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(DEFAULT_SERVER_PORT);
  server_addr.sin_addr.s_addr = INADDR_ANY;
  bzero(&(server_addr.sin_zero), 8);

  /* Binds the address */
  if (bind(sock_server, (struct sockaddr *) &server_addr,
        sizeof(struct sockaddr)) == -1) {
    debugerr(COLOR_YELLOW, "Server", "Couldn't bind server socket");
    pthread_exit((void *) E_CANT_BIND_SERVER_SOCKET);
  }

  /* Listens for connections on default port */
  if (listen(sock_server, MAX_PENDING_CONNECTIONS) == -1) {
    debugerr(COLOR_YELLOW, "Server", "Couldn't listen to connections");
    pthread_exit((void *) E_CANT_LISTEN_SERVER_SOCKET);
  }

  /* Waits on barrier for other units to load */
  debug(COLOR_YELLOW, "Server", "Waiting on barrier for units to load");
  rc = pthread_barrier_wait(&all_done);
  if (rc && rc != PTHREAD_BARRIER_SERIAL_THREAD) {
    debugerr(COLOR_YELLOW, "Server", "Error waiting on barrier");
    pthread_exit((void *) E_CANT_WAIT_ON_BARRIER);
  }

  debug(COLOR_YELLOW, "Server", "Starting");

  /* Execution loop, stays on it until an exit signal is signaled by
   * the interactive unit */
  while (is_executing) {
    debug(COLOR_YELLOW, "Server", "Waiting for connections");

    /* Waits for a connection and reads the message sent */
    connection = accept(sock_server, (struct sockaddr *) &client_addr,
        (socklen_t *) &sin_size);
    debug(COLOR_YELLOW, "Server", "Client connected");

    client_addr_string = inet_ntoa(client_addr.sin_addr);
    recv(connection, (void *) &received_msg, sizeof(received_msg), 0);
    debug(COLOR_YELLOW, "Server", "Message received");

    /* Puts received message on storage if it is a text message */
    if (received_msg.type == MSG_TYPE_TEXT) {
      store_message(received_msg, client_addr_string);
    }
  }

  /* Waits on barrier for all units to exit together */
  debug(COLOR_YELLOW, "Server", "Waiting on barrier for units to exit");
  rc = pthread_barrier_wait(&all_done);
  if (rc && rc != PTHREAD_BARRIER_SERIAL_THREAD) {
    debugerr(COLOR_YELLOW, "Server", "Error waiting on barrier");
    pthread_exit((void *) E_CANT_WAIT_ON_BARRIER);
  }

  debug(COLOR_YELLOW, "Server", "Exiting");
  pthread_exit(OK);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Grid: LineFinder Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Grid

Main Page

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Members

 All Classes Functions

Public Member Functions |
List of all members

LineFinder Class Reference

Public Member Functions

void 	setAccResolution (double dRho, double dTheta)

void 	setMinVote (int minv)

void 	setLineLengthAndGap (double length, double gap)

std::vector< cv::Vec4i > 	findLines (cv::Mat &binary)

void 	drawDetectedLines (cv::Mat &image, cv::Scalar color=cv::Scalar(255, 255, 255))

std::vector< cv::Vec4i > 	removeLinesOfInconsistentOrientations (const cv::Mat &orientations, double percentage, double delta)

The documentation for this class was generated from the following file:

LineFinder.h

LineFinder

Generated on Wed Apr 2 2014 12:00:48 for Grid by

     1.8.6