text:
.class public Landroid/support/constraint/solver/widgets/Snapshot;
.super Ljava/lang/Object;
.source "Snapshot.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/support/constraint/solver/widgets/Snapshot$Connection;
    }
.end annotation

# instance fields
.field private mConnections:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Landroid/support/constraint/solver/widgets/Snapshot$Connection;",
            ">;"
        }
    .end annotation
.end field

.field private mHeight:I

.field private mWidth:I

.field private mX:I

.field private mY:I

# direct methods
.method public constructor <init>(Landroid/support/constraint/solver/widgets/ConstraintWidget;)V
    .registers 8
    .param p1, "widget"    # Landroid/support/constraint/solver/widgets/ConstraintWidget;

    .prologue
    .line 91
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 30
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    iput-object v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    .line 92
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getX()I

    move-result v4

    iput v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mX:I

    .line 93
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getY()I

    move-result v4

    iput v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mY:I

    .line 94
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getWidth()I

    move-result v4

    iput v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mWidth:I

    .line 95
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getHeight()I

    move-result v4

    iput v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mHeight:I

    .line 96
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getAnchors()Ljava/util/ArrayList;

    move-result-object v1

    .line 97
    .local v1, "anchors":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Landroid/support/constraint/solver/widgets/ConstraintAnchor;>;"
    const/4 v3, 0x0

    .local v3, "i":I
    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v2

    .local v2, "anchorsSize":I
    :goto_2b
    if-ge v3, v2, :cond_40

    .line 98
    invoke-virtual {v1, v3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/support/constraint/solver/widgets/ConstraintAnchor;

    .line 99
    .local v0, "a":Landroid/support/constraint/solver/widgets/ConstraintAnchor;
    iget-object v4, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    new-instance v5, Landroid/support/constraint/solver/widgets/Snapshot$Connection;

    invoke-direct {v5, v0}, Landroid/support/constraint/solver/widgets/Snapshot$Connection;-><init>(Landroid/support/constraint/solver/widgets/ConstraintAnchor;)V

    invoke-virtual {v4, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 97
    add-int/lit8 v3, v3, 0x1

    goto :goto_2b

    .line 101
    .end local v0    # "a":Landroid/support/constraint/solver/widgets/ConstraintAnchor;
    :cond_40
    return-void
.end method

# virtual methods
.method public applyTo(Landroid/support/constraint/solver/widgets/ConstraintWidget;)V
    .registers 6
    .param p1, "widget"    # Landroid/support/constraint/solver/widgets/ConstraintWidget;

    .prologue
    .line 126
    iget v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mX:I

    invoke-virtual {p1, v3}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->setX(I)V

    .line 127
    iget v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mY:I

    invoke-virtual {p1, v3}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->setY(I)V

    .line 128
    iget v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mWidth:I

    invoke-virtual {p1, v3}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->setWidth(I)V

    .line 129
    iget v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mHeight:I

    invoke-virtual {p1, v3}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->setHeight(I)V

    .line 130
    const/4 v1, 0x0

    .local v1, "i":I
    iget-object v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v2

    .local v2, "mConnectionsSize":I
    :goto_1b
    if-ge v1, v2, :cond_2b

    .line 131
    iget-object v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    invoke-virtual {v3, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/support/constraint/solver/widgets/Snapshot$Connection;

    .line 132
    .local v0, "connection":Landroid/support/constraint/solver/widgets/Snapshot$Connection;
    invoke-virtual {v0, p1}, Landroid/support/constraint/solver/widgets/Snapshot$Connection;->applyTo(Landroid/support/constraint/solver/widgets/ConstraintWidget;)V

    .line 130
    add-int/lit8 v1, v1, 0x1

    goto :goto_1b

    .line 134
    .end local v0    # "connection":Landroid/support/constraint/solver/widgets/Snapshot$Connection;
    :cond_2b
    return-void
.end method

.method public updateFrom(Landroid/support/constraint/solver/widgets/ConstraintWidget;)V
    .registers 6
    .param p1, "widget"    # Landroid/support/constraint/solver/widgets/ConstraintWidget;

    .prologue
    .line 109
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getX()I

    move-result v3

    iput v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mX:I

    .line 110
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getY()I

    move-result v3

    iput v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mY:I

    .line 111
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getWidth()I

    move-result v3

    iput v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mWidth:I

    .line 112
    invoke-virtual {p1}, Landroid/support/constraint/solver/widgets/ConstraintWidget;->getHeight()I

    move-result v3

    iput v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mHeight:I

    .line 113
    iget-object v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v1

    .line 114
    .local v1, "connections":I
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_1f
    if-ge v2, v1, :cond_2f

    .line 115
    iget-object v3, p0, Landroid/support/constraint/solver/widgets/Snapshot;->mConnections:Ljava/util/ArrayList;

    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/support/constraint/solver/widgets/Snapshot$Connection;

    .line 116
    .local v0, "connection":Landroid/support/constraint/solver/widgets/Snapshot$Connection;
    invoke-virtual {v0, p1}, Landroid/support/constraint/solver/widgets/Snapshot$Connection;->updateFrom(Landroid/support/constraint/solver/widgets/ConstraintWidget;)V

    .line 114
    add-int/lit8 v2, v2, 0x1

    goto :goto_1f

    .line 118
    .end local v0    # "connection":Landroid/support/constraint/solver/widgets/Snapshot$Connection;
    :cond_2f
    return-void
.end method


text:
1. Run: stylus plume-band-together.styl
2. Change output file extension from .css to .scss

## Sass to SCSS

1. Run: sass plume-prototype.sass:plume-prototype.scss --sourcemap=none --disable-cache

redpajama_set_name: RedPajamaGithub


text: Java Exception Examples


text:
package controllers.auth

import play.api.mvc.{SimpleResult, RequestHeader, Controller}

import jp.t2v.lab.play2.auth.AuthConfig
import scala.concurrent.{Future, ExecutionContext}
import play.api.libs.Crypto
import util.HashingUtils

trait LoginLogout {
  self: Controller with AuthConfig =>

  def gotoLoginSucceeded(userId: Id)(implicit request: RequestHeader, ctx: ExecutionContext): Future[SimpleResult] = {
    gotoLoginSucceeded(userId, loginSucceeded(request))
  }

  def gotoLoginSucceeded(userId: Id, result: => Future[SimpleResult])(implicit ctx: ExecutionContext): Future[SimpleResult] = {
    val token = idContainer.startNewSession(userId, sessionTimeoutInSeconds)
    val value = Crypto.sign(token) + token
    result.map( (req: SimpleResult) => req.withSession(cookieName -> value))
  }

  def gotoLogoutSucceeded(implicit request: RequestHeader, ctx: ExecutionContext): Future[SimpleResult] = {
    gotoLogoutSucceeded(logoutSucceeded(request))
  }

  def gotoLogoutSucceeded(result: => Future[SimpleResult])(implicit request: RequestHeader, ctx: ExecutionContext): Future[SimpleResult] = {
    request.session.get(cookieName) flatMap HashingUtils.verifyHmac foreach idContainer.remove
    result.map(_.withNewSession)
  }

}


text:
// This file defines the operations used in the MHLO dialect.

#ifndef MLIR_HLO_DIALECT_MHLO_IR_HLO_OPS_H
#define MLIR_HLO_DIALECT_MHLO_IR_HLO_OPS_H

#include "llvm/ADT/StringRef.h"
#include "mlir/Dialect/Quant/QuantTypes.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/Types.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"

// clang-format off
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.h"
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_attrs.h"
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_enums.h"
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_structs.h"
// clang-format on

namespace mlir {
class OpBuilder;

namespace mhlo {

class MhloDialect : public Dialect {
 public:
  explicit MhloDialect(MLIRContext *context);
  static StringRef getDialectNamespace() { return "mhlo"; }

  // Registered hook to materialize a constant operation from a given attribute
  // value with the desired resultant type.
  Operation *materializeConstant(OpBuilder &builder, Attribute value, Type type,
                                 Location loc) override;

  // Registered hook to verify region arg attributes on operations.
  LogicalResult verifyRegionArgAttribute(mlir::Operation *op,
                                         unsigned region_index,
                                         unsigned arg_index,
                                         mlir::NamedAttribute attr) override;

  // Registered hook to verify an attribute from this dialect on operations.
  LogicalResult verifyOperationAttribute(mlir::Operation *op,
                                         mlir::NamedAttribute attr) override;

  // Parses a type registered to this dialect.
  Type parseType(DialectAsmParser &parser) const override;

  // Prints a type registered to this dialect.
  void printType(Type type, DialectAsmPrinter &os) const override;

  // Parses an attribute registered to this dialect.
  Attribute parseAttribute(DialectAsmParser &parser, Type type) const override;

  // Prints an attribute registered to this dialect.
  void printAttribute(Attribute attr, DialectAsmPrinter &os) const override;
};

class TokenType : public Type::TypeBase<TokenType, Type, TypeStorage> {
 public:
  using Base::Base;
};

// Returns true if the given types are the same for the purposes of MHLO type
// inference, accounting for special properties of quantization and sparsity.
bool isCompatibleForMhloTypeInference(Type tp1, Type tp2);

// Shape derivation function that computes the shape of the result based on an
// operand. For a 2-dimensional input tensor, this produces IR of the form
//
//  %0 = dim %arg0, 0 : memref<?x?xf32>
//  %1 = index_cast %0 : index to i64
//  %2 = dim %arg0, 1 : memref<?x?xf32>
//  %3 = index_cast %2 : index to i64
//  %4 = "mhlo.scalars_to_dimension_tensor"(%1, %3)
//    : (i64, i64) -> tensor<2xi64>
//
// and returns %4 as the shape value.
LogicalResult deriveShapeFromOperand(
    OpBuilder *builder, Operation *op, Value operand,
    SmallVectorImpl<Value> *reifiedReturnShapes);

// Type derivation function that returns a tensor type with a new element type.
TensorType getSameShapeTensorType(TensorType tensor_type, Type element_type);

}  // end namespace mhlo
}  // end namespace mlir

#define GET_OP_CLASSES
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h.inc"

namespace mlir {
namespace mhlo {

SortOp CreateSortOp(PatternRewriter *rewriter, const Location &loc,
                    const llvm::ArrayRef<Value> &operands,
                    const llvm::ArrayRef<Type> &element_types,
                    int64_t dimension, bool is_stable,
                    ComparisonDirection direction);

}  // end namespace mhlo
}  // end namespace mlir

#endif  // MLIR_HLO_DIALECT_MHLO_IR_HLO_OPS_H


text:
/*
 * (C) 2007-2013 Alibaba Group Holding Limited
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *
 */
//
// Created by Wentong on 15/2/4.
//

#import "TBMBTestRxCommand.h"
#import "RACDisposable.h"
#import "RACSubscriber.h"
#import "RACScheduler.h"

@implementation TBMBTestRxCommand {

}
- (RACDisposable *)observe:(id)parameter andSubscribe:(id <RACSubscriber>)subscriber {
    NSLog(@"Command %@", [RACScheduler currentScheduler]);
    [subscriber sendNext:@1];
    return nil;
}

- (RACScheduler *)runQueue {
    return [RACScheduler schedulerWithPriority:RACSchedulerPriorityHigh name:@"Test"];
}

@end


text: "use strict";var l={"DZA_ALGIERS":[null,"Alger"]};(this?this:window)['DvtBaseMapManager']['_UNPROCESSED_MAPS'][2].push(["africa","cities",l]);


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#ifndef DORIS_BE_SRC_QUERY_EXEC_OLAP_SCANNER_H
#define DORIS_BE_SRC_QUERY_EXEC_OLAP_SCANNER_H

#include <list>
#include <vector>
#include <string>
#include <memory>
#include <utility>

#include "common/status.h"
#include "exec/olap_common.h"
#include "exec/exec_node.h"
#include "exprs/expr.h"
#include "gen_cpp/PaloInternalService_types.h"
#include "gen_cpp/PlanNodes_types.h"
#include "runtime/descriptors.h"
#include "runtime/tuple.h"
#include "runtime/vectorized_row_batch.h"

#include "olap/delete_handler.h"
#include "olap/rowset/column_data.h"
#include "olap/olap_cond.h"
#include "olap/storage_engine.h"
#include "olap/reader.h"

namespace doris {

class OlapScanNode;
class OLAPReader;
class RuntimeProfile;
class Field;

class OlapScanner {
public:
    OlapScanner(
        RuntimeState* runtime_state,
        OlapScanNode* parent,
        bool aggregation,
        DorisScanRange* scan_range,
        const std::vector<OlapScanRange>& key_ranges);

    ~OlapScanner();

    Status open();

    Status get_batch(RuntimeState* state, RowBatch* batch, bool* eof);

    Status close(RuntimeState* state);

    RuntimeState* runtime_state() {
        return _runtime_state;
    }

    std::vector<ExprContext*>* conjunct_ctxs() {
        return &_conjunct_ctxs;
    }

    int id() const { return _id; }
    void set_id(int id) { _id = id; }
    bool is_open() const { return _is_open; }
    void set_opened() { _is_open = true; }

    int64_t raw_rows_read() const { return _raw_rows_read; }

    void update_counter();
private:
    Status _prepare(
        DorisScanRange* scan_range,
        const std::vector<OlapScanRange>& key_ranges,
        const std::vector<TCondition>& filters,
        const std::vector<TCondition>& is_nulls);
    Status _init_params(
        const std::vector<OlapScanRange>& key_ranges,
        const std::vector<TCondition>& filters,
        const std::vector<TCondition>& is_nulls);
    Status _init_return_columns();
    void _convert_row_to_tuple(Tuple* tuple);

    // Update profile that need to be reported in realtime.
    void _update_realtime_counter();

    RuntimeState* _runtime_state;
    OlapScanNode* _parent;
    const TupleDescriptor* _tuple_desc;      /**< tuple descripter */
    RuntimeProfile* _profile;
    const std::vector<SlotDescriptor*>& _string_slots;

    std::vector<ExprContext*> _conjunct_ctxs;

    int _id;
    bool _is_open;
    bool _aggregation;
    bool _has_update_counter = false;

    Status _ctor_status;
    int _tuple_idx = 0;
    int _direct_conjunct_size = 0;

    bool _use_pushdown_conjuncts = false;

    ReaderParams _params;
    std::unique_ptr<Reader> _reader;

    TabletSharedPtr _tablet;
    int64_t _version;

    std::vector<uint32_t> _return_columns;

    RowCursor _read_row_cursor;

    std::vector<uint32_t> _request_columns_size;

    std::vector<SlotDescriptor*> _query_slots;

    // time costed and row returned statistics
    ExecNode::EvalConjunctsFn _eval_conjuncts_fn = nullptr;

    RuntimeProfile::Counter* _rows_read_counter = nullptr;
    int64_t _num_rows_read = 0;
    int64_t _raw_rows_read = 0;

    RuntimeProfile::Counter* _rows_pushed_cond_filtered_counter = nullptr;
    // number rows filtered by pushed condition
    int64_t _num_rows_pushed_cond_filtered = 0;

    bool _is_closed = false;
};

} // namespace doris

#endif


text:
closing a path

 * Z = Close path


text:
'use strict';

module.exports = function(gulp, config) {
    var jscs          = require('gulp-jscs');
    var jscsStylish   = require('gulp-jscs-stylish');
    var jshint        = require('gulp-jshint');
    var jshintStylish = require('jshint-stylish');

    var configJs = config.js;

    gulp.task('js:qa', 'JSCS + JSHint', ['js:cs', 'js:hint']);

    /**
     * Check JavaScript code style with jscs.
     *
     * @see https://www.npmjs.com/package/gulp-jscs
     * @see http://jscs.info/
     */
    gulp.task('js:cs', 'Check JavaScript code style with jscs.', function () {
        gulp.src(configJs.src)
            .pipe(jscs())
            .pipe(jscsStylish())
        ;
    });

    /**
     * Detect errors and potential problems in your JavaScript code with jshint.
     *
     * @see https://www.npmjs.com/package/gulp-jshint
     * @see http://jshint.com/docs/
     */
    gulp.task('js:hint', 'Detect errors and potential problems in your JavaScript code with jshint.', function () {
        gulp.src(configJs.src)
            .pipe(jshint('.jshintrc'))
            .pipe(jshint.reporter(jshintStylish))
            .pipe(jshint.reporter('fail'))
        ;
    });
};


text:
'use strict';

angular.module(
		'sftypeset.question',
		[ 'sf.services', 'palaso.ui.listview', 'palaso.ui.typeahead', 'palaso.ui.jqte', 'ui.bootstrap' ]
	)
	.controller('QuestionCtrl', ['$scope', '$routeParams', 'questionService', 'sessionService', 'breadcrumbService',
	                             function($scope, $routeParams, questionService, ss, bcs) {
		$scope.jqteOptions = {
			'placeholder': 'Say what you think...',
			'u': false,
			'indent': false,
			'outdent': false,
			'left': false,
			'center': false,
			'right': false,
			'rule': false,
			'source': false,
			'link': false,
			'unlink': false,
			'fsize': false,
			'formats': [
				['p', 'Normal'],
				['h4', 'Large']
			]
		};

		var projectId = $routeParams.projectId;
		var questionId = $routeParams.questionId;
		questionService.read(projectId, questionId, function(result) {
			console.log('questionService.read(', projectId, questionId, ')');
			if (result.ok) {
				$scope.text = result.data.text;
				$scope.question = result.data.question;
				$scope.project = result.data.project;
				bcs.updateMap('project', $scope.project.id, $scope.project.projectname);
				bcs.updateMap('text', $scope.text.id, $scope.text.title);
				bcs.updateMap('question', $scope.question.id, $scope.question.title);
				// Keep track of answer count so we can show or hide "There are no answers" as appropriate
				$scope.question.answerCount = Object.keys($scope.question.answers).length;
				$scope.rights = result.data.rights;
			} else {
				// error condition
			}
		});

		$scope.rightsEditOwn = function(userId) {
			var right = (userId == ss.currentUserId()) && ss.hasRight($scope.rights, ss.domain.ANSWERS, ss.operation.EDIT_OWN);
			return right;
		};

		$scope.rightsDeleteOwn = function(userId) {
			var right = (userId == ss.currentUserId()) && ss.hasRight($scope.rights, ss.domain.ANSWERS, ss.operation.DELETE_OWN);
			return right;
		};

		$scope.editQuestionCollapsed = true;
		$scope.showQuestionEditor = function() {
			$scope.editQuestionCollapsed = false;
		};
		$scope.hideQuestionEditor = function() {
			$scope.editQuestionCollapsed = true;
		};
		$scope.toggleQuestionEditor = function() {
			$scope.editQuestionCollapsed = !$scope.editQuestionCollapsed;
		};
		$scope.$watch('editQuestionCollapsed', function(newval) {
			if (newval) { return; }
			// Question editor not collapsed? Then set up initial values
			$scope.editedQuestion = {
				id: $scope.question.id,
				title: $scope.question.title,
				description: $scope.question.description,
				// Do we need to copy the other values? Let's check:
				//dateCreated: $scope.question.dateCreated,
				//textRef: $scope.question.textRef,
				//answers: $scope.question.answers,
				//answerCount: $scope.question.answerCount,
			}
		});
		$scope.updateQuestion = function(newQuestion) {
			questionService.update(projectId, newQuestion, function(result) {
				if (result.ok) {
					questionService.read(projectId, newQuestion.id, function(result) {
						if (result.ok) {
							$scope.question = result.data.question;
							// Recalculate answer count since the DB doesn't store it
							$scope.question.answerCount = Object.keys($scope.question.answers).length;
						} else {
							// error condition
							console.log('update_question failed to read DB after update');
							console.log(result);
						}
					});
				} else {
					console.log('update_question ERROR');
					console.log(result);
				}
			});
		};

		$scope.openEditors = {
			answerId: null,
			commentId: null,
		};

		$scope.showAnswerEditor = function(answerId) {
			$scope.openEditors.answerId = answerId;
		};

		$scope.hideAnswerEditor = function() {
			$scope.openEditors.answerId = null;
		};

		$scope.$watch('openEditors.answerId', function(newval, oldval) {
			if (newval === null || newval === undefined) {
				// Skip; we're being called during initialization
				return;
			}

			// Set up the values needed by the new editor
			var answer = $scope.question.answers[newval];
			if (angular.isUndefined(answer)) {
				//console.log('Failed to find', newval, 'in', $scope.question.answers);
				return;
			}
			$scope.editedAnswer = {
				id: newval,
				comments: {},
				content: answer.content,
				//dateEdited: Date.now(), // Commented out for now because the model wasn't happy with a Javascript date. TODO: Figure out what format I should be passing this in. RM 2013-08
				score: answer.score,
				textHighlight: answer.textHighlight,
				userRef: answer.userRef,
			};
			for (var id in answer.comments) {
				var strippedComment = {};
				var comment = answer.comments[id];
				strippedComment.id = comment.id;
				strippedComment.content = comment.content;
				strippedComment.dateCreated = comment.dateCreated;
				strippedComment.dateEdited = comment.dateEdited;
				strippedComment.userRef = comment.userRef.userid;
				$scope.editedAnswer.comments[id] = strippedComment;
			}
		});

		$scope.answerEditorVisible = function(answerId) {
			return (answerId == $scope.openEditors.answerId);
		};

		$scope.showCommentEditor = function(commentId) {
			$scope.openEditors.commentId = commentId;
		};
		$scope.hideCommentEditor = function() {
			$scope.openEditors.commentId = null;
		};
		$scope.$watch('openEditors.commentId', function(newval, oldval) {
			if (newval === null || newval === undefined) {
				// Skip; we're being called during initialization
				return;
			}

			// We're in the question-level scope, and we need to find a
			// specific commentId without knowing which answer it belongs
			// to, because all we have to work with is the new value of
			// the commentId (the old value won't help us).
			var comment;
			search_loop:
			for (var aid in $scope.question.answers) {
				var answer = $scope.question.answers[aid];
				for (var cid in answer.comments) {
					if (cid == newval) {
						comment = answer.comments[cid];
						break search_loop;
					}
				}
			}
			// Set up the values needed by the new editor
			if (angular.isUndefined(comment)) {
				//console.log('Failed to find', newval, 'in', $scope.question.comments);
				return;
			}
			$scope.editedComment = {
				id: newval,
				content: comment.content,
				//dateEdited: Date.now(), // Commented out for now because the model wasn't happy with a Javascript date. TODO: Figure out what format I should be passing this in. RM 2013-08
				userRef: comment.userRef, // Do we really need to copy this over? Or will the PHP model code take care of that for us?
			};
		});

		$scope.commentEditorVisible = function(commentId) {
			return (commentId == $scope.openEditors.commentId);
		};

		$scope.newComment = {
			'content': ''
		};

		$scope.newAnswer = {
			content: ''
		};

		$scope.updateComment = function(answerId, answer, newComment) {
			questionService.update_comment(projectId, questionId, answerId, newComment, function(result) {
				if (result.ok) {
					for (var id in result.data) {
						newComment = result.data[id]; // There should be one, and only one, record in result.data
					}
					$scope.question.answers[answerId].comments[newComment.id] = newComment;
				} else {
					console.log('update_comment ERROR');
					console.log(result);
				}
			});
		};

		$scope.submitComment = function(answerId, answer) {
			var newComment = {
				id: '',
				content: $scope.newComment.content,
			};
			$scope.updateComment(answerId, answer, newComment);
			$scope.newComment.content = '';
		}

		$scope.editComment = function(answerId, answer, comment) {
			if ($scope.rightsEditOwn(comment.userRef.userid)) {
				$scope.updateComment(answerId, answer, comment);
			}
			$scope.hideCommentEditor();
		}

		$scope.commentDelete = function(answer, commentId) {
			console.log('delete ', commentId);
			questionService.remove_comment(projectId, questionId, answer.id, commentId, function(result) {
				if (result.ok) {
					console.log('remove_comment ok');
					// Delete locally
					delete answer.comments[commentId];
				}
			});
		};

		$scope.updateAnswer = function(projectId, questionId, answer) {
			questionService.update_answer(projectId, questionId, answer, function(result) {
				if (result.ok) {
					console.log('update_answer ok');
					for (var id in result.data) {
						$scope.question.answers[id] = result.data[id];
					}
					// Recalculate answer count as it might have changed
					$scope.question.answerCount = Object.keys($scope.question.answers).length;
					// TODO error condition (well, that should be handled globally by the service CP 2013-08)
				}
			});
		};

		$scope.submitAnswer = function() {
			var answer = {
				'id':'',
				'content': $scope.newAnswer.content
			};
			$scope.updateAnswer(projectId, questionId, answer);
			$scope.newAnswer.content = '';
		};

		$scope.editAnswer = function(answer) {
			if ($scope.rightsEditOwn(answer.userRef.userid)) {
				$scope.updateAnswer(projectId, questionId, answer);
			}
			$scope.hideAnswerEditor();
		};

		$scope.answerDelete = function(answerId) {
			console.log('delete ', answerId);
			questionService.remove_answer(projectId, questionId, answerId, function(result) {
				if (result.ok) {
					console.log('remove_answer ok');
					// Delete locally
					delete $scope.question.answers[answerId];
					// Recalculate answer count as it just changed
					$scope.question.answerCount = Object.keys($scope.question.answers).length;
				}
			});
		};

	}])
	;


text:
namespace DataAccess
{
    using System;

    public partial class Leader_OfEmployee_Result
    {
        public Nullable<int> LeaderEmployee_ID { get; set; }
        public string LeaderDisplayName { get; set; }
        public string LeaderEmail { get; set; }
    }
}


text:
#include <aws/workmail/model/UserRole.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace WorkMail
  {
    namespace Model
    {
      namespace UserRoleMapper
      {

        static const int USER_HASH = HashingUtils::HashString("USER");
        static const int RESOURCE_HASH = HashingUtils::HashString("RESOURCE");
        static const int SYSTEM_USER_HASH = HashingUtils::HashString("SYSTEM_USER");

        UserRole GetUserRoleForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == USER_HASH)
          {
            return UserRole::USER;
          }
          else if (hashCode == RESOURCE_HASH)
          {
            return UserRole::RESOURCE;
          }
          else if (hashCode == SYSTEM_USER_HASH)
          {
            return UserRole::SYSTEM_USER;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<UserRole>(hashCode);
          }

          return UserRole::NOT_SET;
        }

        Aws::String GetNameForUserRole(UserRole enumValue)
        {
          switch(enumValue)
          {
          case UserRole::USER:
            return "USER";
          case UserRole::RESOURCE:
            return "RESOURCE";
          case UserRole::SYSTEM_USER:
            return "SYSTEM_USER";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return {};
          }
        }

      } // namespace UserRoleMapper
    } // namespace Model
  } // namespace WorkMail
} // namespace Aws


