text:
HOST = "test.example.com"
PORT = 6667
USE_SSL = False
PASSWORD = None  # Server password, set to None if not needed
NICKNAME = "shesaidbot"
REALNAME = "bot: provides quotations from notable women"

CHANNEL = "#test"

# Trigger phrases, in lowercase
TRIGGERS = (
    "twss",
    )

# Process settings
PID_FILE = "./talkbackbot.pid"
LOG_FILE = "./talkbackbot.log"
QUOTES_FILE = "tests/test_quote.txt"

redpajama_set_name: RedPajamaGithub


text:
define(["solv/array/copy"], function () {
	"use strict";

	describe("array.copy", function () {
		it("should create a shallow copy of an array", function () {
			var array = [1, 2, 3, 4, 5],
				copy = Array.copy(array);

			expect(array.join()).toBe(copy.join());
			copy.shift();
			expect(array.length).not.toBe(copy.length);
		});

		it("should not be recursive", function () {
			var nested = [1],
				object = {},
				array = [object, nested],
				copy = Array.copy(array);
			expect(array[0]).toBe(copy[0]);
			expect(array[1]).toBe(copy[1]);
		});

		it("should be available as a static method or an instance method", function () {
			var nested = [1],
				object = {},
				array = [object, nested],
				copy = array.copy();
			expect(array[0]).toBe(copy[0]);
			expect(array[1]).toBe(copy[1]);
		});
	});
});


text:
var infoData = {};

$( "#info" ).hide();

function showDialog() {
    $( "#toggle" ).show();
    $( "#info" ).tabs();
    $( "#info" ).dialog({ width: 700, height: 500 });
    $( "#info" ).dialog("option", "position", 'top');
}

function selectAD(feature) {
    var infolink = document.getElementById('info-link');
    var info_key;
    $.getJSON('/data?geoid='+feature['i'],
        function(data_list) {
            if (data_list.length > 1) {
                infolink.innerHTML = "";
                for (var i=0 ; i<data_list.length ; i++) {
                    info_key = feature['i'] + "_" + i;
                    infolink.innerHTML += 'annonce '+i+' ';
                    infoData[info_key] = data_list[i];
                }
            }
            else {
                infolink.innerHTML = "";
                info_key = feature['i'] + "_0";
                infoData[info_key] = data_list[0];
            }
            info_key = feature['i'] + "_0";
            updateInfo(info_key);
        });
    showDialog();
    return new ol.style.Style({
        image: new ol.style.Circle({
            radius: 10,
            fill: new ol.style.Fill({
                color: '#FFFFFF'
            }),
            stroke: new ol.style.Stroke({
                color: '#FF0000'
            })
        })
    })
}

function getColoredPoint(feature, resolution) {
    var color = "#bbbbbb";
    var stroke = "#000000";
    $.ajax({
        'async': false,
        'type': "POST",
        'global': false,
        'url': '/data?geoid='+feature['i'],
        'success': function (data) {
            if (data.length > 0) {
                color = data[0].color;
                for (var cpt = 0 ; cpt++ ; cpt<data.length) {
                    infoData[feature['i'] + "_" + cpt] = null;
                }
            }
            else {
                stroke = "#bbbbbb";
            }
        }
    });
    return new ol.style.Style({
                image: new ol.style.Circle({
                    radius: 5,
                    fill: new ol.style.Fill({
                        color: color
                    }),
                    stroke: new ol.style.Stroke({
                        color: stroke
                    })
                })
            });
}

var raster = new ol.layer.Tile({
    title: "Immo Spider",
    source: new ol.source.OSM()
});

var vectorSource = new ol.source.Vector({
        url: '/features',
        format: new ol.format.GeoJSON()
    },
    {
        transitionEffect: null
    });

var vector = new ol.layer.Vector({
    title: 'Houses',
    source: vectorSource,
    style: getColoredPoint
});

var map = new ol.Map({
    interactions: ol.interaction.defaults().extend([
        new ol.interaction.Select({
            style: selectAD
        })
    ]),
    target: 'map',
    layers: [raster, vector],
    view: new ol.View({
        center: ol.proj.fromLonLat([-2.8185137, 47.6577568]),
        zoom: 10
    }),
    controls: ol.control.defaults({
        attributionOptions: {
            collapsible: true
        }
    }),
    controls: ol.control.defaults().extend([
        new ol.control.ScaleLine()
    ])
});

function  hide_ad(uuid) {
    $.getJSON('/data?uuid='+uuid+'&action=hide',
        function(data_list) {
            location.reload();
        });
}

function updateInfo(data_uuid) {
    var data = infoData[data_uuid];
    var infoElement1 = document.getElementById('tabs-1-content');
    var infoElement2 = document.getElementById('tabs-2-content');
    var infoElement3 = document.getElementById('tabs-3-content');
    var infoElement4 = document.getElementById('tabs-4-content');
    infoElement1.innerHTML =
        '
'+data["address"]+'
'+data["description"]+ '
' +
            'link to the ad';
    var tmp = "";
    infoElement2.innerHTML = "";
    for (var cpt=0 ; cpt<data["img_urls"].length ; cpt++){
        tmp += "";
    }
    infoElement2.innerHTML = tmp;
    infoElement3.innerHTML =
            'surface : ' + data["surface"] + "
" +
            'jardin : ' + data["groundsurface"] + "
" +
            'prix : ' + data["price"] + "
" +
            'date : ' + data["date"] + "
";
    infoElement4.innerHTML =
        "
Cacher
"
    ;
}


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

using Dapper.FluentMap;
using RingoTabetterApi.POCOs;

namespace RingoTabetterApi.FluentMaps
{
    public class LastSearchesMap : Dapper.FluentMap.Mapping.EntityMap<LastSearchPoco>
    {
        public LastSearchesMap()
        {
            Map(p => p.Id).ToColumn("id");
            Map(p => p.TweetId).ToColumn("tweet_id");
            Map(p => p.UpdatedAt).ToColumn("updated_at");
        }
    }
}


text:
#ifndef _IDENTITY_FIND_H_
#define _IDENTITY_FIND_H_  1

#include <Security/SecBase.h>
#include <Security/cssmtype.h>

#ifdef __cplusplus
extern "C" {
#endif

extern SecIdentityRef find_identity(CFTypeRef keychainOrArray,
									const char *identity,
									const char *hash,
									CSSM_KEYUSE keyUsage);

extern int keychain_find_identity(int argc, char * const *argv);

#ifdef __cplusplus
}
#endif

#endif /* _IDENTITY_FIND_H_ */


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Draw = void 0;
const DrawStroke_1 = require("./DrawStroke");
const OptionsColor_1 = require("../../../../Options/Classes/OptionsColor");
class Draw {
    constructor() {
        this.enable = false;
        this.stroke = new DrawStroke_1.DrawStroke();
    }
    get lineWidth() {
        return this.stroke.width;
    }
    set lineWidth(value) {
        this.stroke.width = value;
    }
    get lineColor() {
        return this.stroke.color;
    }
    set lineColor(value) {
        this.stroke.color = OptionsColor_1.OptionsColor.create(this.stroke.color, value);
    }
    load(data) {
        var _a;
        if (data !== undefined) {
            if (data.enable !== undefined) {
                this.enable = data.enable;
            }
            const stroke = (_a = data.stroke) !== null && _a !== void 0 ? _a : {
                color: data.lineColor,
                width: data.lineWidth,
            };
            this.stroke.load(stroke);
        }
    }
}
exports.Draw = Draw;


