text:
<!DOCTYPE html>

<!DOCTYPE html>

<title>Flaticon WebFont</title>
<link href="http://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="flaticon.css">
<meta charset="UTF-8">

        <svg version="1.1" xmlns="http://www.w3.org/2000/svg"   viewBox="0 0 560.875 102.036" enable-background="new 0 0 560.875 102.036" xml:space="preserve">
                <defs>
                </defs>
                <g>
                    <g class="letters">
                        <path fill="#ffffff" d="M141.596,29.675c0-3.777,2.985-6.767,6.764-6.767h34.438c3.426,0,6.15,2.728,6.15,6.15
                        c0,3.43-2.724,6.149-6.15,6.149h-27.674v13.091h23.719c3.429,0,6.151,2.724,6.151,6.15c0,3.43-2.723,6.149-6.151,6.149h-23.719
                        v17.574c0,3.773-2.986,6.761-6.764,6.761c-3.779,0-6.764-2.989-6.764-6.761V29.675z"></path>
                        <path fill="#ffffff" d="M193.844,29.149c0-3.781,2.985-6.767,6.764-6.767c3.776,0,6.763,2.985,6.763,6.767v42.957h25.039
                        c3.426,0,6.149,2.726,6.149,6.153c0,3.425-2.723,6.15-6.149,6.15h-31.802c-3.779,0-6.764-2.986-6.764-6.768V29.149z"></path>
                        <path fill="#ffffff" d="M241.891,75.71l21.438-48.407c1.492-3.341,4.215-5.357,7.906-5.357h0.792
                        c3.686,0,6.323,2.017,7.815,5.357l21.439,48.407c0.436,0.967,0.701,1.845,0.701,2.723c0,3.602-2.809,6.501-6.414,6.501
                        c-3.161,0-5.269-1.845-6.499-4.655l-4.132-9.661h-27.059l-4.301,10.102c-1.144,2.631-3.426,4.214-6.237,4.214
                        c-3.517,0-6.24-2.81-6.24-6.325C241.1,77.64,241.451,76.677,241.891,75.71z M279.932,58.666l-8.521-20.297l-8.526,20.297H279.932
                        z"></path>
                        <path fill="#ffffff" d="M314.864,35.387H301.86c-3.429,0-6.239-2.813-6.239-6.238c0-3.429,2.811-6.24,6.239-6.24h39.533
                        c3.426,0,6.237,2.811,6.237,6.24c0,3.425-2.811,6.238-6.237,6.238h-13.001v42.785c0,3.773-2.99,6.761-6.764,6.761
                        c-3.779,0-6.764-2.989-6.764-6.761V35.387z"></path>
                        <path fill="#A9FD00" d="M352.615,29.149c0-3.781,2.985-6.767,6.767-6.767c3.774,0,6.761,2.985,6.761,6.767v49.024
                        c0,3.773-2.987,6.761-6.761,6.761c-3.781,0-6.767-2.989-6.767-6.761V29.149z"></path>
                        <path fill="#A9FD00" d="M374.132,53.836v-0.179c0-17.481,13.178-31.801,32.065-31.801c9.22,0,15.459,2.458,20.557,6.238
                        c1.402,1.054,2.637,2.985,2.637,5.357c0,3.692-2.985,6.59-6.681,6.59c-1.845,0-3.071-0.702-4.044-1.319
                        c-3.776-2.813-7.729-4.393-12.562-4.393c-10.364,0-17.831,8.611-17.831,19.154v0.173c0,10.542,7.291,19.329,17.831,19.329
                        c5.715,0,9.492-1.756,13.359-4.834c1.049-0.874,2.458-1.491,4.039-1.491c3.429,0,6.325,2.813,6.325,6.236
                        c0,2.106-1.056,3.78-2.282,4.834c-5.539,4.834-12.036,7.733-21.878,7.733C387.572,85.464,374.132,71.493,374.132,53.836z"></path>
                        <path fill="#A9FD00" d="M433.009,53.836v-0.179c0-17.481,13.79-31.801,32.766-31.801c18.981,0,32.592,14.143,32.592,31.628v0.173
                        c0,17.483-13.785,31.807-32.769,31.807C446.625,85.464,433.009,71.32,433.009,53.836z M484.224,53.836v-0.179
                        c0-10.539-7.725-19.326-18.626-19.326c-10.893,0-18.449,8.611-18.449,19.154v0.173c0,10.542,7.73,19.329,18.626,19.329
                        C476.676,72.986,484.224,64.378,484.224,53.836z"></path>
                        <path fill="#A9FD00" d="M506.233,29.321c0-3.774,2.99-6.763,6.767-6.763h1.401c3.252,0,5.183,1.583,7.029,3.953l26.093,34.265
                        V29.059c0-3.692,2.99-6.677,6.681-6.677c3.683,0,6.671,2.985,6.671,6.677v48.934c0,3.78-2.987,6.765-6.764,6.765h-0.436
                        c-3.257,0-5.188-1.581-7.034-3.953l-27.056-35.492v32.944c0,3.687-2.985,6.676-6.678,6.676c-3.683,0-6.673-2.989-6.673-6.676
                        V29.321z"></path>
                    </g>
                    <g class="insignia">
                        <path fill="#ffffff" d="M48.372,56.137h12.517l11.156-18.537H37.186L25.688,18.539h57.825L94.668,0H9.271
                        C5.925,0,2.842,1.801,1.198,4.716c-1.644,2.907-1.593,6.482,0.134,9.343l50.38,83.501c1.678,2.781,4.689,4.476,7.938,4.476
                        c3.246,0,6.257-1.695,7.935-4.476l2.898-4.804L48.372,56.137z"></path>
                        <g class="i">
                            <path fill="#A9FD00" d="M93.575,18.539h0.031v0.004l21.652,0.004l2.705-4.488c1.727-2.861,1.778-6.436,0.133-9.343
                            C116.454,1.801,113.371,0,110.026,0h-5.294L93.575,18.539z"></path>
                            <polygon fill="#A9FD00" points="88.291,27.356 64.725,66.486 75.519,84.404 109.942,27.356"></polygon>
                        </g>
                    </g>
                </g>
            </svg>

    Font Demo

Instructions

            1Copy the "Fonts" files and CSS files to your website CSS folder.

            2Add the CSS link to your website source code on header.

                <head>

...

<link rel="stylesheet" type="text/css" href="your_website_domain/css_root/flaticon.css">

...

</head>

                3Use the icon class on "display: inline" elements:

                Use example: <i class="flaticon-airplane49"></i> or <span class="flaticon-airplane49"></span>

.flaticon-preview-mode

Author: Gregor Cresnar

.flaticon-new-window

Author: Icon
        Works

.flaticon-graphic

Author: Eucalyp

.flaticon-computer-2

Author: Madebyoliver

.flaticon-export

Author: Kirill
        Kazachek

.flaticon-youtube

Author: Madebyoliver

.flaticon-line

Author: Alfredo
        Hernandez

.flaticon-server

Author: Freepik

.flaticon-reports

Author: Vectors
        Market

.flaticon-hashtag

Author: Alfredo Hernandez

.flaticon-js

Author: Alfredo
        Hernandez

.flaticon-square-1

Author: Chanut is
        Industries

.flaticon-home

Author: Madebyoliver

.flaticon-unlink

Author: Madebyoliver

.flaticon-filter

Author: Madebyoliver

.flaticon-technology-1

Author: Madebyoliver

.flaticon-created-date

Author: Madebyoliver

.flaticon-open-folder

Author: Madebyoliver

.flaticon-folder

Author: Madebyoliver

.flaticon-edit-1

Author: Madebyoliver

.flaticon-internet

Author: Madebyoliver

.flaticon-database

Author: Madebyoliver

.flaticon-share

Author: Madebyoliver

.flaticon-help

Author: Madebyoliver

.flaticon-play-button-1

Author: Madebyoliver

.flaticon-save

Author: Madebyoliver

.flaticon-photo

Author: Madebyoliver

.flaticon-menu

Author: Freepik

.flaticon-interface-4

Author: Madebyoliver

.flaticon-music

Author: EpicCoders

.flaticon-columns

Author: Dario
        Ferrando

.flaticon-rows

Author: Dario
        Ferrando

.flaticon-cache

Author: Hadrien

.flaticon-tooltip

Author: Hadrien

.flaticon-reload

Author: Gregor
        Cresnar

.flaticon-back

Author: Gregor
        Cresnar

.flaticon-sql

Author: Freepik

.flaticon-multimedia

Author: Freepik

.flaticon-css

Author: Freepik

.flaticon-technology

Author: Freepik

.flaticon-cursor

Author: Katarina
        Stefanikova

.flaticon-report-analytics

Author: Freepik

.flaticon-paint

Author: Freepik

.flaticon-edit

Author: Nice
        and Serious

.flaticon-click-hand

Author: Nice and Serious

.flaticon-connection

Author: Freepik

.flaticon-instant-bi

Author: Freepik

.flaticon-pause

Author: Egor
        Rumyantsev

.flaticon-graphic-progression

Author: Freepik

.flaticon-code-editor

Author: Freepik

.flaticon-computer

Author: Freepik

.flaticon-intelligent-events

Author: Freepik

.flaticon-delete-button

Author: Freepik

.flaticon-custom-size

Author: Taras
        Shypka

.flaticon-sort-descending

Author: Catalin Fertu

.flaticon-arrow-1

Author: Catalin
        Fertu

.flaticon-search

Author: Linh
        Pham

.flaticon-rowscolumns

Author: Freepik

.flaticon-layout-selection

Author: Freepik

.flaticon-crowd-of-users

Author: Freepik

.flaticon-office

Author: Freepik

.flaticon-screen

Author: Freepik

.flaticon-interface-2

Author: Freepik

.flaticon-video

Author: Freepik

.flaticon-table-visualization

Author: Freepik

.flaticon-interface-1

Author: Freepik

.flaticon-play-button

Author: Appzgear

.flaticon-create

Author: Freepik

.flaticon-editor

Author: Freepik

.flaticon-text-document-cancel-button

Author: Picol

.flaticon-arrow

Author: Daniel
        Bruce

.flaticon-widgets

Author: User

.flaticon-draw

Author: Eucalyp

.flaticon-signs-1

Author: Alfredo Hernandez

.flaticon-toolbox

Author: Freepik

.flaticon-computer-1

Author: Pixel
        perfect

.flaticon-custom-label

Author: Freepik

.flaticon-customization

Author: Freepik

.flaticon-dashboard

Author: Freepik

.flaticon-signs

Author: Elias
        Bikbulatov

.flaticon-square

Author: Madebyoliver

.flaticon-mail

Author: Iconnice

.flaticon-next

Author: Gregor
        Cresnar

.flaticon-dashboard-monitor

Author: Gregor Cresnar

.flaticon-people

Author: Gregor
        Cresnar

.flaticon-close

Author: Freepik

.flaticon-correct

Author: Lucy G

.flaticon-presentation

Author: Vectors Market

.flaticon-browser-visualization

Author: Freepik

.flaticon-left-arrows

Author: Lyolya

.flaticon-right-arrow

Author: Lyolya

.flaticon-typography

Author: Vaadin

.flaticon-data-sources

Author: Vaadin

.flaticon-check

Author: Freepik