text:
/* xljump - execution context routines */
/*	Copyright (c) 1985, by David Michael Betz
	All Rights Reserved
	Permission is granted for unrestricted non-commercial use	*/
/* modified for SPEC by Michael Paton 1994 and Alexander Carlton 1995 */

#include <math.h>
#include <stdarg.h>
#include "xlisp.h"
#include "proto.h"
#include "xtrnl.h"

/* xlbegin - beginning of an execution context */
void xlbegin(CONTEXT *cptr,int flags,NODE *expr)
{
    cptr->c_flags = flags;
    cptr->c_expr = expr;
    cptr->c_xlstack = xlstack;
    cptr->c_xlenv = xlenv;
    cptr->c_xltrace = xltrace;
    cptr->c_xlcontext = xlcontext;
    xlcontext = cptr;
}

/* xlend - end of an execution context */
void xlend(CONTEXT *cptr)
{
    xlcontext = cptr->c_xlcontext;
}

/* xljump - jump to a saved execution context */
void xljump(CONTEXT *cptr,int type,NODE *val)
{
    /* restore the state */
    xlcontext = cptr;
    xlstack = xlcontext->c_xlstack;
    xlenv = xlcontext->c_xlenv;
    xltrace = xlcontext->c_xltrace;
    xlvalue = val;

    /* call the handler */
    longjmp(xlcontext->c_jmpbuf,type);
}