text:
package com.intellij.psi.impl.source.tree;

import com.intellij.lang.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiManager;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.impl.source.DummyHolder;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.CharTable;
import com.intellij.util.IncorrectOperationException;

public class SourceUtil {
  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.SourceUtil");

  private SourceUtil() { }

  public static String getTextSkipWhiteSpaceAndComments(final ASTNode element) {
    return AstBufferUtil.getTextSkippingTokens(element, StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET);
  }

  public static String getTextSkipWhiteSpaceAndComments(final LighterAST tree, final LighterASTNode node) {
    return LightTreeUtil.toFilteredString(tree, node, StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET);
  }

  public static TreeElement addParenthToReplacedChild(final IElementType parenthType, TreeElement newChild, PsiManager manager) {
    CompositeElement parenthExpr = ASTFactory.composite(parenthType);

    TreeElement dummyExpr = (TreeElement)newChild.clone();
    final CharTable charTableByTree = SharedImplUtil.findCharTableByTree(newChild);
    new DummyHolder(manager, parenthExpr, null, charTableByTree);
    parenthExpr.putUserData(CharTable.CHAR_TABLE_KEY, charTableByTree);
    parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.LPARENTH, "("));
    parenthExpr.rawAddChildren(dummyExpr);
    parenthExpr.rawAddChildren(ASTFactory.leaf(JavaTokenType.RPARENTH, ")"));

    try {
      CodeStyleManager codeStyleManager = manager.getCodeStyleManager();
      parenthExpr =
      (CompositeElement)SourceTreeToPsiMap.psiElementToTree(
        codeStyleManager.reformat(SourceTreeToPsiMap.treeElementToPsi(parenthExpr)));
    }
    catch (IncorrectOperationException e) {
      LOG.error(e); // should not happen
    }

    newChild.putUserData(CharTable.CHAR_TABLE_KEY, SharedImplUtil.findCharTableByTree(newChild));
    dummyExpr.rawReplaceWithList(newChild);

    newChild = parenthExpr;
    // TODO remove explicit caches drop since this should be ok if we will use ChangeUtil for the modification
    TreeUtil.clearCaches(TreeUtil.getFileElement(newChild));
    return newChild;
  }
}


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.gcore;

import android.os.Bundle;
import android.os.Handler;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;

/**
 * Helper that allows to manage connection failures when using {@link GoogleApiClient}.
 *
 * When the connection fails, it will try to reconnect {@link ConnectedTask#RETRY_NUMBER_LIMIT}
 * times in the background, waiting {@link ConnectedTask#CONNECTION_RETRY_TIME_MS} milliseconds
 * between each attempt.
 */
public class GoogleApiClientConnectionHelper
        implements OnConnectionFailedListener, ConnectionCallbacks {
    private int mResolutionAttempts = 0;
    private Handler mHandler;
    private final GoogleApiClient mClient;

    public GoogleApiClientConnectionHelper(GoogleApiClient client) {
        mClient = client;
        mClient.registerConnectionCallbacks(this);
        mClient.registerConnectionFailedListener(this);
    }

    @Override
    public void onConnectionFailed(ConnectionResult result) {
        if (mResolutionAttempts++ < ConnectedTask.RETRY_NUMBER_LIMIT) {
            if (mHandler == null) mHandler = new Handler();
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mClient.connect();
                }
            }, ConnectedTask.CONNECTION_RETRY_TIME_MS);
        }
    }

    @Override
    public void onConnected(Bundle connectionHint) {
        mResolutionAttempts = 0;
    }

    @Override
    public void onConnectionSuspended(int cause) {}
}


text:
import "source-map-support/register";

import { assert } from "chai";
import { suite, test } from "mocha-typescript";

@suite class ExampleSuite {
    @test public "compute True && False"() {
      assert.equal(true, true);
    }

}


text:
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace MasterDevs.ChromeDevTools.Protocol.CacheStorage
{
	/// <summary>
	/// Deletes a cache.
	/// </summary>
	[Command(ProtocolName.CacheStorage.DeleteCache)]
	public class DeleteCacheCommand
	{
		/// <summary>
		/// Gets or sets Id of cache for deletion.
		/// </summary>
		public string CacheId { get; set; }
	}
}


text:
<?xml version='1.0' encoding='utf-8'?>
<Context>

	<!-- Turn off session serialization -->
    <Manager pathname=""/>

</Context>


text:
import os
import tempfile
import shutil

from chrome_remote_control import multi_page_benchmark_unittest_base
from perf_tools import skpicture_printer

class SkPicturePrinterUnitTest(
  multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):

  def setUp(self):
    super(SkPicturePrinterUnitTest, self).setUp()
    self._outdir = tempfile.mkdtemp()

  def tearDown(self):
    shutil.rmtree(self._outdir)
    super(SkPicturePrinterUnitTest, self).tearDown()

  def CustomizeOptionsForTest(self, options):
    options.outdir = self._outdir

  def testPrintToSkPicture(self):
    ps = self.CreatePageSetFromFileInUnittestDataDir('non_scrollable_page.html')
    printer = skpicture_printer.SkPicturePrinter()
    all_results = self.RunBenchmark(printer, ps)

    self.assertEqual(0, len(all_results.page_failures))
    self.assertEqual(1, len(all_results.page_results))
    results0 = all_results.page_results[0]

    outdir = results0['output_path']
    self.assertTrue('non_scrollable_page_html' in outdir)
    self.assertTrue(os.path.isdir(outdir))
    self.assertEqual(['layer_0.skp'], os.listdir(outdir))

    skp_file = os.path.join(outdir, 'layer_0.skp')
    self.assertTrue(os.path.isfile(skp_file))
    self.assertTrue(os.path.getsize(skp_file) > 0)


text:
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef _SCRIPT_LOGPSEUDOMODEL_H_
#define _SCRIPT_LOGPSEUDOMODEL_H_
class CScript_LogPseudoModel : public CXFA_OrdinaryObject {
 public:
  CScript_LogPseudoModel(CXFA_Document* pDocument);
  virtual ~CScript_LogPseudoModel();

  void Script_LogPseudoModel_Message(CFXJSE_Arguments* pArguments);
  void Script_LogPseudoModel_TraceEnabled(CFXJSE_Arguments* pArguments);
  void Script_LogPseudoModel_TraceActivate(CFXJSE_Arguments* pArguments);
  void Script_LogPseudoModel_TraceDeactivate(CFXJSE_Arguments* pArguments);
  void Script_LogPseudoModel_Trace(CFXJSE_Arguments* pArguments);
};
#endif


text:
/**
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree. *
 *
 * @providesModule toContainReact
 * @flow
 */

import { shallow } from 'enzyme';

export default {
  toContainReact() : Object {
    return {
      compare(enzymeWrapper:Object, reactInstance:Object) : Object {
        const wrappedInstance = shallow(reactInstance);

        return {
          pass: enzymeWrapper.contains(reactInstance),
          message: `Expected wrapper to contain ${wrappedInstance.html()}.`,
        };
      },
    };
  },
};


text:
using io.rong.models;
using io.rong.models.response;
using System;
using System.Collections.Generic;
using System.Text;
using io.rong.models.message;
using io.rong.exception;
using io.rong.util;
using System.Web;
using io.rong.util;

namespace io.rong.methods.messages.discussion
{