.flaticon-interface-3

Author: Freepik

License and attribution:

Font generated by flaticon.com.

Under CC: Freepik,
            Vaadin, Lyolya, Vectors Market, Lucy G, Gregor
                Cresnar, Iconnice, Madebyoliver, Elias Bikbulatov,
            Pixel perfect, Alfredo Hernandez,
            Eucalyp, Daniel Bruce, Picol,
            Appzgear, Linh Pham, Catalin
                Fertu, Taras
                Shypka, Egor
                Rumyantsev, Nice and
                Serious, Katarina
                Stefanikova, Hadrien, Dario Ferrando, EpicCoders, Chanut is
                Industries, Kirill
                Kazachek, Icon
                Works, User

Copy the Attribution License:

    <textarea onclick="this.focus();this.select();">Font generated by <a href="http://www.flaticon.com">flaticon.com</a>.

Under CC: Freepik,
            Vaadin, Lyolya, Vectors Market, Lucy G, Gregor
                Cresnar, Iconnice, Madebyoliver, Elias Bikbulatov,
            Pixel perfect, Alfredo Hernandez,
            Eucalyp, Daniel Bruce, Picol,
            Appzgear, Linh Pham, Catalin
                Fertu, Taras
                Shypka, Egor
                Rumyantsev, Nice and
                Serious, Katarina
                Stefanikova, Hadrien, Dario Ferrando, EpicCoders, Chanut is
                Industries, Kirill
                Kazachek, Icon
                Works, User

    </textarea>

Examples:

            <i class="flaticon-preview-mode"></i>

            <i class="flaticon-new-window"></i>

            <i class="flaticon-graphic"></i>

            <i class="flaticon-computer-2"></i>

Generated by flaticon.com


text:
if defined? ActiveSupport

module Logging

  # Rails compatibility module.
  #
  # The ActiveSupport gem adds a few methods to the default Ruby logger, and
  # some Rails extensions expect these methods to exist. Those methods are
  # implemented in this module and included in the Logging::Logger class when
  # the ActiveSupport gem is present.
  #
  module RailsCompat

    # A no-op implementation of the +silence+ method. Setting of log levels
    # should be done during the Logging configuration. It is the author's
    # opinion that overriding the log level programmatically is a logical
    # error.
    #
    # Please see https://github.com/TwP/logging/issues/11 for a more detail
    # discussion of the issue.
    #
    def silence( *args )
      yield self
    end

  end  # RailsCompat

  Logger.send :include, RailsCompat

end  # Logging
end  # if defined?

redpajama_set_name: RedPajamaGithub


text:
#ifndef BUTLER_ARDUINO_LIBRARY_H_
#define BUTLER_ARDUINO_LIBRARY_H_

/* System Includes */
/* Internal Includes */

namespace Butler {
namespace Arduino {

}}

#endif // BUTLER_ARDUINO_LIBRARY_H_


text:
package main.doge.service;

import main.doge.service.domain.Todo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class TodoService {

    private final RestTemplate restTemplate;
    private final String uri;

    @Autowired
    public TodoService(RestTemplate restTemplate, @Value("${doge.service.uri}") String uri) {
        this.restTemplate = restTemplate;
        this.uri = uri;
    }

    public List<Todo> getTodos() {
        return Arrays.stream(callService(uri + "/todos", Todo[].class)).collect(Collectors.toList());
    }

    public Todo getSingleTodo(int todoId) {
        return callService(uri + "/todo/" + Integer.toString(todoId), Todo.class);
    }

    private <T> T callService(String uri, Class<T> type) {
        return restTemplate.getForObject(uri, type);
    }
}


text:
<?php

namespace frontend\modules\comment\widgets;

use frontend\modules\comment\Asset;
use frontend\modules\comment\CommentModule;
use frontend\modules\comment\components\CommentAddEvent;
use frontend\modules\comment\models\Comment;
use yii\base\Event;
use yii\base\Widget;

class CommentWidget extends Widget
{
    public $recordId;
    public $minRating = -5;
    public $defaultComment = "Comment removed";

    private $_comments = "";
    private $_model;
    private $_initError = false;

    public function init()
    {
        parent::init();
        if (!$this->_validateRecordId()) {
            $this->_initError = true;
            return false;
        }
        $this->_loadModel();
        $this->_getComments();
        $this->_registerClientScript();
    }

    public function run()
    {
        if (!$this->_initError) {
            return $this->render("index", [
                'comments' => $this->_comments,
                'minRating' => $this->minRating,
                'defaultComment' => \Yii::t("comment", $this->_getDefaultComment()),
                'model' => $this->_model
            ]);
        }
        return \Yii::t("comment", "Can't see any comments even through my spyglass");
    }

    /**
     * @return bool
     */
    private function _validateRecordId()
    {
        $recordModel = \Yii::$app->getModule("comment")->recordModel;
        if (empty($this->recordId) || !$recordModel::findOne($this->recordId)) {
            return false;
        }
        return true;
    }

    /**
     *
     */
    private function _getComments()
    {
        $comments = Comment::find()->where(['record_id' => $this->recordId])->orderBy("lft asc")->all();
        if ($comments) {
            $this->_comments = $comments;
        }
    }

    /**
     *
     */
    private function _loadModel()
    {
        if (\Yii::$app->user->isGuest) {
            $scenario = 'add-guest';
            $author = 'Anonymous';
        } else {
            $scenario = 'add-user';
            $author = \Yii::$app->user->identity->username;
        }

        $model = new Comment(['scenario' => $scenario]);
        $model->author = $author;
        $model->user_id = \Yii::$app->user->id;

        $model->record_id = $this->recordId;
        $this->_model = $model;
        if (!$this->_model->load(\Yii::$app->request->post())) {
            return;
        }

        $parentComment = $this->_model->parentId ? Comment::findOne($this->_model->parentId) : Comment::find()->roots()->one();
        if (!$this->_model->appendTo($parentComment)) {
            \Yii::$app->session->setFlash("error", \Yii::t("comment", "Yer comment fell overboard :( Add it again, lad!"));
            return;
        }

        $this->_createCommentAddEvent();

        \Yii::$app->session->setFlash("success", \Yii::t("comment", "Aye! Yer comment is mine!"));
        \Yii::$app->response->redirect("");
        \Yii::$app->end();
    }

    /**
     * Register widget client scripts.
     */
    private function _registerClientScript()
    {
        $view = $this->getView();
        Asset::register($view);
    }

    /**
     * @return string
     */
    private function _getDefaultComment()
    {
        if (is_array($this->defaultComment)) {
            shuffle($this->defaultComment);
            return $this->defaultComment[0];
        } else {
            return $this->defaultComment;
        }
    }

    /**
     *
     */
    private function _createCommentAddEvent()
    {
        $event = new CommentAddEvent();
        $event->recordId = $this->_model->record_id;
        $event->userId = $this->_model->user_id;
        Event::trigger(CommentModule::className(), CommentModule::EVENT_COMMENT_ADD, $event);
    }

}


text:
build:
	wasm-pack build
publish:
	wasm-pack publish


text:
describe("Postman requests with variables", function() {
	var waitTime = 100;

	beforeEach(function() {
		waitsFor(function() {
			return pm.hasPostmanInitialized === true;
		}, "hasPostmanInitialized", 500);

		runs(function() {
			pm.settings.resetSettings();
			pm.tester.resetRequest();
		});
	});

	afterEach(function() {
		pm.tester.resetRequest();
	});

	it("has initialized Postman", function() {
		expect(pm.hasPostmanInitialized).toBe(true);
		pm.tester.addTestEnvironments();
		pm.tester.addTestGlobals();
	});

	describe("can set variables in the URL", function() {
		it("the URL is set in the environment variable", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");

				pm.tester.setUrl("{{full_url}}");
				pm.tester.setMethod("GET");
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("get")).toBe(true);
			});
		});

		it("the URL is set in a global variable", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");

				pm.tester.setUrl("{{full_global_url}}");
				pm.tester.setMethod("GET");
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("get")).toBe(true);
			});
		});

		it("partial URL is set in an environment variable", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");

				pm.tester.setUrl("http://localhost:5000/{{resource_get}}");
				pm.tester.setMethod("GET");
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("get")).toBe(true);
			});
		});

		it("partial URL is set in a global variable", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");

				pm.tester.setUrl("http://localhost:5000/{{global_resource_get}}");
				pm.tester.setMethod("GET");
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("get")).toBe(true);
			});
		});

		it("partial URL has multiple variables", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");

				pm.tester.setUrl("{{base_url}}/{{global_resource_get}}?v={{v}}&a={{v}}");
				pm.tester.setMethod("GET");
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("v=test")).toBe(true);
				expect(pm.tester.prettyBodyHasString("a=test")).toBe(true);
			});
		});
	});

	describe("can send variables in the request body", function() {
		it("can send a multipart/formdata request with variables", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setEnvironmentByName("test_env_1");
				pm.tester.setUrl("http://localhost:5000/{{resource_post}}");
				pm.tester.setMethod("POST");
				var params = [
					{ key: "Foo", value: "{{Foo}}" },
					{ key: "Test", value: "{{Test}}" }
				];

				pm.tester.setFormDataParams(params);
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not load the response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("/post")).toBe(true);
				expect(pm.tester.prettyBodyHasString("multipart")).toBe(true);
				expect(pm.tester.prettyBodyHasString("bar")).toBe(true);
				expect(pm.tester.prettyBodyHasString("This")).toBe(true);
			});
		});

		it("can send a urlencoded request with variables", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setUrl("http://localhost:5000/post");
				pm.tester.setMethod("POST");
				var params = [
					{ key: "Foo", value: "{{Foo}}" },
					{ key: "Test", value: "{{Test}}" }
				];

				pm.tester.setBodyType("urlencoded");
				pm.tester.setURLEncodedParams(params);
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not load the response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("/post")).toBe(true);
				expect(pm.tester.prettyBodyHasString("urlencoded")).toBe(true);
				expect(pm.tester.prettyBodyHasString("bar")).toBe(true);
				expect(pm.tester.prettyBodyHasString("This")).toBe(true);
			});
		});

		it("can send a raw request with variables", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setUrl("http://localhost:5000/post");
				pm.tester.setMethod("POST");

				var data = "{{Foo}}";

				pm.tester.setBodyType("raw");
				pm.tester.setRawData(data);
				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not load the response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("/post")).toBe(true);
				expect(pm.tester.prettyBodyHasString("bar")).toBe(true);
			});
		});
	});

	describe("can set variables in the headers", function() {
		it("can set a header value in a variable", function() {
			var responseLoaded = false;
			runs(function() {
				pm.tester.setUrl("http://localhost:5000/get");
				pm.tester.setMethod("GET");

				var headers = [
					{ key: "Content-Type", value: "{{header_json}}" }
				];

				pm.tester.setHeaders(headers);

				pm.tester.submitRequest();

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not get response", waitTime);

			runs(function() {
				expect(pm.tester.prettyBodyHasString("application\\/json")).toBe(true);
			});
		});
	});

	describe("can set variables in the URL params editor", function() {
		it("can set partial and entire values as variables", function() {
			var responseLoaded = false;
			var haveSetParams = false;
			runs(function() {
				pm.tester.setUrl("http://localhost:5000/post");
				pm.tester.setMethod("POST");
				pm.tester.toggleURLParams();

				var urlParams = [
					{ key: "Foo", value: "{{Foo}}" },
					{ key: "Test", value: "{{Test}}" }
				];

				pm.tester.setURLParams(urlParams);

				setTimeout(function() {
					haveSetParams = true;
				}, 100);
			});

			waitsFor(function() {
				return haveSetParams === true;
			}, "could not set URL params", 150);

			runs(function() {
				pm.tester.submitRequest();

				console.log(pm.request.get("url"));

				var response = pm.request.get("response");
				response.on("loadResponse", function() {
					responseLoaded = true;
				});
			});

			waitsFor(function() {
				return responseLoaded === true;
			}, "Could not load the response", waitTime);

			runs(function() {
				var found = pm.tester.prettyBodyHasString("/post");
				expect(found).toBe(true);
				expect(pm.tester.prettyBodyHasString("bar")).toBe(true);
				expect(pm.tester.prettyBodyHasString("This")).toBe(true);
			});
		});
	});

});


