text:
module Euler.Factorial.Test (suite) where

import Test.Tasty (testGroup, TestTree)
import Test.Tasty.HUnit

import Euler.Factorial

suite :: TestTree
suite = testGroup "Factorial"
        [ testCase "first" testFirst
        , testCase "shortest" testShortest
        , testCase "fastest" testFastest
        ]

testFirst :: Assertion
testFirst = 3628800 @=? first (10 :: Int)

testShortest :: Assertion
testShortest = 3628800 @=? shortest (10 :: Int)

testFastest :: Assertion
testFastest = 3628800 @=? fastest (10 :: Int)


text:
class ElementDoesNotExist(Exception):
    pass

class ElementIsNotVisible(Exception):
    pass

class ElementAtIndexDoesNotExist(Exception):
    pass

class WrongJavascriptReturnValue(Exception):
    pass

class TimeoutException(Exception):
    pass

redpajama_set_name: RedPajamaGithub


text:
package com.lukaszbyjos.popularmovies;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.lukaszbyjos.popularmovies.databinding.ActivityMovieDetailsBinding;
import com.lukaszbyjos.popularmovies.dto.MovieDetails;
import com.lukaszbyjos.popularmovies.enums.PosterSizes;
import com.lukaszbyjos.popularmovies.network.RestClient;
import com.lukaszbyjos.popularmovies.utils.MovieUtils;

import hugo.weaving.DebugLog;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * The type Movie details activity.
 */
public class MovieDetailsActivity extends AppCompatActivity {

    public static final String MOVIE_ID = "MOVIE_ID";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_details);

        Intent intent = getIntent();
        final int movieId = intent.getIntExtra(MOVIE_ID, -1);
        if (movieId > -1) {
            getTopRatedMovies(movieId);
        }

    }

    @DebugLog
    private void getTopRatedMovies(final int movieId) {
        Call<MovieDetails> call = RestClient.get().getMovieDetails(movieId, BuildConfig.movie_db_api_key);
        call.enqueue(new Callback<MovieDetails>() {
            @Override
            @DebugLog
            public void onResponse(Call<MovieDetails> call, Response<MovieDetails> response) {
                bindData(response.body());
            }

            @Override
            public void onFailure(Call<MovieDetails> call, Throwable t) {

            }
        });
    }

    @DebugLog
    private void bindData(MovieDetails movieDetails) {
        ActivityMovieDetailsBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_movie_details);
        movieDetails.setPosterPath(
                MovieUtils.correctPosterURL(movieDetails.getPosterPath(), PosterSizes.W185));
        binding.setMovie(movieDetails);
    }
}


text:
DELIMITER /
INSERT INTO KRIM_TYP_ATTR_ID_BS_S VALUES(NULL)
/
INSERT INTO KRIM_TYP_ATTR_T (KIM_TYP_ATTR_ID, KIM_TYP_ID, KIM_ATTR_DEFN_ID, SORT_CD, ACTV_IND, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM KRIM_TYP_ATTR_ID_BS_S), (SELECT KIM_TYP_ID FROM KRIM_TYP_T WHERE NMSPC_CD = 'KC-SYS' AND NM = 'Document Section'), (SELECT KIM_ATTR_DEFN_ID FROM KRIM_ATTR_DEFN_T WHERE NM = 'documentTypeName'), 'b', 'Y', UUID())
/
INSERT INTO KRIM_TYP_ATTR_ID_BS_S VALUES(NULL)
/

INSERT INTO KRIM_TYP_ATTR_T (KIM_TYP_ATTR_ID, KIM_TYP_ID, KIM_ATTR_DEFN_ID, SORT_CD, ACTV_IND, OBJ_ID)
VALUES ((SELECT (MAX(ID)) FROM KRIM_TYP_ATTR_ID_BS_S), (SELECT KIM_TYP_ID FROM KRIM_TYP_T WHERE NMSPC_CD = 'KC-SYS' AND NM = 'Document Action'), (SELECT KIM_ATTR_DEFN_ID FROM KRIM_ATTR_DEFN_T WHERE NM = 'documentTypeName'), 'b', 'Y', UUID())
/
DELIMITER ;


text:
import _ from 'underscore';
import uuid from 'uuid-v4';
import BitbucketCommitMalformedError from '../../middleware/bitbucketCommitMalformedError';
import getProperties from './getProperties';
import VcsFamilies from '../helpers/vcsFamilies';

const bitbucketTranslator = {
  family: VcsFamilies.Bitbucket,
  canTranslate(request) {
    return hasCorrectHeaders(request.headers);
  },
  translatePush(pushEvent, instanceId, digestId, inboxId) {
    try {
      let latestCommit = pushEvent.push.changes[0].new;
      //TODO: we only have the date of the newest commit in the push.
      //Do we want to use it for every commit?

      let branch = latestCommit.name;
      let date = latestCommit.target.date;
      let repository = {
        id: pushEvent.repository.uuid,
        name: pushEvent.repository.name
      };
      // Bitbucket puts the newest commits firts hence the reverse
      let commits = pushEvent.push.changes[0].commits.reverse();
      let events = _.map(commits, aCommit => {
        const author = aCommit.author;
        const email = author.raw;
        let display_name, username;
        if (_.has(author, 'user') && _.has(author.user, 'display_name')) display_name = author.user.display_name;
        else display_name = 'unknown';
        if (_.has(author, 'user') && _.has(author.user, 'username')) username = author.user.username;
        else username = 'unknown';
        let commit = {
          sha: aCommit.hash,
          commit: {
            author: username,
            // bitbucket does not have a commit.committer object. Using the same thing as author for now.
            committer: {
              name: display_name,
              email: email,
              date
            },
            message: aCommit.message
          },
          html_url: aCommit.links.html.href,
          repository,
          branch,
          originalMessage: aCommit
        };
        return {
          eventId: uuid(),
          eventType: bitbucketTranslator.family + 'CommitReceived',
          data: commit,
          metadata: {
            instanceId,
            digestId,
            inboxId
          }
        };
      });

      return events;
    } catch (ex) {
      throw new BitbucketCommitMalformedError(ex, pushEvent);
    }
  },
  getProperties(event) {
    return getProperties(event, '/commits', 'branch');
  }
};

const hasCorrectHeaders = (headers) => {
  return headers.hasOwnProperty('x-event-key') && headers['x-event-key'] === 'repo:push';
};

export default bitbucketTranslator;


text:
<card [verticalMode]="hasChild" [title]="'Identifier List'" (reset)="onReset()" (close)="close()" (closeChild)="closeChild()" [(showAll)]="isShowAll">
    <form>
        <sml-abstract-metadata-list [model]="model" [config]="config" [isShowAll]="isShowAll"></sml-abstract-metadata-list>

            {{getDisplayName('identifiers')}}
            <list [list]="model.identifiers" [fixLength]="config.elementFixQuantity('sml:identifiers')" (select)="openNewIdentifierItem($event)" (remove)="onRemoveIdentifier($event)" (add)="onAddIdentifier()"></list>

    </form>
</card>


text:
module Mastercard
  module Services
    module Locations

      class Features

        attr_accessor :cash_back

      end

    end
  end
end


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model frontend\controllers\search\DistrictSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'id') ?>

    <?= $form->field($model, 'name') ?>

    <?= $form->field($model, 'location') ?>

        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
package com.stratio.explorer.notebook.utils;

import com.stratio.explorer.notebook.form.Input;

import java.util.HashMap;
import java.util.Map;

public class ParamsBuilder {

    public static Map<String,Object> buildParamsByExpectedInput(InputExpectedValues expectedvalues){
           Input input = new Input(expectedvalues.name, expectedvalues.displayName, expectedvalues.type,
                                   expectedvalues.defaultValue, expectedvalues.options, expectedvalues.hidden);
           Map<String,Object> params = new HashMap<>();
           params.put(expectedvalues.name,input);
           return params;
    }
}


text:
const nodemailer  = require('nodemailer'),
      credentials = require('./credentials/Credentials'),
      logger = require('./logger')

const EmailManager = {

  // formatting shld be done prior to this
  // returns false if not sent, true if sent
  sendEmail: (subject, messageObject, formatter, callback) => {
    const transporter = nodemailer.createTransport(credentials.email);

    const emailText = formatter
      ? formatter(messageObject)
      : messageObject;

    const mailOptions = {
      from: credentials.email.auth.user,
      to: credentials.myEmail,
      subject: subject,
      text: emailText
    }

    logger.info(`Sending email.
        Contents: ${emailText}`);
    transporter.sendMail(mailOptions, callback);
  },

  // helper function to format email
  // Schema shld be as follows:
  // {
  //   name:
  //   email:
  //   phone:
  //   message:
  // }
  formatContactMe: message => {
    const emailMessageFormatted =
      'Name: ' + message.name + '\n' +
      'Email: ' + message.email + '\n' +
      'Phone: ' + message.phone + '\n' +
      'Message: ' + message.message;
    return emailMessageFormatted;
  }
}

module.exports = EmailManager;


text:
name: disconnectnode
btcversion: 0.16.2
btcgroup: network
permalink: en/doc/0.16.2/rpc/network/disconnectnode/
---

disconnectnode "[address]" [nodeid]

Immediately disconnects from the specified peer node.

Strictly one out of 'address' and 'nodeid' can be provided to identify the node.

To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.

Arguments:
1. "address"     (string, optional) The IP address/port of the node
2. "nodeid"      (number, optional) The node ID (see getpeerinfo for node IDs)

Examples:
> bitcoin-cli disconnectnode "192.168.0.6:8333"
> bitcoin-cli disconnectnode "" 1
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "disconnectnode", "params": ["192.168.0.6:8333"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "disconnectnode", "params": ["", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/


text:
// Copyright 2014 Google Inc. All Rights Reserved.

package tw.realtime.project.lativtest;

/**
 * Static container class for holding a reference to your YouTube Developer Key.
 */
public class DeveloperKey {

  /**
   * Please replace this with a valid API key which is enabled for the
   * YouTube Data API v3 service. Go to the
   * Google Developers Console
   * to register a new developer key.
   */
  public static final String DEVELOPER_KEY = "AIzaSyD5wxTibtP7P00o0TrA9z9oHvOTks-U_B4";

}


text:
package org.apache.kylin.metadata.expression;

import java.nio.ByteBuffer;
import java.util.Collections;

import org.apache.kylin.metadata.filter.IFilterCodeSystem;
import org.apache.kylin.metadata.tuple.IEvaluatableTuple;

public class NoneTupleExpression extends TupleExpression {

    public NoneTupleExpression() {
        super(ExpressionOperatorEnum.NONE, Collections.<TupleExpression> emptyList());
    }

    @Override
    public boolean ifAbleToPushDown() {
        return false;
    }

    @Override
    public void verify() {
    }

    @Override
    public Object calculate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs) {
        throw new UnsupportedOperationException();
    }

    @Override
    public TupleExpression accept(ExpressionVisitor visitor) {
        return visitor.visitNone(this);
    }

    @Override
    public void serialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
        throw new UnsupportedOperationException();
    }
}