    /**
     * 发送讨论组消息方法
     *
     * docs : http://www.rongcloud.cn/docs/server.html#message_discussion_publish
     * @author RongCloud
     *
     */
    public class Discussion

    {

        private static readonly Encoding UTF8 = Encoding.UTF8;
        private static readonly String PATH = "message/discussion";
        private String appKey;
        private String appSecret;
        private RongCloud rongCloud;

        public string AppKey { get => appKey; set => appKey = value; }
        public string AppSecret { get => appSecret; set => appSecret = value; }
        internal RongCloud RongCloud { get => rongCloud; set => rongCloud = value; }

        public RongCloud getRongCloud()
        {
            return rongCloud;
        }

        public void setRongCloud(RongCloud rongCloud)
        {
            this.rongCloud = rongCloud;
        }
        public Discussion(String appKey, String appSecret)
        {
            this.appKey = appKey;
            this.appSecret = appSecret;

        }
        /**
         * 发送讨论组消息方法(以一个用户身份向讨论组发送消息,单条消息最大 128k,每秒钟最多发送 20 条消息.)
         *
         *
         * @param  message:发送消息内容,参考融云消息类型表.示例说明;如果 objectName 为自定义消息类型,该参数可自定义格式。(必传)
         *
         * @return ResponseResult
         * @throws Exception
         **/
        public ResponseResult Send(DiscussionMessage message)
        {

            String code = CommonUtil.CheckFiled(message, PATH, CheckMethod.PUBLISH);
            if (null != code)
            {
                return (ResponseResult)RongJsonUtil.JsonStringToObj<ResponseResult>(code);
            }

            StringBuilder sb = new StringBuilder();
            sb.Append("&fromUserId=").Append(HttpUtility.UrlEncode(message.SenderId.ToString(), UTF8));
            for (int i = 0; i < message.TargetId.Length; i++)
            {
                String child = message.TargetId[i];
                if (null != child)
                {
                    sb.Append("&toDiscussionId=").Append(HttpUtility.UrlEncode(child, UTF8));
                }
            }
            sb.Append("&objectName=").Append(HttpUtility.UrlEncode(message.Content.GetType(), UTF8));
            sb.Append("&content=").Append(HttpUtility.UrlEncode(message.Content.ToString(), UTF8));

            if (message.PushContent != null)
            {
                sb.Append("&pushContent=").Append(HttpUtility.UrlEncode(message.PushContent.ToString(), UTF8));
            }

            if (message.PushData != null)
            {
                sb.Append("&pushData=").Append(HttpUtility.UrlEncode(message.PushData.ToString(), UTF8));
            }

            if (0 == message.IsPersisted || message.IsPersisted != null)
            {
                sb.Append("&isPersisted=").Append(HttpUtility.UrlEncode(message.IsPersisted.ToString(), UTF8));
            }

            if (0 == message.IsCounted || message.IsCounted != null)
            {
                sb.Append("&isCounted=").Append(HttpUtility.UrlEncode(message.IsCounted.ToString(), UTF8));
            }

            if (0 == message.IsIncludeSender || message.IsIncludeSender != null)
            {
                sb.Append("&isIncludeSender=").Append(HttpUtility.UrlEncode(message.IsIncludeSender.ToString(), UTF8));
            }
            String body = sb.ToString();
            if (body.IndexOf("&") == 0)
            {
                body = body.Substring(1, body.Length - 1);
            }

            String result = RongHttpClient.ExecutePost(appKey, appSecret, body,
                                      rongCloud.ApiHostType.Type + "/message/discussion/publish.json", "application/x-www-form-urlencoded");

            return (ResponseResult)RongJsonUtil.JsonStringToObj<ResponseResult>(CommonUtil.GetResponseByCode(PATH, CheckMethod.PUBLISH, result));
        }

        /**
         * 设置用户某会话接收新消息时是否进行消息提醒。
         *
         * @param message
         *
         * @return ResponseResult
         * @throws Exception
         **/
        public Result Recall(RecallMessage message)
        {
            //需要校验的字段
            String msgErr = CommonUtil.CheckFiled(message, PATH, CheckMethod.RECALL);
            if (null != msgErr)
            {
                return (ResponseResult)RongJsonUtil.JsonStringToObj<ResponseResult>(msgErr);
            }
            StringBuilder sb = new StringBuilder();
            sb.Append("&conversationType=").Append(HttpUtility.UrlEncode("2", UTF8));
            sb.Append("&fromUserId=").Append(HttpUtility.UrlEncode(message.SenderId.ToString(), UTF8));
            sb.Append("&targetId=").Append(HttpUtility.UrlEncode(message.TargetId.ToString(), UTF8));
            sb.Append("&messageUID=").Append(HttpUtility.UrlEncode(message.UId.ToString(), UTF8));
            sb.Append("&sentTime=").Append(HttpUtility.UrlEncode(message.SentTime.ToString(), UTF8));
            String body = sb.ToString();
            if (body.IndexOf("&") == 0)
            {
                body = body.Substring(1, body.Length - 1);
            }

            String result = RongHttpClient.ExecutePost(appKey, appSecret, body,
                                         rongCloud.ApiHostType.Type + "/message/recall.json", "application/x-www-form-urlencoded");

            return (ResponseResult)RongJsonUtil.JsonStringToObj<ResponseResult>(CommonUtil.GetResponseByCode(PATH, CheckMethod.RECALL, result));

        }
    }
}


text:
/*
 *  cropit - v0.0.4
 *  Customizable crop and zoom.
 *  https://github.com/scottcheng/cropit
 *
 *  Made by Scott Cheng
 *  Based on https://github.com/yufeiliu/simple_image_uploader
 *  Under MIT License
 */