text:
/* change style default editor */
#editorcontainer textarea#content {
	font-size: 16px;
	font-family: Georgia, "Times New Roman", Times, serif;
	color: #333;
}
/* hide user with id2 from users menu */
#user-2 {
	display: none;
}


text:
package io.polyglotted.eswrapper.indexing;

import com.google.common.collect.ImmutableMap;
import io.polyglotted.pgmodel.search.DocStatus;
import io.polyglotted.pgmodel.search.IndexKey;
import io.polyglotted.pgmodel.search.SimpleDoc;

import java.util.List;
import java.util.Map;

import static com.google.common.base.Functions.identity;
import static com.google.common.collect.Maps.uniqueIndex;
import static io.polyglotted.eswrapper.indexing.IndexRecord.createRecord;
import static io.polyglotted.eswrapper.indexing.IndexRecord.deleteRecord;
import static io.polyglotted.eswrapper.indexing.IndexRecord.updateRecord;
import static io.polyglotted.eswrapper.indexing.IndexSerializer.GSON;
import static io.polyglotted.pgmodel.search.index.HiddenFields.APPROVAL_ROLES_FIELD;
import static io.polyglotted.pgmodel.search.index.HiddenFields.BASEVERSION_FIELD;

public abstract class IndexableHelper {
    public static Indexable approvalIndexable(Iterable<SimpleDoc> docs, String comment, String user, long timestamp) {
        Indexable.Builder builder = Indexable.indexableBuilder().user(user).timestamp(timestamp);
        for (SimpleDoc doc : docs) {
            IndexKey baseKey = doc.baseKey(doc.baseVersion());

            if (doc.status() == DocStatus.PENDING_DELETE) {
                builder.record(deleteRecord(doc.key, comment, DocStatus.DELETED));
                builder.record(deleteRecord(baseKey));
            } else {
                builder.record(deleteRecord(doc.key, comment, DocStatus.LIVE));
                if (doc.hasItem(BASEVERSION_FIELD)) {
                    builder.record(updateRecord(baseKey, GSON.toJson(doc.filteredCopy(false))));
                } else {
                    builder.record(createRecord(baseKey, GSON.toJson(doc.filteredCopy(false))));
                }
            }
        }
        return builder.build();
    }

    public static Indexable rejectionIndexable(Iterable<SimpleDoc> docs, String comment, String user, long timestamp) {
        Indexable.Builder builder = Indexable.indexableBuilder().user(user).timestamp(timestamp);
        for (SimpleDoc doc : docs)
            builder.record(updateRecord(doc.key, DocStatus.REJECTED, comment, GSON.toJson(doc.filteredCopy(true))));
        return builder.build();
    }

    public static Indexable discardIndexable(Iterable<SimpleDoc> docs, String user, long timestamp) {
        Indexable.Builder builder = Indexable.indexableBuilder().user(user).timestamp(timestamp);
        for (SimpleDoc doc : docs) builder.record(deleteRecord(doc.key, null, DocStatus.DISCARDED));
        return builder.build();
    }

    public static boolean validateApprovalRoles(List<SimpleDoc> docs, List<String> userRoles) {
        outer:
        for (SimpleDoc doc : docs) {
            @SuppressWarnings("unchecked")
            Map<String, String> approvalRoles = doc.hasItem(APPROVAL_ROLES_FIELD) ? uniqueIndex((List<String>)
               doc.source.get(APPROVAL_ROLES_FIELD), identity()) : ImmutableMap.of();
            if (approvalRoles.isEmpty()) continue;

            for (String userRole : userRoles)
                if (approvalRoles.containsKey(userRole)) continue outer;
            return false;
        }
        return true;
    }
}


text:
#ifndef LIB_ATLAS_MATHS_PID_H_
#define LIB_ATLAS_MATHS_PID_H_

#include <lib_atlas/macros.h>
#include <math.h>
#include <eigen3/Eigen/Eigen>

namespace atlas {

/// PID is a class that encapsulate the logic of a PID controller.
/// You must set the gains and the limits of the values, and the method Refresh
/// does the calculations.
/// This implementation is based on: https://github.com/gregorygusberti/PID
/// A good ressource is the Paper PID without a PhD that you can find here:
/// http://www.wescottdesign.com/articles/pid/pidWithoutAPhd.pdf
class PID {
 public:
  struct Weights {
    double p;
    double i;
    double d;
  };

  //============================================================================
  // P U B L I C   C / D T O R S

  /// Public constructor
  PID();

  /// Set the proportional term. Use it AFTER setRefreshInterval or
  /// setRefreshRate
  void SetKp(const double &Kp);

  /// Set the integral term. Use it AFTER setRefreshInterval or setRefreshRate
  void SetKi(const double &Ki);

  /// Set the derivative term. Use it AFTER setRefreshInterval or setRefreshRate
  void SetKd(const double &Kd);

  /// Set the P, I, D terms respectively. Use it AFTER setRefreshInterval or
  /// setRefreshRate
  void SetWeights(const double &Kp, const double &Ki, const double &Kd);

  /// Set the refresh interval of the controller in seconds.
  /// If you don't know the interval you can set the frequency of update using
  /// setRefreshRate
  void SetRefreshInterval(const double &refresh_interval);

  /// Set the refresh frequency of the controller in hertz.
  /// If you don't know the refresh frequency you can set the refresh interval
  /// using SetRefreshInterval
  void SetRefreshRate(const double &refresh_rate);

  /// Set the minimun error for computation of the PID loop. The default is 0.0
  /// It can be set to prevent integral windup or updates with minimal errors
  void SetErrorThreshold(const double &error_threshold);

  /// Set the lower limit of the output. Output will be clamped to this value.
  /// If clamped, the integral will not be computed to prevent integral windup.
  /// To set the upper limit use setOutputUpperLimit
  /// YOU NEED TO SET IT!
  void SetOutputLowerLimit(const double &output_lower_limit);

  /// Set the upper limit of the output. Output will be clamped to this value.
  /// If clamped, the integral will not be computed to prevent integral windup.
  /// To set the lower limit use setOutputLowerLimit
  /// YOU NEED TO SET IT!
  void SetOutputUpperLimit(const double &output_upper_limit);

  /// Set the desired point of the output.
  /// This is the output the PID loop will try to reach.
  /// error will be computed subtracting the feedback input from this value
  void SetDesiredPoint(const double &desired_point);

  /// The refresh function that make all the PID computations.
  /// Call it at specific rate, setted by setRefreshRate or setRefreshInterval
  /// (read descriptions).
  /// (use a timer interrupt if used on a embedded microcontroller)
  /// The feedback_input is the value from the feedback.
  /// The returned value is the output value of the filter.
  double Refresh(const double &feedback_input);

 private:
  Weights k_;
  double last_error_;
  double last_output_;
  double set_point_;
  double integral_;
  double interval_;
  double error_threshold_;
  double output_upper_limit_;
  double output_lower_limit_;
  double error_;
};

}  // namespace atlas

#include <lib_atlas/maths/pid_inl.h>

#endif  // LIB_ATLAS_MATHS_PID_H_


text:
soco.github.io
==============

GitHub Pages for SoCo


text:
addCommandHandler( "Reload weapon",
	function ()
		local task = getPedSimplestTask( localPlayer )

		-- Remove the ability to reload with a full clip in some weapons to avoid network abuse (purposely desyncing etc).
		local ammo = getPedAmmoInClip( localPlayer )
		local wep = getPedWeapon( localPlayer )
		if ( ( wep == 23 and ammo == 17 ) or ( wep == 24 and ammo == 7 ) or ( wep == 27 and ammo == 7 ) or ( wep == 29 and ammo == 30 )
		or ( wep == 30 and ammo == 50 ) or ( wep == 31 and ammo == 50 ) ) then
			return
		end

		-- Prevent instant reload while performing a jump
		if ( ( task == "TASK_SIMPLE_JUMP" or task == "TASK_SIMPLE_IN_AIR" or task == "TASK_SIMPLE_LAND" ) and not doesPedHaveJetPack( localPlayer ) ) then return end

		-- If you reload and press shift at the exact same time you're able to instant reload so temporarily disable jump
		if ( isControlEnabled( "jump" ) ) then
			toggleControl( "jump", false )
			addEventHandler( "onClientRender", root, enableJump )
		end

		triggerServerEvent( "onPlayerReload", localPlayer )
	end
)

bindKey( "r", "down", "Reload weapon" )

-- Disable jumping for at least 4 frames after pressing reload to prevent instant reload
local frames = 0

function enableJump()
	if ( frames >= 3 ) then
		toggleControl( "jump", true )
		removeEventHandler( "onClientRender", root, enableJump )
		frames = 0
	else
		frames = frames + 1
	end
end


text:
const { createBenchmark } = require('../common');

const { Request, TYPES } = require('../../src/tedious');
const RpcRequestPayload = require('../../src/rpcrequest-payload');

const { Readable } = require('readable-stream');

const bench = createBenchmark(main, {
  n: [10, 100],
  size: [10, 100, 1000, 10000]
});

function main({ n, size }) {
  var table = {
    columns: [
      { name: 'user_id', type: TYPES.Int },
      { name: 'user_name', type: TYPES.VarChar, length: 500 },
      { name: 'user_enabled', type: TYPES.Bit }
    ],
    rows: []
  };

  for (let j = 0; j < size; j++) {
    table.rows.push([15, 'Eric', true]);
  }

  const request = new Request('...', () => {});
  request.addParameter('value', TYPES.TVP, table);

  let i = 0;
  bench.start();

  (function cb() {
    if (i++ === n) {
      bench.end(n);
      return;
    }

    const payload = new RpcRequestPayload(request, Buffer.alloc(0), {});
    const stream = Readable.from(payload, { objectMode: false });
    const chunks = [];
    stream.on('data', (chunk) => {
      chunks.push(chunk);
    });
    stream.on('end', cb);
  })();
}


text:
<?php
/**
 * BugFree is free software under the terms of the FreeBSD License.
 *
 * search bug form.
 *
 * @link        http://www.bugfree.org.cn
 * @package     BugFree
 */
/* Init BugFree system. */
require('Include/Init.inc.php');

$FieldName = 'Field';
$OperatorName = 'Operator';
$ValueName = 'Value';
$AndOrName = 'AndOr';