/* xltoplevel - go back to the top level */
void xltoplevel(void)
{
    findtarget(CF_TOPLEVEL,"no top level");
}

/* xlcleanup - clean-up after an error */
void xlcleanup(void)
{
    findtarget(CF_CLEANUP,"not in a break loop");
}

/* xlcontinue - continue from an error */
void xlcontinue(void)
{
    findtarget(CF_CONTINUE,"not in a break loop");
}

/* xlgo - go to a label */
void xlgo(NODE *label)
{
    CONTEXT *cptr;
    NODE *p;

    /* find a tagbody context */
    for (cptr = xlcontext; cptr; cptr = cptr->c_xlcontext)
	if (cptr->c_flags & CF_GO)
	    for (p = cptr->c_expr; consp(p); p = cdr(p))
		if (car(p) == label)
		    xljump(cptr,CF_GO,p);
    xlfail("no target for GO");
}

/* xlreturn - return from a block */
void xlreturn(NODE *val)
{
    CONTEXT *cptr;

    /* find a block context */
    for (cptr = xlcontext; cptr; cptr = cptr->c_xlcontext)
	if (cptr->c_flags & CF_RETURN)
	    xljump(cptr,CF_RETURN,val);
    xlfail("no target for RETURN");
}

/* xlthrow - throw to a catch */
void xlthrow(NODE *tag,NODE *val)
{
    CONTEXT *cptr;

    /* find a catch context */
    for (cptr = xlcontext; cptr; cptr = cptr->c_xlcontext)
	if ((cptr->c_flags & CF_THROW) && cptr->c_expr == tag)
	    xljump(cptr,CF_THROW,val);
    xlfail("no target for THROW");
}

/* xlsignal - signal an error */
void xlsignal(char *emsg,NODE *arg)
{
    CONTEXT *cptr;

    /* find an error catcher */
    for (cptr = xlcontext; cptr; cptr = cptr->c_xlcontext)
	if (cptr->c_flags & CF_ERROR) {
	    if (cptr->c_expr && emsg)
		xlerrprint("error",NULL,emsg,arg);
	    xljump(cptr,CF_ERROR,NIL);
	}
    xlfail("no target for error");
}

/* findtarget - find a target context frame */
LOCAL findtarget(int flag, char *error)
{
    CONTEXT *cptr;

    /* find a block context */
    for (cptr = xlcontext; cptr; cptr = cptr->c_xlcontext)
	if (cptr->c_flags & flag)
	    xljump(cptr,flag,NIL);
    xlabort(error);
}


text:
{% extends '_base.html' %}
{% load i18n %}

{% block body %}

    {% block navigation %}{% include 'nav_utility.html' %}{% endblock navigation %}

            {% block sidebar %}

{% trans 'PROJECTS' %}

                            {% for project in sidebar_projects %}
                                {{ project }}

                            {% empty %}
                                No {% trans 'PROJECTS' %}

                            {% endfor %}

 Add {% trans 'PROJECT' %}

                    {% if not user.user_is_historian %}

Hosts

                                {% for host in sidebar_hosts %}
                                    {{ host }}

                                {% empty %}
                                    No Hosts

                                {% endfor %}

 Add Host

                        {% if user.user_is_admin %}

Users

                                    {% for user in sidebar_users %}
                                        {{ user }}

                                    {% empty %}
                                        No Users

                                    {% endfor %}

 Add User

Hooks

                                    {% for hook in system_hooks %}
                                        {{ hook }}

                                    {% empty %}
                                        No Hooks

                                    {% endfor %}

 Add Hook

                        {% endif %}

                    {% endif %}

            {% endblock sidebar %}

            {% block wrapper %}

                    {% block breadcrumb %}
                    {% endblock breadcrumb %}

                    {% block messages %}
                        {% for message in messages %}

                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                {{ message }}

                        {% endfor %}
                    {% endblock messages %}

                    {% block content %}{% endblock content %}

            {% endblock  %}

            Created by Trevor Hartman for profit ©

            Icons by Glyphicons | Themes by Bootswatch | Thanks for playing

{% endblock body %}


text:
/**
 *
 */
package net.i2geo.comped.webapp.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import net.i2geo.comped.model.CompetencyProcess;
import net.i2geo.comped.model.ConcreteCompetency;
import net.i2geo.comped.model.Topic;
import net.i2geo.comped.service.CompetencyProcessManager;
import net.i2geo.comped.service.ConcreteCompetencyManager;
import net.i2geo.comped.service.TopicManager;
import net.i2geo.comped.util.UserUtil;

import org.appfuse.model.User;
import org.appfuse.webapp.action.BaseAction;
import org.springframework.security.AccessDeniedException;

/**
 * @author Martin Homik
 *
 */
public class SearchAction extends BaseAction {

	private static final long serialVersionUID = 5546628460041310223L;

	// Managers
	private ConcreteCompetencyManager ccm;
	private CompetencyProcessManager cpm;
	private TopicManager tm;

	// List of matched concrete competencies
	private List<ConcreteCompetency> ccMatch = new ArrayList<ConcreteCompetency>();
	// List of all matched concrete competencies
	private List<CompetencyProcess> cpMatch = new ArrayList<CompetencyProcess>();

	// List of all matched topics
	private List<Topic> tMatch = new ArrayList<Topic>();

	private String searchString = "";

	// set managers
	public void setConcreteCompetencyManager(ConcreteCompetencyManager ccm) {
		this.ccm = ccm;
		this.ccm.setLocale(getCurrentLocale());
	}

	public void setCompetencyProcessManager(CompetencyProcessManager cpm) {
		this.cpm = cpm;
		this.cpm.setLocale(getCurrentLocale());
	}

	public void setTopicManager(TopicManager tm) {
		this.tm = tm;
		this.tm.setLocale(getCurrentLocale());
	}

	// get matches
	public List<ConcreteCompetency> getCcMatch() {
		return ccMatch;
	}

	public List<CompetencyProcess> getCpMatch() {
		return cpMatch;
	}

	public List<Topic> getTMatch() {
		return tMatch;
	}

	public void setSearchString(String searchString) {
		this.searchString = "%" + searchString + "%";
	}

	public String search() {

		if (searchString != null && !searchString.isEmpty()) {
			cpMatch = cpm.findByNameLike(searchString, getLocale().getLanguage());
			// log.debug("cpMatch hat Anzahl Items: " + cpMatch.size());
			ccMatch = ccm.findByNameLike(searchString, getLocale().getLanguage());
			// log.debug("ccMatch hat Anzahl Items: " + ccMatch.size());

			tMatch = tm.findByNameLike(searchString, getLocale().getLanguage());

			return SUCCESS;
		}

		return INPUT;
	}