(function($) {
    var Zoomer;
    Zoomer = function() {
        function Zoomer() {}
        Zoomer.prototype.setup = function(imageSize, previewSize, exportZoom, options) {
            var heightRatio, widthRatio;
            if (exportZoom == null) {
                exportZoom = 1;
            }
            widthRatio = previewSize.w / imageSize.w;
            heightRatio = previewSize.h / imageSize.h;
            if ((options != null ? options.fitWidth : void 0) && !(options != null ? options.fitHeight : void 0)) {
                this.minZoom = widthRatio;
            } else if ((options != null ? options.fitHeight : void 0) && !(options != null ? options.fitWidth : void 0)) {
                this.minZoom = heightRatio;
            } else if ((options != null ? options.fitWidth : void 0) && (options != null ? options.fitHeight : void 0)) {
                this.minZoom = widthRatio < heightRatio ? widthRatio : heightRatio;
            } else {
                this.minZoom = widthRatio < heightRatio ? heightRatio : widthRatio;
            }
            return this.maxZoom = this.minZoom < 1 / exportZoom ? 1 / exportZoom : this.minZoom;
        };
        Zoomer.prototype.getZoom = function(sliderPos) {
            if (!(this.minZoom && this.maxZoom)) {
                return null;
            }
            return sliderPos * (this.maxZoom - this.minZoom) + this.minZoom;
        };
        Zoomer.prototype.isZoomable = function() {
            if (!(this.minZoom && this.maxZoom)) {
                return null;
            }
            return this.minZoom !== this.maxZoom;
        };
        return Zoomer;
    }();
    var Cropit, defaults;
    defaults = {
        exportZoom: 1,
        imageBackground: false,
        imageBackgroundBorderSize: 0,
        imageState: null
    };
    Cropit = function() {
        function Cropit(element, options) {
            var dynamicDefaults;
            this.element = element;
            this.$el = $(this.element);
            dynamicDefaults = {
                $fileInput: this.$("input.cropit-image-input"),
                $preview: this.$(".cropit-image-preview"),
                $imageZoomInput: this.$("input.cropit-image-zoom-input"),
                $previewContainer: this.$(".cropit-image-preview-container")
            };
            this.options = $.extend({}, defaults, dynamicDefaults, options);
            this._defaults = defaults;
            this.init();
        }
        Cropit.prototype.init = function() {
            var $previewContainer, imageBgBorderSize, _ref, _ref1, _ref2, _ref3, _ref4;
            this.$fileInput = this.options.$fileInput;
            this.$preview = this.options.$preview.css({
                backgroundRepeat: "no-repeat"
            });
            this.$imageZoomInput = this.options.$imageZoomInput.attr({
                min: 0,
                max: 1,
                step: .01
            });
            this.$hiddenImage = $("<img />").addClass("cropit-image-hidden-preview").attr({
                alt: "",
                style: "display: none;"
            }).appendTo(this.$el);
            this.previewSize = {
                w: this.options.width || this.$preview.width(),
                h: this.options.height || this.$preview.height()
            };
            if (this.options.width) {
                this.$preview.width(this.previewSize.w);
            }
            if (this.options.height) {
                this.$preview.height(this.previewSize.h);
            }
            if (this.options.imageBackground) {
                imageBgBorderSize = this.options.imageBackgroundBorderSize;
                $previewContainer = this.options.$previewContainer;
                this.$imageBg = $("<img />").addClass("cropit-image-background").attr("alt", "").css("position", "absolute");
                this.$imageBgContainer = $("<div />").addClass("cropit-image-background-container").css({
                    position: "absolute",
                    zIndex: 0,
                    top: -imageBgBorderSize,
                    left: -imageBgBorderSize,
                    width: this.previewSize.w + imageBgBorderSize * 2,
                    height: this.previewSize.h + imageBgBorderSize * 2
                }).append(this.$imageBg);
                $previewContainer.css("position", "relative").prepend(this.$imageBgContainer);
                this.$preview.css("position", "relative");
                this.imageBgPreviewOffset = {
                    x: imageBgBorderSize + window.parseInt(this.$preview.css("border-left-width")),
                    y: imageBgBorderSize + window.parseInt(this.$preview.css("border-top-width"))
                };
            }
            this.initialZoomSliderPos = 0;
            this.imageLoaded = false;
            this.imageSrc = ((_ref = this.options.imageState) != null ? _ref.src : void 0) || null;
            this.offset = ((_ref1 = this.options.imageState) != null ? _ref1.offset : void 0) || {
                x: 0,
                y: 0
            };
            this.zoom = ((_ref2 = this.options.imageState) != null ? _ref2.zoom : void 0) || null;
            this.sliderPos = ((_ref3 = this.options.imageState) != null ? _ref3.sliderPos : void 0) || this.initialZoomSliderPos;
            this.$imageZoomInput.val(this.sliderPos);
            this.moveContinue = false;
            this.zoomer = new Zoomer();
            this.$preview.on("mousedown mouseup mouseleave", this.handlePreviewEvent.bind(this));
            this.$fileInput.on("change", this.onFileChange.bind(this));
            this.$imageZoomInput.on("change mousemove", this.updateImageZoom.bind(this));
            if ((_ref4 = this.options.imageState) != null ? _ref4.src : void 0) {
                return this.loadImage();
            }
        };
        Cropit.prototype.onFileChange = function() {
            var file, oFReader, _base;
            if (typeof (_base = this.options).onFileChange === "function") {
                _base.onFileChange();
            }
            oFReader = new FileReader();
            file = this.$fileInput.get(0).files[0];
            oFReader.readAsDataURL(file);
            return oFReader.onload = this.onFileReaderLoaded.bind(this);
        };
        Cropit.prototype.onFileReaderLoaded = function(e) {
            this.imageSrc = e.target.result;
            this.sliderPos = this.initialZoomSliderPos;
            this.offset = {
                x: 0,
                y: 0
            };
            return this.loadImage();
        };
        Cropit.prototype.loadImage = function() {
            var _base;
            this.$hiddenImage.attr("src", this.imageSrc);
            this.$preview.css("background-image", "url(" + this.imageSrc + ")");
            if (typeof (_base = this.options).onImageLoading === "function") {
                _base.onImageLoading();
            }
            return this.$hiddenImage.load(this.onImageLoaded.bind(this));
        };
        Cropit.prototype.onImageLoaded = function() {
            var _base;
            if (this.options.imageBackground) {
                this.$imageBg.attr("src", this.imageSrc);
            }
            this.imageSize = {
                w: this.$hiddenImage.width(),
                h: this.$hiddenImage.height()
            };
            this.zoomer.setup(this.imageSize, this.previewSize, this.options.exportZoom, this.options);
            this.$imageZoomInput.val(this.sliderPos);
            this.zoom = this.zoomer.getZoom(this.sliderPos);
            this.updateImageZoom();
            this.imageLoaded = true;
            return typeof (_base = this.options).onImageLoaded === "function" ? _base.onImageLoaded() : void 0;
        };
        Cropit.prototype.handlePreviewEvent = function(e) {
            if (!this.imageLoaded) {
                return;
            }
            this.moveContinue = false;
            this.$preview.off("mousemove");
            if (e.type === "mousedown") {
                this.origin = {
                    x: e.clientX,
                    y: e.clientY
                };
                this.moveContinue = true;
                this.$preview.on("mousemove", this.onMove.bind(this));
            } else {
                $(document.body).focus();
            }
            e.stopPropagation();
            return false;
        };
        Cropit.prototype.onMove = function(e) {
            if (this.moveContinue) {
                this.updateImageOffset({
                    x: this.offset.x + e.clientX - this.origin.x,
                    y: this.offset.y + e.clientY - this.origin.y
                });
            }
            this.origin = {
                x: e.clientX,
                y: e.clientY
            };
            e.stopPropagation();
            return false;
        };
        Cropit.prototype.updateImageOffset = function(position) {
            var _ref, _ref1;
            if (!(((_ref = this.imageSize) != null ? _ref.w : void 0) && ((_ref1 = this.imageSize) != null ? _ref1.h : void 0))) {
                return;
            }
            this.offset = this.fixOffset(position);
            this.$preview.css("background-position", "" + this.offset.x + "px " + this.offset.y + "px");
            if (this.options.imageBackground) {
                return this.$imageBg.css({
                    left: this.offset.x + this.imageBgPreviewOffset.x,
                    top: this.offset.y + this.imageBgPreviewOffset.y
                });
            }
        };
        Cropit.prototype.fixOffset = function(offset) {
            var ret;
            ret = {
                x: offset.x,
                y: offset.y
            };
            if (this.imageSize.w * this.zoom <= this.previewSize.w) {
                ret.x = 0;
            } else if (ret.x > 0) {
                ret.x = 0;
            } else if (ret.x + this.imageSize.w * this.zoom < this.previewSize.w) {
                ret.x = this.previewSize.w - this.imageSize.w * this.zoom;
            }
            if (this.imageSize.h * this.zoom <= this.previewSize.h) {
                ret.y = 0;
            } else if (ret.y > 0) {
                ret.y = 0;
            } else if (ret.y + this.imageSize.h * this.zoom < this.previewSize.h) {
                ret.y = this.previewSize.h - this.imageSize.h * this.zoom;
            }
            ret.x = Math.round(ret.x);
            ret.y = Math.round(ret.y);
            return ret;
        };
        Cropit.prototype.updateImageZoom = function() {
            var newX, newY, newZoom, oldZoom, updatedHeight, updatedWidth, _ref, _ref1;
            if (!(((_ref = this.imageSize) != null ? _ref.w : void 0) && ((_ref1 = this.imageSize) != null ? _ref1.h : void 0))) {
                return;
            }
            this.sliderPos = Number(this.$imageZoomInput.val());
            newZoom = this.zoomer.getZoom(this.sliderPos);
            updatedWidth = Math.round(this.imageSize.w * newZoom);
            updatedHeight = Math.round(this.imageSize.h * newZoom);
            oldZoom = this.zoom;
            newX = this.imageSize.w * oldZoom / 2 + this.offset.x - updatedWidth / 2;
            newY = this.imageSize.h * oldZoom / 2 + this.offset.y - updatedHeight / 2;
            this.zoom = newZoom;
            this.updateImageOffset({
                x: newX,
                y: newY
            });
            this.$preview.css("background-size", "" + updatedWidth + "px " + updatedHeight + "px");
            if (this.options.imageBackground) {
                return this.$imageBg.css({
                    width: updatedWidth,
                    height: updatedHeight
                });
            }
        };
        Cropit.prototype.isZoomable = function() {
            return this.zoomer.isZoomable();
        };
        Cropit.prototype.getCroppedImageData = function() {
            var $canvas, canvasContext, croppedSize;
            if (!this.imageSrc) {
                return null;
            }
            croppedSize = {
                w: this.previewSize.w,
                h: this.previewSize.h
            };
            if (this.options.fitHeight && !this.options.fitWidth && this.imageSize.w * this.zoom < this.previewSize.w) {
                croppedSize.w = this.imageSize.w * this.zoom;
            } else if (this.options.fitWidth && !this.options.fitHeight && this.imageSize.h * this.zoom < this.previewSize.h) {
                croppedSize.h = this.imageSize.h * this.zoom;
            }
            $canvas = $("<canvas />").attr({
                style: "display: none;",
                width: croppedSize.w * this.options.exportZoom,
                height: croppedSize.h * this.options.exportZoom
            }).appendTo(this.$el);
            canvasContext = $canvas[0].getContext("2d");
            canvasContext.drawImage(this.$hiddenImage[0], this.offset.x * this.options.exportZoom, this.offset.y * this.options.exportZoom, this.zoom * this.options.exportZoom * this.imageSize.w, this.zoom * this.options.exportZoom * this.imageSize.h);
            return $canvas[0].toDataURL();
        };
        Cropit.prototype.getImageState = function() {
            return {
                src: this.imageSrc,
                offset: this.offset,
                zoom: this.zoom,
                sliderPos: this.sliderPos
            };
        };
        Cropit.prototype.getImageSize = function() {
            if (!this.imageSize) {
                return null;
            }
            return {
                width: this.imageSize.w,
                height: this.imageSize.h
            };
        };
        Cropit.prototype.getPreviewSize = function() {
            return {
                width: this.previewSize.w,
                height: this.previewSize.h
            };
        };
        Cropit.prototype.setPreviewSize = function(size) {
            if (!((size != null ? size.width : void 0) > 0 && (size != null ? size.height : void 0) > 0)) {
                return;
            }
            this.previewSize = {
                w: size.width,
                h: size.height
            };
            this.$preview.css({
                width: this.previewSize.w,
                height: this.previewSize.h
            });
            if (this.options.imageBackground) {
                this.$imageBgContainer.css({
                    width: this.previewSize.w + this.options.imageBackgroundBorderSize * 2,
                    height: this.previewSize.h + this.options.imageBackgroundBorderSize * 2
                });
            }
            if (this.imageLoaded) {
                this.zoomer.setup(this.imageSize, this.previewSize, this.options.exportZoom, this.options);
                this.zoom = this.zoomer.getZoom(this.sliderPos);
                return this.updateImageZoom();
            }
        };
        Cropit.prototype.$ = function(selector) {
            if (!this.$el) {
                return null;
            }
            return this.$el.find(selector);
        };
        return Cropit;
    }();
    var dataKey, methods;
    dataKey = "cropit";
    methods = {
        init: function(options) {
            return this.each(function() {
                var cropit;
                cropit = new Cropit(this, options);
                return $.data(this, dataKey, cropit);
            });
        },
        isZoomable: function() {
            var cropit;
            cropit = this.first().data(dataKey);
            return cropit != null ? cropit.isZoomable() : void 0;
        },
        croppedImageData: function() {
            var cropit;
            cropit = this.first().data(dataKey);
            return cropit != null ? cropit.getCroppedImageData() : void 0;
        },
        imageState: function() {
            var cropit;
            cropit = this.first().data(dataKey);
            return cropit != null ? cropit.getImageState() : void 0;
        },
        imageSize: function() {
            var cropit;
            cropit = this.first().data(dataKey);
            return cropit != null ? cropit.getImageSize() : void 0;
        },
        previewSize: function(newSize) {
            var cropit;
            if (arguments.length) {
                return this.each(function() {
                    var cropit;
                    cropit = $.data(this, dataKey);
                    return cropit != null ? cropit.setPreviewSize(newSize) : void 0;
                });
            } else {
                cropit = this.first().data(dataKey);
                return cropit != null ? cropit.getPreviewSize() : void 0;
            }
        }
    };
    $.fn.cropit = function(method) {
        if (methods[method]) {
            return methods[method].apply(this, [].slice.call(arguments, 1));
        } else {
            return methods.init.apply(this, arguments);
        }
    };
})(window.jQuery);