$FieldList = array();
$OperatorList = array();
$ValueList = array();
$AndOrList = array();
$FieldCount = $_CFG['QueryFieldNumber'];
$Attrib = 'class="FullSelect"';

$And = 'checked';
$Or = '';

$FieldListSelectItem = array(0=>'ProjectName',1=>'OpenedBy',2=>'ModulePath',3=>'AssignedTo',4=>'BugID',5=>'BugTitle');
$OperatorListSelectItem = array(0=>'=', 2=>'LIKE', 5=>'LIKE');

if($_REQUEST['reset'])
{
    $_SESSION['BugFieldListCondition']='';
    $_SESSION['BugOperatorListCondition']='';
    $_SESSION['BugAndOrListCondition']='';
    $_SESSION['BugValueListCondition']='';
    $_SESSION['BugQueryCondition'] = '';
    $_SESSION['BugQueryTitle'] = '';
    $_SESSION['BugFieldsToShow'] = '';

}
if($_SESSION['BugFieldListCondition']!='')
  $FieldListSelectItem = $_SESSION['BugFieldListCondition'];
if($_SESSION['BugOperatorListCondition']!='')
  $OperatorListSelectItem = $_SESSION['BugOperatorListCondition'];
if($_SESSION['BugAndOrListCondition']!='')
  $SelectItem = $_SESSION['BugAndOrListCondition'];
if($_SESSION['BugValueListCondition']!='')
  $ValueListSelectItem = $_SESSION['BugValueListCondition'];

if(strpos($_SESSION['BugQueryCondition'],') OR (')!== FALSE)
{
   $Or = 'checked';
   $And = '';
}

if($_GET['QueryID'])
{
   $QueryInfo = dbGetRow('TestUserQuery', '', "QueryID='{$_REQUEST[QueryID]}' AND QueryType='Bug'");
   $AndOr = $QueryInfo['QueryString'];

   if(strpos($QueryInfo['QueryString'],') OR (')!== FALSE)
   {
      $Or = 'checked';
      $And = '';
   }
   if(strpos($QueryInfo['QueryString'],') AND (')!== FALSE)
   {
      $Or = '';
      $And = 'checked';
   }

   if($QueryInfo['FieldList']!='')
       $FieldListSelectItem = unserialize($QueryInfo['FieldList']);
   if($QueryInfo['OperatorList']!='')
       $OperatorListSelectItem = unserialize($QueryInfo['OperatorList']);
   if($QueryInfo['AndOrList']!='')
       $SelectItem =  unserialize($QueryInfo['AndOrList']);
   if($QueryInfo['ValueList']!='')
       $ValueListSelectItem = unserialize($QueryInfo['ValueList']);
}

if($_REQUEST['UpdateQueryID'])
{
   $QueryStr = addslashes($_SESSION['BugQueryCondition']);
   $AndOrListCondition = serialize($_SESSION['BugAndOrListCondition']);
   $OperatorListCondition = serialize($_SESSION['BugOperatorListCondition']);
   $ValueListCondition = my_escape_string(serialize($_SESSION['BugValueListCondition']));
   $FieldListCondition = serialize($_SESSION['BugFieldListCondition']);
   $FieldsToShow = implode(",",array_keys(testSetCustomFields('Bug')));

   if(strpos($QueryStr, ') OR (')!== FALSE)
   {
      $Or = 'checked';
      $And = '';
   }
   if(strpos($QueryStr,') AND (')!== FALSE)
   {
      $Or = '';
      $And = 'checked';
   }

   dbUpdateRow('TestUserQuery', 'QueryString', "'{$QueryStr}'", 'AndOrList', "'{$AndOrListCondition}'", 'OperatorList',
                    "'$OperatorListCondition'", 'ValueList',"'$ValueListCondition'", 'FieldList', "'$FieldListCondition'",  'FieldsToShow', "'$FieldsToShow'","QueryID={$_REQUEST['UpdateQueryID']}");

   jsGoTo('BugList.php',"parent.RightBottomFrame");

}

for($I=0; $I<$FieldCount; $I ++)
{
    $FieldListOnChange = ' onchange="setQueryForm('.$I.');"';
    $OperatorListOnChange = ' onchange="setQueryValue('.$I.');"';
    $FieldList[$I] = htmlSelect($_LANG['BugQueryField'], $FieldName . $I, $Mode, $FieldListSelectItem[$I], $Attrib.$FieldListOnChange);
    $OperatorList[$I] = htmlSelect($_LANG['Operators'], $OperatorName . $I, $Mode, $OperatorListSelectItem[$I], $Attrib.$OperatorListOnChange);
    $ValueList[$I] = '<input id="'.$ValueName.$I.'" name="' . $ValueName.$I .'" type="text" size="5" style="width:95%;"/>';
    $AndOrList[$I] = htmlSelect($_LANG['AndOr'], $AndOrName . $I, $Mode, $SelectItem[$I], $Attrib);
}

$SimpleProjectList = array(''=>'')+testGetValidSimpleProjectList();

$AutoTextValue['ProjectNameText']=jsArray($SimpleProjectList);
$AutoTextValue['ProjectNameValue']=jsArray($SimpleProjectList);
$AutoTextValue['SeverityText']=jsArray($_LANG['BugSeveritys']);
$AutoTextValue['SeverityValue']=jsArray($_LANG['BugSeveritys'], 'Key');
$AutoTextValue['PriorityText']=jsArray($_LANG['BugPriorities']);
$AutoTextValue['PriorityValue']=jsArray($_LANG['BugPriorities'], 'Key');
$AutoTextValue['TypeText']=jsArray($_LANG['BugTypes']);
$AutoTextValue['TypeValue']=jsArray($_LANG['BugTypes'], 'Key');
$AutoTextValue['StatusText']=jsArray($_LANG['BugStatus']);
$AutoTextValue['StatusValue']=jsArray($_LANG['BugStatus'], 'Key');
$AutoTextValue['OSText']=jsArray($_LANG['BugOS']);
$AutoTextValue['OSValue']=jsArray($_LANG['BugOS'], 'Key');
$AutoTextValue['BrowserText']=jsArray($_LANG['BugBrowser']);
$AutoTextValue['BrowserValue']=jsArray($_LANG['BugBrowser'], 'Key');
$AutoTextValue['MachineText']=jsArray($_LANG['BugMachine']);
$AutoTextValue['MachineValue']=jsArray($_LANG['BugMachine'], 'Key');
$AutoTextValue['ResolutionText']=jsArray($_LANG['BugResolutions']);
$AutoTextValue['ResolutionValue']=jsArray($_LANG['BugResolutions'], 'Key');
$AutoTextValue['HowFoundText']=jsArray($_LANG['BugHowFound']);
$AutoTextValue['HowFoundValue']=jsArray($_LANG['BugHowFound'], 'Key');
$AutoTextValue['SubStatusText']=jsArray($_LANG['BugSubStatus']);
$AutoTextValue['SubStatusValue']=jsArray($_LANG['BugSubStatus'], 'Key');

$AutoTextValue['FieldType'] = jsArray($_CFG['FieldType']);
$AutoTextValue['FieldOperationTypeValue'] = jsArray($_CFG['FieldTypeOperation']);
$AutoTextValue['FieldOperationTypeText'] = jsArray($_LANG['FieldTypeOperationName']);

$UserList = testGetCurrentUserNameList('PreAppend');
$ACUserList = array(''=>'', 'Active' => 'Active') + $UserList+array('Closed'=>'Closed');
$UserList = array(''=>'') + $UserList;
$AutoTextValue['ACUserText']=jsArray($ACUserList);
$AutoTextValue['ACUserValue']=jsArray($ACUserList, 'Key');
$AutoTextValue['UserText']=jsArray($UserList);
$AutoTextValue['UserValue']=jsArray($UserList, 'Key');

$TPL->assign('OperatorListSelectItem', $OperatorListSelectItem);
$TPL->assign('ValueListSelectItem', $ValueListSelectItem);
$TPL->assign('QueryTitle', $_REQUEST['QueryTitle']);

$TPL->assign('And', $And);
$TPL->assign('Or', $Or);

$TPL->assign('AutoTextValue', $AutoTextValue);
$TPL->assign("FieldList", $FieldList);
$TPL->assign("OperatorList", $OperatorList);
$TPL->assign("ValueList", $ValueList);
$TPL->assign("AndOrList", $AndOrList);
$TPL->assign("FieldCount",$FieldCount);

$TPL->display('Search.tpl');


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

        Moving object sheets

      <canvas id="maincanvas" width="900" height="500"></canvas>

        In this example we use the rotateSheet method of our object to change the orientation of some sheets. First parameter is a reference to the sheet, second and third parameters set the axis of rotation (second is a point on the axis, third is the direction of the axis), last parameter is rotation angle in radians:

var state = Math.floor( (character.animationState % 8) / 2);
var dir = (state == 0 || state == 3) ? 1 : -1;

character.rotateSheet(character.leg1, {x:0,y:0,z:8}, {x:1,y:0,z:0}, dir * Math.PI/8);
character.rotateSheet(character.leg2, {x:0,y:0,z:8}, {x:1,y:0,z:0}, -dir * Math.PI/8);

        Since the above rotations do not affect intersections of other sheets of the object we don't have to call the redefineIntersections function on the object.


text:
import { HtmlParser, HtmlParseTreeResult } from './html_parser';
export declare class LegacyHtmlParser extends HtmlParser {
    parse(sourceContent: string, sourceUrl: string, parseExpansionForms?: boolean): HtmlParseTreeResult;
}


text:
class AddRejectedAtToProjects < ActiveRecord::Migration
  def change
    add_column :projects, :rejected_at, :timestamp
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Shuttle - Material Design Mobile Template</title>
    <meta name="description" content="Material Design Mobile Template">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/touch/apple-touch-icon-144x144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/touch/apple-touch-icon-114x114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/touch/apple-touch-icon-72x72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="img/touch/apple-touch-icon-57x57-precomposed.png">
    <link rel="shortcut icon" sizes="196x196" href="img/touch/touch-icon-196x196.png">
    <link rel="shortcut icon" href="img/touch/apple-touch-icon.png">

    <meta name="msapplication-TileImage" content="img/touch/apple-touch-icon-144x144-precomposed.png">
    <meta name="msapplication-TileColor" content="#222222">

    <meta name="mobile-web-app-capable" content="yes">

    <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,700,100' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

    <link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" media="all" rel="stylesheet" type="text/css">

    <link rel="stylesheet" href="css/animate.css">
    <link rel="stylesheet" href="css/materialize.min.css">
    <link rel="stylesheet" href="css/swipebox.min.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">

Shuttle

Traffic

Free

Paid

            <canvas id="canvas"></canvas>

Users

New

Completed

Cancelled

            <canvas id="pieChart" width="300" height="300"></canvas>

Email Report

Search

Bounce

New

            <canvas id="doughnutChart" width="300" height="300"></canvas>

Growth

Euro

Dollar

            <canvas id="barChart"></canvas>

Shuttle

You can use rows and columns here to organize your footer content.

              Made with  by Codnauts

            heyfromjhon@email.com

hellojhon@email.com

heyfromjhon@email.com