	@Override
	public Locale getLocale() {
		String language = getCurrentLocale().getLanguage();
		try {
			return new Locale(language, "");
		} catch (Exception e) {
			return super.getLocale();
		}
	}

	public Locale getCurrentLocale() {
		// NOTE: should be written in some properties file
		Locale defaultLocale = super.getLocale();
		Locale locale = getUsersLocale();

		if (locale == null) {
			return defaultLocale;
		}
		return locale;
	}

	private Locale getUsersLocale() {
		try {
			User currentUser = UserUtil.getUserFromSecurityContext();
			if (currentUser != null) {
				return new Locale(currentUser.getLanguage());
			}
			return null;
		} catch (AccessDeniedException e) {
			return null;
		}
    }

}


text:
using System.Linq.Expressions;
using ExcelFormulaExpressionParser.Extensions;
using ExcelFormulaParser;
using NFluent;
using Xunit;

namespace ExcelFormulaExpressionParser.Tests
{
    partial class OperandFunctionTests
    {
        [Fact]
        public void OperandFunction_Math_Multiply()
        {
            // Assign
            var formula = new ExcelFormula("=3 * 7 * 9");

            // Act
            Expression expression = new ExpressionParser(formula).Parse();
            var result = expression.LambdaInvoke<double>();

            // Assert
            Check.That(result).IsEqualTo(189);
        }

        [Fact]
        public void OperandFunction_Math_Multiply_Negative()
        {
            // Assign
            var formula = new ExcelFormula("=-3 * 7");

            // Act
            Expression expression = new ExpressionParser(formula).Parse();
            var result = expression.LambdaInvoke<double>();

            // Assert
            Check.That(result).IsEqualTo(-21);
        }

        [Fact]
        public void OperandFunction_Math_Multiply_Negative_Both()
        {
            // Assign
            var formula = new ExcelFormula("=-3 * -7");

            // Act
            Expression expression = new ExpressionParser(formula).Parse();
            var result = expression.LambdaInvoke<double>();

            // Assert
            Check.That(result).IsEqualTo(21);
        }

        [Fact]
        public void OperandFunction_Math_Order()
        {
            // Assign
            var formula = new ExcelFormula("=10 * 50 + 20");

            // Act
            Expression expression = new ExpressionParser(formula).Parse();
            var result = expression.LambdaInvoke<double>();

            // Assert
            Check.That(result).IsEqualTo(520);
        }

        [Fact]
        public void OperandFunction_Math_Sum()
        {
            // Assign
            var formula = new ExcelFormula("=SUM(1,2,3)");

            // Act
            Expression expression = new ExpressionParser(formula).Parse();
            var result = expression.LambdaInvoke<double>();

            // Assert
            Check.That(result).IsEqualTo(6);
        }
    }
}


text:
import { Then, When } from 'cucumber';
const homeSteps = require(__srcdir + '/steps/home/homeSteps.js');

let hSteps = new homeSteps(__wdriver);

Then(/^the home page is loaded$/, {timeout: 2 * 5000}, async () => {
    await hSteps.isLoaded();
    await hSteps.verifyIsLoaded();
});

When(/^click logout from the home page$/, async() => {
    await hSteps.clickLogout();
});

When(/^I click the panel "(.*)"$/, async title => {
    await hSteps.clickQuickStartPanel(title);
});

Then(/^the dashboards panel contains a link to "(.*)"$/, async dbdName => {
    await hSteps.verifyDbdPanelDashboard(dbdName);
});

When(/^click the dashboard link to "(.*)"$/, async dbdName => {

    await hSteps.clickDbdPanelDashboard(dbdName);

});

Then(/^the dashboards panel contains links:$/, async links => {
    await hSteps.verifyDashboardLinksInPanel(links);
});

When(/^click the dashboards panel link "(.*)"$/, async link => {
    await hSteps.clickDashboardLinkFromPanel(link);
});


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.bigquery.model;

/**
 * Model definition for DestinationTableProperties.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the BigQuery API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class DestinationTableProperties extends com.google.api.client.json.GenericJson {

  /**
   * [Optional] The description for the destination table. This will only be used if the destination
   * table is newly created. If the table already exists and a value different than the current
   * description is provided, the job will fail.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String description;

  /**
   * [Internal] This field is for Google internal use only.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private com.google.api.client.util.DateTime expirationTime;

  /**
   * [Optional] The friendly name for the destination table. This will only be used if the
   * destination table is newly created. If the table already exists and a value different than the
   * current friendly name is provided, the job will fail.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String friendlyName;

  /**
   * [Optional] The labels associated with this table. You can use these to organize and group your
   * tables. This will only be used if the destination table is newly created. If the table already
   * exists and labels are different than the current labels are provided, the job will fail.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.String> labels;

  /**
   * [Optional] The description for the destination table. This will only be used if the destination
   * table is newly created. If the table already exists and a value different than the current
   * description is provided, the job will fail.
   * @return value or {@code null} for none
   */
  public java.lang.String getDescription() {
    return description;
  }

  /**
   * [Optional] The description for the destination table. This will only be used if the destination
   * table is newly created. If the table already exists and a value different than the current
   * description is provided, the job will fail.
   * @param description description or {@code null} for none
   */
  public DestinationTableProperties setDescription(java.lang.String description) {
    this.description = description;
    return this;
  }

  /**
   * [Internal] This field is for Google internal use only.
   * @return value or {@code null} for none
   */
  public com.google.api.client.util.DateTime getExpirationTime() {
    return expirationTime;
  }

  /**
   * [Internal] This field is for Google internal use only.
   * @param expirationTime expirationTime or {@code null} for none
   */
  public DestinationTableProperties setExpirationTime(com.google.api.client.util.DateTime expirationTime) {
    this.expirationTime = expirationTime;
    return this;
  }

  /**
   * [Optional] The friendly name for the destination table. This will only be used if the
   * destination table is newly created. If the table already exists and a value different than the
   * current friendly name is provided, the job will fail.
   * @return value or {@code null} for none
   */
  public java.lang.String getFriendlyName() {
    return friendlyName;
  }

  /**
   * [Optional] The friendly name for the destination table. This will only be used if the
   * destination table is newly created. If the table already exists and a value different than the
   * current friendly name is provided, the job will fail.
   * @param friendlyName friendlyName or {@code null} for none
   */
  public DestinationTableProperties setFriendlyName(java.lang.String friendlyName) {
    this.friendlyName = friendlyName;
    return this;
  }

  /**
   * [Optional] The labels associated with this table. You can use these to organize and group your
   * tables. This will only be used if the destination table is newly created. If the table already
   * exists and labels are different than the current labels are provided, the job will fail.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.String> getLabels() {
    return labels;
  }

  /**
   * [Optional] The labels associated with this table. You can use these to organize and group your
   * tables. This will only be used if the destination table is newly created. If the table already
   * exists and labels are different than the current labels are provided, the job will fail.
   * @param labels labels or {@code null} for none
   */
  public DestinationTableProperties setLabels(java.util.Map<String, java.lang.String> labels) {
    this.labels = labels;
    return this;
  }

  @Override
  public DestinationTableProperties set(String fieldName, Object value) {
    return (DestinationTableProperties) super.set(fieldName, value);
  }

  @Override
  public DestinationTableProperties clone() {
    return (DestinationTableProperties) super.clone();
  }

}


text:
These instructions will walk you through downloading Container Linux, bundling the image, and running an instance from it.

## Import the image

These steps will download the Container Linux image, uncompress it, convert it from qcow to raw, and then import it into Eucalyptus. In order to convert the image you will need to install `qemu-img` with your favorite package manager.

### Choosing a channel

Container Linux is released into alpha, beta, and stable channels. Releases to each channel serve as a release candidate for the next channel. For example, a bug-free alpha release is promoted bit-for-bit to the beta channel.