text:
package org.red5.io.object;

/**
 * Serial flag options.
 */
public enum Flag {
	Enabled, Disabled, Default
}


text:
module Developerreply
  VERSION = "0.0.3"
end


text:
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=rc
[END_COT_EXT]
==================== */

/**
 * Head resources
 *
 * @package Tags
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */

defined('COT_CODE') or die('Wrong URL');

if (cot_plugin_active('autocomplete')) {
    if (cot::$cfg['jquery'] && cot::$cfg['turnajax'] && cot::$cfg['plugin']['autocomplete']['autocomplete'] > 0) {
        Resources::addEmbed(
            '$(document).ready(function() {
$(".autotags").autocomplete("' . cot_url('plug','r=tags') . '", {multiple: true, minChars: ' .
            cot::$cfg['plugin']['autocomplete']['autocomplete'] . '});
});', 'js',50,'global','tags.autocomplete');
    }
}
if(cot::$cfg['plugin']['tags']['css']) {
    Resources::addFile(cot::$cfg['plugins_dir'] . '/tags/tpl/tags.css', 'css');
}


text: export capitalize from './capitalize-text.js';


text:
package com.bagri.client.hazelcast.task.doc;

import static com.bagri.client.hazelcast.serialize.TaskSerializationFactory.cli_GetDocumentTask;

import java.util.Properties;

import com.bagri.core.api.DocumentDistributionStrategy;

public class DocumentProvider extends DocumentProcessor {

	public DocumentProvider() {
		super();
	}

	public DocumentProvider(String clientId, long txId, Properties props, String uri, DocumentDistributionStrategy distributor) {
		super(clientId, txId, props, uri, distributor);
	}

	@Override
	public int getId() {
		return cli_GetDocumentTask;
	}

}


text:
// Code generated by protoc-gen-grpc-gateway
// source: examples/examplepb/echo_service.proto
// DO NOT EDIT!

/*
Package examplepb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.
*/
package examplepb

import (
	"io"
	"net/http"

	"github.com/gengo/grpc-gateway/runtime"
	"github.com/gengo/grpc-gateway/utilities"
	"github.com/golang/protobuf/proto"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/grpclog"
)

var _ codes.Code
var _ io.Reader
var _ = runtime.String
var _ = utilities.NewDoubleArray

func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq SimpleMessage
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["id"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
	}

	protoReq.Id, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}