Settings

            Home

                Classic
                Sliced
                Slider
                Drawer
                Walkthrough

            Layout

                Material
                Left
                Right
                Dual
                Blank

            Pages

                Article
                About
                Event
                Project
                Music Player
                ToDo
                Category
                Product
                Checkout
                Search
                Faq
                Coming Soon
                404

            App

                Calendar
                Profile
                Timeline
                Chat
                Login
                Sign Up
                Password
                Lockscreen
                Chart

            Blog

                Classic
                Masonry

            Gallery

                Filter
                Masonry
                Card

            Portfolio

                Filter
                Masonry
                Card

 Shop

 News

UI Kit (Coming Soon)

 Contact

              <form>

                  <input id="search" type="search" required>

              </form>

Social

Chat

 Follow us on Twitter

@Codnauts

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod #tempor.

@Codnauts

Excepteur sint occaecat cupidatat non proident, sunt in #voluptate culpa qui officia deserunt mollit anim.

@Codnauts

At vero eos et accusamus et iusto odio #dignissimos #ducimus qui blanditiis praesentium.

Notifications

Mike Green

                Sent you a message
                Today at 16:48

Lara Connors

                Post a photo with you
                Today at 14:26

Mike Green

                Post something...
                Yesterday at 03:19

Mike Green

              Sent you a message
              online

Lora Bell

              6 New messages
              online

Tony Lee

              Away from keyboard.
              Away

Jim Connor

              Is offline.
              offline

Sara Lower

              Sent you a message
              online

Mick Pole

              Is offline.
              offline

James Tree

              Awaiting your reply.
              online


text:
This module enables interop between the native gateway and modules written in
Java. This module will broker communication to and from the native gateway as
well as manage the lifetime of the Java Virtual Machine. Please read the [high
level design](../java_binding_hld.md) document for more design details. This
module will be built as a dynamic library and loaded by the Java class using
`System.loadLibrary(...)` in order to publish messages to the broker. The path
to the .dll or .so must be included in `library_path` of the configuration for
the java module host, or be part of the default library path.

## References

[module.h](../../../../core/devdoc/module.md)

[JNI](http://docs.oracle.com/javase/8/docs/technotes/guides/jni/)

## Relevant Structures
```C
typedef struct JVM_OPTIONS_TAG
{
    const char* class_path;
    const char* library_path;
    int version;
    bool debug;
    int debug_port;
    bool verbose;
    VECTOR_HANDLE additional_options;
} JVM_OPTIONS;

typedef struct JAVA_MODULE_HOST_CONFIG_TAG
{
    const char* class_name;
    const char* configuration_json;
    JVM_OPTIONS* options;
} JAVA_MODULE_HOST_CONFIG;

typedef struct JAVA_MODULE_HANDLE_DATA_TAG
{
    JavaVM *jvm;
    JNIEnv *env;
    jobject module;
    char* moduleName;
}JAVA_MODULE_HANDLE_DATA;
```

## Module_GetApi
This is the primary public interface for the module. It returns a pointer to the
`MODULE_API` structure containing the implementation functions for this module.
The following functions are the implementation of those APIs.

**SRS_JAVA_MODULE_HOST_26_001: [** `Module_GetApi` shall fill out the provided `MODULES_API` structure with required module's APIs functions. **]**

## JavaModuleHost_Create
```C
static MODULE_HANDLE JavaModuleHost_Create(BROKER_HANDLE broker, const void* configuration);
```

Creates a new Java Module Host instance. The parameter `configuration` is a
pointer to a `JAVA_MODULE_HOST_CONFIG` structure.

**SRS_JAVA_MODULE_HOST_14_001: [** This function shall return `NULL` if `broker` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_002: [** This function shall return `NULL` if `configuration` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_003: [** This function shall return `NULL` if `class_name` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_004: [** This function shall return `NULL` upon any underlying API call failure. **]**

**SRS_JAVA_MODULE_HOST_14_005: [** This function shall return a non-`NULL` `MODULE_HANDLE` when successful. **]**

**SRS_JAVA_MODULE_HOST_14_006: [** This function shall allocate memory for an instance of a `JAVA_MODULE_HANDLE_DATA` structure to be used as the backing structure for this module. **]**

**SRS_JAVA_MODULE_HOST_14_037: [** This function shall get a singleton instance of a JavaModuleHostManager. **]**

**SRS_JAVA_MODULE_HOST_14_007: [** This function shall initialize a `JavaVMInitArgs` structure using the `JVM_OPTIONS` structure `configuration->options`. **]**

**SRS_JAVA_MODULE_HOST_14_008: [** If `configuration->options` is `NULL`**,** `JavaVMInitArgs` shall be initialized using default values. **]**

**SRS_JAVA_MODULE_HOST_14_009: [** This function shall allocate memory for an array of `JavaVMOption` structures and initialize each with each option provided. **]**

**SRS_JAVA_MODULE_HOST_14_030: [** The function shall set the `JavaVMInitArgs` structures `nOptions`, `version` and `JavaVMOption*` `options` member variables**]**

**SRS_JAVA_MODULE_HOST_14_031: [** The function shall create a new `VECTOR_HANDLE` to store the option strings. **]**

**SRS_JAVA_MODULE_HOST_14_032: [** The function shall construct a new `STRING_HANDLE` for each option. **]**

**SRS_JAVA_MODULE_HOST_14_036: [** The function shall copy any additional user options into a `STRING_HANDLE`. **]**

**SRS_JAVA_MODULE_HOST_14_033: [** The function shall concatenate the user supplied options to the option key names. **]**

**SRS_JAVA_MODULE_HOST_14_034: [** The function shall push the new `STRING_HANDLE` onto the newly created vector. **]**

**SRS_JAVA_MODULE_HOST_14_035: [** If any operation fails, the function shall delete the `STRING_HANDLE` structures, `VECTOR_HANDLE` and `JavaVMOption` array. **]**

**SRS_JAVA_MODULE_HOST_14_010: [** If this is the first Java module to load, this function shall create the JVM using the `JavaVMInitArgs` through a call to `JNI_CreateJavaVM` and save the JavaVM and JNIEnv pointers in the `JAVA_MODULE_HANDLE_DATA`. **]**

**SRS_JAVA_MODULE_HOST_14_011: [** If the JVM was previously created, the function shall get a pointer to that `JavaVM` pointer and `JNIEnv` environment pointer. **]**

**SRS_JAVA_MODULE_HOST_14_012: [** This function shall increment the count of modules in the JavaModuleHostManager. **]**

**SRS_JAVA_MODULE_HOST_14_013: [** This function shall return `NULL` if a JVM could not be created or found. **]**

**SRS_JAVA_MODULE_HOST_14_014: [** This function shall find the `Broker` Java class, get the constructor, and create a `Broker` Java object. **]**

**SRS_JAVA_MODULE_HOST_14_015: [** This function shall find the user-defined Java module class using `configuration->class_name`, get the constructor, and create an instance of this module object. **]**

**SRS_JAVA_MODULE_HOST_14_016: [** This function shall return `NULL` if any returned `jclass`, `jmethodID`, or `jobject` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_017: [** This function shall return `NULL` if any JNI function fails. **]**

**SRS_JAVA_MODULE_HOST_14_018: [** The function shall save a new global reference to the Java module object in `JAVA_MODULE_HANDLE_DATA->module`. **]**

## JavaModuleHost_Destroy
```C
static void JavaModuleHost_Destroy(MODULE_HANDLE module);
```

**SRS_JAVA_MODULE_HOST_14_019: [** This function shall do nothing if `module` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_039: [** This function shall attach the JVM to the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_038: [** This function shall get the user-defined Java module class using the `module` parameter and get the `destroy()` method. **]**

**SRS_JAVA_MODULE_HOST_14_020: [** This function shall call the `void destroy()` method of the Java module object and delete the global reference to this object. **]**

**SRS_JAVA_MODULE_HOST_14_021: [** This function shall free all resources associated with this module. **]**

**SRS_JAVA_MODULE_HOST_14_029: [** This function shall destroy the JVM if it the last module to be disconnected from the gateway. **]**

**SRS_JAVA_MODULE_HOST_14_040: [** This function shall detach the JVM from the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_041: [** This function shall exit if any JNI function fails. **]**

## JavaModuleHost_Receive
```C
static void JavaModuleHost_Receive(MODULE_HANDLE module, MESSAGE_HANDLE message);
```

**SRS_JAVA_MODULE_HOST_14_022: [** This function shall do nothing if `module` or `message` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_023: [** This function shall serialize `message`. **]**

**SRS_JAVA_MODULE_HOST_14_042: [** This function shall attach the JVM to the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_043: [** This function shall create a new `jbyteArray` for the serialized message. **]**

**SRS_JAVA_MODULE_HOST_14_044: [** This function shall set the contents of the `jbyteArray` to the serialized_message. **]**

**SRS_JAVA_MODULE_HOST_14_045: [** This function shall get the user-defined Java module class using the module parameter and get the `receive()` method. **]**

**SRS_JAVA_MODULE_HOST_14_024: [** This function shall call the `void receive(byte[] source)` method of the Java module object passing the serialized `message`. **]**

**SRS_JAVA_MODULE_HOST_14_046: [** This function shall detach the JVM from the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_047: [** This function shall exit if any underlying function fails. **]**

## JavaModuleHost_Start
```C
static void JavaModuleHost_Start(MODULE_HANDLE module);
```

**SRS_JAVA_MODULE_HOST_14_049: [** This function shall do nothing if `module` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_050: [** This function shall attach the JVM to the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_051: [** This function shall get the user-defined Java module class using the `module` parameter and get the `start()` method. **]**

**SRS_JAVA_MODULE_HOST_14_052: [** This function shall call the `void start()` method of the Java module object. **]**

**SRS_JAVA_MODULE_HOST_14_053: [** This function shall detach the JVM from the current thread. **]**

**SRS_JAVA_MODULE_HOST_14_054: [** This function shall exit if any JNI function fails. **]**

## JavaModuleHost_ParseConfigurationFromJson
```C
static void* JavaModuleHost_ParseConfigurationFromJson(const char* configuration);
```

**SRS_JAVA_MODULE_HOST_14_028: [** This function shall allocate memory for the `configuration` parameter and copy it. **]**

**SRS_JAVA_MODULE_HOST_14_055: [** This function shall return `NULL` if any underlying platform call fails. **]**

**SRS_JAVA_MODULE_HOST_14_056: [** This function shall return a non-`NULL` `const char*` configuration string when successful. **]**

## JavaModuleHost_FreeConfiguration
```C
static void JavaModuleHost_FreeConfiguration(void* configuration)
```

**SRS_JAVA_MODULE_HOST_14_057: [** This function shall do nothing if `configuration` is `NULL`. **]**

**SRS_JAVA_MODULE_HOST_14_058: [** This function shall free the `configuration`. **]**

## Broker_Publish
```C
JNIEXPORT jint JNICALL Java_com_microsoft_azure_gateway_core_Broker_publishMessage(JNIEnv *env, jobject Broker, jlong addr, jbyteArray message);
```

**SRS_JAVA_MODULE_HOST_14_025: [** This function shall convert the `jbyteArray message` into an `unsigned char` array. **]**

**SRS_JAVA_MODULE_HOST_14_026: [** This function shall use the serialized message in a call to `Message_Create`. **]**

**SRS_JAVA_MODULE_HOST_14_027: [** This function shall publish the message to the `BROKER_HANDLE` addressed by `addr` and return the value of this function call. **]**

**SRS_JAVA_MODULE_HOST_14_048: [**  This function shall return a non-zero value if any underlying function call fails. **]**


text:
package com.alibaba.druid.support.http;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.alibaba.druid.filter.stat.StatFilterContextListenerAdapter;
import com.alibaba.druid.support.http.stat.WebAppStat;
import com.alibaba.druid.support.http.stat.WebRequestStat;
import com.alibaba.druid.support.http.stat.WebSessionStat;
import com.alibaba.druid.util.DruidWebUtils;

public class AbstractWebStatImpl {

    public final static int                DEFAULT_MAX_STAT_SESSION_COUNT = 1000 * 1;

    protected WebAppStat                   webAppStat                     = null;

    protected boolean                      sessionStatEnable              = true;
    protected int                          sessionStatMaxCount            = DEFAULT_MAX_STAT_SESSION_COUNT;
    protected boolean                      createSession                  = false;
    protected boolean                      profileEnable                  = false;

    protected String                       contextPath;

    protected String                       principalSessionName;
    protected String                       principalCookieName;
    protected String                       realIpHeader;

    protected WebStatFilterContextListener statFilterContextListener      = new WebStatFilterContextListener();

    public boolean isSessionStatEnable() {
        return sessionStatEnable;
    }

    public void setSessionStatEnable(boolean sessionStatEnable) {
        this.sessionStatEnable = sessionStatEnable;
    }

    public boolean isProfileEnable() {
        return profileEnable;
    }

    public void setProfileEnable(boolean profileEnable) {
        this.profileEnable = profileEnable;
    }

    public String getContextPath() {
        return contextPath;
    }

    public int getSessionStatMaxCount() {
        return sessionStatMaxCount;
    }

    public String getRequestURI(HttpServletRequest request) {
        return request.getRequestURI();
    }

    public String getPrincipalSessionName() {
        return principalSessionName;
    }

    public String getPrincipalCookieName() {
        return principalCookieName;
    }

    public WebSessionStat getSessionStat(HttpServletRequest request) {
        if (!isSessionStatEnable()) {
            return null;
        }

        WebSessionStat sessionStat = null;
        String sessionId = getSessionId(request);
        if (sessionId != null) {
            sessionStat = webAppStat.getSessionStat(sessionId, true);
        }

        if (sessionStat != null) {
            long currentMillis = System.currentTimeMillis();

            String userAgent = request.getHeader("user-agent");

            if (sessionStat.getCreateTimeMillis() == -1L) {
                HttpSession session = request.getSession(false);

                if (session != null) {
                    sessionStat.setCreateTimeMillis(session.getCreationTime());
                } else {
                    sessionStat.setCreateTimeMillis(currentMillis);
                }

                webAppStat.computeUserAgent(userAgent);
                webAppStat.incrementSessionCount();
            }

            sessionStat.setUserAgent(userAgent);

            String ip = getRemoteAddress(request);

            sessionStat.addRemoteAddress(ip);
        }

        return sessionStat;
    }

    protected String getRemoteAddress(HttpServletRequest request) {
        String ip = null;
        if (this.realIpHeader != null && this.realIpHeader.length() != 0) {
            ip = request.getHeader(realIpHeader);
        }
        if (ip == null || ip.length() == 0) {
            ip = DruidWebUtils.getRemoteAddr(request);
        }
        return ip;
    }

    public String getSessionId(HttpServletRequest httpRequest) {
        String sessionId = null;

        HttpSession session = httpRequest.getSession(createSession);
        if (session != null) {
            sessionId = session.getId();
        }

        return sessionId;
    }

    public String getPrincipal(HttpServletRequest httpRequest) {
        if (principalSessionName != null) {
            HttpSession session = httpRequest.getSession(createSession);
            if (session == null) {
                return null;
            }

            Object sessionValue = session.getAttribute(principalSessionName);

            if (sessionValue == null) {
                return null;
            }

            return sessionValue.toString();
        }

        if (principalCookieName != null && httpRequest.getCookies() != null) {
            for (Cookie cookie : httpRequest.getCookies()) {
                if (principalCookieName.equals(cookie.getName())) {
                    return cookie.getValue();
                }
            }
        }

        return null;
    }

    public class WebStatFilterContextListener extends StatFilterContextListenerAdapter {

        @Override
        public void addUpdateCount(int updateCount) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.addJdbcUpdateCount(updateCount);
            }
        }

        @Override
        public void addFetchRowCount(int fetchRowCount) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.addJdbcFetchRowCount(fetchRowCount);
            }
        }

        @Override
        public void executeBefore(String sql, boolean inTransaction) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcExecuteCount();
            }
        }

        @Override
        public void executeAfter(String sql, long nanos, Throwable error) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.addJdbcExecuteTimeNano(nanos);
                if (error != null) {
                    reqStat.incrementJdbcExecuteErrorCount();
                }
            }
        }

        @Override
        public void commit() {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcCommitCount();
            }
        }

        @Override
        public void rollback() {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcRollbackCount();
            }
        }

        @Override
        public void pool_connect() {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcPoolConnectCount();
            }
        }

        @Override
        public void pool_close(long nanos) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcPoolCloseCount();
            }
        }

        @Override
        public void resultSet_open() {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcResultSetOpenCount();
            }
        }

        @Override
        public void resultSet_close(long nanos) {
            WebRequestStat reqStat = WebRequestStat.current();
            if (reqStat != null) {
                reqStat.incrementJdbcResultSetCloseCount();
            }
        }
    }
}