The channel is selected based on the URL below. Simply replace `alpha` with `beta`. Read the [release notes](https://coreos.com/releases) for specific features and bug fixes in each channel.

```sh
$ wget -q https://alpha.release.core-os.net/amd64-usr/current/coreos_production_openstack_image.img.bz2
$ bunzip2 coreos_production_openstack_image.img.bz2
$ qemu-img convert -O raw coreos_production_openstack_image.img coreos_production_openstack_image.raw
$ euca-bundle-image -i coreos_production_openstack_image.raw -r x86_64 -d /var/tmp
00% |====================================================================================================|   5.33 GB  59.60 MB/s Time: 0:01:35
Wrote manifest bundle/coreos_production_openstack_image.raw.manifest.xml
$ euca-upload-bundle -m /var/tmp/coreos_production_openstack_image.raw.manifest.xml -b coreos-production
Uploaded coreos-production/coreos_production_openstack_image.raw.manifest.xml
$ euca-register coreos-production/coreos_production_openstack_image.raw.manifest.xml --virtualization-type hvm --name "Container Linux-Production"
emi-E4A33D45
```

## Boot it up

Now generate the ssh key that will be injected into the image for the `core` user and boot it up!

```sh
$ euca-create-keypair coreos > core.pem
$ euca-run-instances emi-E4A33D45 -k coreos -t m1.medium -g default
...
```

Your first Container Linux instance should now be running. The only thing left to do is find the IP and SSH in.

```sh
$ euca-describe-instances | grep coreos
RESERVATION     r-BCF44206      498025213678    group-1380012085
INSTANCE        i-22444094      emi-E4A33D45    euca-10-0-1-61.cloud.home       euca-172-16-0-56.cloud.internal running coreos  0
                m1.small        2013-10-02T05:32:44.096Z        one     eki-05573B4A    eri-EA7436D2            monitoring-enabled      10.0.1.61    172.16.0.56                     instance-store                                  paravirtualized         5046c208-fec1-4a6e-b079-e7cdf6a7db8f_one_1

```

Finally SSH into it, note that the user is `core`:

```sh
$ chmod 400 core.pem
$ ssh -i core.pem core@10.0.1.61
   ______                ____  _____
  / ____/___  ________  / __ \/ ___/
 / /   / __ \/ ___/ _ \/ / / /\__ \
/ /___/ /_/ / /  /  __/ /_/ /___/ /
\____/\____/_/   \___/\____//____/

core@10-0-0-3 ~ $
```

## Using CoreOS Container Linux

Now that you have a machine booted it is time to play around. Check out the [Container Linux Quickstart](quickstart.md) guide or dig into [more specific topics](https://coreos.com/docs).


text:
describe "Quickbooks::Service::Report" do
  before(:all) do
    construct_service :reports
  end

  describe '.url_for_query()' do
    it 'uses "BalanceSheet" and "This Fiscal Year to date" as the default parameters' do
      expect(@service.url_for_query()).to eq('https://quickbooks.api.intuit.com/v3/company/9991111222/reports/BalanceSheet?date_macro=This+Fiscal+Year-to-date')
    end

    it 'allows overriding the report type' do
      expect(@service.url_for_query('ProfitAndLoss')).to eq('https://quickbooks.api.intuit.com/v3/company/9991111222/reports/ProfitAndLoss?date_macro=This+Fiscal+Year-to-date')
    end

    it 'allows overriding the date_macro' do
      expect(@service.url_for_query('BalanceSheet', 'Last Year')).to eq('https://quickbooks.api.intuit.com/v3/company/9991111222/reports/BalanceSheet?date_macro=Last+Year')
    end

    it 'allows passing additional query parameters' do
      url = @service.url_for_query('BalanceSheet', 'Last Year',
        :start_date => '2015-01-01',
        :end_date => '2015-01-31',
        :accounting_method => 'Cash',
        :columns => 'subt_nat_amount,tax_amount',
      )
      expect(url).to eq('https://quickbooks.api.intuit.com/v3/company/9991111222/reports/BalanceSheet?start_date=2015-01-01&end_date=2015-01-31&accounting_method=Cash&columns=subt_nat_amount,tax_amount')
    end

    it 'currently ignores the date_macro argument when passed in additional options' do
      expect(@service.url_for_query('BalanceSheet', 'Today', :accounting_method => 'Cash')).to eq('https://quickbooks.api.intuit.com/v3/company/9991111222/reports/BalanceSheet?accounting_method=Cash')
    end
  end

  it 'forwards arguments to .url_for_query' do
    xml = fixture("balancesheet.xml")
    url = @service.url_for_query('BalanceSheet', 'Today', :accounting_method => 'Cash')
    stub_http_request(:get, url, ["200", "OK"], xml)

    @service.query('BalanceSheet', 'Today', :accounting_method => 'Cash')
  end

  it "returns a Report model" do
    xml = fixture("balancesheet.xml")

    stub_http_request(:get, @service.url_for_query, ["200", "OK"], xml)
    report = @service.query('BalanceSheet')

    expect(report).to be_a Quickbooks::Model::Report
  end

end


text:
package gorma

import "fmt"

// NewBuildSource returns an initialized BuildSource
func NewBuildSource() *BuildSource {
	bs := &BuildSource{}
	return bs
}

// Context returns the generic definition name used in error messages.
func (f *BuildSource) Context() string {
	if f.BuildSourceName != "" {
		return fmt.Sprintf("BuildSource %#v", f.BuildSourceName)
	}
	return "unnamed BuildSource"
}

// DSL returns this object's DSL.
func (f *BuildSource) DSL() func() {
	return f.DefinitionDSL
}


text:
package com.greenpepper.samples.application.calculator;

/**
 * Demo SUT Application.
 *
 * @author oaouattara
 * @version $Id: $Id
 */
public class Division
{
    public double dividend;
    public double divisor;

    /**
     *
quotient.

     *
     * @return a double.
     */
    public double quotient()
    {
        return dividend / divisor;
    }
}


text:
namespace net {

QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id,
                                                   QuicSpdySession* session,
                                                   const BoundNetLog& net_log)
    : QuicDataStream(id, session),
      net_log_(net_log),
      delegate_(nullptr),
      headers_delivered_(false),
      weak_factory_(this) {}

QuicReliableClientStream::~QuicReliableClientStream() {
  if (delegate_)
    delegate_->OnClose(connection_error());
}

void QuicReliableClientStream::OnStreamHeadersComplete(bool fin,
                                                       size_t frame_len) {
  QuicDataStream::OnStreamHeadersComplete(fin, frame_len);
  // The delegate will read the headers via a posted task.
  NotifyDelegateOfHeadersCompleteLater();
}

void QuicReliableClientStream::OnDataAvailable() {
  // TODO(rch): buffer data if we don't have a delegate.
  if (!delegate_) {
    DLOG(ERROR) << "Missing delegate";
    Reset(QUIC_STREAM_CANCELLED);
    return;
  }

  if (!FinishedReadingHeaders() || !headers_delivered_) {
    // Buffer the data in the sequencer until the headers have been read.
    return;
  }

  // The delegate will read the data via a posted task, and
  // will be able to, potentially, read all data which has queued up.
  NotifyDelegateOfDataAvailableLater();
}

void QuicReliableClientStream::OnClose() {
  if (delegate_) {
    delegate_->OnClose(connection_error());
    delegate_ = nullptr;
  }
  ReliableQuicStream::OnClose();
}

void QuicReliableClientStream::OnCanWrite() {
  ReliableQuicStream::OnCanWrite();

  if (!HasBufferedData() && !callback_.is_null()) {
    base::ResetAndReturn(&callback_).Run(OK);
  }
}

QuicPriority QuicReliableClientStream::EffectivePriority() const {
  if (delegate_ && delegate_->HasSendHeadersComplete()) {
    return QuicDataStream::EffectivePriority();
  }
  return QuicWriteBlockedList::kHighestPriority;
}

int QuicReliableClientStream::WriteStreamData(
    base::StringPiece data,
    bool fin,
    const CompletionCallback& callback) {
  // We should not have data buffered.
  DCHECK(!HasBufferedData());
  // Writes the data, or buffers it.
  WriteOrBufferData(data, fin, nullptr);
  if (!HasBufferedData()) {
    return OK;
  }

  callback_ = callback;
  return ERR_IO_PENDING;
}

void QuicReliableClientStream::SetDelegate(
    QuicReliableClientStream::Delegate* delegate) {
  DCHECK(!(delegate_ && delegate));
  delegate_ = delegate;
  if (delegate == nullptr && sequencer()->IsClosed()) {
    OnFinRead();
  }
}

void QuicReliableClientStream::OnError(int error) {
  if (delegate_) {
    QuicReliableClientStream::Delegate* delegate = delegate_;
    delegate_ = nullptr;
    delegate->OnError(error);
  }
}

int QuicReliableClientStream::Read(IOBuffer* buf, int buf_len) {
  if (sequencer()->IsClosed())
    return 0;  // EOF

  if (!HasBytesToRead())
    return ERR_IO_PENDING;

  iovec iov;
  iov.iov_base = buf->data();
  iov.iov_len = buf_len;
  return Readv(&iov, 1);
}

bool QuicReliableClientStream::CanWrite(const CompletionCallback& callback) {
  bool can_write =  session()->connection()->CanWrite(HAS_RETRANSMITTABLE_DATA);
  if (!can_write) {
    session()->MarkConnectionLevelWriteBlocked(id(), EffectivePriority());
    DCHECK(callback_.is_null());
    callback_ = callback;
  }
  return can_write;
}

void QuicReliableClientStream::NotifyDelegateOfHeadersCompleteLater() {
  DCHECK(delegate_);
  base::ThreadTaskRunnerHandle::Get()->PostTask(
      FROM_HERE,
      base::Bind(&QuicReliableClientStream::NotifyDelegateOfHeadersComplete,
                 weak_factory_.GetWeakPtr()));
}

void QuicReliableClientStream::NotifyDelegateOfHeadersComplete() {
  if (!delegate_)
    return;

  size_t headers_len = decompressed_headers().length();
  SpdyHeaderBlock headers;
  SpdyFramer framer(SpdyUtils::GetSpdyVersionForQuicVersion(version()));
  size_t len = framer.ParseHeaderBlockInBuffer(decompressed_headers().data(),
                                               headers_len, &headers);
  MarkHeadersConsumed(headers_len);
  headers_delivered_ = true;
  if (len == 0 || len != headers_len) {
    DLOG(WARNING) << "Invalid headers";
    Reset(QUIC_BAD_APPLICATION_PAYLOAD);
    return;
  }

  delegate_->OnHeadersAvailable(headers);
}

void QuicReliableClientStream::NotifyDelegateOfDataAvailableLater() {
  DCHECK(delegate_);
  base::ThreadTaskRunnerHandle::Get()->PostTask(
      FROM_HERE,
      base::Bind(&QuicReliableClientStream::NotifyDelegateOfDataAvailable,
                 weak_factory_.GetWeakPtr()));
}

void QuicReliableClientStream::NotifyDelegateOfDataAvailable() {
  if (delegate_)
    delegate_->OnDataAvailable();
}

}  // namespace net


text:
package com.wci.umls.server.algo;

import java.util.List;

import com.wci.umls.server.AlgorithmParameter;
import com.wci.umls.server.ProcessExecution;
import com.wci.umls.server.ValidationResult;
import com.wci.umls.server.helpers.Configurable;
import com.wci.umls.server.helpers.HasProject;
import com.wci.umls.server.services.RootService;
import com.wci.umls.server.services.helpers.ProgressReporter;

/**
 * Represents an algortihm. Implementations must fully configure themselves
 * before the compute call is made.
 */
public interface Algorithm
    extends RootService, ProgressReporter, Configurable, HasProject {

  /**
   * Check preconditions for action. This will make use of data structures
   * configured in the action.
   *
   * @return true, if successful
   * @throws Exception the exception
   */
  public ValidationResult checkPreconditions() throws Exception;

  /**
   * Compute.
   *
   * @throws Exception the exception
   */
  public void compute() throws Exception;

  /**
   * Rests to initial conditions.
   *
   * @throws Exception the exception
   */
  public void reset() throws Exception;

  /**
   * Cancel.
   *
   * @throws Exception the exception
   */
  public void cancel() throws Exception;

  /**
   * Sets the activity id.
   *
   * @param activityId the activity id
   */
  public void setActivityId(String activityId);

  /**
   * Sets the work id.
   *
   * @param workId the work id
   */
  public void setWorkId(String workId);

  /**
   * Returns the process.
   *
   * @return the process
   */
  public ProcessExecution getProcess();

  /**
   * Sets the process.
   *
   * @param process the process
   */
  public void setProcess(ProcessExecution process);

  /**
   * Returns the parameters.
   *
   * @return the parameters
   * @throws Exception the exception
   */
  public List<AlgorithmParameter> getParameters() throws Exception;

  /**
   * Sets the parameters.
   *
   * @param parameter the parameters
   * @throws Exception the exception
   */
  public void setParameters(List<AlgorithmParameter> parameter)
    throws Exception;

  /**
   * Returns the default description, especially for algorithms that are
   * configured via algorighm configs.
   *
   * @return the description
   */
  public String getDescription();

  /**
   * Returns the terminology.
   *
   * @return the terminology
   */
  public String getTerminology();

  /**
   * Sets the terminology.
   *
   * @param terminology the terminology
   */
  public void setTerminology(String terminology);

  /**
   * Returns the version.
   *
   * @return the version
   */
  public String getVersion();

  /**
   * Sets the version.
   *
   * @param version the version
   */
  public void setVersion(String version);

}


text:
:orphan:

.. _install:

Installation
------------

Using setuptools
~~~~~~~~~~~~~~~~

To obtain the latest released version of statsmodels using pip

    pip install -U statsmodels

Or follow `this link to our PyPI page <https://pypi.python.org/pypi/statsmodels>`__, download
the wheel or source and install.

Statsmodels is also available in through conda provided by
`Anaconda <https://www.continuum.io/downloads>`__. The latest release can
be installed using

    conda install -c conda-forge statsmodels

Obtaining the Source
~~~~~~~~~~~~~~~~~~~~

We do not release very often but the master branch of our source code is
usually fine for everyday use. You can get the latest source from our
`github repository <https://github.com/statsmodels/statsmodels>`__. Or if you
have git installed::

    git clone git://github.com/statsmodels/statsmodels.git

If you want to keep up to date with the source on github just periodically do::

    git pull

in the statsmodels directory.

Installation from Source
~~~~~~~~~~~~~~~~~~~~~~~~

You will need a C compiler installed to build statsmodels. If you are building
from the github source and not a source release, then you will also need
Cython. You can follow the instructions below to get a C compiler setup for Windows.

Linux
^^^^^

Once you have obtained the source, you can do (with appropriate permissions)::

    python setup.py install

Or::

    python setup.py build
    python setup.py install

Windows
^^^^^^^

It is strongly recommended to use 64-bit Python if possible.

Python 2.7
~~~~~~~~~~
Obtain
`Microsoft Visual C++ Compiler for Python 2.7 <https://www.microsoft.com/en-gb/download/details.aspx?id=44266>`__
and then install using

    python setup.py install

Python 3.5
~~~~~~~~~~
Download and install the most recent version of
`Visual Studio Community Edition <https://www.visualstudio.com/vs/community/>`__
and then install using

    python setup.py install

32-bit or other versions of Python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can build 32-bit version of the code on windows using mingw32.

First, get and install `mingw32 <http://www.mingw.org/>`__. Then, you'll need to edit distutils.cfg. This is usually found somewhere like C:\Python27\Lib\distutils\distutils.cfg. Add these lines::

    [build]
    compiler=mingw32

Then in the statsmodels directory do::

    python setup.py build
    python setup.py install

OR

You can build 32-bit Microsoft SDK. Detailed instructions can be found on the
Cython wiki `here <https://github.com/cython/cython/wiki/CythonExtensionsOnWindows>`__.
The gist of these instructions follow. You will need to download the free
Windows SDK C/C++ compiler from Microsoft. You must use
the **Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1** to be
comptible with Python 2.7, 3.1, and 3.2. The link for the 3.5 SP1 version is

`https://www.microsoft.com/en-us/download/details.aspx?id=18950 <https://www.microsoft.com/en-us/download/details.aspx?id=18950>`__

For Python 3.3 and 3.4, you need to use the **Microsoft Windows SDK for Windows 7 and .NET Framework 4**,
available from

`https://www.microsoft.com/en-us/download/details.aspx?id=8279 <https://www.microsoft.com/en-us/download/details.aspx?id=8279>`__

For 7.0, get the ISO file GRMSDKX_EN_DVD.iso for AMD64. After you install this,
open the SDK Command Shell (Start -> All Programs ->
Microsoft Windows SDK v7.0 -> CMD Shell). CD to the statsmodels directory and type::

    set DISTUTILS_USE_SDK=1

To build a 64-bit application type::

    setenv /x64 /release

To build a 32-bit application type::

    setenv /x86 /release

The prompt should change colors to green. Then proceed as usual to install::

    python setup.py build
    python setup.py install

For 7.1, the instructions are exactly the same, except you use the download
link provided above and make sure you are using SDK 7.1.

If you want to accomplish the same without opening up the SDK CMD SHELL, then
you can use these commands at the CMD Prompt or in a batch file.::

    setlocal EnableDelayedExpansion
    CALL "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd" /x64 /release
    set DISTUTILS_USE_SDK=1

Replace `/x64` with `/x86` and `v7.0` with `v7.1` as needed.

Dependencies
~~~~~~~~~~~~

The current minimum dependencies are:

* `Python <https://www.python.org>`__ >= 2.7, including Python 3.4+
* `NumPy <http://www.scipy.org/>`__ >= 1.11
* `SciPy <http://www.scipy.org/>`__ >= 0.18
* `Pandas <http://pandas.pydata.org/>`__ >= 0.19
* `Patsy <https://patsy.readthedocs.io/en/latest/>`__ >= 0.4.0
* `Cython <http://cython.org/>`__ >= 0.24 is required to build the code from
  github but not from a source distribution.

Given the long release cycle, Statsmodels follows a loose time-based policy for
dependencies: minimal dependencies are lagged about one and a half to two
years. Our next planned update of minimum versions in `setup.py` is expected in
September 2018, when we will update to reflect Numpy >= 1.12 (released January
2017), Scipy >= 0.19 (released March 2017) and Pandas >= 0.20 (released May
2017).

Optional Dependencies
~~~~~~~~~~~~~~~~~~~~~

* `Matplotlib <http://matplotlib.org/>`__ >= 1.5 is needed for plotting
  functions and running many of the examples.
* If installed, `X-12-ARIMA <http://www.census.gov/srd/www/x13as/>`__ or
  `X-13ARIMA-SEATS <http://www.census.gov/srd/www/x13as/>`__ can be used
  for time-series analysis.
* `pytest <https://docs.pytest.org/en/latest/>`__ is required to run
  the test suite.
* `IPython <http://ipython.org>`__ >= 3.0 is required to build the
  docs locally or to use the notebooks.
* `joblib <http://pythonhosted.org/joblib/>`__ >= 0.9 can be used to accelerate distributed
  estimation for certain models.
* `jupyter <http://jupyter.org/>`__ is needed to run the notebooks.


text:
package org.voovan.tools.weave;

/**
 * 代码织入配置对象
 * @author helyho
 * voovan Framework.
 * WebSite: https://github.com/helyho/voovan
 * Licence: Apache v2 License
 */
public class WeaveConfig {
    private String agent;   //AgentJar 文件
    private String scan;    //扫描的包路径, 可逗号分割多个包
    private String inject;  //注入的包路径, 可逗号分割多个包

    public WeaveConfig(String agent, String scan, String Injinjectect) {
        this.agent = agent;
        this.scan = scan;
        this.inject = inject;
    }

    public WeaveConfig(String scan, String inject) {
        this.scan = scan;
        this.inject = inject;
    }

    public WeaveConfig(String scanAndWeave) {
        this.scan = scanAndWeave;
        this.inject = scanAndWeave;
    }

    public String getAgent() {
        return agent;
    }

    public void setAgent(String agent) {
        this.agent = agent;
    }

    public String getScan() {
        return scan;
    }

    public void setScan(String scan) {
        this.scan = scan;
    }

    public String getInject() {
        return inject;
    }

    public void setInject(String inject) {
        this.inject = inject;
    }

    public boolean isInject(String className) {
        for(String injectPackage : inject.split(",")){
            if(className.startsWith(injectPackage)){
                return true;
            }
        }

        return false;
    }
}


text:
/**
 *
 * @author greg (at) myrobotlab.org
 *
 * This file is part of MyRobotLab (http://myrobotlab.org).
 *
 * MyRobotLab is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version (subject to the "Classpath" exception
 * as provided in the LICENSE.txt file that accompanied this code).
 *
 * MyRobotLab is distributed in the hope that it will be useful or fun,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * All libraries in thirdParty bundle are subject to their own license
 * requirements - please refer to http://myrobotlab.org/libraries for
 * details.
 *
 * Enjoy !
 *
 * */

package org.myrobotlab.service;

import java.awt.Color;
import java.awt.Dimension;
import java.util.HashMap;
import java.util.Random;

import org.myrobotlab.framework.Service;
import org.myrobotlab.logging.Level;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.interfaces.ServiceInterface;
import org.slf4j.Logger;

public class Graphics extends Service {

	private static final long serialVersionUID = 1L;

	public final static Logger log = LoggerFactory.getLogger(Graphics.class.getCanonicalName());

	public int width = 640;
	public int height = 480;

	public String guiServiceName = null;

	HashMap<String, Color> plotColorMap = new HashMap<String, Color>();

	HashMap<String, Integer> plotXValueMap = new HashMap<String, Integer>();

	public Random rand = new Random();

	int plotTextStart = 10;

	public static void main(String[] args) {
		LoggingFactory.getInstance().configure();
		LoggingFactory.getInstance().setLevel(Level.DEBUG);
		try {
			GUIService gui = new GUIService("gui");
			Graphics graph = new Graphics("graph");
			// OpenCV opencv = new OpenCV("opencv");
			// manual intervention - clear screen

			gui.startService();
			graph.startService();

			graph.attach(gui.getName());
			graph.createGraph(640, 480);
			graph.setColor(new Color(0x666666));
			graph.drawGrid(10, 10);

		} catch (Exception e) {
			Logging.logError(e);
		}

		// graph.draw

	}

	public Graphics(String n) {
		super(n);
	}

	// in order for a graphics service to work it needs to be associated with a
	// GUIService
	// this is how to associate it
	public boolean attach(String guiServiceName) {
		ServiceInterface sw = Runtime.getService(guiServiceName);
		if (sw.getClass() != GUIService.class) {
			log.warn(String.format("attaching type of %s instead of GUIService instance %s", sw.getSimpleName(), guiServiceName));
		}
		this.guiServiceName = guiServiceName;
		return true;
	}

	public void clearRect(Integer x, Integer y, Integer width, Integer height) {
		send(guiServiceName, "clearRect", x, y, width, height);
	}

	public void createGraph() {
		createGraph(width, height);
	}

	/*
	 * publishing points begin -------------------------------------------- This
	 * would be fore static routes and invoking - but it is abondoned for
	 * non-static routes and message "send"ing with more robuts parameter
	 * handling
	 */
	// sent to GUIService - TODO - this message node CAN NOT be private
	// (unfortunately) because the invoking is only allowed to touch
	// public methods - This is a little confusing, because the "user" of this
	// function might think it does something immediately
	// in actuality it does something only when it is INVOKED
	public Dimension createGraph(Dimension d) {
		return d;
	}

	public void createGraph(Integer x, Integer y) {
		send(guiServiceName, "createGraph", new Dimension(x, y));
	}

	public void detach() {
		this.guiServiceName = null;
	}

	public void drawGrid(Integer x, Integer y) {
		send(guiServiceName, "drawGrid", x, y);
	}

	// wrappers end --------------------------

	// wrappers begin --------------------------
	public void drawLine(Integer x1, Integer y1, Integer x2, Integer y2) {
		send(guiServiceName, "drawLine", x1, y1, x2, y2);
	}

	public void drawRect(Integer x, Integer y, Integer width, Integer height) {
		send(guiServiceName, "drawRect", x, y, width, height);
	}

	/*
	 * publishing points end --------------------------------------------
	 */

	public void drawString(String str, Integer x, Integer y) {
		send(guiServiceName, "drawString", str, x, y);
	}

	public void fillOval(Integer x, Integer y, Integer width, Integer height) {
		send(guiServiceName, "fillOval", x, y, width, height);
	}

	public void fillRect(Integer x, Integer y, Integer width, Integer height) {
		send(guiServiceName, "fillRect", x, y, width, height);
	}

	@Override
	public String[] getCategories() {
		return new String[] { "display" };
	}

	/*
	 * public void plot(Message msg) { if (msg.data == null)
	 *
	 * if (!plotColorMap.containsKey(msg.sender)) { Color color = new
	 * Color(rand.nextInt(16777215)); plotColorMap.put(msg.sender, color);
	 * setColor(plotColorMap.get(msg.sender)); drawString(msg.sender, 10,
	 * plotTextStart); plotTextStart += 10; }
	 *
	 * if (!plotXValueMap.containsKey(msg.sender)) { Integer x = new Integer(0);
	 * plotXValueMap.put(msg.sender, x); }
	 *
	 * Integer value = cfg.getInt("height"); if (msg.data != null &&
	 * msg.data.length > 0) { value = (Integer) msg.data[0]; }
	 *
	 * int x = plotXValueMap.get(msg.sender); int y = cfg.getInt("height") -
	 * value % cfg.getInt("height"); setColor(plotColorMap.get(msg.sender));
	 * drawLine(x, y, x, y); if (x % cfg.getInt("width") == 0 || y %
	 * cfg.getInt("height") == 0) { int textPos = 10; Iterator<String> it =
	 * plotColorMap.keySet().iterator(); while (it.hasNext()) { String name =
	 * it.next(); setColor(plotColorMap.get(name)); drawString(name, 10,
	 * textPos); textPos += 10; } } plotXValueMap.put(msg.getName(), ++x %
	 * cfg.getInt("width")); }
	 */

	@Override
	public String getDescription() {
		return "a graphics service encapsulating Java swing graphic methods";
	}

	public void refreshDisplay() {
		send(guiServiceName, "refreshDisplay");
	}

	public void setColor(Color c) {
		send(guiServiceName, "setColor", c);
	}

}


text:
#include <stdio.h>
#include <stdint.h>

#include "../lib/includes.h"

#include "types.h"
#include "fieldset.h"
#include "filter.h"

#ifndef STATE_H
#define STATE_H

#define MAX_PACKET_SIZE 4096
#define MAC_ADDR_LEN_BYTES 6

struct probe_module;
struct output_module;

struct fieldset_conf {
	fielddefset_t defs;
	fielddefset_t outdefs;
	translation_t translation;
	int success_index;
	int classification_index;
};

// global configuration
struct state_conf {
	int log_level;
	port_h_t target_port;
	port_h_t source_port_first;
	port_h_t source_port_last;
	// maximum ttl use in header when perform a router scan
	int max_ttl;
	// maximum number of packets that the scanner will send before terminating
	uint32_t max_targets;
	// maximum number of seconds that scanner will run before terminating
	uint32_t max_runtime;
	// maximum number of results before terminating
	uint32_t max_results;
	// name of network interface that
   	// will be utilized for sending/receiving
	char *iface;
	// rate in packets per second
	// that the sender will maintain
	int rate;
	// rate in bits per second
	uint64_t bandwidth;
	// how many seconds after the termination of the sender will the receiver
	// continue to process responses
	int cooldown_secs;
	// number of sending threads
	uint8_t senders;
	// should use CLI provided randomization seed instead of generating
	// a random seed.
	int use_seed;
	uint32_t seed;
	// generator of the cyclic multiplicative group that is utilized for
	// address generation
	uint32_t generator;
	// sharding options
	uint8_t shard_num;
	uint8_t total_shards;
	int packet_streams;
	struct probe_module *probe_module;
	struct output_module *output_module;
	char *probe_args;
	char *output_args;
	macaddr_t gw_mac[MAC_ADDR_LEN_BYTES];
	macaddr_t hw_mac[MAC_ADDR_LEN_BYTES];
	uint32_t gw_ip;
	int gw_mac_set;
	int send_ip_pkts;
	char *source_ip_first;
	char *source_ip_last;
	char *output_filename;
	char *blacklist_filename;
	char *whitelist_filename;
	char *metadata_filename;
	FILE *metadata_file;
	char **destination_cidrs;
	int destination_cidrs_len;
	char *raw_output_fields;
	char **output_fields;
	struct output_filter filter;
	char *output_filter_str;
	struct fieldset_conf fsconf;
	int output_fields_len;
	char *log_file;
	char *log_directory;
	int dryrun;
	int summary;
	int quiet;
	int syslog;
	int filter_duplicates;
	int filter_unsuccessful;
	int recv_ready;
};
extern struct state_conf zconf;

// global sender stats
struct state_send {
	double start;
	double finish;
	uint32_t sent;
	uint32_t blacklisted;
	int complete;
	uint32_t first_scanned;
	uint32_t targets;
	uint32_t sendto_failures;
	uint32_t max_index;
};
extern struct state_send zsend;

// global receiver stats
struct state_recv {
	// valid responses classified as "success"
	uint32_t success_total;
	// unique IPs that sent valid responses classified as "success"
	uint32_t success_unique;
	// valid responses classified as "success" received during cooldown
	uint32_t cooldown_total;
	// unique IPs that first sent valid "success"es during cooldown
	uint32_t cooldown_unique;
	// valid responses NOT classified as "success"
	uint32_t failure_total;

	int complete;  // has the scanner finished sending?
	double start;  // timestamp of when recv started
	double finish; // timestamp of when recv terminated

	// number of packets captured by pcap filter
	uint32_t pcap_recv;
	// number of packets dropped because there was no room in
	// the operating system's buffer when they arrived, because
	// packets weren't being read fast enough
	uint32_t pcap_drop;
	// number of packets dropped by the network interface or its driver.
	uint32_t pcap_ifdrop;

};
extern struct state_recv zrecv;

#endif // _STATE_H


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Functions for listing directories
 *
 * @package PhpMyAdmin
 */
namespace PhpMyAdmin;

/**
 * PhpMyAdmin\FileListing class
 *
 * @package PhpMyAdmin
 */
class FileListing
{
    /**
     * Returns array of filtered file names
     *
     * @param string $dir        directory to list
     * @param string $expression regular expression to match files
     *
     * @return array   sorted file list on success, false on failure
     */
    public static function getDirContent($dir, $expression = '')
    {
        if (!@file_exists($dir) || !($handle = @opendir($dir))) {
            return false;
        }

        $result = array();
        if (substr($dir, -1) != '/') {
            $dir .= '/';
        }
        while ($file = @readdir($handle)) {
            if (@is_file($dir . $file)
                && ! @is_link($dir . $file)
                && ($expression == '' || preg_match($expression, $file))
            ) {
                $result[] = $file;
            }
        }
        closedir($handle);
        asort($result);
        return $result;
    }

    /**
     * Returns options of filtered file names
     *
     * @param string $dir        directory to list
     * @param string $extensions regular expression to match files
     * @param string $active     currently active choice
     *
     * @return array   sorted file list on success, false on failure
     */
    public static function getFileSelectOptions($dir, $extensions = '', $active = '')
    {
        $list = self::getDirContent($dir, $extensions);
        if ($list === false) {
            return false;
        }
        $result = '';
        foreach ($list as $val) {
            $result .= '<option value="' . htmlspecialchars($val) . '"';
            if ($val == $active) {
                $result .= ' selected="selected"';
            }
            $result .= '>' . htmlspecialchars($val) . '</option>' . "\n";
        }
        return $result;
    }

    /**
     * Get currently supported decompressions.
     *
     * @return string separated list of extensions usable in self::getDirContent
     */
    public static function supportedDecompressions()
    {
        global $cfg;

        $compressions = '';

        if ($cfg['GZipDump'] && function_exists('gzopen')) {
            if (!empty($compressions)) {
                $compressions .= '|';
            }
            $compressions .= 'gz';
        }
        if ($cfg['BZipDump'] && function_exists('bzopen')) {
            if (!empty($compressions)) {
                $compressions .= '|';
            }
            $compressions .= 'bz2';
        }
        if ($cfg['ZipDump'] && function_exists('gzinflate')) {
            if (!empty($compressions)) {
                $compressions .= '|';
            }
            $compressions .= 'zip';
        }

        return $compressions;
    }
}


text:
<!DOCTYPE html>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<html>
<!--
Copyright 2007 Google Inc. All Rights Reserved.

-->
<head>
<title>Closure Unit Tests - goog.dom.TagName</title>
<script src="../base.js"></script>
<script>
  goog.require('goog.dom.TagName');
  goog.require('goog.object');
  goog.require('goog.testing.jsunit');
</script>
</head>
<body>

<script>

  function testCorrectNumberOfTagNames() {
    assertEquals(91, goog.object.getCount(goog.dom.TagName));
  }

  function testPropertyNamesEqualValues() {
    for (var propertyName in goog.dom.TagName) {
      assertEquals(propertyName, goog.dom.TagName[propertyName]);
    }
  }

</script>
</body>
</html>


text:
// For conditions of distribution and use, see copyright notice in LICENSE

#include "StableHeaders.h"
#include "DebugOperatorNew.h"

#include "UiAPI.h"
#include "UiMainWindow.h"
#include "UiGraphicsView.h"
#include "QtUiAsset.h"
#include "UiProxyWidget.h"

#include "CoreDefines.h"
#include "Application.h"
#include "Framework.h"
#include "AssetAPI.h"
#include "GenericAssetFactory.h"
#include "NullAssetFactory.h"
#include "LoggingFunctions.h"

#include <QMenuBar>
#include <QEvent>
#include <QLayout>
#include <QVBoxLayout>
#include <QScrollBar>
#include <QUiLoader>
#include <QFile>
#include <QDir>

#include "MemoryLeakCheck.h"

SuppressedPaintWidget::SuppressedPaintWidget(QWidget *parent, Qt::WindowFlags f)
:QWidget(parent, f)
{
    setAttribute(Qt::WA_PaintOnScreen);
    setAttribute(Qt::WA_NoSystemBackground);
    setAttribute(Qt::WA_OpaquePaintEvent, true);
}

bool SuppressedPaintWidget::event(QEvent *event)
{
    switch(event->type())
    {
    case QEvent::UpdateRequest:
    case QEvent::Paint:
    case QEvent::Wheel:
    case QEvent::Resize:
        return true;
    default:
        return QWidget::event(event);
    }
}

void SuppressedPaintWidget::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);
}