text: A basic engine for creating playing card based card games on the Java platform.


text:
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Mar 07, 2016 at 06:29 AM
-- Server version: 10.1.9-MariaDB
-- PHP Version: 5.5.30

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `multi-admin`
--

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE `category` (
  `category_code` int(11) NOT NULL,
  `category_description` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`category_code`, `category_description`, `created_at`, `updated_at`) VALUES
(22, 'Haaziq', '2016-02-28 09:27:06', '2016-02-28 09:27:06');

-- --------------------------------------------------------

--
-- Table structure for table `item`
--

CREATE TABLE `item` (
  `item_code` int(10) UNSIGNED NOT NULL,
  `item_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `item_warrantyperiod` int(11) NOT NULL,
  `item_unitprice` int(11) NOT NULL,
  `item_category_code` int(10) NOT NULL,
  `item_pricingprofile_code` int(10) UNSIGNED NOT NULL,
  `item_supplier_code` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `module`
--

CREATE TABLE `module` (
  `mod_modulegroupcode` varchar(25) NOT NULL,
  `mod_modulegroupname` varchar(50) NOT NULL,
  `mod_modulecode` varchar(25) NOT NULL,
  `mod_modulename` varchar(50) NOT NULL,
  `mod_modulegrouporder` int(3) NOT NULL,
  `mod_moduleorder` int(3) NOT NULL,
  `mod_modulepagename` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `module`
--

INSERT INTO `module` (`mod_modulegroupcode`, `mod_modulegroupname`, `mod_modulecode`, `mod_modulename`, `mod_modulegrouporder`, `mod_moduleorder`, `mod_modulepagename`) VALUES
('INVT', 'Inventory', 'PURCHASES', 'Purchases', 2, 1, 'purchases.php'),
('INVT', 'Inventory', 'STOCKS', 'Stocks', 2, 2, 'stocks.php');

-- --------------------------------------------------------

--
-- Table structure for table `pricingprofile`
--

CREATE TABLE `pricingprofile` (
  `pricingprofile_code` int(10) UNSIGNED NOT NULL,
  `pricingprofile_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `pricingprofile_bottom_price` int(11) NOT NULL,
  `pricingprofile_line_discount` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `pricingprofile`
--

INSERT INTO `pricingprofile` (`pricingprofile_code`, `pricingprofile_name`, `pricingprofile_bottom_price`, `pricingprofile_line_discount`, `created_at`, `updated_at`) VALUES
(3, 'Profile 2', 10, 10, '2016-02-28 06:35:46', '2016-02-28 06:35:46');

-- --------------------------------------------------------

--
-- Table structure for table `role`
--

CREATE TABLE `role` (
  `role_rolecode` varchar(50) NOT NULL,
  `role_rolename` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `role`
--

INSERT INTO `role` (`role_rolecode`, `role_rolename`) VALUES
('ADMIN', 'Administrator'),
('Dlip', 'Super Admin'),
('SUPERADMIN', 'Super Admin');

-- --------------------------------------------------------

--
-- Table structure for table `role_rights`
--

CREATE TABLE `role_rights` (
  `rr_rolecode` varchar(50) NOT NULL,
  `rr_modulecode` varchar(25) NOT NULL,
  `rr_create` enum('yes','no') NOT NULL DEFAULT 'no',
  `rr_edit` enum('yes','no') NOT NULL DEFAULT 'no',
  `rr_delete` enum('yes','no') NOT NULL DEFAULT 'no',
  `rr_view` enum('yes','no') NOT NULL DEFAULT 'no'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `role_rights`
--

INSERT INTO `role_rights` (`rr_rolecode`, `rr_modulecode`, `rr_create`, `rr_edit`, `rr_delete`, `rr_view`) VALUES
('ADMIN', 'PURCHASES', 'yes', 'yes', 'yes', 'yes'),
('ADMIN', 'STOCKS', 'no', 'no', 'no', 'yes'),
('SUPERADMIN', 'PURCHASES', 'yes', 'yes', 'yes', 'yes'),
('SUPERADMIN', 'STOCKS', 'yes', 'yes', 'yes', 'yes');

-- --------------------------------------------------------

--
-- Table structure for table `supplier`
--

CREATE TABLE `supplier` (
  `supplier_code` int(10) UNSIGNED NOT NULL,
  `supplier_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `supplier_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `supplier_contact_no` int(11) NOT NULL,
  `supplier_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `supplier_NIC_BR` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `supplier_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `supplier_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `supplier`
--

INSERT INTO `supplier` (`supplier_code`, `supplier_name`, `supplier_address`, `supplier_contact_no`, `supplier_email`, `supplier_NIC_BR`, `supplier_title`, `supplier_type`, `created_at`, `updated_at`) VALUES
(5, 'L-Vision 2', '111', 111, '11', '11', '11', '11', '2016-02-28 08:43:06', '2016-02-28 08:43:06');

-- --------------------------------------------------------

--
-- Table structure for table `system_users`
--

CREATE TABLE `system_users` (
  `u_userid` int(11) NOT NULL,
  `u_username` varchar(100) NOT NULL,
  `u_password` varchar(255) NOT NULL,
  `u_rolecode` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `system_users`
--

INSERT INTO `system_users` (`u_userid`, `u_username`, `u_password`, `u_rolecode`) VALUES
(1, 'hamza', '123', 'SUPERADMIN'),
(2, 'dilip', '123', 'ADMIN');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`category_code`);

--
-- Indexes for table `item`
--
ALTER TABLE `item`
  ADD PRIMARY KEY (`item_code`),
  ADD UNIQUE KEY `item_category_code` (`item_category_code`),
  ADD KEY `item_item_pricingprofile_code_foreign` (`item_pricingprofile_code`),
  ADD KEY `item_item_supplier_code_foreign` (`item_supplier_code`);

--
-- Indexes for table `module`
--
ALTER TABLE `module`
  ADD PRIMARY KEY (`mod_modulegroupcode`,`mod_modulecode`),
  ADD UNIQUE KEY `mod_modulecode` (`mod_modulecode`);

--
-- Indexes for table `pricingprofile`
--
ALTER TABLE `pricingprofile`
  ADD PRIMARY KEY (`pricingprofile_code`);

--
-- Indexes for table `role`
--
ALTER TABLE `role`
  ADD PRIMARY KEY (`role_rolecode`);

--
-- Indexes for table `role_rights`
--
ALTER TABLE `role_rights`
  ADD PRIMARY KEY (`rr_rolecode`,`rr_modulecode`),
  ADD KEY `rr_modulecode` (`rr_modulecode`);

--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
  ADD PRIMARY KEY (`supplier_code`);

--
-- Indexes for table `system_users`
--
ALTER TABLE `system_users`
  ADD PRIMARY KEY (`u_userid`),
  ADD KEY `u_rolecode` (`u_rolecode`),
  ADD KEY `u_userid` (`u_userid`,`u_username`,`u_password`,`u_rolecode`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `category_code` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `item`
--
ALTER TABLE `item`
  MODIFY `item_code` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pricingprofile`
--
ALTER TABLE `pricingprofile`
  MODIFY `pricingprofile_code` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `supplier`
--
ALTER TABLE `supplier`
  MODIFY `supplier_code` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `system_users`
--
ALTER TABLE `system_users`
  MODIFY `u_userid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `item`
--
ALTER TABLE `item`
  ADD CONSTRAINT `item_item_pricingprofile_code_foreign` FOREIGN KEY (`item_pricingprofile_code`) REFERENCES `pricingprofile` (`pricingprofile_code`),
  ADD CONSTRAINT `item_item_supplier_code_foreign` FOREIGN KEY (`item_supplier_code`) REFERENCES `supplier` (`supplier_code`);

--
-- Constraints for table `role_rights`
--
ALTER TABLE `role_rights`
  ADD CONSTRAINT `role_rights_ibfk_1` FOREIGN KEY (`rr_rolecode`) REFERENCES `role` (`role_rolecode`) ON UPDATE CASCADE,
  ADD CONSTRAINT `role_rights_ibfk_2` FOREIGN KEY (`rr_modulecode`) REFERENCES `module` (`mod_modulecode`) ON UPDATE CASCADE;

--
-- Constraints for table `system_users`
--
ALTER TABLE `system_users`
  ADD CONSTRAINT `system_users_ibfk_1` FOREIGN KEY (`u_rolecode`) REFERENCES `role` (`role_rolecode`) ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


text:
/**
 * @file path_time_heuristic_optimizer.cc
 **/

#include "modules/planning/tasks/optimizers/path_time_heuristic/path_time_heuristic_optimizer.h"

#include <vector>

#include "modules/common/configs/vehicle_config_helper.h"
#include "modules/common/vehicle_state/vehicle_state_provider.h"
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/common/st_graph_data.h"
#include "modules/planning/proto/planning_internal.pb.h"
#include "modules/planning/tasks/optimizers/path_time_heuristic/gridded_path_time_graph.h"

namespace apollo {
namespace planning {

using apollo::common::ErrorCode;
using apollo::common::Status;
using apollo::common::TrajectoryPoint;
using apollo::planning_internal::STGraphDebug;

PathTimeHeuristicOptimizer::PathTimeHeuristicOptimizer(const TaskConfig& config)
    : SpeedOptimizer(config) {
  CHECK(config.has_dp_st_speed_config());
  dp_st_speed_config_ = config.dp_st_speed_config();
}

bool PathTimeHeuristicOptimizer::SearchPathTimeGraph(
    SpeedData* speed_data) const {
  GriddedPathTimeGraph st_graph(
      reference_line_info_->st_graph_data(), dp_st_speed_config_,
      reference_line_info_->path_decision()->obstacles().Items(), init_point_);

  if (!st_graph.Search(speed_data).ok()) {
    AERROR << "failed to search graph with dynamic programming.";
    return false;
  }
  return true;
}

Status PathTimeHeuristicOptimizer::Process(
    const PathData& path_data, const common::TrajectoryPoint& init_point,
    SpeedData* const speed_data) {
  init_point_ = init_point;

  if (path_data.discretized_path().empty()) {
    std::string msg("Empty path data");
    AERROR << msg;
    return Status(ErrorCode::PLANNING_ERROR, msg);
  }

  if (!SearchPathTimeGraph(speed_data)) {
    const std::string msg(Name() +
                          ":Failed to search graph with dynamic programming.");
    AERROR << msg;
    RecordDebugInfo(*speed_data, reference_line_info_->mutable_st_graph_data()
                                     ->mutable_st_graph_debug());
    return Status(ErrorCode::PLANNING_ERROR, msg);
  }
  RecordDebugInfo(
      *speed_data,
      reference_line_info_->mutable_st_graph_data()->mutable_st_graph_debug());
  return Status::OK();
}

}  // namespace planning
}  // namespace apollo


text:
define(["myapp/app.common"],
    function(Common) {

        var Donation = Common.BaseModel.extend({
            urlRoot: "/api/donation",
            defaults: {
                amount: null,
                typeOfPayment: null,
                nameOnCard: null,
                cardNumber: null,
                expirationDate: null,
                cvv: null,
                address: null
            }
        });
        return Donation;
    });


text:
<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="generator" content="ApiGen 2.8.0" />

<<<<<<< HEAD
	<title>Interface Native5\Identity\ComparableEquals</title>

=======
	<title>Interface Native5\Identity\ComparableEquals | Native5 API Client</title>

>>>>>>> release-0.2.0
	<link rel="stylesheet" type="text/css" media="all" href="resources/bootstrap.min.css?2446941819" />
	<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?2979642362" />

        			Native5 APIs

							Namespace

Class

							Tree

		<form id="search" class="form-search">
			<input type="hidden" name="cx" value="" />
			<input type="hidden" name="ie" value="UTF-8" />
			<input type="text" name="q" class="search-query" placeholder="Search" />
		</form>

Namespaces

Native5

<<<<<<< HEAD

Api

=======
>>>>>>> release-0.2.0

Control

Identity

<<<<<<< HEAD

Route

Scheduler

Security

Services

Account

Analytics

Identity

Job

Messaging

Users

=======

Route

DeviceDetection

Security

>>>>>>> release-0.2.0

Sessions

UI

<<<<<<< HEAD

Users

None

PHP

=======

>>>>>>> release-0.2.0

Classes

AuthRealm

DBRealm

DefaultAccount

DefaultSecurityManager

DefaultSubjectContext

DefaultSubjectDAO

DelegatingSubject

RealmAuthenticator

SecurityUtils

SimpleAuthInfo

Subject

SubjectBuilder

UsernamePasswordToken

Interfaces

Account

Authenticator

AuthInfo

AuthToken

ComparableEquals

Logout

Realm

SubjectDAO

Exceptions

AuthenticationException

Interface ComparableEquals

ComparableEquals

Direct known implementers

			Native5\Identity\Account,
			Native5\Identity\AuthToken

Indirect known implementers

			Native5\Identity\DefaultAccount,
			Native5\Identity\UsernamePasswordToken

		Namespace: Native5\Identity

		Package: Native5\Util

				Category:
				Identity

				Copyright:
				2012 Native5. All Rights Reserved

				License:
				attached NOTICE.md for details

				Author:
				Barada Sahu <<a
<<<<<<barry@native5.com>

=======
href="mailto:barry@native5.com">barry@native5.com>

>>>>>>> release-0.2.0
				Version:
				Release: 1.0

				Link:
				Created : 27-11-2012
Last Modified : Fri Dec 21 09:11:53 2012

		Located at Native5/Identity/ComparableEquals.php

Methods summary

				 public

			#
			equals( mixed <var>$otherObj</var> )

equals

equals

Parameters

<var>$otherObj</var>

mixed
$otherObj The object to compare against.

Magic methods summary


text:
package io.gatling.core

object ConfigKeys {

  object core {
    val OutputDirectoryBaseName = "gatling.core.outputDirectoryBaseName"
    val RunDescription = "gatling.core.runDescription"
    val Encoding = "gatling.core.encoding"
    val SimulationClass = "gatling.core.simulationClass"
    val Mute = "gatling.core.mute"
    val ElFileBodiesCacheMaxCapacity = "gatling.core.elFileBodiesCacheMaxCapacity"
    val RawFileBodiesCacheMaxCapacity = "gatling.core.rawFileBodiesCacheMaxCapacity"
    val RawFileBodiesInMemoryMaxSize = "gatling.core.rawFileBodiesInMemoryMaxSize"

    object extract {
      object regex {
        val CacheMaxCapacity = "gatling.core.extract.regex.cacheMaxCapacity"
      }
      object xpath {
        val CacheMaxCapacity = "gatling.core.extract.xpath.cacheMaxCapacity"
      }
      object jsonPath {
        val CacheMaxCapacity = "gatling.core.extract.jsonPath.cacheMaxCapacity"
        val PreferJackson = "gatling.core.extract.jsonPath.preferJackson"
      }
      object css {
        val CacheMaxCapacity = "gatling.core.extract.css.cacheMaxCapacity"
      }
    }
    object directory {
      val Data = "gatling.core.directory.data"
      val Bodies = "gatling.core.directory.bodies"
      val Simulations = "gatling.core.directory.simulations"
      val Binaries = "gatling.core.directory.binaries"
      val ReportsOnly = "gatling.core.directory.reportsOnly"
      val Results = "gatling.core.directory.results"
    }
  }

  object charting {
    val NoReports = "gatling.charting.noReports"
    val MaxPlotPerSeries = "gatling.charting.maxPlotPerSeries"
    val UseGroupDurationMetric = "gatling.charting.useGroupDurationMetric"

    object indicators {
      val LowerBound = "gatling.charting.indicators.lowerBound"
      val HigherBound = "gatling.charting.indicators.higherBound"
      val Percentile1 = "gatling.charting.indicators.percentile1"
      val Percentile2 = "gatling.charting.indicators.percentile2"
      val Percentile3 = "gatling.charting.indicators.percentile3"
      val Percentile4 = "gatling.charting.indicators.percentile4"
    }
  }

  object http {
    val FetchedCssCacheMaxCapacity = "gatling.http.fetchedCssCacheMaxCapacity"
    val FetchedHtmlCacheMaxCapacity = "gatling.http.fetchedHtmlCacheMaxCapacity"
    val PerUserCacheMaxCapacity = "gatling.http.perUserCacheMaxCapacity"
    val WarmUpUrl = "gatling.http.warmUpUrl"
    val EnableGA = "gatling.http.enableGA"

    object ssl {
      object keyStore {
        val Type = "gatling.http.ssl.keyStore.type"
        val File = "gatling.http.ssl.keyStore.file"
        val Password = "gatling.http.ssl.keyStore.password"
        val Algorithm = "gatling.http.ssl.keyStore.algorithm"
      }
      object trustStore {
        val Type = "gatling.http.ssl.trustStore.type"
        val File = "gatling.http.ssl.trustStore.file"
        val Password = "gatling.http.ssl.trustStore.password"
        val Algorithm = "gatling.http.ssl.trustStore.algorithm"
      }
    }

    object ahc {
      val KeepAlive = "gatling.http.ahc.keepAlive"
      val ConnectTimeout = "gatling.http.ahc.connectTimeout"
      val HandshakeTimeout = "gatling.http.ahc.handshakeTimeout"
      val PooledConnectionIdleTimeout = "gatling.http.ahc.pooledConnectionIdleTimeout"
      val ReadTimeout = "gatling.http.ahc.readTimeout"
      val MaxRetry = "gatling.http.ahc.maxRetry"
      val RequestTimeout = "gatling.http.ahc.requestTimeout"
      val AcceptAnyCertificate = "gatling.http.ahc.acceptAnyCertificate"
      val HttpClientCodecMaxInitialLineLength = "gatling.http.ahc.httpClientCodecMaxInitialLineLength"
      val HttpClientCodecMaxHeaderSize = "gatling.http.ahc.httpClientCodecMaxHeaderSize"
      val HttpClientCodecMaxChunkSize = "gatling.http.ahc.httpClientCodecMaxChunkSize"
      val WebSocketMaxFrameSize = "gatling.http.ahc.webSocketMaxFrameSize"
      val SslEnabledProtocols = "gatling.http.ahc.sslEnabledProtocols"
      val SslEnabledCipherSuites = "gatling.http.ahc.sslEnabledCipherSuites"
      val SslSessionCacheSize = "gatling.http.ahc.sslSessionCacheSize"
      val SslSessionTimeout = "gatling.http.ahc.sslSessionTimeout"
      val UseOpenSsl = "gatling.http.ahc.useOpenSsl"
      val UseNativeTransport = "gatling.http.ahc.useNativeTransport"
      val UsePooledMemory = "gatling.http.ahc.usePooledMemory"
      val TcpNoDelay = "gatling.http.ahc.tcpNoDelay"
      val SoReuseAddress = "gatling.http.ahc.soReuseAddress"
      val SoLinger = "gatling.http.ahc.soLinger"
      val SoSndBuf = "gatling.http.ahc.soSndBuf"
      val SoRcvBuf = "gatling.http.ahc.soRcvBuf"
      val Allocator = "gatling.http.ahc.allocator"
      val MaxThreadLocalCharBufferSize = "gatling.http.ahc.maxThreadLocalCharBufferSize"
    }

    object dns {
      val QueryTimeout = "gatling.http.dns.queryTimeout"
      val MaxQueriesPerResolve = "gatling.http.dns.maxQueriesPerResolve"
    }
  }

  object jms {
    val AcknowledgedMessagesBufferSize = "gatling.jms.acknowledgedMessagesBufferSize"
  }

  object data {
    val Writers = "gatling.data.writers"

    object file {
      val BufferSize = "gatling.data.file.bufferSize"
    }
    object leak {
      val NoActivityTimeout = "gatling.data.leak.noActivityTimeout"
    }
    object console {
      val Light = "gatling.data.console.light"
    }
    object graphite {
      val Light = "gatling.data.graphite.light"
      val Host = "gatling.data.graphite.host"
      val Port = "gatling.data.graphite.port"
      val Protocol = "gatling.data.graphite.protocol"
      val RootPathPrefix = "gatling.data.graphite.rootPathPrefix"
      val BufferSize = "gatling.data.graphite.bufferSize"
      val WriteInterval = "gatling.data.graphite.writeInterval"
    }
  }

  // [fl]
  //
  //
  //
  //
  //
  //
  //
  //
  //
  //
  //
  //
  //
  // [fl]
}


text:
package gov.nist.javax.sip.header;

public class AlertInfoList
  extends SIPHeaderList<AlertInfo>{
  // Constructors

  public AlertInfoList(){
    super((java.lang.Class) null, (java.lang.String) null);
  }
  // Methods

  public java.lang.Object clone(){
    return (java.lang.Object) null;
  }
}


text:
"""Tests for manipulating Nodes via the DB API"""

import datetime

import mock
from oslo.utils import timeutils
import six

from ironic.common import exception
from ironic.common import states
from ironic.common import utils as ironic_utils
from ironic.db import api as dbapi
from ironic.tests.db import base
from ironic.tests.db import utils

class DbNodeTestCase(base.DbTestCase):

    def setUp(self):
        super(DbNodeTestCase, self).setUp()
        self.dbapi = dbapi.get_instance()

    def _create_test_node(self, **kwargs):
        n = utils.get_test_node(**kwargs)
        self.dbapi.create_node(n)
        return n

    def test_create_node(self):
        self._create_test_node()

    def test_create_node_nullable_chassis_id(self):
        n = utils.get_test_node()
        del n['chassis_id']
        self.dbapi.create_node(n)

    def test_create_node_already_exists(self):
        n = utils.get_test_node()
        del n['id']
        self.dbapi.create_node(n)
        self.assertRaises(exception.NodeAlreadyExists,
                          self.dbapi.create_node, n)

    def test_create_node_instance_already_associated(self):
        instance = ironic_utils.generate_uuid()
        n1 = utils.get_test_node(id=1, uuid=ironic_utils.generate_uuid(),
                                 instance_uuid=instance)
        self.dbapi.create_node(n1)
        n2 = utils.get_test_node(id=2, uuid=ironic_utils.generate_uuid(),
                                 instance_uuid=instance)
        self.assertRaises(exception.InstanceAssociated,
                          self.dbapi.create_node, n2)

    def test_get_node_by_id(self):
        n = self._create_test_node()
        res = self.dbapi.get_node_by_id(n['id'])
        self.assertEqual(n['id'], res.id)
        self.assertEqual(n['uuid'], res.uuid)

    def test_get_node_by_uuid(self):
        n = self._create_test_node()
        res = self.dbapi.get_node_by_uuid(n['uuid'])
        self.assertEqual(n['id'], res.id)
        self.assertEqual(n['uuid'], res.uuid)

    def test_get_node_that_does_not_exist(self):
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.get_node_by_id, 99)
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.get_node_by_uuid,
                          '12345678-9999-0000-aaaa-123456789012')

    def test_get_nodeinfo_list_defaults(self):
        for i in range(1, 6):
            n = utils.get_test_node(id=i, uuid=ironic_utils.generate_uuid())
            self.dbapi.create_node(n)
        res = [i[0] for i in self.dbapi.get_nodeinfo_list()]
        self.assertEqual(sorted(res), sorted(range(1, 6)))

    def test_get_nodeinfo_list_with_cols(self):
        uuids = {}
        extras = {}
        for i in range(1, 6):
            uuid = ironic_utils.generate_uuid()
            extra = {'foo': i}
            uuids[i] = uuid
            extras[i] = extra
            n = utils.get_test_node(id=i, extra=extra, uuid=uuid)
            self.dbapi.create_node(n)
        res = self.dbapi.get_nodeinfo_list(columns=['id', 'extra', 'uuid'])
        self.assertEqual(extras, dict((r[0], r[1]) for r in res))
        self.assertEqual(uuids, dict((r[0], r[2]) for r in res))

    def test_get_nodeinfo_list_with_filters(self):
        n1 = utils.get_test_node(id=1, driver='driver-one',
                                 instance_uuid=ironic_utils.generate_uuid(),
                                 reservation='fake-host',
                                 uuid=ironic_utils.generate_uuid())
        n2 = utils.get_test_node(id=2, driver='driver-two',
                                 uuid=ironic_utils.generate_uuid(),
                                 maintenance=True)
        self.dbapi.create_node(n1)
        self.dbapi.create_node(n2)

        res = self.dbapi.get_nodeinfo_list(filters={'driver': 'driver-one'})
        self.assertEqual([1], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'driver': 'bad-driver'})
        self.assertEqual([], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'associated': True})
        self.assertEqual([1], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'associated': False})
        self.assertEqual([2], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'reserved': True})
        self.assertEqual([1], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'reserved': False})
        self.assertEqual([2], [r[0] for r in res])

        res = self.dbapi.get_node_list(filters={'maintenance': True})
        self.assertEqual([2], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'maintenance': False})
        self.assertEqual([1], [r.id for r in res])

    @mock.patch.object(timeutils, 'utcnow')
    def test_get_nodeinfo_list_provision(self, mock_utcnow):
        past = datetime.datetime(2000, 1, 1, 0, 0)
        next = past + datetime.timedelta(minutes=8)
        present = past + datetime.timedelta(minutes=10)
        mock_utcnow.return_value = past

        # node with provision_updated timeout
        n1 = utils.get_test_node(id=1, uuid=ironic_utils.generate_uuid(),
                                 provision_updated_at=past)
        # node with None in provision_updated_at
        n2 = utils.get_test_node(id=2, uuid=ironic_utils.generate_uuid(),
                                 provision_state=states.DEPLOYWAIT)
        # node without timeout
        n3 = utils.get_test_node(id=3, uuid=ironic_utils.generate_uuid(),
                                 provision_updated_at=next)
        self.dbapi.create_node(n1)
        self.dbapi.create_node(n2)
        self.dbapi.create_node(n3)

        mock_utcnow.return_value = present
        res = self.dbapi.get_nodeinfo_list(filters={'provisioned_before': 300})
        self.assertEqual([1], [r[0] for r in res])

        res = self.dbapi.get_nodeinfo_list(filters={'provision_state':
                                                    states.DEPLOYWAIT})
        self.assertEqual([2], [r[0] for r in res])

    def test_get_node_list(self):
        uuids = []
        for i in range(1, 6):
            n = utils.get_test_node(id=i, uuid=ironic_utils.generate_uuid())
            self.dbapi.create_node(n)
            uuids.append(six.text_type(n['uuid']))
        res = self.dbapi.get_node_list()
        res_uuids = [r.uuid for r in res]
        self.assertEqual(uuids.sort(), res_uuids.sort())

    def test_get_node_list_with_filters(self):
        ch1 = utils.get_test_chassis(id=1, uuid=ironic_utils.generate_uuid())
        ch2 = utils.get_test_chassis(id=2, uuid=ironic_utils.generate_uuid())
        self.dbapi.create_chassis(ch1)
        self.dbapi.create_chassis(ch2)

        n1 = utils.get_test_node(id=1, driver='driver-one',
                                 instance_uuid=ironic_utils.generate_uuid(),
                                 reservation='fake-host',
                                 uuid=ironic_utils.generate_uuid(),
                                 chassis_id=ch1['id'])
        n2 = utils.get_test_node(id=2, driver='driver-two',
                                 uuid=ironic_utils.generate_uuid(),
                                 chassis_id=ch2['id'],
                                 maintenance=True)
        self.dbapi.create_node(n1)
        self.dbapi.create_node(n2)

        res = self.dbapi.get_node_list(filters={'chassis_uuid': ch1['uuid']})
        self.assertEqual([1], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'chassis_uuid': ch2['uuid']})
        self.assertEqual([2], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'driver': 'driver-one'})
        self.assertEqual([1], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'driver': 'bad-driver'})
        self.assertEqual([], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'associated': True})
        self.assertEqual([1], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'associated': False})
        self.assertEqual([2], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'reserved': True})
        self.assertEqual([1], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'reserved': False})
        self.assertEqual([2], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'maintenance': True})
        self.assertEqual([2], [r.id for r in res])

        res = self.dbapi.get_node_list(filters={'maintenance': False})
        self.assertEqual([1], [r.id for r in res])

    def test_get_node_list_chassis_not_found(self):
        self.assertRaises(exception.ChassisNotFound,
                          self.dbapi.get_node_list,
                          {'chassis_uuid': ironic_utils.generate_uuid()})

    def test_get_node_by_instance(self):
        n = self._create_test_node(
                instance_uuid='12345678-9999-0000-aaaa-123456789012')

        res = self.dbapi.get_node_by_instance(n['instance_uuid'])
        self.assertEqual(n['uuid'], res.uuid)

    def test_get_node_by_instance_wrong_uuid(self):
        self._create_test_node(
                instance_uuid='12345678-9999-0000-aaaa-123456789012')

        self.assertRaises(exception.InstanceNotFound,
                          self.dbapi.get_node_by_instance,
                          '12345678-9999-0000-bbbb-123456789012')

    def test_get_node_by_instance_invalid_uuid(self):
        self.assertRaises(exception.InvalidUUID,
                          self.dbapi.get_node_by_instance,
                          'fake_uuid')

    def test_destroy_node(self):
        n = self._create_test_node()

        self.dbapi.destroy_node(n['id'])
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.get_node_by_id, n['id'])

    def test_destroy_node_by_uuid(self):
        n = self._create_test_node()

        self.dbapi.destroy_node(n['uuid'])
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.get_node_by_uuid, n['uuid'])

    def test_destroy_node_that_does_not_exist(self):
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.destroy_node,
                          '12345678-9999-0000-aaaa-123456789012')

    def test_ports_get_destroyed_after_destroying_a_node(self):
        n = self._create_test_node()
        node_id = n['id']

        p = utils.get_test_port(node_id=node_id)
        p = self.dbapi.create_port(p)

        self.dbapi.destroy_node(node_id)

        self.assertRaises(exception.PortNotFound,
                          self.dbapi.get_port_by_id, p.id)

    def test_ports_get_destroyed_after_destroying_a_node_by_uuid(self):
        n = self._create_test_node()
        node_id = n['id']

        p = utils.get_test_port(node_id=node_id)
        p = self.dbapi.create_port(p)

        self.dbapi.destroy_node(n['uuid'])

        self.assertRaises(exception.PortNotFound,
                          self.dbapi.get_port_by_id, p.id)

    def test_update_node(self):
        n = self._create_test_node()

        old_extra = n['extra']
        new_extra = {'foo': 'bar'}
        self.assertNotEqual(old_extra, new_extra)

        res = self.dbapi.update_node(n['id'], {'extra': new_extra})
        self.assertEqual(new_extra, res.extra)

    def test_update_node_not_found(self):
        node_uuid = ironic_utils.generate_uuid()
        new_extra = {'foo': 'bar'}
        self.assertRaises(exception.NodeNotFound, self.dbapi.update_node,
                          node_uuid, {'extra': new_extra})

    def test_update_node_uuid(self):
        n = self._create_test_node()
        self.assertRaises(exception.InvalidParameterValue,
                          self.dbapi.update_node, n['id'],
                          {'uuid': ''})

    def test_update_node_associate_and_disassociate(self):
        n = self._create_test_node()
        new_i_uuid = ironic_utils.generate_uuid()
        res = self.dbapi.update_node(n['id'], {'instance_uuid': new_i_uuid})
        self.assertEqual(new_i_uuid, res.instance_uuid)
        res = self.dbapi.update_node(n['id'], {'instance_uuid': None})
        self.assertIsNone(res.instance_uuid)

    def test_update_node_already_associated(self):
        n = self._create_test_node()
        new_i_uuid_one = ironic_utils.generate_uuid()
        self.dbapi.update_node(n['id'], {'instance_uuid': new_i_uuid_one})
        new_i_uuid_two = ironic_utils.generate_uuid()
        self.assertRaises(exception.NodeAssociated,
                          self.dbapi.update_node,
                          n['id'],
                          {'instance_uuid': new_i_uuid_two})

    def test_update_node_instance_already_associated(self):
        n = self._create_test_node(id=1, uuid=ironic_utils.generate_uuid())
        new_i_uuid = ironic_utils.generate_uuid()
        self.dbapi.update_node(n['id'], {'instance_uuid': new_i_uuid})
        n = self._create_test_node(id=2, uuid=ironic_utils.generate_uuid())
        self.assertRaises(exception.InstanceAssociated,
                          self.dbapi.update_node,
                          n['id'],
                          {'instance_uuid': new_i_uuid})

    @mock.patch.object(timeutils, 'utcnow')
    def test_update_node_provision(self, mock_utcnow):
        mocked_time = datetime.datetime(2000, 1, 1, 0, 0)
        mock_utcnow.return_value = mocked_time
        n = self._create_test_node()
        res = self.dbapi.update_node(n['id'], {'provision_state': 'fake'})
        self.assertEqual(mocked_time,
                         timeutils.normalize_time(res['provision_updated_at']))

    def test_update_node_no_provision(self):
        n = self._create_test_node()
        res = self.dbapi.update_node(n['id'], {'extra': {'foo': 'bar'}})
        self.assertIsNone(res['provision_updated_at'])

    def test_reserve_node(self):
        n = self._create_test_node()
        uuid = n['uuid']

        r1 = 'fake-reservation'

        # reserve the node
        self.dbapi.reserve_node(r1, uuid)

        # check reservation
        res = self.dbapi.get_node_by_uuid(uuid)
        self.assertEqual(r1, res.reservation)

    def test_release_reservation(self):
        n = self._create_test_node()
        uuid = n['uuid']

        r1 = 'fake-reservation'
        self.dbapi.reserve_node(r1, uuid)

        # release reservation
        self.dbapi.release_node(r1, uuid)
        res = self.dbapi.get_node_by_uuid(uuid)
        self.assertIsNone(res.reservation)

    def test_reservation_of_reserved_node_fails(self):
        n = self._create_test_node()
        uuid = n['uuid']

        r1 = 'fake-reservation'
        r2 = 'another-reservation'

        # reserve the node
        self.dbapi.reserve_node(r1, uuid)

        # another host fails to reserve or release
        self.assertRaises(exception.NodeLocked,
                          self.dbapi.reserve_node,
                          r2, uuid)
        self.assertRaises(exception.NodeLocked,
                          self.dbapi.release_node,
                          r2, uuid)

    def test_reservation_after_release(self):
        n = self._create_test_node()
        uuid = n['uuid']

        r1 = 'fake-reservation'
        r2 = 'another-reservation'

        self.dbapi.reserve_node(r1, uuid)
        self.dbapi.release_node(r1, uuid)

        # another host succeeds
        self.dbapi.reserve_node(r2, uuid)
        res = self.dbapi.get_node_by_uuid(uuid)
        self.assertEqual(r2, res.reservation)

    def test_reservation_in_exception_message(self):
        n = self._create_test_node()
        uuid = n['uuid']

        r = 'fake-reservation'
        self.dbapi.reserve_node(r, uuid)
        try:
            self.dbapi.reserve_node('another', uuid)
        except exception.NodeLocked as e:
            self.assertIn(r, str(e))

    def test_reservation_non_existent_node(self):
        n = self._create_test_node()
        self.dbapi.destroy_node(n['id'])

        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.reserve_node, 'fake', n['id'])
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.reserve_node, 'fake', n['uuid'])

    def test_release_non_existent_node(self):
        n = self._create_test_node()
        self.dbapi.destroy_node(n['id'])

        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.release_node, 'fake', n['id'])
        self.assertRaises(exception.NodeNotFound,
                          self.dbapi.release_node, 'fake', n['uuid'])

    def test_release_non_locked_node(self):
        n = self._create_test_node()

        self.assertEqual(None, n['reservation'])
        self.assertRaises(exception.NodeNotLocked,
                          self.dbapi.release_node, 'fake', n['id'])
        self.assertRaises(exception.NodeNotLocked,
                          self.dbapi.release_node, 'fake', n['uuid'])


text:
/* @(#) $Id: zutil.c,v 1.3 2006/04/29 07:31:16 wl Exp $ */

#include "zutil.h"

#ifndef STDC
extern void exit OF((int));
#endif

#ifndef HAVE_MEMCPY

void zmemcpy(dest, source, len)
    Bytef* dest;
    const Bytef* source;
    uInt  len;
{
    if (len == 0) return;
    do {
        *dest++ = *source++; /* ??? to be unrolled */
    } while (--len != 0);
}

int zmemcmp(s1, s2, len)
    const Bytef* s1;
    const Bytef* s2;
    uInt  len;
{
    uInt j;

    for (j = 0; j < len; j++) {
        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
    }
    return 0;
}

void zmemzero(dest, len)
    Bytef* dest;
    uInt  len;
{
    if (len == 0) return;
    do {
        *dest++ = 0;  /* ??? to be unrolled */
    } while (--len != 0);
}
#endif

#ifdef __TURBOC__
#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
/* Small and medium model in Turbo C are for now limited to near allocation
 * with reduced MAX_WBITS and MAX_MEM_LEVEL
 */
#  define MY_ZCALLOC

/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
 * and farmalloc(64K) returns a pointer with an offset of 8, so we
 * must fix the pointer. Warning: the pointer must be put back to its
 * original form in order to free it, use zcfree().
 */

#define MAX_PTR 10
/* 10*64K = 640K */

local int next_ptr = 0;

typedef struct ptr_table_s {
    voidpf org_ptr;
    voidpf new_ptr;
} ptr_table;

local ptr_table table[MAX_PTR];
/* This table is used to remember the original form of pointers
 * to large buffers (64K). Such pointers are normalized with a zero offset.
 * Since MSDOS is not a preemptive multitasking OS, this table is not
 * protected from concurrent access. This hack doesn't work anyway on
 * a protected system like OS/2. Use Microsoft C instead.
 */

voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
{
    voidpf buf = opaque; /* just to make some compilers happy */
    ulg bsize = (ulg)items*size;

    /* If we allocate less than 65520 bytes, we assume that farmalloc
     * will return a usable pointer which doesn't have to be normalized.
     */
    if (bsize < 65520L) {
        buf = farmalloc(bsize);
        if (*(ush*)&buf != 0) return buf;
    } else {
        buf = farmalloc(bsize + 16L);
    }
    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
    table[next_ptr].org_ptr = buf;

    /* Normalize the pointer to seg:0 */
    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
    *(ush*)&buf = 0;
    table[next_ptr++].new_ptr = buf;
    return buf;
}

void  zcfree (voidpf opaque, voidpf ptr)
{
    int n;
    if (*(ush*)&ptr != 0) { /* object < 64K */
        farfree(ptr);
        return;
    }
    /* Find the original pointer */
    for (n = 0; n < next_ptr; n++) {
        if (ptr != table[n].new_ptr) continue;

        farfree(table[n].org_ptr);
        while (++n < next_ptr) {
            table[n-1] = table[n];
        }
        next_ptr--;
        return;
    }
    ptr = opaque; /* just to make some compilers happy */
    Assert(0, "zcfree: ptr not found");
}
#endif
#endif /* __TURBOC__ */

#if defined(M_I86) && !defined(__32BIT__)
/* Microsoft C in 16-bit mode */

#  define MY_ZCALLOC

#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
#  define _halloc  halloc
#  define _hfree   hfree
#endif

voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
{
    if (opaque) opaque = 0; /* to make compiler happy */
    return _halloc((long)items, size);
}

void  zcfree (voidpf opaque, voidpf ptr)
{
    if (opaque) opaque = 0; /* to make compiler happy */
    _hfree(ptr);
}

#endif /* MSC */

#ifndef MY_ZCALLOC /* Any system without a special alloc function */

#ifndef STDC
extern voidp  ft_scalloc OF((uInt items, uInt size));
extern void   ft_sfree   OF((voidpf ptr));
#endif

voidpf zcalloc (opaque, items, size)
    voidpf opaque;
    unsigned items;
    unsigned size;
{
    if (opaque) items += size - size; /* make compiler happy */
    return (voidpf)ft_scalloc(items, size);
}

void  zcfree (opaque, ptr)
    voidpf opaque;
    voidpf ptr;
{
    ft_sfree(ptr);
    if (opaque) return; /* make compiler happy */
}

#endif /* MY_ZCALLOC */


text:
package org.kuali.kfs.module.ar.document.validation.impl;

import org.kuali.kfs.module.ar.document.CustomerInvoiceDocument;
import org.kuali.kfs.sys.document.validation.GenericValidation;
import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
import org.kuali.rice.krad.util.ObjectUtils;

public class CustomerInvoiceRecurrenceWorkgroupValidation extends GenericValidation {

    private CustomerInvoiceDocument customerInvoiceDocument;

    public boolean validate(AttributedDocumentEvent event) {

        // short circuit if no recurrence object at all
        if (ObjectUtils.isNull(customerInvoiceDocument.getCustomerInvoiceRecurrenceDetails())) {
            return true;
        }

        if (customerInvoiceDocument.getNoRecurrenceDataFlag())
            return true;

        return true;
    }

    public CustomerInvoiceDocument getCustomerInvoiceDocument() {
        return customerInvoiceDocument;
    }

    public void setCustomerInvoiceDocument(CustomerInvoiceDocument customerInvoiceDocument) {
        this.customerInvoiceDocument = customerInvoiceDocument;
    }
}


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model(array('Users_model', 'CMS_model'));
    }

    /**
     * This function is used to load view.
     * @author : HPA
     */
    public function index() {
        $this->template->load('home_main');
    }

    /**
     * This function is used to send mail for get in touch section.
     * @author : AKK
     */
    public function get_in_touch() {
        if ($this->input->method() == 'post') {
            $value['message'] = '';
            if (!empty($this->input->post())) {
                $email_config = mail_config();
                $this->email->initialize($email_config);
                $this->email_data = array('head1' => 'New',
                    'head2' => 'Contact Request',
                    'name' => 'Support Team',
                    'ticket' => ''
                );
                $content = "Contact Request From : " . htmlentities($this->input->post('fname')) . ' ' . htmlentities($this->input->post('lname')) . "
";
                $content .= "Email : " . htmlentities($this->input->post('email')) . "
";
                $content .= "Website URL is : " . htmlentities($this->input->post('web')) . "
";
                $content .= "Message : " . htmlentities($this->input->post('message')) . "
";
                $this->email_data['content'] = $content;
                $message = $this->load->view('email_templates/common_email', $this->email_data, true);
//                echo $message;
//                die;
                $this->email
                        ->from(FROM_MAIL, 'OSOS')
                        ->to('info@osos.com')
//                        ->to('akk@narola.email')
                        ->subject('Contact Request From : ' . htmlentities($this->input->post('fname')) . ' ' . htmlentities($this->input->post('lname')))
                        ->message($message);

                $this->email->send();
                $this->CMS_model->log_activity(htmlentities($this->input->post('fname')) . ' ' . htmlentities($this->input->post('lname')) . ' has sent Contact Request!');
                $value['message'] = 'Your Contact Request has been sent successfully!';
            }
            echo json_encode($value);
        }
    }

    public function company_add() {
        if (!empty($this->session->userdata('company')) || !empty($this->session->userdata('agent')))
            redirect('dashboard');
        if ($this->input->post('company_type') == 'business') {
            $this->data['company'] = true;
            $this->form_validation->set_rules('company_name', 'Company Name', 'trim|required', array('required' => 'Please fill the field' . ' %s .'));
        }
        $this->data['plans'] = $this->CMS_model->get_result(TBL_MEMBERSHIP, array('is_deleted' => 0), 'id,title');
        $this->data['cities'] = $this->CMS_model->get_result(TBL_PROP_CITIES, array('is_delete' => 0));
        $this->form_validation->set_rules('fname', 'First Name', 'trim|required', array('required' => 'Please fill the field' . ' %s .', 'regex_match' => 'Only aplbhabets,space and underscore allowed for %s.'));
        $this->form_validation->set_rules('lname', 'Last Name', 'trim|required', array('required' => 'Please fill the field' . ' %s .'));
        $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_check_user', array('required' => 'Please fill the field' . ' %s.', 'valid_email' => 'Please enter valid E-mail.', 'check_user' => 'Email Already Exists.'));
        $this->form_validation->set_rules('confirm_email', 'Confirm Email', 'trim|required|matches[email]', array('matches' => 'Confirm Email and Email does not matche.'));
        $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[6]', array('required' => 'Please fill the field' . ' %s.', 'min_length' => 'Please enter password of minimum 6 characters.'));
        $this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|required|matches[password]', array('matches' => 'Confirm Password and Password does not match.'));
        $this->form_validation->set_rules('phone_no', 'Contact Number', 'trim|required|regex_match[/^[0-9]{9}$/]', array('required' => 'Please fill the field' . ' %s.', 'regex_match' => 'Please enter valid %s.'));
        $this->form_validation->set_rules('membership_id', 'No of Property', 'trim|required', array('required' => 'Please fill the field' . ' %s.'));
        $this->form_validation->set_rules('city_id', 'Work Emirates', 'trim|required', array('required' => 'Please fill the field' . ' %s.'));
        if ($this->form_validation->run() == FALSE) {
            $this->template->load('front_register', null, $this->data);
        } else {
            $verification_token = generate_crypto_string(25);
            $company_data = array('role_id' => 2,
                'fname' => htmlentities($this->input->post('fname')),
                'lname' => htmlentities($this->input->post('lname')),
                'company_type' => $this->input->post('company_type'),
                'company_name' => htmlentities($this->input->post('company_name')) != '' ? htmlentities($this->input->post('company_name')) : NULL,
                'email' => htmlentities($this->input->post('email')),
                'phone_no' => htmlentities($this->input->post('phone_no')),
                'password' => $this->encrypt->encode(htmlentities($this->input->post('password'))),
                'membership_id' => $this->input->post('membership_id'),
                'city_id' => $this->input->post('city_id'),
                'verification_token' => $verification_token,
                'created_date' => date('Y-m-d H:i:s'),
            );
            $last_company_id = $this->CMS_model->manage_record(TBL_USERS, $company_data);
            if ($last_company_id != null) {
                $last_id = $this->db->insert_id();
                $this->CMS_model->insert_data(TBL_CRON_SETTINGS, ['company_id' => $last_id, 'created' => date('Y-m-d H:i:s')]);
                $permission_settings = [
                    0 => [
                        'role_id' => 5,
                        'method_id' => '1,2,3,9'
                    ],
                    1 => [
                        'role_id' => 6,
                        'method_id' => '10,11,12,15,19,20,21'
                    ],
                    2 => [
                        'role_id' => 7,
                        'method_id' => '24,25,26,31,32,33'
                    ],
                    3 => [
                        'role_id' => 8,
                        'method_id' => '38,39,40,43,44,45'
                    ],
                    4 => [
                        'role_id' => 9,
                        'method_id' => 'ALL,49,50,51,52,53,54,55,56'
                    ],
                    5 => [
                        'role_id' => 10,
                        'method_id' => '1,10,19,24,31,38,43,ALL,49,50,51,52,53,54,55,56'
                    ],
                ];
                $insert_permission = [];
                foreach ($permission_settings as $val) {
                    $insert_permission[] = [
                        'company_id' => $last_id,
                        'permission_id' => $val['role_id'],
                        'method_id' => $val['method_id'],
                        'created' => date('Y-m-d H:i:s')
                    ];
                }
                $this->CMS_model->insert_batch(TBL_EMPLOYEE_PERMISSION, $insert_permission);
//                $link = "" . base_url() . "verify_account/" . $verification_token . "";
                $email_config = mail_config();
                $this->email->initialize($email_config);
                $this->data['token'] = $verification_token;
                $message = $this->load->view('email_templates/confirm_email', $this->data, true);
//                echo $message;
//                die;
                $this->email
                        ->from(FROM_MAIL, 'OSOS')
                        ->to(htmlentities($this->input->post('email')))
                        ->subject('OSOS Account Verification')
                        ->message($message);

                if ($this->email->send()) {
                    $this->CMS_model->log_activity(htmlentities($this->input->post('fname')) . ' ' . htmlentities($this->input->post('lname')) . ' has Registerd!', $last_id);
                    $this->session->set_flashdata('message', ['message' => 'We have sent an email to you, please click on the link in your email to activate you account!!', 'class' => 'alert alert-success']);
                    redirect('/');
//                    redirect('register');
                }
            }
            redirect('/');
//            redirect('register');
        }
    }

    public function confirm_email($token) {

        $user = $this->CMS_model->get_result(TBL_USERS, array('is_deleted' => 0, 'verification_token' => $token));
//        echo $this->db->last_query();
//        pr($user, 1);
        if (empty($user)) {
            custom_error();
            $this->load->view('company/error404', $this->data);
        } else {
            if ($user[0]['is_verify'] == 1) {
//                $this->data['verify'] = 0;
                $this->data['message'] = 'Account is already verified.';
//                $this->session->set_flashdata('success', 'Account is already verified.');
            } else {
                $data = ['is_verify' => 1];
                $this->CMS_model->manage_record(TBL_USERS, $data, $user[0]['id']);
//                $this->data['verify'] = 1;
                $email_config = mail_config();
                $this->email->initialize($email_config);
                $this->email_data['content'] = $this->load->view('email_templates/welcome_content', null, true);
                $message = $this->load->view('email_templates/welcome_email', $this->email_data, true);
                $this->email
                        ->from('shadi@osos.ae', 'Shadi Al Saiegh')
                        ->to($user[0]['email'])
//                        ->to('akk@narola.email')
                        ->subject('Welcome to OSOS Properties')
                        ->message($message);

                $this->email->send();
                $this->CMS_model->log_activity($user[0]['fname'] . ' ' . $user[0]['lname'] . ' has Verified Account!', $user[0]['id']);
                $this->data['message'] = 'Your account is successfully verified! Please login to access your account!';
//                redirect('login');
            }
            $this->template->load('email_verify', null, $this->data);
        }
    }

    /**
     * This function is used to Check email already exists.
     * @author : HPA
     * @return boolean
     */
    public function check_user() {
        $email = htmlentities($this->input->post('email')); // get last name
        $this->db->select('email');
        $this->db->from(TBL_USERS);
        $this->db->where('email', $email);
        $this->db->where('is_deleted', '0');
        $query = $this->db->get();
        $num = $query->num_rows();
        if ($num > 0) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

}


text:
[![Build Status](https://travis-ci.org/runafter/working-time-tracer.svg?branch=master)](https://travis-ci.org/runafter/working-time-tracer)

# Working time tracer
- Using Android Notification, trace working time.


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model as BaseModel;

class Model extends BaseModel
{
    public function scopeOrdered($query)
    {
        return $query->orderBy('id', 'desc');
    }

    public function scopeOrder($query)
    {
        return $query->orderBy('order', 'asc');
    }
}


text:
      <a id="mind-map-toggle" href="<?= home_url() ?>" class="js-mind-map-toggle">
        Mind-map

        <a href="<?= home_url() ?>" class="dark">Anson Kao

            Toronto, ON, Canada

Electronic Dance Music

Music Production

Music

Music Theory

Emotion

Passion

Interpersonal Relationships

Philosophy

Motivation

Innovation

Startup

Design

Technology

Software Development

User Experience

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        Toggle navigation
        Menu
      </button>

        <?php
          if (has_nav_menu('primary_navigation')) :
            wp_nav_menu(array('theme_location' => 'primary_navigation', 'menu_class' => 'nav nav-anson-toolbar'));
          endif;
        ?>


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

namespace com.fswire.streaming.api
{
    public enum ConnectionState
    {
        Initialized,
        Connecting,
        Connected,
        Unavailable,
        Failed,
        Disconnected
    }
}


text:
<!--
~ Copyright 2012-2013 Thomas Bouffard (redfish4ktc)
~
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>soapui.extension</groupId>
    <artifactId>common-it-parent</artifactId>
    <version>@project.version@</version>
    <relativePath>../common.xml</relativePath>
  </parent>
  <groupId>soapui.extension</groupId>
  <artifactId>mock-as-war-goal-no-jetty-deploy</artifactId>
  <packaging>pom</packaging>

  <properties>
    <soapui.configuration.path>${basedir}/../_soapui_conf</soapui.configuration.path>
    <soapui.project.file.path>${soapui.configuration.path}/test-mock-service-soapui-project.xml</soapui.project.file.path>
    <soapui.settings.empty.file.path>${soapui.configuration.path}/empty-soapui-settings.xml</soapui.settings.empty.file.path>

    <soapui.base.output.directory>${project.build.directory}/soapui</soapui.base.output.directory>
    <soapui.output.directory>${soapui.base.output.directory}/reports</soapui.output.directory>
    <soapui.log.directory>${soapui.base.output.directory}/test-logs/</soapui.log.directory>
    <soapui.generation.dir>${soapui.base.output.directory}/generation</soapui.generation.dir>
    <!-- put generated webapp in 2 differents tree to be sure our plugin creates subdirectories -->
    <soapui.war.path.basedir>${soapui.generation.dir}/file/war/</soapui.war.path.basedir>
    <soapui.war.path>${soapui.war.path.basedir}/${project.build.finalName}.war</soapui.war.path>
    <soapui.war.exploded.path>${soapui.generation.dir}/war/exploded</soapui.war.exploded.path>
    <soapui.host>localhost:${server.port}</soapui.host>

  </properties>

</project>


text:
package wisekb.flume.sink.jdbc;

import org.apache.flume.Event;

import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class DateHeaderParameter extends HeaderParameter {

    private static final Pattern CONFIG_PATTERN = Pattern.compile("(.+)#(.+?)");
    SimpleDateFormat format;

    public DateHeaderParameter(final int parameter, final String header) {
        super(parameter, header);
    }

    @Override
    public void configure(final String config) {
        if (config == null || "".equals(config)) {
            throw new IllegalArgumentException("Config string is required for date parameters.");
        }
        final Matcher m = CONFIG_PATTERN.matcher(config);
        if (m.matches()) {
            format = new SimpleDateFormat(m.group(1));
            format.setTimeZone(TimeZone.getTimeZone(m.group(2)));
        } else {
            format = new SimpleDateFormat(config);
        }
    }

    @Override
    public void setValue(final PreparedStatement ps, final Event e) throws Exception {
        final String value = e.getHeaders().get(header);
        if (value == null) {
            ps.setNull(id, Types.TIMESTAMP);
        } else {
            ps.setTimestamp(id, new Timestamp(format.parse(value).getTime()));
        }
    }

}


text:
package com.db4o.marshall;

import com.db4o.typehandlers.*;

/**
 * this interface is passed to internal class {@link TypeHandler4} during marshaling
 * and provides methods to marshal objects.
 */
public interface WriteContext extends Context, WriteBuffer {

    /**
     * makes sure the object is stored and writes the ID of
     * the object to the context.
     * Use this method for first class objects only (objects that
     * have an identity in the database). If the object can potentially
     * be a primitive type, do not use this method but use
     * a matching {@link WriteBuffer} method instead.
     * @param obj the object to write.
     */
    void writeObject(Object obj);

    /**
     * writes sub-objects, in cases where the {@link TypeHandler4} is known.
     *
     * @param handler typehandler to be used to write the object.
     * @param obj the object to write
     */
    void writeObject(TypeHandler4 handler, Object obj);

    /**
     * reserves a buffer with a specific length at the current
     * position, to be written in a later step.
     * @param length the length to be reserved.
     * @return the ReservedBuffer
     */
    ReservedBuffer reserve(int length);

}


text:
module Spree
  module Stock
    module Splitter
      class ShippingCategory < Spree::Stock::Splitter::Base
        def split(packages)
          split_packages = []
          packages.each do |package|
            split_packages += split_by_category(package)
          end
          return_next split_packages
        end

        private

        def split_by_category(package)
          categories = Hash.new { |hash, key| hash[key] = [] }
          package.contents.each do |item|
            categories[item.variant.shipping_category_id] << item
          end
          hash_to_packages(categories)
        end

        def hash_to_packages(categories)
          packages = []
          categories.each do |_id, contents|
            packages << build_package(contents)
          end
          packages
        end
      end
    end
  end
end


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

  <title>Description of enclosingCircle</title>
  <meta name="keywords" content="enclosingCircle">
  <meta name="description" content="ENCLOSINGCIRCLE find the minimum circle enclosing a set of points.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html © 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">

Home >  imael > geom2d > enclosingCircle.m

enclosingCircle

PURPOSE

ENCLOSINGCIRCLE find the minimum circle enclosing a set of points.

SYNOPSIS

function circle = enclosingCircle(pts)

DESCRIPTION

ENCLOSINGCIRCLE find the minimum circle enclosing a set of points.

   CIRCLE = enclosingCircle(POINTS);
   compute cirlce CIRCLE=[xc yc r] which enclose all points POINTS given
   as an [Nx2] array.

   Rewritten from a file from
           Yazan Ahed (yash78@gmail.com)

   which was rewritten from a Java applet by Shripad Thite :
   http://heyoka.cs.uiuc.edu/~thite/mincircle/

   See also:
   circles2d, points2d, boxes2d

   ---------
   author : David Legland
   INRA - TPV URPOI - BIA IMASTE
   created the 07/07/2005.

CROSS-REFERENCE INFORMATION

This function calls:

createCircle	CREATECIRCLE create a circle from points

distancePoints	DISTANCEPOINTS compute distance between two points

This function is called by:

<address>Generated on Fri 05-Feb-2010 11:20:41 by m2html © 2003</address>


text:
package gui.elements;

import gui.SDMouseEvent;
import gui.SDMouseEvent.SDMouseEventType;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.beans.Transient;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import util.Location2D;
import util.SDListener;
import util.SDShouter;
import static gui.SDMouseEvent.SDMouseEventType.*;

public class FancyImagePanel extends JPanel implements MouseListener {
	private static final long serialVersionUID = 1L;
	private ImagePanel canvas;
	private JScrollPane sp;
	private SDShouter mouseShouter = new SDShouter();

	public FancyImagePanel(BufferedImage image) {

		canvas = new ImagePanel(image);
		canvas.addMouseListener(this);
		canvas.setPreferredSize(new Dimension(image.getWidth(), image
				.getHeight()));
		sp = new JScrollPane(canvas);
		setLayout(new BorderLayout());
		add(sp, BorderLayout.CENTER);
		add(sp);
	}

	public void setZoomFactor(double newZoomFactor) {
		canvas.setZoomFactor(newZoomFactor);
		refresh();
	}

	public BufferedImage getImage() {
		return canvas.getImage();
	}

	public void setImage(BufferedImage image) {
		canvas.setImage(image);
		refresh();
	}

	public void refresh() {
		Dimension dim = getPreferredSize();
		sp.setPreferredSize(dim);
		sp.getViewport().setPreferredSize(dim);
		canvas.setPreferredSize(dim);
		setPreferredSize(dim);

		repaint();
		canvas.repaint();
		sp.repaint();
	}

	@Override
	@Transient
	public Dimension getPreferredSize() {
		return canvas.getPreferredSize();
	}

	public void addImageMouseMotionListener(MouseMotionListener ml) {
		canvas.addMouseMotionListener(ml);
	}

	public void addImageMouseListener(SDListener sdl) {
		mouseShouter.addListener(sdl);
	}

	public void addImageMouseListener(MouseListener ml) {
		canvas.addMouseListener(ml);
	}

	public void setHorizontalLine(int value) {
//		canvas.setHorizontalLine((int) (value * canvas.getZoomFactor()));
		canvas.setHorizontalLine(value);
	}

	public void setVerticalLine(int value) {
//		canvas.setVerticalLine((int) (x * canvas.getZoomFactor()));
		canvas.setVerticalLine(value);
	}

	// TODO_ ignore clicks outside the actual image
	private void processMouseEvent(MouseEvent e, SDMouseEventType met) {
		Location2D loc = new Location2D(e.getX(), e.getY());
		loc.scaleDownBy(canvas.getZoomFactor());
		SDMouseEvent sdme = new SDMouseEvent(met, loc, e);
		mouseShouter.broadcast(sdme);
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		processMouseEvent(e, CLICK);
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		processMouseEvent(e, ENTER);
	}

	@Override
	public void mouseExited(MouseEvent e) {
		processMouseEvent(e, EXIT);
	}

	@Override
	public void mousePressed(MouseEvent e) {
		processMouseEvent(e, PRESS);
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		processMouseEvent(e, RELEASE);
	}
}


text:
import { Component } from '@angular/core';

@Component({
  selector: 'app-comparison-header',
  templateUrl: 'header.component.html',
  styleUrls: ['header.component.scss']
})
export class HeaderComponent { }


text:
package com.intellij.refactoring.extractMethod;

import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;

/**
* User: ktisha
*/
public class SimpleMatch {
  PsiElement myStartElement;
  PsiElement myEndElement;
  private final Map<String, String> myChangedParameters;
  private String myChangedOutput;

  public SimpleMatch(@NotNull final PsiElement start, @NotNull final PsiElement endElement) {
    myStartElement = start;
    myEndElement = endElement;
    myChangedParameters = new HashMap<String, String>();
  }

  public PsiElement getStartElement() {
    return myStartElement;
  }

  public PsiElement getEndElement() {
    return myEndElement;
  }

  public Map<String, String> getChangedParameters() {
    return myChangedParameters;
  }

  public void changeParameter(@NotNull final String from, @NotNull final String to) {
    myChangedParameters.put(from, to);
  }

  public void changeOutput(@NotNull final String to) {
    myChangedOutput = to;
  }

  public String getChangedOutput() {
    return myChangedOutput;
  }

}


text:
layout: page
title: Sellers Family Reunion
date: 2016-05-24
author: Mildred Pearson
tags: weekly links, java
status: published
summary: Donec dictum viverra metus sed facilisis. Donec mollis diam ullamcorper.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 05/08/2019
  endDate: 05/11/2019
  ctyhocn: TYSDDHX
  groupCode: SFR
published: true
---
Ut rhoncus iaculis molestie. Nullam nunc quam, auctor eget porttitor vel, condimentum ac mi. Fusce eu facilisis mauris. Nam consectetur velit ut diam vehicula fermentum. Mauris in eleifend eros. Quisque congue magna tortor, et condimentum leo dictum ultricies. Maecenas posuere dui non urna molestie, quis posuere ipsum volutpat. Fusce a dui ullamcorper, ullamcorper urna convallis, egestas mauris. Aenean lobortis accumsan elit ac lacinia. Maecenas non enim ipsum. Suspendisse sapien orci, convallis et blandit eget, porttitor et metus. Nunc euismod laoreet nibh eu tincidunt.

* Proin molestie justo in purus ultrices, a feugiat nisl placerat
* Quisque tincidunt odio et purus aliquet consectetur
* Sed vel felis vel leo elementum luctus et eget orci.

Aenean vestibulum efficitur felis, nec pellentesque nulla aliquam eu. Integer ac luctus risus. Nullam porttitor nunc sed porta porttitor. Aliquam imperdiet ex sit amet scelerisque luctus. Nulla aliquet egestas odio et efficitur. Praesent id ullamcorper erat, eget consequat justo. Nulla in cursus leo. Quisque suscipit mauris a velit congue finibus.
Cras libero lorem, tristique id tincidunt vitae, semper a libero. Donec quis malesuada arcu. Praesent ultrices tincidunt neque, dapibus sollicitudin sem rutrum at. Phasellus interdum elit eget diam tristique porttitor. Suspendisse volutpat lorem sit amet turpis elementum, sit amet pharetra metus sollicitudin. Proin non libero egestas, accumsan eros finibus, molestie orci. Nam porttitor est velit, sit amet volutpat sapien varius quis. Morbi cursus viverra elit, laoreet placerat dui maximus varius.


text:
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;

namespace Swicli.Library
{
       #region P/Invoke
      // Adapted from http://tirania.org/blog/archive/2009/Aug-11.html
      // This is a hack to work around Linux not being able to use libld.so to dynamically
      // load .so modules...
    public class PInvokeDLL
    {
        private string m_dllName;
        private AssemblyBuilder m_assemblyBuilder;
        private ModuleBuilder m_moduleBuilder;

        public PInvokeDLL(string name)
        {
            m_dllName = name;
            m_assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("ctype"), AssemblyBuilderAccess.Run);
            m_moduleBuilder = m_assemblyBuilder.DefineDynamicModule("ctype");
        }

        public Delegate CreateDelegate(string entry_point, Type delegateType)
        {
            MethodInfo methodInfo = delegateType.GetMethod("Invoke");

            // Get parameter signature information from delegate Invokation
            ParameterInfo returnParameter = methodInfo.ReturnParameter;
            ParameterInfo[] parameters = methodInfo.GetParameters();
            Type[] parameterTypes = new Type[parameters.Length];
            Type[][] parameterTypeRequiredCustomModifiers = new Type[parameters.Length][];
            Type[][] parameterTypeOptionalCustomModifiers = new Type[parameters.Length][];
            for (int i = 0; i < parameters.Length; ++i)
            {
                parameterTypes[i] = parameters[i].ParameterType;
                parameterTypeRequiredCustomModifiers[i] = parameters[i].GetRequiredCustomModifiers();
                parameterTypeOptionalCustomModifiers[i] = parameters[i].GetOptionalCustomModifiers();
            }

            TypeBuilder typeBuilder = m_moduleBuilder.DefineType("ctype_" + entry_point);
            typeBuilder.DefinePInvokeMethod("Invoke", m_dllName, entry_point,
               MethodAttributes.Static | MethodAttributes.PinvokeImpl, CallingConventions.Standard,
               returnParameter.ParameterType, returnParameter.GetRequiredCustomModifiers(), returnParameter.GetOptionalCustomModifiers(),
               parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers,
               CallingConvention.StdCall, CharSet.Auto);

            Type builtType = typeBuilder.CreateType();
            MethodInfo returnMethodInfo = builtType.GetMethod("Invoke", BindingFlags.Static | BindingFlags.NonPublic) ??
                                          builtType.GetMethod("Invoke", BindingFlags.Static | BindingFlags.Public);
            return Delegate.CreateDelegate(delegateType, returnMethodInfo);
        }

        private PInvokeDLL m_pInvokeDll = null;
        private IntPtr m_hDLL;

        [DllImport("kernel32", SetLastError = true)]
        private static extern IntPtr LoadLibrary(string lpFileName);

        [DllImport("kernel32.dll", SetLastError = true)]
        private static extern bool FreeLibrary(IntPtr hModule);

        [DllImport("kernel32", EntryPoint = "GetProcAddress", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
        private static extern IntPtr GetProcAddress(IntPtr hModule, string procName);

        private Delegate GetDelegate(string funcName, Type delegateType)
        {
            if (m_pInvokeDll != null)
                return m_pInvokeDll.CreateDelegate(funcName, delegateType);

            IntPtr funcPtr = GetProcAddress(m_hDLL, funcName);
            if (funcPtr.Equals(IntPtr.Zero))
                return null;
            return Marshal.GetDelegateForFunctionPointer(funcPtr, delegateType);
        }
       #endregion
    }
}


text:
'use strict';

//Salaries service used to communicate SalariesFiltered REST endpoint
angular.module('salaries').factory('SalariesFiltered', ['$resource', function ($resource) {
    return $resource('salaries/search');
}]);


text:
struct PapayaMemory;

namespace Platform
{
    void Print(char* Message);
    void StartMouseCapture();
    void ReleaseMouseCapture();
    void SetMousePosition(Vec2 Pos);
    void SetCursorVisibility(bool Visible);
    char* OpenFileDialog();
    char* SaveFileDialog();

	FILE* openFile(const char* filename, const char* flags);

	int64 GetMilliseconds();

	PapayaMemory* GetMem();
}


text:
module ChefDK
  module Policyfile

    # A class that can apply constraints from a lock to a compiler
    class LockApplier
      attr_reader :unlocked_policies
      attr_reader :policyfile_lock
      attr_reader :policyfile_compiler

      # Initialize a LockApplier. By default, all locked data this class knows
      # about will be applied to the compiler. Currently, it applies locks only
      # for included policies.
      #
      # @param policyfile_lock [PolicyfileLock] contains the locked data to use
      # @param policyfile_compiler [PolicyfileCompiler] the compiler to apply the locked data
      def initialize(policyfile_lock, policyfile_compiler)
        @policyfile_lock = policyfile_lock
        @policyfile_compiler = policyfile_compiler
        @unlocked_policies = []
      end

      # Unlocks included policies
      #
      # @param policies [:all] Unconstrain all policies
      # @param policies [Array<String>] Unconstrain a specific policy by name
      def with_unlocked_policies(policies)
        if policies == :all || unlocked_policies == :all
          @unlocked_policies = :all
        else
          policies.each do |policy|
            @unlocked_policies << policy
          end
        end
        self
      end

      # Apply locks described in policyfile_lock allowing for the deviations asked
      # for.
      #
      # @note No changes are applied until apply! is invoked
      def apply!
        prepare_constraints_for_policies
      end

      private

      def prepare_constraints_for_policies
        if unlocked_policies == :all
          return
        end

        policyfile_compiler.included_policies.each do |policy|
          unless unlocked_policies.include?(policy.name)
            lock = policyfile_lock.included_policy_locks.find do |policy_lock|
              policy_lock["name"] == policy.name
            end
            policy.apply_locked_source_options(lock["source_options"])
          end
        end
      end
    end
  end
end


text:
@interface TracelessInitConfigure : NSObject

@property (nonatomic,copy) NSString *appid;
@property(nonatomic,copy) NSString *channelId;
@property(nonatomic,copy) NSString *devid;
@property (nonatomic,copy) NSString *URLSchemes;
-(instancetype)initWithAppid:(NSString *)appid URLSchemes:(NSString *)shemes;

@end


text:
package typeformation.cf.init

import typeformation.cf.HasLogicalId

case class Group(logicalId: String, gid: Option[Int]) extends HasLogicalId


text:
package com.cognifide.maven.plugins.crx;

import static org.junit.Assert.assertEquals;

import java.io.IOException;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException;
import org.junit.Test;

public class CrxResponseParserTest {

	@Test
	public void parseDefaultResponseTest() throws JsonParseException,
			JsonMappingException, IOException {
		String json = "{\"success\":true,\"msg\":\"Package installed\"}";

		CrxResponse defaultResponse = CrxResponse.parseCrxJsonResponse(json);
		assertEquals(defaultResponse.isSuccess(), true);
		assertEquals(defaultResponse.getMsg(), "Package installed");
		assertEquals(defaultResponse.getPath(), null);
	}

	@Test
	public void parseFullResponseTest() throws JsonParseException,
			JsonMappingException, IOException {
		String json = "{\"success\":true,\"msg\":\"Package created\",\"path\":\"/etc/packages/day/testpackage.zip\"}";

		CrxResponse defaultResponse = CrxResponse.parseCrxJsonResponse(json);
		assertEquals(defaultResponse.isSuccess(), true);
		assertEquals(defaultResponse.getMsg(), "Package created");
		assertEquals(defaultResponse.getPath(),
				"/etc/packages/day/testpackage.zip");
	}

	@Test(expected = UnrecognizedPropertyException.class)
	public void wrongJsonMappingTest() throws JsonParseException,
			JsonMappingException, IOException {
		String json = "{\"x\":true,\"msg\":\"Package installed\"}";

		CrxResponse.parseCrxJsonResponse(json);
	}

}


text:
/**
 * Classes for testing XML content.
 */
package org.xbib.content.xml;


text:
dropdb ownership
dropdb ownership_test
dropuser ownership