text:
using System;
using System.Linq;
using System.Web.Mvc;
using StackExchange.DataExplorer.Helpers;
using StackExchange.DataExplorer.Models;

namespace StackExchange.DataExplorer.Controllers
{
    public class VoteController : StackOverflowController
    {
        [HttpPost]
        [Route(@"vote/{querySetId:\d+}")]
        public ActionResult Vote(int querySetId, string voteType)
        {
            if (Current.User.IsAnonymous)
            {
                return new EmptyResult();
            }

            if (voteType == "favorite")
            {
                QuerySet querySet = Current.DB.QuerySets.Get(querySetId);

                if (querySet == null)
                {
                    return Json(new { error = true });
                }

                Vote vote = Current.DB.Query<Vote>(@"
                    SELECT
                        *
                    FROM
                        Votes
                    WHERE
                        VoteTypeId = @vote AND
                        QuerySetId = @querySetId AND
                        UserId = @user"
                    ,
                    new
                    {
                        vote = (int)VoteType.Favorite,
                        querySetId = querySetId,
                        user = CurrentUser.Id
                    }
                ).FirstOrDefault();

                if (vote == null)
                {
                    Current.DB.Votes.Insert(new
                    {
                        QuerySetId = querySetId,
                        UserId = CurrentUser.Id,
                        VoteTypeId = (int)VoteType.Favorite,
                        CreationDate = DateTime.UtcNow
                    });
                }
                else
                {
                    Current.DB.Execute("DELETE Votes WHERE Id = @id", new { id = vote.Id });
                }

                Current.DB.Execute(@"
                    UPDATE
                        QuerySets
                    SET
                        Votes = Votes + @change
                    WHERE
                        Id = @id",
                    new
                    {
                        change = vote == null ? 1 : -1,
                        id = querySetId
                    }
                );
            }

            return Json(new {success = true});
        }
    }
}


text:
(cd ..; sudo pear install -f package.xml)
rm -f *.log
mysql -u root webdav -e "TRUNCATE TABLE locks"
mysql -u root webdav -e "TRUNCATE TABLE properties"
sudo rm -rf /usr/local/apache/htdocs/mod_dav/*
sudo rm -rf /usr/local/apache/htdocs/litmus/*
litmus -k http://localhost/file.php   # add -k to continue on errors
php -q split_log.php


text:
<?php

final class PhabricatorPasswordSettingsPanel extends PhabricatorSettingsPanel {

  public function getPanelKey() {
    return 'password';
  }

  public function getPanelName() {
    return pht('Password');
  }

  public function getPanelGroup() {
    return pht('Authentication');
  }

  public function isEnabled() {
    // There's no sense in showing a change password panel if this install
    // doesn't support password authentication.
    if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
      return false;
    }

    return true;
  }

  public function processRequest(AphrontRequest $request) {
    $user = $request->getUser();

    $token = id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
      $user,
      $request,
      '/settings/');

    $min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length');
    $min_len = (int)$min_len;

    // NOTE: To change your password, you need to prove you own the account,
    // either by providing the old password or by carrying a token to
    // the workflow from a password reset email.

    $key = $request->getStr('key');
    $password_type = PhabricatorAuthPasswordResetTemporaryTokenType::TOKENTYPE;

    $token = null;
    if ($key) {
      $token = id(new PhabricatorAuthTemporaryTokenQuery())
        ->setViewer($user)
        ->withTokenResources(array($user->getPHID()))
        ->withTokenTypes(array($password_type))
        ->withTokenCodes(array(PhabricatorHash::digest($key)))
        ->withExpired(false)
        ->executeOne();
    }

    $e_old = true;
    $e_new = true;
    $e_conf = true;

    $errors = array();
    if ($request->isFormPost()) {
      if (!$token) {
        $envelope = new PhutilOpaqueEnvelope($request->getStr('old_pw'));
        if (!$user->comparePassword($envelope)) {
          $errors[] = pht('The old password you entered is incorrect.');
          $e_old = pht('Invalid');
        }
      }

      $pass = $request->getStr('new_pw');
      $conf = $request->getStr('conf_pw');

      if (strlen($pass) < $min_len) {
        $errors[] = pht('Your new password is too short.');
        $e_new = pht('Too Short');
      } else if ($pass !== $conf) {
        $errors[] = pht('New password and confirmation do not match.');
        $e_conf = pht('Invalid');
      } else if (PhabricatorCommonPasswords::isCommonPassword($pass)) {
        $e_new = pht('Very Weak');
        $e_conf = pht('Very Weak');
        $errors[] = pht(
          'Your new password is very weak: it is one of the most common '.
          'passwords in use. Choose a stronger password.');
      }

      if (!$errors) {
        // This write is unguarded because the CSRF token has already
        // been checked in the call to $request->isFormPost() and
        // the CSRF token depends on the password hash, so when it
        // is changed here the CSRF token check will fail.
        $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();

          $envelope = new PhutilOpaqueEnvelope($pass);
          id(new PhabricatorUserEditor())
            ->setActor($user)
            ->changePassword($user, $envelope);

        unset($unguarded);

        if ($token) {
          // Destroy the token.
          $token->delete();

          // If this is a password set/reset, kick the user to the home page
          // after we update their account.
          $next = '/';
        } else {
          $next = $this->getPanelURI('?saved=true');
        }

        id(new PhabricatorAuthSessionEngine())->terminateLoginSessions(
          $user,
          $request->getCookie(PhabricatorCookies::COOKIE_SESSION));

        return id(new AphrontRedirectResponse())->setURI($next);
      }
    }

    $hash_envelope = new PhutilOpaqueEnvelope($user->getPasswordHash());
    if (strlen($hash_envelope->openEnvelope())) {
      try {
        $can_upgrade = PhabricatorPasswordHasher::canUpgradeHash(
          $hash_envelope);
      } catch (PhabricatorPasswordHasherUnavailableException $ex) {
        $can_upgrade = false;

        // Only show this stuff if we aren't on the reset workflow. We can
        // do resets regardless of the old hasher's availability.
        if (!$token) {
          $errors[] = pht(
            'Your password is currently hashed using an algorithm which is '.
            'no longer available on this install.');
          $errors[] = pht(
            'Because the algorithm implementation is missing, your password '.
            'can not be used or updated.');
          $errors[] = pht(
            'To set a new password, request a password reset link from the '.
            'login screen and then follow the instructions.');
        }
      }

      if ($can_upgrade) {
        $errors[] = pht(
          'The strength of your stored password hash can be upgraded. '.
          'To upgrade, either: log out and log in using your password; or '.
          'change your password.');
      }
    }

    $len_caption = null;
    if ($min_len) {
      $len_caption = pht('Minimum password length: %d characters.', $min_len);
    }

    $form = new AphrontFormView();
    $form
      ->setUser($user)
      ->addHiddenInput('key', $key);

    if (!$token) {
      $form->appendChild(
        id(new AphrontFormPasswordControl())
          ->setLabel(pht('Old Password'))
          ->setError($e_old)
          ->setName('old_pw'));
    }

    $form
      ->appendChild(
        id(new AphrontFormPasswordControl())
          ->setDisableAutocomplete(true)
          ->setLabel(pht('New Password'))
          ->setError($e_new)
          ->setName('new_pw'));
    $form
      ->appendChild(
        id(new AphrontFormPasswordControl())
          ->setDisableAutocomplete(true)
          ->setLabel(pht('Confirm Password'))
          ->setCaption($len_caption)
          ->setError($e_conf)
          ->setName('conf_pw'));
    $form
      ->appendChild(
        id(new AphrontFormSubmitControl())
          ->setValue(pht('Change Password')));

    $form->appendChild(
      id(new AphrontFormStaticControl())
        ->setLabel(pht('Current Algorithm'))
        ->setValue(PhabricatorPasswordHasher::getCurrentAlgorithmName(
          new PhutilOpaqueEnvelope($user->getPasswordHash()))));

    $form->appendChild(
      id(new AphrontFormStaticControl())
        ->setLabel(pht('Best Available Algorithm'))
        ->setValue(PhabricatorPasswordHasher::getBestAlgorithmName()));

    $form->appendRemarkupInstructions(
      pht(
        'NOTE: Changing your password will terminate any other outstanding '.
        'login sessions.'));

    $form_box = id(new PHUIObjectBoxView())
      ->setHeaderText(pht('Change Password'))
      ->setFormSaved($request->getStr('saved'))
      ->setFormErrors($errors)
      ->setForm($form);

    return array(
      $form_box,
    );
  }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/black">

    <item android:id="@android:id/mask" android:drawable="@drawable/rect" />

</ripple>


text:
<?php
/**
 * User: TRANN
 * Date: 6/10/13
 * Time: 1:14 PM
 */