UiAPI::UiAPI(Framework *owner_) :
    owner(owner_),
    mainWindow(0),
    graphicsView(0),
    graphicsScene(0)
{
    /// @todo We don't support QML, remove the following
    QStringList qmlExtensions;
    qmlExtensions << ".qml" << ".qmlzip";

    if (owner_->IsHeadless())
    {
        owner_->Asset()->RegisterAssetTypeFactory(MAKE_SHARED(NullAssetFactory, "QtUiFile", ".ui"));
        owner_->Asset()->RegisterAssetTypeFactory(MAKE_SHARED(NullAssetFactory, "QtQmFile", qmlExtensions));
        return;
    }

    owner_->Asset()->RegisterAssetTypeFactory(MAKE_SHARED(GenericAssetFactory<QtUiAsset>, "QtUiFile", ".ui"));
    owner_->Asset()->RegisterAssetTypeFactory(MAKE_SHARED(GenericAssetFactory<QtUiAsset>, "QtQmFile", qmlExtensions));

    mainWindow = new UiMainWindow(owner);

    /* Unless the option --nomenubar was specified, assume that the startup UI for the Tundra main window will
       have a menu bar, and create one *immediately* here as a placeholder.
       This will enable having properly positioned window geometry for UiGraphicsView and UiMainWindow, so that
       the main Ogre render target will not be created to full size first, and afterwards resized to a smaller
       size when a script (e.g. menubar.js) eventually creates the menu bar.
       Resizing the main window causes a D3D9 device loss, so creating the menu here has the effect of optimizing
       Tundra startup to avoid a full D3D9 device Reset() (and a resubmit of all GPU resources).

       On the other hand if central widget is not used, it is imperative we do not make the menu show up yet. Otherwise
       the graphics view will be displayed on top of the menu.
    */
    if (!owner_->HasCommandLineParameter("--nomenubar") && !owner_->HasCommandLineParameter("--nocentralwidget"))
    {
        QMenuBar *menu = mainWindow->menuBar();
        menu->addMenu("&File"); // Need to add an element, or otherwise the menu will not show up.
    }

    mainWindow->setAutoFillBackground(false);
    mainWindow->setWindowIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/TundraLogo32px.ico"));
    connect(mainWindow, SIGNAL(WindowCloseEvent()), owner, SLOT(Exit()));

    // Prepare graphics view and scene
    graphicsView = new UiGraphicsView(owner_, mainWindow);

    // If debugging the compositing system, restore back default Qt window state.
    if (owner_->HasCommandLineParameter("--nouicompositing"))
    {
        graphicsView->setUpdatesEnabled(true);
        graphicsView->setAttribute(Qt::WA_DontShowOnScreen, false);
    }

    ///\todo Memory leak below, see very end of ~Renderer() for comments.

    // QMainWindow has a layout by default. It will not let you set another.
    // Leave this check here if the window type changes to for example QWidget so we dont crash then.
    if (!mainWindow->layout())
        mainWindow->setLayout(new QVBoxLayout());

    mainWindow->layout()->setMargin(0);
    mainWindow->layout()->setContentsMargins(0,0,0,0);

    if (owner_->HasCommandLineParameter("--nocentralwidget"))
        mainWindow->layout()->addWidget(graphicsView);
    else
        mainWindow->setCentralWidget(graphicsView);

    viewportWidget = new SuppressedPaintWidget();
    graphicsView->setViewport(viewportWidget);
    //viewportWidget->setAttribute(Qt::WA_DontShowOnScreen, true);
    viewportWidget->setGeometry(0, 0, graphicsView->width(), graphicsView->height());
    viewportWidget->setContentsMargins(0,0,0,0);

    mainWindow->setContentsMargins(0,0,0,0);
    graphicsView->setContentsMargins(0,0,0,0);

    graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    graphicsView->horizontalScrollBar()->setValue(0);
    graphicsView->horizontalScrollBar()->setRange(0, 0);

    graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    graphicsView->verticalScrollBar()->setValue(0);
    graphicsView->verticalScrollBar()->setRange(0, 0);

    graphicsScene = new QGraphicsScene(this);

    graphicsView->setScene(graphicsScene);
    graphicsView->scene()->setSceneRect(graphicsView->rect());

    connect(graphicsScene, SIGNAL(changed(const QList<QRectF> &)), graphicsView, SLOT(HandleSceneChanged(const QList<QRectF> &)));
    connect(graphicsScene, SIGNAL(sceneRectChanged(const QRectF &)), SLOT(OnSceneRectChanged(const QRectF &)));
    connect(mainWindow, SIGNAL(WindowResizeEvent(int,int)), graphicsView, SLOT(Resize(int,int)));

    mainWindow->LoadWindowSettingsFromFile();
    graphicsView->Resize(mainWindow->width(), mainWindow->height());

    graphicsView->show();
    mainWindow->show();
    viewportWidget->show();

    /// Do a full repaint of the view now that we've shown it.
    graphicsView->MarkViewUndirty();
}