func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq SimpleMessage
	var metadata runtime.ServerMetadata

	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}

// RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
	conn, err := grpc.Dial(endpoint, opts...)
	if err != nil {
		return err
	}
	defer func() {
		if err != nil {
			if cerr := conn.Close(); cerr != nil {
				grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
			}
			return
		}
		go func() {
			<-ctx.Done()
			if cerr := conn.Close(); cerr != nil {
				grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
			}
		}()
	}()

	return RegisterEchoServiceHandler(ctx, mux, conn)
}

// RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
	client := NewEchoServiceClient(conn)

	mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
		ctx, cancel := context.WithCancel(ctx)
		defer cancel()
		if cn, ok := w.(http.CloseNotifier); ok {
			go func(done <-chan struct{}, closed <-chan bool) {
				select {
				case <-done:
				case <-closed:
					cancel()
				}
			}(ctx.Done(), cn.CloseNotify())
		}
		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
		rctx, err := runtime.AnnotateContext(ctx, req)
		if err != nil {
			runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
		}
		resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams)
		ctx = runtime.NewServerMetadataContext(ctx, md)
		if err != nil {
			runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
			return
		}

		forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)

	})

	mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
		ctx, cancel := context.WithCancel(ctx)
		defer cancel()
		if cn, ok := w.(http.CloseNotifier); ok {
			go func(done <-chan struct{}, closed <-chan bool) {
				select {
				case <-done:
				case <-closed:
					cancel()
				}
			}(ctx.Done(), cn.CloseNotify())
		}
		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
		rctx, err := runtime.AnnotateContext(ctx, req)
		if err != nil {
			runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
		}
		resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams)
		ctx = runtime.NewServerMetadataContext(ctx, md)
		if err != nil {
			runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
			return
		}

		forward_EchoService_EchoBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)

	})

	return nil
}

var (
	pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, ""))

	pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, ""))
)

var (
	forward_EchoService_Echo_0 = runtime.ForwardResponseMessage

	forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage
)


text:
Scrubs
======

Creates a before and after scrubber for two images. Currently dependent on jQuery.

### Installation ###

Grab the Scrubs CSS and JS files and put them in your head and after you load jQuery on your page (header or footer).

```HTML
<link rel="stylesheet" type="text/css" href="scrubs.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="scrubs.js"></script>
```

### Compatibility ###