Yii::import('application.models.*');
require_once('AdminActiveRecord.php');

class AdmProperty extends AdminActiveRecord {

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    public function getDbConnection()
    {
        return self::getBiotrackingDbConnection();
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return 'ADM_PROPERTY';
    }

    public function rules ()
    {
        return array(
            array('DESCRIPTION', 'required'),
        );
    }

}


text:
using System;

namespace LiveRoku.Notifications {
    [Serializable]
    public class WidgetSettings {
        public double XOffset { get; set; }
        public double YOffset { get; set; }
        public double XRelative { get; set; }
        public double YRelative { get; set; }
        public bool OnTop { get; set; }
        public bool Lock { get; set; }
        public bool RelativeFirst { get; set; } = true;

        public WidgetSettings () { }

        public WidgetSettings (double x, double y, bool onTop) {
            XOffset = x;
            YOffset = y;
            OnTop = onTop;
        }

        public void relativeTo(double width, double height) {
            this.XRelative = XOffset / width;
            this.YRelative = YOffset / height;
        }

        public void relativeTo(System.Windows.Rect range) => relativeTo(range.Width, range.Height);

        public static WidgetSettings match (WidgetSettings settings, System.Windows.Rect range) {
            var xRelativeOffset = range.Width * settings.XRelative;
            var yRelativeOffset = range.Height * settings.YRelative;
            settings.XOffset = Math.Abs(settings.XOffset - xRelativeOffset) < 2 ? settings.XOffset : xRelativeOffset;
            settings.YOffset = Math.Abs(settings.YOffset - yRelativeOffset) < 2 ? settings.YOffset : yRelativeOffset;
            return settings;
        }
    }
}


text:
.streamList {
    display: flex;
    flex-wrap: wrap;
}

.streamPreview {
    border: 1px solid black;
    margin: 10px;
}


text:
@interface IDETestFailureBreakpoint : IDEBreakpoint
{
}

- (id)symbolNames;
- (id)displayName;
- (id)init;

@end


text:
import React from 'react';
import { inject } from 'mobx-react';
import SubTitleRow from './subtitle';
import LogframeTable from './table';

const LogframeApp = () => {
    return (
        <React.Fragment>
            <SubTitleRow />
            <table className="logframe__table table table-sm table-bordered bg-white text-small">
                <LogframeTable />
            </table>
        </React.Fragment>
    );
}

export default LogframeApp;


text:
require 'standalone_validator/validation_result'
require 'standalone_validator/violation'

class StandaloneValidator
  class ValidationResultBuilder
    attr_writer :validated_object

    def merge_result(result)
      combined_results << result
      self
    end

    def add_violation(attribute_name, violation_type_or_message, options = {})
      creation_attributes = {
        :attribute     => attribute_name.to_sym,
        :source_object => validated_object,
        :options       => options,
      }

      if violation_type_or_message.kind_of?(Symbol)
        creation_attributes[:type] = violation_type_or_message
      else
        creation_attributes[:message] = violation_type_or_message
      end

      push_violation(Violation.new(creation_attributes))
      self
    end

    def result
      ValidationResult.new(
        :validated_object => validated_object,
        :violations       => all_violations
      )
    end

  private
    attr_reader :validated_object

    def all_violations
      combined_results.inject(violations) do |violations_list, subresult|
        violations_list.append(subresult.violations)
      end
    end

    def combined_results
      @combined_results ||= []
    end

    def push_violation(violation)
      @violations = violations.cons(violation)
    end

    def violations
      @violations ||= Hamster.list
    end
  end
end


text:
<?php

declare(strict_types=1);

namespace Knp\DoctrineBehaviors\Model\Timestampable;

use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Knp\DoctrineBehaviors\Exception\ShouldNotHappenException;

trait TimestampableMethodsTrait
{
    public function getCreatedAt(): ?DateTimeInterface
    {
        return $this->createdAt;
    }

    public function getUpdatedAt(): ?DateTimeInterface
    {
        return $this->updatedAt;
    }

    public function setCreatedAt(DateTimeInterface $createdAt): void
    {
        $this->createdAt = $createdAt;
    }

    public function setUpdatedAt(DateTimeInterface $updatedAt): void
    {
        $this->updatedAt = $updatedAt;
    }

    /**
     * Updates createdAt and updatedAt timestamps.
     */
    public function updateTimestamps(): void
    {
        // Create a datetime with microseconds
        $dateTime = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));

        if ($dateTime === false) {
            throw new ShouldNotHappenException();
        }

        $dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));

        if ($this->createdAt === null) {
            $this->createdAt = $dateTime;
        }

        $this->updatedAt = $dateTime;
    }
}


text:
package org.hibernate.validator.internal.constraintvalidators.bv.past;

import java.util.Date;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.Past;

/**
 * Check that the java.util.Date passed to be validated is in the
 * past.
 *
 * @author Alaa Nassef
 */
public class PastValidatorForDate implements ConstraintValidator<Past, Date> {

	public void initialize(Past constraintAnnotation) {
	}

	public boolean isValid(Date date, ConstraintValidatorContext constraintValidatorContext) {
		//null values are valid
		if ( date == null ) {
			return true;
		}
		return date.before( new Date() );
	}
}


text:
var React = require('react');
var MovieActions = require('../actions/movieActions');

var Movie = React.createClass({
    playMovie: function(){
        MovieActions.playMovie(this.props.movie);
    },
    render: function(){
        var imageUrl = this.props.movie.thumbnail !== undefined
            ? 'data:image/png;base64,' + this.props.movie.thumbnail
            : '';
        var imageClassName = this.props.movie.thumbnail !== undefined
            ? 'img-rounded img-responsive'
            : 'hidden';
        return (

{this.props.movie.title}

                                <button type="button" className="btn btn-default" onClick={this.playMovie}>

                                </button>

        );
    }
});

module.exports = Movie;


text:
package FindLatest10Projects;

import entities.Project;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import java.util.List;

public class Main {
    public static void main(String[] args) {

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("soft_uni");

        EntityManager em = emf.createEntityManager();

        List<Project> projects = em.createQuery("SELECT p FROM Project AS p ORDER BY p.startDate DESC, p.name ASC ")
                .setMaxResults(10)
                .getResultList();

        projects.stream().forEach(x->{
            StringBuilder sb = new StringBuilder();

            sb.append("Project name: ").append(x.getName())
                    .append(System.lineSeparator()).append("        Project description: ").append(x.getDescription())
                    .append(System.lineSeparator()).append("        Project start date: ").append(x.getStartDate())
                    .append(System.lineSeparator()).append("        Project end date: ").append(x.getEndDate());
            System.out.println(sb);
        });

        em.close();
        emf.close();
    }
}


text:
"""Script for testing ganeti.runtime"""

from ganeti import constants
from ganeti import errors
from ganeti import runtime
from ganeti import ht

import testutils
import unittest

class _EntStub:
  def __init__(self, uid=None, gid=None):
    self.pw_uid = uid
    self.gr_gid = gid

def _StubGetpwnam(user):
  users = {
    constants.MASTERD_USER: _EntStub(uid=0),
    constants.CONFD_USER: _EntStub(uid=1),
    constants.RAPI_USER: _EntStub(uid=2),
    constants.NODED_USER: _EntStub(uid=3),
    constants.LUXID_USER: _EntStub(uid=4),
    constants.WCONFD_USER: _EntStub(uid=5),
    constants.MOND_USER: _EntStub(uid=6),
    constants.METAD_USER: _EntStub(uid=7),
    }
  return users[user]

def _StubGetgrnam(group):
  groups = {
    constants.MASTERD_GROUP: _EntStub(gid=0),
    constants.CONFD_GROUP: _EntStub(gid=1),
    constants.RAPI_GROUP: _EntStub(gid=2),
    constants.DAEMONS_GROUP: _EntStub(gid=3),
    constants.ADMIN_GROUP: _EntStub(gid=4),
    constants.NODED_GROUP: _EntStub(gid=5),
    constants.LUXID_GROUP: _EntStub(gid=6),
    constants.WCONFD_GROUP: _EntStub(gid=7),
    constants.MOND_GROUP: _EntStub(gid=8),
    constants.METAD_GROUP: _EntStub(gid=9),
    }
  return groups[group]