UiAPI::~UiAPI()
{
    Reset();
}

void UiAPI::Reset()
{
    SAFE_DELETE(mainWindow)
    // viewportWidget will be null after main window is deleted above
    // as it is inside the main window (is a child so gets deleted)
    SAFE_DELETE(viewportWidget)
}

UiMainWindow *UiAPI::MainWindow() const
{
    return mainWindow;
}

UiGraphicsView *UiAPI::GraphicsView() const
{
    return graphicsView;
}

QGraphicsScene *UiAPI::GraphicsScene() const
{
    return graphicsScene;
}

UiProxyWidget *UiAPI::AddWidgetToScene(QWidget *widget, Qt::WindowFlags flags)
{
    if (owner->IsHeadless())
    {
        LogWarning("UiAPI:AddWidgetToScene: You are trying to add widgets to scene on a headless run, check your code!");
        return 0;
    }
    if (!widget)
    {
        LogError("UiAPI:AddWidgetToScene called with a null proxy widget!");
        return 0;
    }

    // QGraphicsProxyWidget maintains symmetry for the following states:
    // state, enabled, visible, geometry, layoutDirection, style, palette,
    // font, cursor, sizeHint, getContentsMargins and windowTitle

    UiProxyWidget *proxy = new UiProxyWidget(widget, flags);
    assert(proxy->widget() == widget);

    // Synchronize windowState flags
    proxy->widget()->setWindowState(widget->windowState());

    AddProxyWidgetToScene(proxy);

    // If the widget has WA_DeleteOnClose on, connect its proxy's visibleChanged()
    // signal to a slot which handles the deletion. This must be done because closing
    // proxy window in our system doesn't yield closeEvent, but hideEvent instead.
    if (widget->testAttribute(Qt::WA_DeleteOnClose))
        connect(proxy, SIGNAL(visibleChanged()), SLOT(DeleteCallingWidgetOnClose()));

    return proxy;
}