Currently, any modern browser that supports CSS transforms *should* work. Go to [caniuse.com](http://caniuse.com/#feat=transforms2d) to learn more. The plugin will automatically use 2D/3D transforms if available, preferring 3D (for hardware acceleration).

In addition, there is also a fallback for older browsers where transforms are not detected, where it will use CSS position properties instead (top, bottom, left, right).

Transitions / animations are all CSS based, so refer to [caniuse.com](http://caniuse.com/#feat=css-transitions) for support.

##### Tested On #####

- Windows (IE8+, Firefox, Chrome)
- OSX (Chrome, Safari, Firefox)
- iOS (Safari)
- Android 4 (Stock browser, Chrome, Firefox)
- Windows Phone (IE)

Note: Both iOS and Windows Phone were tested in simulators.

### Roadmap ###
This is a list of possible improvements or features to include in future versions.
- Multiple image scrubbing (more than 2)
- Additional public methods
- Clean up code

#### Version History ####

##### 0.4.1 #####

Removed 'width' option as well as max-width styling in constructor. May revisit in the future.

##### 0.4 #####

Added deeper browser support. Scrubber now works with browsers that do not support CSS transforms, specifically IE8.

##### 0.3.1 #####

- Fixed a minor issue with numbers being passed to the scrubbing function.
- Renamed public function 'beginning' to 'start'

##### 0.3 #####

Added lots of extra functionality to the code.
- New "scrollTo" method.

###### New options ######
- width | Let's people specify a width to use with the scrubber. Defaults to a 'responsive' max-width if none is specified.
- controls | Option to build out controls or not. Useful if someone wants to rock their own.
- input | Let's people turn off any manual input to the scrubber. Should be useful for people to make their own controls.
- sticky | Causes the scrubber to stay 'stuck' at the point where the input stopped.
- onStart | For callback functions when the user starts scrubbing.

All callbacks now get percent data as part of their arguments. Example:
```JAVASCRIPT
onComplete: function(percent){
	console.log(percent); // Outputs scrubber percent number
}
```

Also renamed a few functions and reorganized a little bit internally, as well as slimmed down the SVG icons in the controls.

##### 0.2 #####

Did some things from the roadmap, including:
- Removed Modernizr dependency
- Added additional public methods (end, beginning)
- Added callbacks (onInit, onScrub, onComplete)
- Added vertical scrubbing

Also:
- Cleaned up / fixed a style error
- Fixed a multiple instances error

##### 0.1 #####

Initial commit. Added the plugin in its first iteration, which should work on modern browsers as well as touch devices. Only includes 1 public method (reset) and no other options / defaults.


text:
@interface RandomIteratorTest : GHTestCase

@end

@implementation RandomIteratorTest

-(void) testInitWithEmptyArray {
    NSArray *emptyArray = [[NSArray alloc] init];
    RandomIterator *iterator = [[RandomIterator alloc] initWithItems:emptyArray];
    GHAssertFalse([iterator hasNext], @"empty iterator will not have next");

    @try {
        [iterator next];
        GHFail(@"Should have thrown an exception");
    } @catch (NSException *exception) {
        GHAssertEqualStrings(@"Error: cannot retrieve item from empty iterator. Did you forget to call hasNext?", [exception reason],
                             @"Exception reason should indicate what happened");
    }

}

-(void) testForArrayWithOneElement {
    NSArray *oneElementArray = [[NSArray alloc] initWithObjects:@"foo", nil];
    RandomIterator *iterator = [[RandomIterator alloc] initWithItems:oneElementArray];
    GHAssertTrue([iterator hasNext], @"iterator with one element should have next");
    GHAssertEqualStrings(@"foo", [iterator next], @"could retrieve iterator sole item");
    GHAssertFalse([iterator hasNext], @"iterator has no more elements");
}

-(void) testForArrayWithTwoElements {
    NSArray *twoElementsArray = [[NSArray alloc] initWithObjects:@"foo", @"bar", nil];
    RandomIterator *iterator = [[RandomIterator alloc] initWithItems:twoElementsArray];
    GHAssertTrue([iterator hasNext], @"Iterator has items");
    NSString *firstElement = [iterator next];
    NSString *secondElement = [iterator next];
    GHAssertNotEqualStrings(firstElement, secondElement, @"both calls to next should have returned different elements");
    GHAssertFalse([iterator hasNext], @"iterator should have no more elements");
}

-(void) testInitWithNull {
    @try {
        RandomIterator *iterator = [[RandomIterator alloc] initWithItems:nil];
        GHFail(@"Should not allow instantiation of %@ with nil", iterator);
    }
    @catch (NSException *exception) {
        GHAssertEqualStrings(@"Argument must not be nil", [exception reason], @"Expected message");
    }
}

@end


text:
dojo.provide("plugins.core.Common.ComboBox");

/* SUMMARY: THIS CLASS IS INHERITED BY Common.js AND CONTAINS

	COMBOBOX METHODS
*/

dojo.declare( "plugins.core.Common.ComboBox",	[  ], {

///////}}}
// COMBOBOX METHODS
setUsernameCombo : function () {
//	POPULATE COMBOBOX AND SET SELECTED ITEM
//	INPUTS: Agua.sharedprojects DATA OBJECT
//	OUTPUTS:	ARRAY OF USERNAMES IN COMBO BOX, ONCLICK CALL TO setSharedProjectCombo
	//console.log("  Common.ComboBox.setUsernameCombo    plugins.core.Common.setUsernameCombo()");
	var usernames = Agua.getSharedUsernames();
	//console.log("  Common.ComboBox.setUsernameCombo    usernames: " + dojo.toJson(usernames));

	// RETURN IF projects NOT DEFINED
	if ( usernames == null || usernames.length == 0 )
	{
		//console.log("  Common.ComboBox.setUsernameCombo    usernames not defined. Returning.");
		return;
	}

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in usernames )
	{
		data.items[i] = { name: usernames[i]	};
	}
	//console.log("  Common.ComboBox.setUsernameCombo    store data: " + dojo.toJson(data));

	// CREATE store
	var store = new dojo.data.ItemFileReadStore( {	data: data	} );
	//console.log("   Common.setUsernameCombo    store: " + dojo.toJson(store));

	// ADD STORE TO USERNAMES COMBO
	this.usernameCombo.store = store;

	// START UP AND SET VALUE
	this.usernameCombo.startup();
	this.usernameCombo.set('value', usernames[0]);
},
setSharedProjectCombo : function (username, projectName, workflowName) {
//	POPULATE COMBOBOX AND SET SELECTED ITEM
//	INPUTS: USERNAME, OPTIONAL PROJECT NAME AND WORKFLOW NAME
//	OUTPUTS: ARRAY OF USERNAMES IN COMBO BOX, ONCLICK CALL TO setSharedWorkflowCombo

	//console.log("  Common.ComboBox.setSharedProjectCombo    plugins.report.Workflow.setSharedProjectCombo(username, project, workflow)");

	var projects = Agua.getSharedProjectsByUsername(username);
	if ( projects == null )
	{
		//console.log("   Common.setSharedProjectCombo    projects is null. Returning");
		return;
	}
	//console.log("  Common.ComboBox.setSharedProjectCombo    projects: " + dojo.toJson(projects));

	var projectNames = this.hashArrayKeyToArray(projects, "name");
	projectNames = this.uniqueValues(projectNames);
	//console.log("  Common.ComboBox.setSharedProjectCombo    projectNames: " + dojo.toJson(projectNames));

	// RETURN IF projects NOT DEFINED
	if ( projectNames == null || projectNames.length == 0 )
	{
		//console.log("  Common.ComboBox.setSharedProjectCombo    projectNames not defined. Returning.");
		return;
	}

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in projectNames )
	{
		data.items[i] = { name: projectNames[i]	};
	}
	//console.log("  Common.ComboBox.setSharedProjectCombo    store data: " + dojo.toJson(data));

	// CREATE store
	var store = new dojo.data.ItemFileReadStore( {	data: data	} );
	//console.log("  Common.ComboBox.setSharedProjectCombo    store: " + dojo.toJson(store));

	// ADD STORE TO USERNAMES COMBO
	this.projectCombo.store = store;

	// START UP AND SET VALUE
	this.projectCombo.startup();
	this.projectCombo.set('value', projectNames[0]);
},
setSharedWorkflowCombo : function (username, projectName, workflowName) {
//	POPULATE COMBOBOX AND SET SELECTED ITEM
//	INPUTS: USERNAME, OPTIONAL PROJECT NAME AND WORKFLOW NAME
//	OUTPUTS: ARRAY OF USERNAMES IN COMBO BOX, ONCLICK CALL TO setSharedWorkflowCombo

	console.log("  Common.ComboBox.setSharedWorkflowCombo    plugins.report.Workflow.setSharedWorkflowCombo(username, project, workflow)");
	console.log("  Common.ComboBox.setSharedWorkflowCombo    projectName: " + projectName);

	if ( projectName == null )	projectName = this.projectCombo.get('value');
	console.log("  Common.ComboBox.setSharedWorkflowCombo    AFTER projectName: " + projectName);

	var workflows = Agua.getSharedWorkflowsByProject(username, projectName);
	if ( workflows == null )
	{
		console.log("  Common.ComboBox.setSharedWorkflowCombo    workflows is null. Returning");
		return;
	}
	console.log("  Common.ComboBox.setSharedWorkflowCombo    workflows: ");
	console.dir({workflows:workflows});

	var workflowNames = this.hashArrayKeyToArray(workflows, "name");
	workflowNames = this.uniqueValues(workflowNames);
	console.log("  Common.ComboBox.setSharedWorkflowCombo    workflowNames: " + dojo.toJson(workflowNames));

	// RETURN IF workflows NOT DEFINED
	if ( workflowNames == null || workflowNames.length == 0 )
	{
		console.log("  Common.ComboBox.setSharedWorkflowCombo    workflowNames not defined. Returning.");
		return;
	}

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in workflowNames )
	{
		data.items[i] = { name: workflowNames[i]	};
	}

	// CREATE store
	var store = new dojo.data.ItemFileReadStore( {	data: data	} );

	// ADD STORE TO USERNAMES COMBO
	this.workflowCombo.store = store;

	// START UP AND SET VALUE
	this.workflowCombo.startup();
	this.workflowCombo.set('value', workflowNames[0]);
},
setProjectCombo : function (project, workflow) {
//	INPUT: (OPTIONAL) project, workflow NAMES
//	OUTPUT:	POPULATE COMBOBOX AND SET SELECTED ITEM

	////console.log("  Common.ComboBox.setProjectCombo    plugins.report.Template.Common.setProjectCombo(project,workflow)");
	////console.log("  Common.ComboBox.setProjectCombo    project: " + project);
	////console.log("  Common.ComboBox.setProjectCombo    workflow: " + workflow);

	var projectNames = Agua.getProjectNames();
	////console.log("  Common.ComboBox.setProjectCombo    projectNames: " + dojo.toJson(projectNames));

	// RETURN IF projects NOT DEFINED
	if ( ! projectNames )
	{
		//console.log("  Common.ComboBox.setProjectCombo    projectNames not defined. Returning.");
		return;
	}
	////console.log("  Common.ComboBox.setProjectCombo    projects: " + dojo.toJson(projects));

	// SET PROJECT IF NOT DEFINED TO FIRST ENTRY IN projects
	if ( project == null || ! project)	project = projectNames[0];

	// DO DATA ARRAY
	var data = {identifier: "name", items: []};
	for ( var i in projectNames )
	{
		data.items[i] = { name: projectNames[i]	};
	}
	////console.log("  Common.ComboBox.setProjectCombo    store data: " + dojo.toJson(data));

	// CREATE store
	var store = new dojo.data.ItemFileReadStore( {	data: data	} );

	//// GET PROJECT COMBO WIDGET
	var projectCombo = this.projectCombo;
	if ( projectCombo == null )
	{
		//console.log("  Common.ComboBox.setProjectCombo    projectCombo is null. Returning.");
		return;
	}

	projectCombo.store = store;
	////console.log("  Common.ComboBox.setProjectCombo    project: " + project);

	// START UP AND SET VALUE
	//projectCombo.startup();
	//console.log("  Common.ComboBox.setProjectCombo    projectCombo.set('value', " + project + ")");
	projectCombo.set('value', project);
},
setWorkflowCombo : function (project, workflow) {
// SET THE workflow COMBOBOX

	//console.log("  Common.ComboBox.setWorkflowCombo    plugins.workflow.Common.setWorkflowCombo(project, workflow)");

	if ( project == null || ! project )
	{
		//console.log("  Common.ComboBox.setWorkflowCombo    Project not defined. Returning.");
		return;
	}
	//console.log("  Common.ComboBox.setWorkflowCombo    project: " + project);
	//console.log("  Common.ComboBox.setWorkflowCombo    workflow: " + workflow);

	// CREATE THE DATA FOR A STORE
	var workflows = Agua.getWorkflowsByProject(project);
	//console.log("  Common.ComboBox.setWorkflowCombo    project '" + project + "' workflows: " + dojo.toJson(workflows));

	console.log("  Common.ComboBox.setWorkflowCombo    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DOING SORT workflows");
	workflows = this.sortHasharrayByKeys(workflows, ["number"]);
	console.log("  Common.ComboBox.setWorkflowCombo    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX AFTER SORT workflows:");
	console.dir({XXXXXXXXXXXXXXXXXworkflows:workflows});

	var workflowNames = this.hashArrayKeyToArray(workflows, "name");

	// RETURN IF workflows NOT DEFINED
	if ( ! workflowNames )
	{
		console.log("  Common.ComboBox.setWorkflowCombo    workflowNames not defined. Returning.");
		return;
	}

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in workflowNames )
	{
		data.items[i] = { name: workflowNames[i]	};
	}
	console.log("  Common.ComboBox.setWorkflowCombo    data: " + dojo.toJson(data));

	// CREATE store
	var store = new dojo.data.ItemFileReadStore( { data: data } );

	// GET WORKFLOW COMBO
	var workflowCombo = this.workflowCombo;
	if ( workflowCombo == null )
	{
		console.log("  Common.ComboBox.setworkflowCombo    workflowCombo is null. Returning.");
		return;
	}

	//console.log("  Common.ComboBox.setWorkflowCombo    workflowCombo: " + workflowCombo);
	workflowCombo.store = store;

	// START UP COMBO AND SET SELECTED VALUE TO FIRST ENTRY IN workflowNames IF NOT DEFINED
	if ( workflow == null || ! workflow )	workflow = workflowNames[0];
	//console.log("  Common.ComboBox.setWorkflowCombo    workflow: " + workflow);

	workflowCombo.startup();
	workflowCombo.set('value', workflow);
},
setReportCombo : function (project, workflow, report) {
// SET THE report COMBOBOX

	//console.log("  Common.ComboBox.setReportCombo    plugins.report.Common.setReportCombo(project, workflow, report)");
	//console.log("  Common.ComboBox.setReportCombo    project: " + project);
	//console.log("  Common.ComboBox.setReportCombo    workflow: " + workflow);
	//console.log("  Common.ComboBox.setReportCombo    report: " + report);

	if ( project == null || ! project )
	{
		console.log("  Common.ComboBox.setReportCombo    project not defined. Returning.");
		return;
	}
	if ( workflow == null || ! workflow )
	{
		console.log("  Common.ComboBox.setReportCombo    workflow not defined. Returning.");
		return;
	}
	//console.log("  Common.ComboBox.setReportCombo    project: " + project);
	//console.log("  Common.ComboBox.setReportCombo    workflow: " + workflow);
	//console.log("  Common.ComboBox.setReportCombo    report: " + report);

	var reports = Agua.getReportsByWorkflow(project, workflow);
	if ( reports == null )	reports = [];
	console.log("  Common.ComboBox.setReportCombo    project " + project + " reports: " + dojo.toJson(reports));

	var reportNames = this.hashArrayKeyToArray(reports, "name");
	console.log("  Common.ComboBox.setReportCombo    reportNames: " + dojo.toJson(reportNames));

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in reports )
	{
		data.items[i] = { name: reportNames[i]	};
	}
	console.log("  Common.ComboBox.setReportCombo    data: " + dojo.toJson(data));

	// CREATE store
	// http://docs.dojocampus.org/dojo/data/ItemFileWriteStore
	var store = new dojo.data.ItemFileReadStore( { data: data } );

	// GET WORKFLOW COMBO
	var reportCombo = this.reportCombo;
	if ( reportCombo == null )
	{
		console.log("  Common.ComboBox.setreportCombo    reportCombo is null. Returning.");
		return;
	}

	console.log("  Common.ComboBox.setReportCombo    reportCombo: " + reportCombo);
	reportCombo.store = store;

	// GET USER INPUT WORKFLOW
	var snpReport = this;

	// START UP COMBO (?? NEEDED ??)
	reportCombo.startup();
	reportCombo.set('value', report);
},
setViewCombo : function (projectName, viewName) {
// SET THE view COMBOBOX
	console.log("  Common.ComboBox.setViewCombo    projectName: " + projectName);
	console.log("  Common.ComboBox.setViewCombo    viewName: " + viewName);

	// SANITY CHECK
	if ( ! this.viewCombo )	return;
	if ( ! projectName )	return;

	var views = Agua.getViewNames(projectName);

	console.log("  Common.ComboBox.setViewCombo    BEFORE SORT views: ");
	console.dir({views: views});

	views.sort(this.sortNaturally);

	console.log("View.setViewCombo    AFTER SORT views: ");
	console.dir({views:views});

	//console.log("  Common.ComboBox.setViewCombo    projectName '" + projectName + "' views: " + dojo.toJson(views));

	// RETURN IF views NOT DEFINED
	if ( ! views || views.length == 0 )	views = [];
	//{
		//console.log("  Common.ComboBox.setViewCombo    views not defined. Returning.");
		//return;
		//Agua.addView({ project: projectName, name: "View1" });
		//views = Agua.getViewNames(projectName);
	//}
	//console.log("  Common.ComboBox.setViewCombo    views: " + dojo.toJson(views));

	// SET view IF NOT DEFINED TO FIRST ENTRY IN views
	if ( viewName == null || ! viewName)
	{
		viewName = views[0];
	}
	//console.log("  Common.ComboBox.setViewCombo    viewName: " + viewName);

	// DO data FOR store
	var data = {identifier: "name", items: []};
	for ( var i in views )
	{
		data.items[i] = { name: views[i]	};
	}
	//console.log("  Common.ComboBox.setViewCombo    data: " + dojo.toJson(data));

	// CREATE store
	// http://docs.dojocampus.org/dojo/data/ItemFileWriteStore
	var store = new dojo.data.ItemFileReadStore( { data: data } );

	//console.log("  Common.ComboBox.setViewCombo    this.viewCombo: " + this.viewCombo);
	this.viewCombo.store = store;

	// START UP COMBO (?? NEEDED ??)
	this.viewCombo.startup();
	this.viewCombo.set('value', viewName);
},
getSelectedValue : function (element) {
	var index = element.selectedIndex;
	//console.log("  Common.ComboBox.getSelectedValue    index: " + index);
	var value = element.options[index].text;
	//console.log("  Common.ComboBox.getSelectedValue    value: " + value);

	return value;
}

});