def _RaisingStubGetpwnam(user):
  raise KeyError("user not found")

def _RaisingStubGetgrnam(group):
  raise KeyError("group not found")

class ResolverStubRaising(object):
  def __init__(self):
    raise errors.ConfigurationError("No entries")

class TestErrors(unittest.TestCase):
  def setUp(self):
    self.resolver = runtime.GetentResolver(_getpwnam=_StubGetpwnam,
                                           _getgrnam=_StubGetgrnam)

  def testEverythingSuccessful(self):
    self.assertEqual(self.resolver.masterd_uid,
                     _StubGetpwnam(constants.MASTERD_USER).pw_uid)
    self.assertEqual(self.resolver.masterd_gid,
                     _StubGetgrnam(constants.MASTERD_GROUP).gr_gid)
    self.assertEqual(self.resolver.confd_uid,
                     _StubGetpwnam(constants.CONFD_USER).pw_uid)
    self.assertEqual(self.resolver.confd_gid,
                     _StubGetgrnam(constants.CONFD_GROUP).gr_gid)
    self.assertEqual(self.resolver.wconfd_uid,
                     _StubGetpwnam(constants.WCONFD_USER).pw_uid)
    self.assertEqual(self.resolver.wconfd_gid,
                     _StubGetgrnam(constants.WCONFD_GROUP).gr_gid)
    self.assertEqual(self.resolver.luxid_uid,
                     _StubGetpwnam(constants.LUXID_USER).pw_uid)
    self.assertEqual(self.resolver.luxid_gid,
                     _StubGetgrnam(constants.LUXID_GROUP).gr_gid)
    self.assertEqual(self.resolver.rapi_uid,
                     _StubGetpwnam(constants.RAPI_USER).pw_uid)
    self.assertEqual(self.resolver.rapi_gid,
                     _StubGetgrnam(constants.RAPI_GROUP).gr_gid)
    self.assertEqual(self.resolver.noded_uid,
                     _StubGetpwnam(constants.NODED_USER).pw_uid)
    self.assertEqual(self.resolver.noded_gid,
                     _StubGetgrnam(constants.NODED_GROUP).gr_gid)
    self.assertEqual(self.resolver.mond_uid,
                     _StubGetpwnam(constants.MOND_USER).pw_uid)
    self.assertEqual(self.resolver.mond_gid,
                     _StubGetgrnam(constants.MOND_GROUP).gr_gid)
    self.assertEqual(self.resolver.metad_uid,
                     _StubGetpwnam(constants.METAD_USER).pw_uid)
    self.assertEqual(self.resolver.metad_gid,
                     _StubGetgrnam(constants.METAD_GROUP).gr_gid)

    self.assertEqual(self.resolver.daemons_gid,
                     _StubGetgrnam(constants.DAEMONS_GROUP).gr_gid)
    self.assertEqual(self.resolver.admin_gid,
                     _StubGetgrnam(constants.ADMIN_GROUP).gr_gid)

  def testUserNotFound(self):
    self.assertRaises(errors.ConfigurationError, runtime.GetentResolver,
                      _getpwnam=_RaisingStubGetpwnam, _getgrnam=_StubGetgrnam)

  def testGroupNotFound(self):
    self.assertRaises(errors.ConfigurationError, runtime.GetentResolver,
                      _getpwnam=_StubGetpwnam, _getgrnam=_RaisingStubGetgrnam)

  def testUserNotFoundGetEnts(self):
    self.assertRaises(errors.ConfigurationError, runtime.GetEnts,
                      resolver=ResolverStubRaising)

  def testLookupForUser(self):
    master_stub = _StubGetpwnam(constants.MASTERD_USER)
    rapi_stub = _StubGetpwnam(constants.RAPI_USER)
    self.assertEqual(self.resolver.LookupUid(master_stub.pw_uid),
                     constants.MASTERD_USER)
    self.assertEqual(self.resolver.LookupUid(rapi_stub.pw_uid),
                     constants.RAPI_USER)
    self.assertEqual(self.resolver.LookupUser(constants.MASTERD_USER),
                     master_stub.pw_uid)
    self.assertEqual(self.resolver.LookupUser(constants.RAPI_USER),
                     rapi_stub.pw_uid)

  def testLookupForGroup(self):
    master_stub = _StubGetgrnam(constants.MASTERD_GROUP)
    rapi_stub = _StubGetgrnam(constants.RAPI_GROUP)
    self.assertEqual(self.resolver.LookupGid(master_stub.gr_gid),
                     constants.MASTERD_GROUP)
    self.assertEqual(self.resolver.LookupGid(rapi_stub.gr_gid),
                     constants.RAPI_GROUP)

  def testLookupForUserNotFound(self):
    self.assertRaises(errors.ConfigurationError, self.resolver.LookupUid, 9999)
    self.assertRaises(errors.ConfigurationError,
                      self.resolver.LookupUser, "does-not-exist-foo")

  def testLookupForGroupNotFound(self):
    self.assertRaises(errors.ConfigurationError, self.resolver.LookupGid, 9999)
    self.assertRaises(errors.ConfigurationError,
                      self.resolver.LookupGroup, "does-not-exist-foo")

class TestArchInfo(unittest.TestCase):
  EXP_TYPES = \
    ht.TAnd(ht.TIsLength(2),
            ht.TItems([
              ht.TNonEmptyString,
              ht.TNonEmptyString,
              ]))

  def setUp(self):
    self.assertTrue(runtime._arch is None)

  def tearDown(self):
    runtime._arch = None

  def testNotInitialized(self):
    self.assertRaises(errors.ProgrammerError, runtime.GetArchInfo)

  def testInitializeMultiple(self):
    runtime.InitArchInfo()

    self.assertRaises(errors.ProgrammerError, runtime.InitArchInfo)

  def testNormal(self):
    runtime.InitArchInfo()

    info = runtime.GetArchInfo()

    self.assertTrue(self.EXP_TYPES(info),
                    msg=("Doesn't match expected type description: %s" %
                         self.EXP_TYPES))

if __name__ == "__main__":
  testutils.GanetiTestProgram()


text:
require 'rubygems'
require 'RMagick'

module AndroidImgResizer

  def self.verify_android_project
  	files=["AndroidManifest.xml"]
  	directories=["res","res/drawable-hdpi","res/drawable-xhdpi","res/drawable-mdpi","src"]

    files.each do |file|
      if !File::exists?(file)
        puts "Error: This is not a Android project Directory\n"
        puts "Error: File not exists #{file} \n"
        return false
      end
    end

    directories.each do |directory|
      if  !File::directory?(directory)
        puts "Error: This is not a Android project Directory\n"
        puts "Error: Directory not exists #{directory} \n"
        return false
      end
    end
    return true
  end

  def self.list_images(base_dpi="xxhdpi")
    return if !self.verify_android_project
    Dir::chdir("res/drawable-"+base_dpi+"/")
    files=Dir["*.{png,jpg,gif,bitmap}"]
    files.each do |entry|
      puts "Drawable File = #{entry}"
    end
  end

  def self.resize_all_images(base_dpi="xxhdpi")
    return if !self.verify_android_project

    baseline_path = "res/drawable-"+base_dpi+"/"
    if !File::exists?(baseline_path)
      puts "Baseline path #{baseline_path} doesnt exist"
      exit(1)
    end

    Dir::chdir(baseline_path)
    files=Dir["*.{png,jpg,gif,bitmap}"]
    Dir::chdir("../../")
    files.each do |entry|
      resize_image(entry,base_dpi)
    end
  end

  def self.scale(imageFile,rimg,factor,tag)
    xsize=rimg.columns*factor
    ysize=rimg.rows*factor
    puts "Image = #{imageFile} #{tag} = #{xsize.to_i}x#{ysize.to_i}"
    hdpi = rimg.scale(xsize.to_i,ysize.to_i)
    hdpi.write "res/drawable-#{tag}/"+imageFile
  end

  def self.resize_image(imageFile,base_dpi="xxhdpi")
    return if !self.verify_android_project

    full_path = "res/drawable-#{base_dpi}/#{imageFile}"

    if !File::exists?(full_path)
      puts "Image #{full_path} doesnt exist"
      exit(1)
    end

    rimg = Magick::Image.read(full_path).first
    puts "Resizing Image = #{imageFile} with size = #{rimg.columns}x#{rimg.rows} from #{base_dpi}"

    # Scale Down images in res/drawable-xxxhdpi to the lower dpis
    if base_dpi == 'xxxhdpi'
      self.scale_xxxhdpi(imageFile,rimg)
    # Scale Down images in res/drawable-xxhdpi to the lower dpis
    elsif base_dpi == 'xxhdpi'
      self.scale_xxhdpi(imageFile,rimg)
    # Scale Down images in res/drawable-xhdpi to the lower dpis
    elsif base_dpi == 'xhdpi'
      self.scale_xhdpi(imageFile,rimg)
    # Scale Down images in res/drawable-hdpi to the lower dpis
    else
      self.scale_hdpi(imageFile,rimg)
    end

  end

  def self.scale_xxxhdpi(imageFile,rimg)
    # xxdpi version 3/4 - 3.0x mdpi
    self.scale(imageFile,rimg,0.75,"xxhdpi")
    # xxdpi version 2/4 - 2.0x mdpi
    self.scale(imageFile,rimg,0.5,"xhdpi")
    # xxdpi version 1.5/4 - 1.5x mdpi
    self.scale(imageFile,rimg,0.375,"hdpi")
    # xxdpi version 1/4 - 1.0x mdpi
    self.scale(imageFile,rimg,0.25,"mdpi")
  end

  def self.scale_xxhdpi(imageFile,rimg)
    # xdpi version 2/3 - 2.0x mdpi
    self.scale(imageFile,rimg,2.0/3,"xhdpi")
    # hdpi version 0.5 - 1.5x mdpi
    self.scale(imageFile,rimg,0.5,"hdpi")
    # hdpi version 1/3 - 1.0x mdpi
    self.scale(imageFile,rimg,1.0/3,"mdpi")
  end

  def self.scale_xhdpi(imageFile,rimg)
    # xdpi version 0.75 - 1.5x mdpi
    self.scale(imageFile,rimg,0.75,"hdpi")
    # xdpi version 0.5 - 1.0x mdpi
    self.scale(imageFile,rimg,0.5,"mdpi")
  end

  def self.scale_hdpi(imageFile,rimg)
    # xdpi version 2/3 - 1.5x mdpi
    self.scale(imageFile,rimg,2.0/3,"mdpi")
  end

  def self.clean_files(imgtoclean)
    if File::exists?("res/drawable-xxhdpi/"+imgtoclean)
      File.delete("res/drawable-xxhdpi/"+imgtoclean)
    end
    if File::exists?("res/drawable-xhdpi/"+imgtoclean)
      File.delete("res/drawable-xhdpi/"+imgtoclean)
    end
    if File::exists?("res/drawable-hdpi/"+imgtoclean)
      File.delete("res/drawable-hdpi/"+imgtoclean)
    end
    if File::exists?("res/drawable-mdpi/"+imgtoclean)
      File.delete("res/drawable-mdpi/"+imgtoclean)
    end
    if File::exists?("res/drawable-ldpi/"+imgtoclean)
      File.delete("res/drawable-ldpi/"+imgtoclean)
    end
  end

end