bool UiAPI::AddProxyWidgetToScene(UiProxyWidget *widget)
{
    if (!graphicsScene)
    {
        LogWarning("UiAPI::AddProxyWidgetToScene: No graphicsScene to add a proxy widget to! This cannot be done in headless mode.");
        return false;
    }

    if (!widget)
    {
        LogError("UiAPI::AddProxyWidgetToScene called with a null proxy widget!");
        return false;
    }

    if (!widget->widget())
    {
        LogError("UiAPI::AddProxyWidgetToScene called for proxy widget that does not embed a widget!");
        return false;
    }

    if (widgets.contains(widget))
    {
        LogWarning("UiAPI::AddProxyWidgetToScene: Scene already contains the given widget!");
        return false;
    }

    connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(OnProxyDestroyed(QObject *)));

    widgets.append(widget);

    if (widget->isVisible())
        widget->hide();

    // If no position has been set for Qt::Dialog widget, use default one so that the window's title
    // bar - or any other critical part, doesn't go outside the view.
    if ((widget->windowFlags() & Qt::Dialog) && widget->pos() == QPointF() && !(widget->widget()->windowState() & Qt::WindowFullScreen))
        widget->setPos(10.0, 200.0);

    // Resize full screen widgets to fit the scene rect.
    if (widget->widget()->windowState() & Qt::WindowFullScreen)
    {
        fullScreenWidgets << widget;
        widget->setGeometry(graphicsScene->sceneRect().toRect());
    }

    graphicsScene->addItem(widget);
    return true;
}

void UiAPI::RemoveWidgetFromScene(QWidget *widget)
{
    if (owner->IsHeadless())
    {
        LogWarning("UiAPI::RemoveWidgetFromScene: You are trying to remove widgets from scene on a headless run, check your code!");
        return;
    }
    if (!widget)
    {
        LogError("UiAPI::RemoveWidgetFromScene called with a null proxy widget!");
        return;
    }

    if (graphicsScene)
        graphicsScene->removeItem(widget->graphicsProxyWidget());
    widgets.removeOne(widget->graphicsProxyWidget());
    fullScreenWidgets.removeOne(widget->graphicsProxyWidget());
}

void UiAPI::RemoveWidgetFromScene(QGraphicsProxyWidget *widget)
{
    if (owner->IsHeadless())
    {
        LogWarning("UiAPI::RemoveWidgetFromScene: You are trying to remove widgets from scene on a headless run, check your code!");
        return;
    }
    if (!widget)
    {
        LogError("UiAPI::RemoveWidgetFromScene called with a null proxy widget!");
        return;
    }

    if (graphicsScene)
        graphicsScene->removeItem(widget);
    bool proxyFound = widgets.removeOne(widget);
    if (!proxyFound)
        LogWarning("UiAPI::RemoveWidgetFromScene: proxy widget not found from list of maintained proxy widgets.");
    fullScreenWidgets.removeOne(widget);
}

void UiAPI::OnProxyDestroyed(QObject* obj)
{
    // Make sure we don't get dangling pointers
    // Note: at this point it's a QObject, not a QGraphicsProxyWidget anymore
    QGraphicsProxyWidget* proxy = static_cast<QGraphicsProxyWidget*>(obj);
    widgets.removeOne(proxy);
    fullScreenWidgets.removeOne(proxy);
}

QWidget *UiAPI::LoadFromFile(const QString &filePath, bool addToScene, QWidget *parent)
{
    QWidget *widget = 0;
    QString resolvedRef;

    /// \todo Should be able to specify asset ref context
    // Hack: here, we interpret anything that begins with . to be a locally relative path, that is not resolved
    if (!filePath.startsWith('.'))
        resolvedRef = owner->Asset()->ResolveAssetRef("", filePath);
    else
        resolvedRef = filePath;

    AssetAPI::AssetRefType refType = AssetAPI::ParseAssetRef(resolvedRef);
    if (refType != AssetAPI::AssetRefLocalPath && refType != AssetAPI::AssetRefRelativePath)
    {
        AssetPtr asset = owner->Asset()->GetAsset(resolvedRef);
        if (!asset)
        {
            LogError("UiAPI::LoadFromFile: Asset \"" + resolvedRef + "\" is not loaded to the asset system. Call RequestAsset prior to use!");
            return 0;
        }

        QtUiAsset *uiAsset = dynamic_cast<QtUiAsset*>(asset.get());
        if (!uiAsset)
        {
            LogError("UiAPI::LoadFromFile: Asset \"" + resolvedRef + "\" is not of type QtUiFile!");
            return 0;
        }
        if (!uiAsset->IsLoaded())
        {
            LogError("UiAPI::LoadFromFile: Asset \"" + resolvedRef + "\" data is not valid!");
            return 0;
        }

        // Get the asset data with the assetrefs replaced to point to the disk sources on the current local system.
        QByteArray data = uiAsset->GetRefReplacedAssetData();

        QUiLoader loader;
        QDataStream dataStream(&data, QIODevice::ReadOnly);
        widget = loader.load(dataStream.device(), parent);
    }
    else // The file is from absolute source location.
    {
        QString path = resolvedRef;
        // If the user submitted a relative path, try to lookup whether a path relative to cwd or the application installation directory was meant.
        if (QDir::isRelativePath(path))
        {
            QString cwdPath = Application::CurrentWorkingDirectory() + resolvedRef;
            if (QFile::exists(cwdPath))
                path = cwdPath;
            else
                path = Application::InstallationDirectory() + resolvedRef;
        }
        QFile file(path);
        QUiLoader loader;
        file.open(QFile::ReadOnly);
        widget = loader.load(&file, parent);
    }

    if (!widget)
    {
        LogError("UiAPI::LoadFromFile: Failed to load widget from file \"" + resolvedRef + "\"!");
        return 0;
    }

    if (addToScene && widget)
    {
        if (!owner->IsHeadless())
            AddWidgetToScene(widget, Qt::Dialog);
        else
            LogWarning("UiAPI::LoadFromFile: You have addToScene = true, but this is a headless run (hence no ui scene).");
    }

    return widget;
}

void UiAPI::EmitContextMenuAboutToOpen(QMenu *menu, QList<QObject *> targets)
{
    emit ContextMenuAboutToOpen(menu,targets);
}

void UiAPI::ShowWidget(QWidget *widget) const
{
    if (!widget)
    {
        LogError("UiAPI::ShowWidget called on a null widget!");
        return;
    }

    if (widget->graphicsProxyWidget())
    {
        if (!widgets.contains(widget->graphicsProxyWidget()))
            LogWarning("UiAPI::ShowWidget called for widget that does not exist list of maintained proxy widgets.");
        widget->graphicsProxyWidget()->show();
    }
    else
        widget->show();
}

void UiAPI::HideWidget(QWidget *widget) const
{
    if (!widget)
    {
        LogError("UiAPI::HideWidget called on a null widget!");
        return;
    }

    if (widget->graphicsProxyWidget())
    {
        if (!widgets.contains(widget->graphicsProxyWidget()))
            LogWarning("UiAPI::ShowWidget called for widget that does not exist list of maintained proxy widgets.");
        widget->graphicsProxyWidget()->hide();
    }
    else
        widget->hide();
}

void UiAPI::BringWidgetToFront(QWidget *widget) const
{
    if (!widget)
    {
        LogError("UiAPI::BringWidgetToFront called on a null widget!");
        return;
    }

    ShowWidget(widget);
    if (graphicsScene)
    {
        graphicsScene->setActiveWindow(widget->graphicsProxyWidget());
        graphicsScene->setFocusItem(widget->graphicsProxyWidget(), Qt::ActiveWindowFocusReason);
    }
}

void UiAPI::BringProxyWidgetToFront(QGraphicsProxyWidget *widget) const
{
    if (!widget)
    {
        LogError("UiAPI::BringWidgetToFront called on a null QGraphicsProxyWidget!");
        return;
    }

    if (graphicsScene)
    {
        graphicsScene->setActiveWindow(widget);
        graphicsScene->setFocusItem(widget, Qt::ActiveWindowFocusReason);
    }
}

void UiAPI::OnSceneRectChanged(const QRectF &rect)
{
    foreach(QGraphicsProxyWidget *widget, fullScreenWidgets)
        widget->setGeometry(rect);
}

void UiAPI::DeleteCallingWidgetOnClose()
{
    QGraphicsProxyWidget *proxy = dynamic_cast<QGraphicsProxyWidget *>(sender());
    if (proxy && !proxy->isVisible())
        proxy->deleteLater();
}