text:
package org.wso2.carbon.event.processor.common.storm.component;

import backtype.storm.task.TopologyContext;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.wso2.carbon.event.processor.manager.commons.utils.Utils;
import org.wso2.siddhi.core.ExecutionPlanRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.stream.input.InputHandler;
import org.wso2.siddhi.core.stream.output.StreamCallback;
import org.wso2.siddhi.query.api.definition.Attribute;
import org.wso2.siddhi.query.api.definition.StreamDefinition;
import org.wso2.siddhi.query.compiler.SiddhiCompiler;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Bold which runs Siddhi engine
 */

public class SiddhiBolt extends BaseBasicBolt {
    private final String name;
    private transient Logger log = Logger.getLogger(SiddhiBolt.class);
    private transient SiddhiManager siddhiManager;

    /**
     * Exported stream IDs. Must declare output filed for each exported stream
     */
    private List<String> outputStreamDefinitions;
    /**
     * All stream inputStreamDefinitions and partition inputStreamDefinitions(if any)
     */
    private List<String> inputStreamDefinitions;
    /**
     * Queries to be executed in Siddhi.
     */
    private String query;

    private BasicOutputCollector collector;
    private int eventCount;
    private long batchStartTime;
    private String logPrefix;

    private transient ExecutionPlanRuntime executionPlanRuntime;

    /**
     * Bolt which runs the Siddhi engine.
     *
     * @param inputStreamDefinitions  - All stream and partition inputStreamDefinitions
     * @param query                   - Siddhi query
     * @param outputSiddhiDefinitions - The names of streams that will be output from this particular bolt
     */
    public SiddhiBolt(String name, List<String> inputStreamDefinitions, String query,
                      List<String> outputSiddhiDefinitions, String executionPlanName, int tenantId) {
        this.inputStreamDefinitions = inputStreamDefinitions;
        this.query = query;
        this.outputStreamDefinitions = outputSiddhiDefinitions;
        this.name = name;
        this.logPrefix = "[" + tenantId + ":" + executionPlanName + ":" + name + "] ";
        init();
    }

    /**
     * Bolt get saved and reloaded, this to redo the configurations.
     */
    private void init() {
        siddhiManager = new SiddhiManager();
        eventCount = 0;
        batchStartTime = System.currentTimeMillis();
        log = Logger.getLogger(SiddhiBolt.class);

        String fullQueryExpression = Utils.constructQueryExpression(inputStreamDefinitions, outputStreamDefinitions,
                query);
        executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(fullQueryExpression);

        for (String outputStreamDefinition : outputStreamDefinitions) {
            final StreamDefinition outputSiddhiDefinition = SiddhiCompiler.parseStreamDefinition(outputStreamDefinition);
            if (log.isDebugEnabled()) {
                log.debug(logPrefix + " Adding callback for stream: " + outputSiddhiDefinition.getId());
            }
            executionPlanRuntime.addCallback(outputSiddhiDefinition.getId(), new StreamCallback() {

                @Override
                public void receive(Event[] events) {
                    for (Event event : events) {
                        Object[] eventData = Arrays.copyOf(event.getData(), event.getData().length + 1);
                        eventData[event.getData().length] = event.getTimestamp();
                        collector.emit(outputSiddhiDefinition.getId(), Arrays.asList(eventData));
                        if (log.isDebugEnabled()) {
                            if (++eventCount % 10000 == 0) {
                                double timeSpentInSecs = (System.currentTimeMillis() - batchStartTime) / 1000.0D;
                                double throughput = 10000 / timeSpentInSecs;
                                log.debug(logPrefix + "Processed 10000 events in " + timeSpentInSecs + " seconds, " +
                                        "throughput : " + throughput + " events/sec. Stream :" +
                                        outputSiddhiDefinition.getId());
                                eventCount = 0;
                                batchStartTime = System.currentTimeMillis();
                            }
                            log.debug(logPrefix + "Emitted Event:" + outputSiddhiDefinition.getId() +
                                    ":" + Arrays.deepToString(eventData) + "@" + event.getTimestamp());
                        }
                    }
                }
            });
        }
        executionPlanRuntime.start();
    }

    @Override
    public void prepare(Map stormConf, TopologyContext context) {
        super.prepare(stormConf, context);
    }

    @Override
    public void execute(Tuple tuple, BasicOutputCollector collector) {
        if (siddhiManager == null) {
            init();
        }

        try {
            this.collector = collector;
            InputHandler inputHandler = executionPlanRuntime.getInputHandler(tuple.getSourceStreamId());
            Object[] dataArray = tuple.getValues().toArray();
            long timestamp = (Long) dataArray[dataArray.length - 1];
            dataArray = ArrayUtils.remove(dataArray, dataArray.length - 1);
            if (log.isDebugEnabled()) {
                log.debug(logPrefix + "Received Event: " + tuple.getSourceStreamId() + ":" + Arrays.deepToString(dataArray) + "@" + timestamp);
            }

            if (inputHandler != null) {
                inputHandler.send(timestamp, dataArray);
            } else {
                log.warn(logPrefix + "Event received for unknown stream " + tuple.getSourceStreamId() + ". Discarding" +
                        " the Event: " + tuple.getSourceStreamId() + ":" + Arrays.deepToString(dataArray) + "@" + timestamp);
            }
        } catch (InterruptedException e) {
            log.error(e);
        }
    }

    @Override
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
        if (siddhiManager == null) {
            init();
        }

        // Declaring output fields for each exported stream ID
        for (String outputStreamDefinition : outputStreamDefinitions) {
            StreamDefinition siddhiOutputDefinition = SiddhiCompiler.parseStreamDefinition(outputStreamDefinition);
            if (outputStreamDefinition == null) {
                throw new RuntimeException(logPrefix + "Cannot find exported stream : " + siddhiOutputDefinition.getId());
            }
            List<String> list = new ArrayList<String>();
            list.add(0,"_timestamp");
            for (Attribute attribute : siddhiOutputDefinition.getAttributeList()) {
                list.add(attribute.getName());
            }
            Fields fields = new Fields(list);
            declarer.declareStream(siddhiOutputDefinition.getId(), fields);
            log.info(logPrefix + "Declaring output field for stream :" + siddhiOutputDefinition.getId());
        }
    }
}


text:
IF OBJECT_ID('account.is_valid_login_id') IS NOT NULL
DROP FUNCTION account.is_valid_login_id;

GO

CREATE FUNCTION account.is_valid_login_id(@login_id bigint)
RETURNS bit
BEGIN
    IF EXISTS(SELECT 1 FROM account.logins WHERE login_id=@login_id)
	BEGIN
        RETURN 1;
    END;

    RETURN 0;
END;

GO

--SELECT account.is_valid_login_id(1);

redpajama_set_name: RedPajamaGithub


text:
function fName = animatedGif(pImg,fName)
% Save an animated gif from a 3D volume of gray scale images
%
% In the future, if we want to save RGB image sequences we need to apply
%
%    [M  c_map]= rgb2ind(RGB,256);  % If we have an rgb, do this
%
% to the RGB image before saving it in the gif, below
%
% Then we want a routine that averages over 50 temporal frames, sliding
% from the beginning to the end, no?
% tAve = 25;
% [r,c,t] = size(pImg);
% tmp = zeros(r,c,t-tAve);
% lst = 1:tAve;
% for ii=0:(nSamples - tAve - 1)
%     tmp(:,:,ii+1) = sum(pImg(:,:,lst + ii),3);
% end
% tmp = ieScale(tmp,0,1);
% tmp = 255*tmp;
% mplay(tmp);
% % Show it as a movie.  In this case the mosaic is held in fixed position
% % and the stimulus is shown moving over the mosaic.  So dark parts, say the
% % blue cones, are stable as the white stimulus moves around.
% pImg = ieScale(pImg,0,1);
% pImg = 255*pImg;
% mplay(pImg);
%
%
% See also:  ctToolbox/ctScripts/presentations/p_Microsoft2013XX
%
% BW,HJ PDCSOFT Team 2013

if ieNotDefined('pImg'), error('3D volume of data needed'); end
if ieNotDefined('fName'), fName = fullfile(pwd,'tmp.gif'); end

% Look forever
loops=65535;

% Gray scale
c_map = gray(256);

% Default frame delays
delay1 = .1;
delay2 = .1;

for ii=1:size(pImg,3)
    M = uint8(pImg(:,:,ii));
    if ii==1
        imwrite(M,c_map,fName,'gif','LoopCount',loops,'DelayTime',delay1)
    end
    imwrite(M,c_map,fName,'gif','WriteMode','append','DelayTime',delay2)
end

fprintf('Finished creating animated gif in file %s\n',fName);

%%


text:
#region File Description
//-----------------------------------------------------------------------------
// PerformanceUtility.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements

using System;
using System.Collections.Generic;
using System.Diagnostics;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.GamerServices;
using PerformanceUtility.GameDebugTools;
using System.Globalization;

#endregion

namespace PerformanceUtility
{
    /// <summary>
    /// Sample program for Debug Components.
    /// </summary>
    public class PerformanceUtilityGame : Microsoft.Xna.Framework.Game
    {
        #region Fields

        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        SpriteFont font;

        // a blank 1x1 texture
        Texture2D blank;

        // our test sprite
        Texture2D cat;

        // Our debug system. We can keep this reference or use the DebugSystem.Instance
        // property once we've called DebugSystem.Initialize.
        DebugSystem debugSystem;

        // Position for debug command test.
        Vector2 debugPos = new Vector2(100, 100);

        // Stopwatch for TimeRuler test.
        Stopwatch stopwatch = new Stopwatch();

        // Variables for inputs.
        GamePadState padState;
        KeyboardState keyState;

        GamePadState prevPadState;
        KeyboardState prevKeyState;

        #endregion

        #region Initialization

        public PerformanceUtilityGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

#if WINDOWS_PHONE
            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);
            graphics.IsFullScreen = true;
#endif
        }

        protected override void Initialize()
        {
            // initialize the debug system with the game and the name of the font
            // we want to use for the debugging
            debugSystem = DebugSystem.Initialize(this, "Font");

            // register a new command that lets us move a sprite on the screen
            debugSystem.DebugCommandUI.RegisterCommand(
                "pos",              // Name of command
                "set position",     // Description of command
                PosCommand          // Command execution delegate
                );

            // we use flick and tap in order to bring down the command prompt and
            // open up the keyboard input panel, respectively.
            TouchPanel.EnabledGestures = GestureType.Flick | GestureType.Tap;

            base.Initialize();
        }

        protected override void LoadContent()
        {
            // create our SpriteBatch and load our font
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("Font");

            // load our sprite
            cat = Content.Load<Texture2D>("cat");

            // create our blank texture
            blank = new Texture2D(GraphicsDevice, 1, 1);
            blank.SetData(new[] { Color.White });

            base.LoadContent();
        }

        #endregion

        #region Debug command test code.

        /// <summary>
        /// This method is called from DebugCommandHost when the user types the 'pos'
        /// command into the command prompt. This is registered with the command prompt
        /// through the DebugCommandUI.RegisterCommand method we called in Initialize.
        /// </summary>
        void PosCommand(IDebugCommandHost host, string command, IList<string> arguments)
        {
            // if we got two arguments from the command
            if (arguments.Count == 2)
            {
                // process text "pos xPos yPos" by parsing our two arguments
                debugPos.X = Single.Parse(arguments[0], CultureInfo.InvariantCulture);
                debugPos.Y = Single.Parse(arguments[1], CultureInfo.InvariantCulture);
            }
            else
            {
                // if we didn't get two arguments, we echo the current position of the cat
                host.Echo(String.Format("Pos={0},{1}", debugPos.X, debugPos.Y));
            }
        }

        #endregion

        #region Update and Draw

        protected override void Update(GameTime gameTime)
        {
            // tell the TimeRuler that we're starting a new frame. you always want
            // to call this at the start of Update
            debugSystem.TimeRuler.StartFrame();

            // Start measuring time for "Update".
            debugSystem.TimeRuler.BeginMark("Update", Color.Blue);

            HandleInput();
            HandleTouchInput();

            // Simulate game update by doing a busy loop for 1ms
            stopwatch.Reset();
            stopwatch.Start();
            while (stopwatch.ElapsedMilliseconds < 1) ;

            // Update other components.
            base.Update(gameTime);

            // Stop measuring time for "Update".
            debugSystem.TimeRuler.EndMark("Update");
        }

        protected override void Draw(GameTime gameTime)
        {
            // Start measuring time for "Draw".
            debugSystem.TimeRuler.BeginMark("Draw", Color.Yellow);

            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();

            // Show usage.
            string message =
                "A Button, A key: Show/Hide FPS Counter\n" +
                "B Button, B key: Show/Hide Time Ruler\n" +
                "X Button, X key: Show/Hide Time Ruler Log\n" +
                "Tab key, flick down: Open debug command UI\n" +
                "Tab key, flick up: Close debug command UI\n" +
                "Tap: Show keyboard input panel";

            Vector2 size = font.MeasureString(message);
            Layout layout = new Layout(GraphicsDevice.Viewport);

            float margin = font.LineSpacing;
            Rectangle rc = new Rectangle(0, 0,
                                    (int)(size.X + margin),
                                    (int)(size.Y + margin));

            // Compute boarder size, position.
            rc = layout.Place(rc, 0.01f, 0.01f, Alignment.TopRight);
            spriteBatch.Draw(blank, rc, Color.Black * .5f);

            // Draw usage message text.
            layout.ClientArea = rc;
            Vector2 pos = layout.Place(size, 0, 0, Alignment.Center);
            spriteBatch.DrawString(font, message, pos, Color.White);

            // Draw debug command test sprite.
            spriteBatch.Draw(cat, debugPos, Color.White);

            spriteBatch.End();

            // Draw other components.
            base.Draw(gameTime);

            // Stop measuring time for "Draw".
            debugSystem.TimeRuler.EndMark("Draw");
        }

        #endregion

        #region Handle Input

        void HandleInput()
        {
            padState = GamePad.GetState(PlayerIndex.One);
            keyState = Keyboard.GetState();

            // Handle exit game.
            if (padState.IsButtonDown(Buttons.Back) ||
                keyState.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            // Ignore key input while DebugCommandUI shows up.
            if (debugSystem.DebugCommandUI.Focused)
                keyState = new KeyboardState();

            // Show/Hide FPS counter by press A button.
            if (IsButtonOrKeyPressed(Buttons.A, Keys.A))
            {
                debugSystem.FpsCounter.Visible = !debugSystem.FpsCounter.Visible;
            }

            // Show/Hide TimeRuler by press B button.
            if (IsButtonOrKeyPressed(Buttons.B, Keys.B))
            {
                debugSystem.TimeRuler.Visible = !debugSystem.TimeRuler.Visible;
            }

            // Show/Hide TimeRuler log by press X button.
            if (IsButtonOrKeyPressed(Buttons.X, Keys.X))
            {
                debugSystem.TimeRuler.Visible = true;
                debugSystem.TimeRuler.ShowLog = !debugSystem.TimeRuler.ShowLog;
            }

            // Copy current input state to previous input state.
            prevPadState = padState;
            prevKeyState = keyState;
        }

        bool IsButtonOrKeyPressed(Buttons button, Keys key)
        {
            return (padState.IsButtonDown(button) && prevPadState.IsButtonUp(button)) ||
                (keyState.IsKeyDown(key) && prevKeyState.IsKeyUp(key));
        }

        void HandleTouchInput()
        {
            // Read Gestures.
            while (TouchPanel.IsGestureAvailable)
            {
                GestureSample gesture = TouchPanel.ReadGesture();

                switch (gesture.GestureType)
                {
                    case GestureType.Tap:
                        // if the user tapped and the debug command UI is focused,
                        // show the keyboard input
                        if (debugSystem.DebugCommandUI.Focused && !Guide.IsVisible)
                        {
                            Guide.BeginShowKeyboardInput(
                                PlayerIndex.One,
                                "Input Debug Command",
                                "type debug command\n"+
                                    "'help' command shows available commands",
                                "",
                                InputDebugCommandCallback,
                                null);
                        }
                        break;
                    case GestureType.Flick:
                        // if the user flicked, we determine the angle of the flick and
                        // use that to either show or hide the debug command UI
                        if (gesture.Delta.Length() > 5)
                        {
                            const float cos30 = 0.87f;
                            Vector2 nd = Vector2.Normalize(gesture.Delta);

                            // Same as "Vector2.Dot(new Vector2(0,1), nd)" that
                            // returns flick angle.
                            float dot = -nd.Y;

                            if (debugSystem.DebugCommandUI.Focused)
                            {
                                if (dot > cos30)
                                    debugSystem.DebugCommandUI.Hide();
                            }
                            else
                            {
                                if (dot < -cos30)
                                    debugSystem.DebugCommandUI.Show();
                            }
                        }
                        break;
                }
            }
        }

        // Invoked after the user inputs text from the on screen keyboard
        private void InputDebugCommandCallback(IAsyncResult result)
        {
            // get the string they entered
            string cmd = Guide.EndShowKeyboardInput(result);

            // if they entered something, execute the command
            if (!string.IsNullOrEmpty(cmd))
                debugSystem.DebugCommandUI.ExecuteCommand(cmd);
        }

        #endregion

    }
}


text:
package net.sansa_stack.rdf.flink.qualityassessment.metrics

import net.sansa_stack.rdf.flink.io._
import org.apache.flink.api.scala.ExecutionEnvironment
import org.scalatest.FunSuite

class FlinkAvailabilityTests extends FunSuite {

  import net.sansa_stack.rdf.flink.qualityassessment._

  val env = ExecutionEnvironment.createLocalEnvironment(4)

  test("getting the Dereferenceable URIs should match") {

    val path = getClass.getResource("/data.nt").getPath
    val lang = Lang.NTRIPLES

    val triples = env.rdf(lang)(path)

    val ratio = triples.assessDereferenceableUris()
    assert(ratio == 0.1320754716981132)
  }

  test("getting the Dereferenceable BackLinks should match") {

    val path = getClass.getResource("/data.nt").getPath
    val lang = Lang.NTRIPLES

    val triples = env.rdf(lang)(path)

    val ratio = triples.assessDereferenceableBackLinks()
    assert(ratio == 0.15384615384615385)
  }

  test("getting the Dereferenceable ForwardLinks should match") {

    val path = getClass.getResource("/data.nt").getPath
    val lang = Lang.NTRIPLES

    val triples = env.rdf(lang)(path)

    val ratio = triples.assessDereferenceableForwardLinks()
    assert(ratio == 0.05660377358490566)
  }

}


text:
import unittest
from graphtheory.structures.edges import Edge
from graphtheory.structures.graphs import Graph
from graphtheory.structures.factory import GraphFactory
from graphtheory.seriesparallel.spnodecolor import SPNodeColoring

# 0 --- 1 --- 2 nie jest dwudzielny, bo sa trojkaty
# |   / |   /
# |  /  |  /
# | /   | /
# 3 --- 4

class TestNodeColoring(unittest.TestCase):

    def setUp(self):
        self.N = 5
        self.G = Graph(self.N)
        self.nodes = range(self.N)
        self.edges = [Edge(0, 1), Edge(0, 3), Edge(1, 3), Edge(1, 4),
            Edge(1, 2), Edge(2, 4), Edge(3, 4)]
        for node in self.nodes:
            self.G.add_node(node)
        for edge in self.edges:
            self.G.add_edge(edge)
        #self.G.show()

    def test_spgraph_node_coloring(self):
        algorithm = SPNodeColoring(self.G)
        algorithm.run()
        # Sprawdzenie, czy kazdy wierzcholek ma kolor.
        for node in self.G.iternodes():
            self.assertNotEqual(algorithm.color[node], None)
        for edge in self.G.iteredges():
            self.assertNotEqual(algorithm.color[edge.source],
                                algorithm.color[edge.target])
        all_colors = set(algorithm.color[node] for node in self.G.iternodes())
        self.assertEqual(len(all_colors), 3)

    def test_cycle_node_coloring(self):
        gf = GraphFactory(Graph)
        self.G = gf.make_cyclic(2 * self.N)   # bipartite
        algorithm = SPNodeColoring(self.G)
        algorithm.run()
        # Sprawdzenie, czy kazdy wierzcholek ma kolor.
        for node in self.G.iternodes():
            self.assertNotEqual(algorithm.color[node], None)
        for edge in self.G.iteredges():
            self.assertNotEqual(algorithm.color[edge.source],
                                algorithm.color[edge.target])
        all_colors = set(algorithm.color[node] for node in self.G.iternodes())
        self.assertEqual(len(all_colors), 2)

    def test_exceptions(self):
        self.assertRaises(ValueError, SPNodeColoring,
            Graph(5, directed=True))

    def tearDown(self): pass

if __name__ == "__main__":

    unittest.main()

# EOF


text:
package reka.util;

import static reka.util.Util.unchecked;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchEvent.Kind;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class SimpleFileWatcher {

	private static final WatchService watcher;

	static {
		try {
			watcher = FileSystems.getDefault().newWatchService();

			new Thread() {
				@Override
				public void run() {
					WatchKey watch;

					while (true) {
						try {
							watch = watcher.take();
						} catch (InterruptedException e) {
							throw unchecked(e);
						}
						List<WatchEvent<?>> events = watch.pollEvents();

						watch.reset();

						for (WatchEvent<?> event : events) {

							@SuppressWarnings("unchecked")
							Kind<Path> kind = (Kind<Path>) event.kind();
							java.nio.file.Path context = (java.nio.file.Path) event.context();
							if (kind.equals(StandardWatchEventKinds.ENTRY_MODIFY)) {
								java.nio.file.Path dir = (java.nio.file.Path) watch.watchable();
								String filename = dir.resolve(context).toAbsolutePath().toString();
								if (watchers.containsKey(filename)) {
									watchers.get(filename).run();
								}
							}
						}
					}
				}
			}.start();

		} catch (IOException e) {
			throw unchecked(e);
		}
	}
	private final static Map<String, Runnable> watchers = new ConcurrentHashMap<>();

	public void watch(String filename, Runnable runnable) {
		if (!new File(filename).exists()) throw new IllegalArgumentException(String.format("%s doesn't exist", filename));
		watchers.put(filename, runnable);
		java.nio.file.Path directory = new File(filename).toPath().getParent();
		try {
			directory.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY);
		} catch (IOException e) {
			throw unchecked(e);
		}
	}
}


text:
import datetime

from fuel_health import ceilometermanager

class CeilometerApiTests(ceilometermanager.CeilometerBaseTest):
    """TestClass contains tests that check basic Ceilometer functionality."""

    def test_list_meters(self):
        """Ceilometer test to list meters, alarms, resources and events
        Target component: Ceilometer

        Scenario:
            1. Request the list of meters with query: disk_format=qcow2.
            2. Request the list of alarms.
            3. Request the list of resources created for the last hour.
            4. Request the list of events created for the last hour.

        Duration: 180 s.
        Deployment tags: Ceilometer
        """

        fail_msg = 'Failed to get list of meters.'
        q = [{'field': 'metadata.disk_format', 'op': 'eq', 'value': 'qcow2'}]
        self.verify(60, self.ceilometer_client.meters.list,
                    1, fail_msg, 'getting list of meters', q)

        fail_msg = 'Failed to get list of alarms.'
        self.verify(60, self.ceilometer_client.alarms.list,
                    2, fail_msg, 'getting list of alarms')

        fail_msg = 'Failed to get list of resources.'
        an_hour_ago = (datetime.datetime.now() -
                       datetime.timedelta(hours=1)).isoformat()
        q = [{'field': 'timestamp', 'op': 'gt', 'value': an_hour_ago}]
        self.verify(60, self.ceilometer_client.resources.list,
                    3, fail_msg, 'getting list of resources', q)

        fail_msg = 'Failed to get list of events.'
        self.verify(60, self.ceilometer_client.events.list,
                    4, fail_msg, 'getting list of events', q)


text:
---
title: Preprocessors API
---

A preprocessor is the plugin responsible for preparing a
[support file](/guides/core-concepts/writing-and-organizing-tests#Support-file)
or a [test file](/guides/core-concepts/writing-and-organizing-tests#Test-files)
for the browser.

A preprocessor could transpile your file from another language (CoffeeScript or
ClojureScript) or from a newer version of JavaScript (ES2017).

A preprocessor also typically watches the source files for changes, processes
them again, and then notifies Cypress to re-run the tests.

## Examples

We've created three preprocessors as examples for you to look at. These are
fully functioning preprocessors.

The code contains comments that explain how it utilizes the preprocessor API.

- [webpack preprocessor](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor)
- [Browserify preprocessor](https://github.com/cypress-io/cypress-browserify-preprocessor)
- [Watch preprocessor](https://github.com/cypress-io/cypress-watch-preprocessor)

### See also

The blog post
[Write Cypress Markdown Preprocessor](https://glebbahmutov.com/blog/write-cypress-preprocessor/)
shows how to write your own file preprocessor.

## Defaults

By default, Cypress comes packaged with the **webpack preprocessor** already
installed.

The webpack preprocessor handles:

- ES2015 and JSX via Babel
- TypeScript
- CoffeeScript `1.x.x`
- Watching and caching files

<Alert type="info">

Are you looking to change the **default options** for webpack?

</Alert>

If you already use webpack in your project, you can pass in your webpack config
as
[shown here](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor#options).

If you don't use webpack in your project or would like to keep the majority of
the default options, you can
[modify the default options](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor#modifying-default-options).
Editing the options allows you to do things like:

- Add your own Babel plugins
- Modify options for TypeScript compilation
- Add support for CoffeeScript `2.x.x`

## Usage

::include{file=partials/warning-setup-node-events.md}

To use a preprocessor, you should bind to the `file:preprocessor` event in your
[setupNodeEvents](/guides/tooling/plugins-guide#Using-a-plugin) function:

:::cypress-plugin-example

```javascript
on('file:preprocessor', (file) => {
  // ...
})
```

:::

### The callback function should return one of the following:

- A promise\* that eventually resolves the path to the **built file**\*\*.
- A promise\* that eventually rejects with an error that occurred during
  processing.

> \* The promise should resolve only after the file has completed writing to
> disk. The promise resolving is a signal that the file is ready to be served to
> the browser.

---

> \*\* The built file is the file that is created by the preprocessor that will
> eventually be served to the browser.

> If, for example, the source file is `spec.coffee`, the preprocessor should:

1. Compile the CoffeeScript into JavaScript `spec.js`
2. Write that JavaScript file to disk (example: `/Users/foo/tmp/spec.js`)
3. Resolve with the absolute path to that file: `/Users/foo/tmp/spec.js`

<Alert type="warning">

This callback function can and _will_ be called multiple times with the same
`filePath`.

The callback function is called any time a file is requested by the browser.
This happens on each run of the tests.

Make sure not to start a new watcher each time it is called. Instead, cache the
watcher and, on subsequent calls, return a promise that resolves when the latest
version of the file has been processed.

</Alert>

## File object

The `file` object passed to the callback function has the following properties:

| Property      | Description                                                                                |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `filePath`    | The full path to the source file.                                                                                |
| `outputPath`  | The suggested path for saving the preprocessed file to disk. This is unique to the source file. A preprocessor can choose to write the file elsewhere, but Cypress automatically provides you this value as a convenient default. |
| `shouldWatch` | A boolean indicating whether the preprocessor should watch for file changes or not.                                                                                |

## File events

The `file` object passed to the callback function is an
[Event Emitter](https://nodejs.org/api/events.html#events_class_eventemitter).

### Receiving 'close' event

When the running spec, the project, or the browser is closed while running
tests, the `close` event will be emitted. The preprocessor should do any
necessary cleanup in this function, like closing the watcher when watching.

```javascript
// example
const watcher = fs.watch(filePath /* ... */)

file.on('close', () => {
  watcher.close()
})
```

### Sending 'rerun' event

If watching for file changes, emit `rerun` after a file has finished being
processed to let Cypress know to rerun the tests.

```javascript
// example
fs.watch(filePath, () => {
  file.emit('rerun')
})
```

## Publishing

Publish preprocessors to [npm](https://www.npmjs.com/) with the naming
convention `cypress-*-preprocessor` (e.g. cypress-clojurescript-preprocessor).

Use the following npm keywords:

```json
"keywords": [
  "cypress",
  "cypress-plugin",
  "cypress-preprocessor"
]
```

Feel free to submit your published plugins to our [list of plugins](/plugins).


text:
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>8.x</api_version>
<recommended_major>7</recommended_major>
<supported_majors>7</supported_majors>
<default_major>7</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
  <terms>
   <term><name>Projects</name><value>Drupal project</value></term>
  </terms>
<releases>
 <release>
  <name>Drupal 7.0</name>
  <version>7.0</version>
  <tag>DRUPAL-7-0</tag>
  <version_major>7</version_major>
  <version_patch>0</version_patch>
  <status>published</status>
  <release_link>http://example.com/drupal-7-0-release</release_link>
  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
  <date>1250424521</date>
  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
  <filesize>1073741824</filesize>
  <terms>
   <term><name>Release type</name><value>New features</value></term>
   <term><name>Release type</name><value>Bug fixes</value></term>
  </terms>
 </release>
 <release>
  <name>Drupal 8.x-dev</name>
  <version>8.x-dev</version>
  <tag>DRUPAL-7</tag>
  <version_major>7</version_major>
  <version_extra>dev</version_extra>
  <status>published</status>
  <release_link>http://example.com/drupal-7-x-dev-release</release_link>
  <download_link>http://example.com/drupal-8.x-dev.tar.gz</download_link>
  <date>1250424581</date>
  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
  <filesize>2147483648</filesize>
  <terms>
   <term><name>Release type</name><value>Bug fixes</value></term>
  </terms>
 </release>
</releases>
</project>


text:
<!DOCTYPE html>

		<meta charset="UTF-8">
		<title>LearnWords</title>

		<link rel="stylesheet" href="bower_components/normalize-css/normalize.css">
		<link rel="stylesheet" href="bower_components/humane-js/themes/original.css">
		<link rel="stylesheet" href="dist/css/main.css">
		<link href="https://fonts.googleapis.com/css?family=Rubik+Mono+One&subset=cyrillic" rel="stylesheet">

				YOUR SCORE
				0

			<input id="submit" type="text" size="20">


text:
<?php

namespace Tms\Bundle\MergeTokenBundle\Exceptions;

/**
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 */
class UndefinedMergeableObjectException extends \Exception
{
    /**
     * The constructor
     *
     * @param string $id
     */
    public function __construct($property, $value)
    {
        parent::__construct(sprintf(
            'No mergeable object define with "%s": %s',
            $property,
            $value
        ));
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/ContactPicker.iml" filepath="$PROJECT_DIR$/ContactPicker.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
    </modules>
  </component>
</project>


text:
Comparison::Comparison(int i, double d) :
        index(i), value(d)
{
}

bool Comparison::CompareComparison (const Comparison& first, const Comparison& second)
{
    return first.value > second.value;
}


text:
SmallNeuron
====
Simple and small neural network library for c programming language.
See xor.c file as example how to use this library.


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.msforms;
import com.wilutions.com.*;

/**
 * ComboBox2.
 *
 */
@CoClass(guid="{6C177EBD-C42D-4728-A04B-4131892EDBF6}")
public class ComboBox2 extends Dispatch implements IMdcCombo {
  static boolean __typelib__loaded = __TypeLib.load();
  @DeclDISPID(-500)  public void setAutoSize(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(-500,"AutoSize", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-500)  public Boolean getAutoSize() throws ComException {
    final Object obj = this._dispatchCall(-500,"AutoSize", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(217)  public void setAutoTab(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(217,"AutoTab", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(217)  public Boolean getAutoTab() throws ComException {
    final Object obj = this._dispatchCall(217,"AutoTab", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(218)  public void setAutoWordSelect(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(218,"AutoWordSelect", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(218)  public Boolean getAutoWordSelect() throws ComException {
    final Object obj = this._dispatchCall(218,"AutoWordSelect", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(-501)  public void setBackColor(final OLE_COLOR value) throws ComException {
    assert(value != null);
    this._dispatchCall(-501,"BackColor", DISPATCH_PROPERTYPUT,value.getValue());
  }
  @DeclDISPID(-501)  public OLE_COLOR getBackColor() throws ComException {
    final Object obj = this._dispatchCall(-501,"BackColor", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    final Integer als = (Integer)obj;
    return new OLE_COLOR(als);
  }
  @DeclDISPID(-502)  public void setBackStyle(final fmBackStyle value) throws ComException {
    assert(value != null);
    this._dispatchCall(-502,"BackStyle", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(-502)  public fmBackStyle getBackStyle() throws ComException {
    final Object obj = this._dispatchCall(-502,"BackStyle", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmBackStyle.valueOf((Integer)obj);
  }
  @DeclDISPID(-503)  public void setBorderColor(final OLE_COLOR value) throws ComException {
    assert(value != null);
    this._dispatchCall(-503,"BorderColor", DISPATCH_PROPERTYPUT,value.getValue());
  }
  @DeclDISPID(-503)  public OLE_COLOR getBorderColor() throws ComException {
    final Object obj = this._dispatchCall(-503,"BorderColor", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    final Integer als = (Integer)obj;
    return new OLE_COLOR(als);
  }
  @DeclDISPID(-504)  public void setBorderStyle(final fmBorderStyle value) throws ComException {
    assert(value != null);
    this._dispatchCall(-504,"BorderStyle", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(-504)  public fmBorderStyle getBorderStyle() throws ComException {
    final Object obj = this._dispatchCall(-504,"BorderStyle", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmBorderStyle.valueOf((Integer)obj);
  }
  @DeclDISPID(501)  public void setBoundColumn(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(501,"BoundColumn", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(501)  public Object getBoundColumn() throws ComException {
    final Object obj = this._dispatchCall(501,"BoundColumn", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(25)  public Boolean getCanPaste() throws ComException {
    final Object obj = this._dispatchCall(25,"CanPaste", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(601)  public void setColumnCount(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(601,"ColumnCount", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(601)  public Integer getColumnCount() throws ComException {
    final Object obj = this._dispatchCall(601,"ColumnCount", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(602)  public void setColumnHeads(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(602,"ColumnHeads", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(602)  public Boolean getColumnHeads() throws ComException {
    final Object obj = this._dispatchCall(602,"ColumnHeads", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(603)  public void setColumnWidths(final String value) throws ComException {
    assert(value != null);
    this._dispatchCall(603,"ColumnWidths", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(603)  public String getColumnWidths() throws ComException {
    final Object obj = this._dispatchCall(603,"ColumnWidths", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (String)obj;
  }
  @DeclDISPID(210)  public Integer getCurTargetX() throws ComException {
    final Object obj = this._dispatchCall(210,"CurTargetX", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(208)  public void setCurX(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(208,"CurX", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(208)  public Integer getCurX() throws ComException {
    final Object obj = this._dispatchCall(208,"CurX", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(305)  public void setDropButtonStyle(final fmDropButtonStyle value) throws ComException {
    assert(value != null);
    this._dispatchCall(305,"DropButtonStyle", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(305)  public fmDropButtonStyle getDropButtonStyle() throws ComException {
    final Object obj = this._dispatchCall(305,"DropButtonStyle", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmDropButtonStyle.valueOf((Integer)obj);
  }
  @DeclDISPID(-514)  public void setEnabled(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(-514,"Enabled", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-514)  public Boolean getEnabled() throws ComException {
    final Object obj = this._dispatchCall(-514,"Enabled", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(-512)  public void setFont(final Font value) throws ComException {
    this._dispatchCall(-512,"Font", DISPATCH_PROPERTYPUTREF,Dispatch.param(value));
  }
  @DeclDISPID(-512)  public Font getFont() throws ComException {
    final Object obj = this._dispatchCall(-512,"Font", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return Dispatch.as(obj, com.wilutions.mslib.msforms.impl.FontImpl.class);
  }
  @DeclDISPID(-513)  public void setForeColor(final OLE_COLOR value) throws ComException {
    assert(value != null);
    this._dispatchCall(-513,"ForeColor", DISPATCH_PROPERTYPUT,value.getValue());
  }
  @DeclDISPID(-513)  public OLE_COLOR getForeColor() throws ComException {
    final Object obj = this._dispatchCall(-513,"ForeColor", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    final Integer als = (Integer)obj;
    return new OLE_COLOR(als);
  }
  @DeclDISPID(207)  public void setHideSelection(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(207,"HideSelection", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(207)  public Boolean getHideSelection() throws ComException {
    final Object obj = this._dispatchCall(207,"HideSelection", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(214)  public Integer getLineCount() throws ComException {
    final Object obj = this._dispatchCall(214,"LineCount", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(-531)  public Integer getListCount() throws ComException {
    final Object obj = this._dispatchCall(-531,"ListCount", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(-526)  public void setListIndex(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(-526,"ListIndex", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-526)  public Object getListIndex() throws ComException {
    final Object obj = this._dispatchCall(-526,"ListIndex", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(605)  public void setListRows(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(605,"ListRows", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(605)  public Integer getListRows() throws ComException {
    final Object obj = this._dispatchCall(605,"ListRows", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(307)  public void setListStyle(final fmListStyle value) throws ComException {
    assert(value != null);
    this._dispatchCall(307,"ListStyle", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(307)  public fmListStyle getListStyle() throws ComException {
    final Object obj = this._dispatchCall(307,"ListStyle", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmListStyle.valueOf((Integer)obj);
  }
  @DeclDISPID(606)  public void setListWidth(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(606,"ListWidth", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(606)  public Object getListWidth() throws ComException {
    final Object obj = this._dispatchCall(606,"ListWidth", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(10)  public void setLocked(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(10,"Locked", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(10)  public Boolean getLocked() throws ComException {
    final Object obj = this._dispatchCall(10,"Locked", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(504)  public void setMatchEntry(final fmMatchEntry value) throws ComException {
    assert(value != null);
    this._dispatchCall(504,"MatchEntry", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(504)  public fmMatchEntry getMatchEntry() throws ComException {
    final Object obj = this._dispatchCall(504,"MatchEntry", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmMatchEntry.valueOf((Integer)obj);
  }
  @DeclDISPID(505)  public Boolean getMatchFound() throws ComException {
    final Object obj = this._dispatchCall(505,"MatchFound", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(503)  public void setMatchRequired(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(503,"MatchRequired", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(503)  public Boolean getMatchRequired() throws ComException {
    final Object obj = this._dispatchCall(503,"MatchRequired", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(-533)  public void setMaxLength(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(-533,"MaxLength", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-533)  public Integer getMaxLength() throws ComException {
    final Object obj = this._dispatchCall(-533,"MaxLength", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(-522)  public void setMouseIcon(final com.wilutions.mslib.stdole.Picture value) throws ComException {
    this._dispatchCall(-522,"MouseIcon", DISPATCH_PROPERTYPUT,Dispatch.param(value));
  }
  @DeclDISPID(-522)  public com.wilutions.mslib.stdole.Picture getMouseIcon() throws ComException {
    final Object obj = this._dispatchCall(-522,"MouseIcon", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return Dispatch.as(obj, com.wilutions.mslib.stdole.impl.PictureImpl.class);
  }
  @DeclDISPID(-521)  public void setMousePointer(final fmMousePointer value) throws ComException {
    assert(value != null);
    this._dispatchCall(-521,"MousePointer", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(-521)  public fmMousePointer getMousePointer() throws ComException {
    final Object obj = this._dispatchCall(-521,"MousePointer", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmMousePointer.valueOf((Integer)obj);
  }
  @DeclDISPID(220)  public void setSelectionMargin(final Boolean value) throws ComException {
    assert(value != null);
    this._dispatchCall(220,"SelectionMargin", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(220)  public Boolean getSelectionMargin() throws ComException {
    final Object obj = this._dispatchCall(220,"SelectionMargin", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Boolean)obj;
  }
  @DeclDISPID(-548)  public void setSelLength(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(-548,"SelLength", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-548)  public Integer getSelLength() throws ComException {
    final Object obj = this._dispatchCall(-548,"SelLength", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(-547)  public void setSelStart(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(-547,"SelStart", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-547)  public Integer getSelStart() throws ComException {
    final Object obj = this._dispatchCall(-547,"SelStart", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(-546)  public void setSelText(final String value) throws ComException {
    assert(value != null);
    this._dispatchCall(-546,"SelText", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-546)  public String getSelText() throws ComException {
    final Object obj = this._dispatchCall(-546,"SelText", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (String)obj;
  }
  @DeclDISPID(304)  public void setShowDropButtonWhen(final fmShowDropButtonWhen value) throws ComException {
    assert(value != null);
    this._dispatchCall(304,"ShowDropButtonWhen", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(304)  public fmShowDropButtonWhen getShowDropButtonWhen() throws ComException {
    final Object obj = this._dispatchCall(304,"ShowDropButtonWhen", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmShowDropButtonWhen.valueOf((Integer)obj);
  }
  @DeclDISPID(12)  public void setSpecialEffect(final fmSpecialEffect value) throws ComException {
    assert(value != null);
    this._dispatchCall(12,"SpecialEffect", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(12)  public fmSpecialEffect getSpecialEffect() throws ComException {
    final Object obj = this._dispatchCall(12,"SpecialEffect", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmSpecialEffect.valueOf((Integer)obj);
  }
  @DeclDISPID(308)  public void setStyle(final fmStyle value) throws ComException {
    assert(value != null);
    this._dispatchCall(308,"Style", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(308)  public fmStyle getStyle() throws ComException {
    final Object obj = this._dispatchCall(308,"Style", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmStyle.valueOf((Integer)obj);
  }
  @DeclDISPID(-517)  public void setText(final String value) throws ComException {
    assert(value != null);
    this._dispatchCall(-517,"Text", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(-517)  public String getText() throws ComException {
    final Object obj = this._dispatchCall(-517,"Text", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (String)obj;
  }
  @DeclDISPID(10004)  public void setTextAlign(final fmTextAlign value) throws ComException {
    assert(value != null);
    this._dispatchCall(10004,"TextAlign", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(10004)  public fmTextAlign getTextAlign() throws ComException {
    final Object obj = this._dispatchCall(10004,"TextAlign", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmTextAlign.valueOf((Integer)obj);
  }
  @DeclDISPID(502)  public void setTextColumn(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(502,"TextColumn", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(502)  public Object getTextColumn() throws ComException {
    final Object obj = this._dispatchCall(502,"TextColumn", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(216)  public Integer getTextLength() throws ComException {
    final Object obj = this._dispatchCall(216,"TextLength", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  @DeclDISPID(611)  public void setTopIndex(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(611,"TopIndex", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(611)  public Object getTopIndex() throws ComException {
    final Object obj = this._dispatchCall(611,"TopIndex", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(0)  public void setValue(final Object value) throws ComException {
    assert(value != null);
    this._dispatchCall(0,"Value", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(0)  public Object getValue() throws ComException {
    final Object obj = this._dispatchCall(0,"Value", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(-529)  public Object getColumn(final Object pvargColumn, final Object pvargIndex) throws ComException {
    assert(pvargColumn != null);
    assert(pvargIndex != null);
    final Object obj = this._dispatchCall(-529,"Column", DISPATCH_PROPERTYGET,null,pvargColumn,pvargIndex);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(-529)  public void setColumn(final Object pvargColumn, final Object pvargIndex, final Object value3) throws ComException {
    assert(value3 != null);
    assert(pvargColumn != null);
    assert(pvargIndex != null);
    this._dispatchCall(-529,"Column", DISPATCH_PROPERTYPUT,value3,pvargColumn,pvargIndex);
  }
  @DeclDISPID(-528)  public Object getList(final Object pvargIndex, final Object pvargColumn) throws ComException {
    assert(pvargIndex != null);
    assert(pvargColumn != null);
    final Object obj = this._dispatchCall(-528,"List", DISPATCH_PROPERTYGET,null,pvargIndex,pvargColumn);
    if (obj == null) return null;
    return (Object)obj;
  }
  @DeclDISPID(-528)  public void setList(final Object pvargIndex, final Object pvargColumn, final Object value3) throws ComException {
    assert(value3 != null);
    assert(pvargIndex != null);
    assert(pvargColumn != null);
    this._dispatchCall(-528,"List", DISPATCH_PROPERTYPUT,value3,pvargIndex,pvargColumn);
  }
  @DeclDISPID(-553)  public void AddItem(final Object pvargItem, final Object pvargIndex) throws ComException {
    assert(pvargItem != null);
    assert(pvargIndex != null);
    this._dispatchCall(-553,"AddItem", DISPATCH_METHOD,null,pvargItem,pvargIndex);
  }
  @DeclDISPID(-554)  public void Clear() throws ComException {
    this._dispatchCall(-554,"Clear", DISPATCH_METHOD,null);
  }
  @DeclDISPID(1001)  public void DropDown() throws ComException {
    this._dispatchCall(1001,"DropDown", DISPATCH_METHOD,null);
  }
  @DeclDISPID(-555)  public void RemoveItem(final Object pvargIndex) throws ComException {
    assert(pvargIndex != null);
    this._dispatchCall(-555,"RemoveItem", DISPATCH_METHOD,null,pvargIndex);
  }
  @DeclDISPID(22)  public void Copy() throws ComException {
    this._dispatchCall(22,"Copy", DISPATCH_METHOD,null);
  }
  @DeclDISPID(21)  public void Cut() throws ComException {
    this._dispatchCall(21,"Cut", DISPATCH_METHOD,null);
  }
  @DeclDISPID(24)  public void Paste() throws ComException {
    this._dispatchCall(24,"Paste", DISPATCH_METHOD,null);
  }
  @DeclDISPID(-542)  public void setIMEMode(final fmIMEMode value) throws ComException {
    assert(value != null);
    this._dispatchCall(-542,"IMEMode", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(-542)  public fmIMEMode getIMEMode() throws ComException {
    final Object obj = this._dispatchCall(-542,"IMEMode", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmIMEMode.valueOf((Integer)obj);
  }
  @DeclDISPID(224)  public void setEnterFieldBehavior(final fmEnterFieldBehavior value) throws ComException {
    assert(value != null);
    this._dispatchCall(224,"EnterFieldBehavior", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(224)  public fmEnterFieldBehavior getEnterFieldBehavior() throws ComException {
    final Object obj = this._dispatchCall(224,"EnterFieldBehavior", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmEnterFieldBehavior.valueOf((Integer)obj);
  }
  @DeclDISPID(225)  public void setDragBehavior(final fmDragBehavior value) throws ComException {
    assert(value != null);
    this._dispatchCall(225,"DragBehavior", DISPATCH_PROPERTYPUT,value.value);
  }
  @DeclDISPID(225)  public fmDragBehavior getDragBehavior() throws ComException {
    final Object obj = this._dispatchCall(225,"DragBehavior", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return fmDragBehavior.valueOf((Integer)obj);
  }
  public ComboBox2() throws ComException {
    super("{6C177EBD-C42D-4728-A04B-4131892EDBF6}", "{8BD21D33-EC42-11CE-9E0D-00AA006002F3}");
  }
  protected ComboBox2(long ndisp) {
    super(ndisp);
  }
  public String toString() {
    return "[ComboBox2" + super.toString() + "]";
  }
}


text:
package com.parallelsymmetry.cirrus;

import java.awt.Color;

/**
 * Base class with all the standard properties for shadow effects.
 * <p>
 * Derived from ShadowEffect in Nimbus Look and Feel.
 *
 * @author Mark Soderquist
 */
abstract class ShadowEffect extends Effect {
	protected Color color = Color.BLACK;

	/** Opacity a float 0-1 for percentage */
	protected float opacity = 0.75f;

	/** Angle in degrees between 0-360 */
	protected int angle = 135;

	/** Distance in pixels */
	protected int distance = 5;

	/** The shadow spread between 0-100 % */
	protected int spread = 0;

	/** Size in pixels */
	protected int size = 5;

	// =================================================================================================================
	// Bean methods

	Color getColor() {
		return color;
	}

	void setColor( Color color ) {
		Color old = getColor();
		this.color = color;
	}

	float getOpacity() {
		return opacity;
	}

	void setOpacity( float opacity ) {
		float old = getOpacity();
		this.opacity = opacity;
	}

	int getAngle() {
		return angle;
	}

	void setAngle( int angle ) {
		int old = getAngle();
		this.angle = angle;
	}

	int getDistance() {
		return distance;
	}

	void setDistance( int distance ) {
		int old = getDistance();
		this.distance = distance;
	}

	int getSpread() {
		return spread;
	}

	void setSpread( int spread ) {
		int old = getSpread();
		this.spread = spread;
	}

	int getSize() {
		return size;
	}

	void setSize( int size ) {
		int old = getSize();
		this.size = size;
	}
}


text:
namespace ql {
	//! A magic scroll for inscribing spells.
	struct scroll {
		reg_ptr reg;
		id id;
		std::optional<magic::spell> spell;
	};

	auto make_scroll(reg& reg, id scroll_id, std::optional<magic::spell> spell) -> id;
}


text:
package cache.logging;

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

/**
 * LogEntries are responsible for storing information about the request process.
 *
 * @author Ben Kimmel
 *
 */
public class LogEntry {

	private Map<String, Object> fieldValues;

	/**
	 * Constructs a new LogEntry.
	 */
	public LogEntry() {
		this.fieldValues = new HashMap<String, Object>();
	}

	/**
	 * Adds a new field to the LogEntry and then provides the field's value. If
	 * the field already exists in the LogEntry, the value will be overwritten
	 * by the new value.
	 *
	 * @param field
	 *            The name of the field
	 * @param value
	 *            The value of the field
	 */
	public void addField(String field, Object value) {
		this.fieldValues.put(field, value);
	}

	/**
	 * Returns a list of the fields this LogEntry contains.
	 *
	 * @return The list of fields contained by the LogEntry in no particular
	 *         order
	 */
	public Set<String> getFieldList() {
		return this.fieldValues.keySet();
	}

	/**
	 * Returns the value of the given field. Often used in conjunction with
	 * {@link #getFieldType(String)}.
	 *
	 * @param field
	 *            The field requested
	 * @return The value of the requested field
	 */
	public Object getFieldValue(String field) {
		return this.fieldValues.get(field);
	}

}


text:
#include "modules/localization/msf/local_map/base_map/base_map_matrix.h"

namespace apollo {
namespace localization {
namespace msf {

BaseMapMatrix::BaseMapMatrix() {}

BaseMapMatrix::~BaseMapMatrix() {}

BaseMapMatrix::BaseMapMatrix(const BaseMapMatrix& cells) {}

unsigned int BaseMapMatrix::LoadBinary(unsigned char* buf) { return 0; }

unsigned int BaseMapMatrix::CreateBinary(unsigned char* buf,
                                         unsigned int buf_size) const {
  return 0;
}

unsigned int BaseMapMatrix::GetBinarySize() const { return 0; }

}  // namespace msf
}  // namespace localization
}  // namespace apollo


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Why log records are weakly ordered in a multithreaded application?</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Log v2">
<link rel="up" href="../rationale.html" title="Rationale and FAQ">
<link rel="prev" href="why_weak_scoped_attributes.html" title="Why scoped attributes don't override existing attributes?">
<link rel="next" href="why_attribute_manips_dont_affect_filters.html" title="Why attributes set with stream manipulators do not participate in filtering?">

Why log records
      are weakly ordered in a multithreaded application?

        Although the library guarantees that log records made in a given thread are
        always delivered to sinks in the same order as they were made in, the library
        cannot provide such guarantee for different threads. For instance, it is
        possible that thread A emits a log record and gets preempted, then thread
        B emits its log record and manages to deliver it to a sink before being preempted.
        The resulting log will contain log record from thread B before the record
        made in thread A. However, attribute values attached to the records will
        always be actual with regard to the moment of emitting the record and not
        the moment of passing the record to the sink. This is the reason for a strange,
        at first glance, situation when a log record with an earlier time stamp follows
        a record with a later time stamp. The problem appears quite rarely, usually
        when thread contention on logging is very high.

        There are few possible ways to cope with the problem:

            Enforce strict serialization of log record being made throughout the
            application. This solution implies a severe performance impact in multithreaded
            applications because log records that otherwise could be processed concurrently
            would have to go serial. Since this controverses one of the main
            library goals, it was rejected.

            Attempt to maintain log record ordering on the sink level. This solution
            is more or less viable. On the downside, it would introduce log record
            buffering, which in turn would compromise logs reliability. In the case
            of application crash all buffered records would be lost.

            Bear with the problem and let mis-ordered records appear in log files
            occasionally. Order log records upon reading the files, if needed.

        The second solution was implemented as a special policy for the asynchronous
        sink frontend.

Copyright © 2007-2013 Andrey Semashev

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).


text:
' Copyright (c) 2015 ZZZ Projects. All rights reserved
' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
' Website: http://www.zzzprojects.com/
' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library

#If NET45_OR_GREATER Then
Imports System.IO
Imports System.IO.Compression

Public Module Extensions_50

	''' <summary>
	'''     The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as
	'''     relative to the current working directory.
	''' </summary>
	''' <param name="this">
	'''     The path to the archive to open, specified as a relative or absolute path. A relative path is
	'''     interpreted as relative to the current working directory.
	''' </param>
	''' <returns>The opened zip archive.</returns>
	<System.Runtime.CompilerServices.Extension> _
	Public Function OpenReadZipFile(this As FileInfo) As ZipArchive
		Return ZipFile.OpenRead(this.FullName)
	End Function
End Module
#End If


text:
\documentclass[11pt, a4paper]{book}
\input{includes.tex}

\begin{document}

\setcounter{chapter}{5}

\tableofcontents

\chapter{Évaluation globale}
\input{Chapter6/chapter6.tex}

\bibliographystyle{apalike}
\bibliography{../../../../Documents/Bibliography/library.bib}
\end{document}


text:
from . import QT_API
if QT_API != 'pyqt':
    msg = 'the Qt Scintilla widget is only available when using PyQt'
    raise ImportError(msg)

from PyQt4 import Qsci

class PythonLexer(Qsci.QsciLexerPython):
    """ A custom Python lexer which highlights extra identifiers.

    """
    py_kwds = (
        'ArithmeticError AssertionError AttributeError BaseException '
        'BufferError BytesWarning DeprecationWarning EOFErr Ellipsis '
        'EnvironmentError Exception False FloatingPointError FutureWarning '
        'GeneratorExit IOError ImportError ImportWarning IndentationError '
        'IndexError KeyError KeyboardInterrupt LookupError MemoryError '
        'NameError None NotImplemented NotImplementedError OSError '
        'OverflowError PendingDeprecationWarning ReferenceError RuntimeError '
        'RuntimeWarning StandardError StopIteration SyntaxError SyntaxWarning '
        'SystemError SystemExit TabError True TypeError UnboundLocalError '
        'UnicodeDecodeError UnicodeEncodeError UnicodeError '
        'UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning '
        'WindowsError ZeroDivisionError abs all any apply basestring bin bool '
        'buffer bytearray bytes callable chr classmethod cmp coerce compile '
        'complex delattr dict dir divmod enumerate eval execfile file filter'
        'float format frozenset getattr globals hasattr hash help hex id input'
        'int intern isinstance issubclass iter len list locals long map max '
        'memoryview min next object oct open ord pow print property range '
        'raw_input reduce reload repr reversed round set setattr slice sorted'
        'staticmethod str sum super tuple type unichr unicode vars xrange zip'
    )

    def __init__(self, *args):
        super(PythonLexer, self).__init__(*args)
        # This setting is a relatively recent lexer addition.
        setter = getattr(self, 'setHighlightSubidentifiers', None)
        if setter is not None:
            setter(False)

    def keywords(self, kwset):
        if kwset == 2:
            return self.py_kwds
        return super(PythonLexer, self).keywords(kwset)

class EnamlLexer(PythonLexer):
    """ A custom Python lexer which adds Enaml keywords.

    """
    enaml_kwds = " enamldef attr event"

    def keywords(self, kwset):
        kwds = super(EnamlLexer, self).keywords(kwset)
        if kwset == 1:
            kwds += self.enaml_kwds
        return kwds

#: A static mapping of theme language name to lexer class.
LEXERS = {
    'bash': Qsci.QsciLexerBash,
    'batch': Qsci.QsciLexerBatch,
    'cmake': Qsci.QsciLexerCMake,
    'cpp': Qsci.QsciLexerCPP,
    'csharp': Qsci.QsciLexerCSharp,
    'css': Qsci.QsciLexerCSS,
    'd': Qsci.QsciLexerD,
    'diff': Qsci.QsciLexerDiff,
    'enaml': EnamlLexer,
    'fortran': Qsci.QsciLexerFortran,
    'fortran77': Qsci.QsciLexerFortran77,
    'html': Qsci.QsciLexerHTML,
    'idl': Qsci.QsciLexerIDL,
    'java': Qsci.QsciLexerJava,
    'javascript': Qsci.QsciLexerJavaScript,
    'lua': Qsci.QsciLexerLua,
    'makefile': Qsci.QsciLexerMakefile,
    'matlab': Qsci.QsciLexerMatlab,
    'octave': Qsci.QsciLexerOctave,
    'pascal': Qsci.QsciLexerPascal,
    'perl': Qsci.QsciLexerPerl,
    'postscript': Qsci.QsciLexerPostScript,
    'pov': Qsci.QsciLexerPOV,
    'properties': Qsci.QsciLexerProperties,
    'python': PythonLexer,
    'ruby': Qsci.QsciLexerRuby,
    'spice': Qsci.QsciLexerSpice,
    'sql': Qsci.QsciLexerSQL,
    'tcl': Qsci.QsciLexerTCL,
    'tex': Qsci.QsciLexerTeX,
    'verilog': Qsci.QsciLexerVerilog,
    'vhdl': Qsci.QsciLexerVHDL,
    'xml': Qsci.QsciLexerXML,
    'yaml': Qsci.QsciLexerYAML,
}

#: A static mapping of lexer class to theme language name.
LEXERS_INV = {}
for key, value in LEXERS.iteritems():
    LEXERS_INV[value] = key


text:
from django.contrib.sites.models import Site

from django.core.management.base import BaseCommand
from opps.channels.models import Channel
from opps.containers.models import Container

class Command(BaseCommand):
    args = "<site_id> <domain>"
    help = "Updates site id domain and then updates channels and containers."

    def handle(self, *args, **options):
        if len(args) < 2:
            print "Usage: opps_update_site_domain %s" % self.args
            return

        pk, domain = args[:2]
        s = Site.objects.get(pk=pk)
        s.domain = domain
        s.save(update_fields=['domain'])
        print "Site updated."
        print Channel.objects.filter(site_id=pk).update(site_domain=domain),
        print "Channels updated."
        print Container.objects.filter(site_id=pk).update(site_domain=domain),
        print "Containers updated."


text:
/**
* (c) 2016 Highsoft AS
* Authors: Lars A. V. Cabrera
*
* License: www.highcharts.com/license
*/
'use strict';
// import H from '../parts/Globals.js';
import 'grid-axis.js';
import '../modules/xrange.src.js';


text:
.class Lcom/android/settings/TetherSettings$16;
.super Ljava/lang/Object;
.source "TetherSettings.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/settings/TetherSettings;->onCreateDialog(I)Landroid/app/Dialog;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/settings/TetherSettings;

.field final synthetic val$dnsCheckBox:Landroid/widget/CheckBox;

.field final synthetic val$edit:Landroid/content/SharedPreferences$Editor;

# direct methods
.method constructor <init>(Lcom/android/settings/TetherSettings;Landroid/content/SharedPreferences$Editor;Landroid/widget/CheckBox;)V
    .locals 0

    iput-object p1, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    iput-object p2, p0, Lcom/android/settings/TetherSettings$16;->val$edit:Landroid/content/SharedPreferences$Editor;

    iput-object p3, p0, Lcom/android/settings/TetherSettings$16;->val$dnsCheckBox:Landroid/widget/CheckBox;

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

    return-void
.end method

# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .locals 3

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    invoke-virtual {v0}, Lcom/android/settings/TetherSettings;->getActivity()Landroid/app/Activity;

    move-result-object v0

    invoke-static {v0}, Lcom/android/settings/TetherSettings;->isTAConnected(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->val$edit:Landroid/content/SharedPreferences$Editor;

    const-string/jumbo v1, "pref_dns_usb_tether_wifi_on"

    iget-object v2, p0, Lcom/android/settings/TetherSettings$16;->val$dnsCheckBox:Landroid/widget/CheckBox;

    invoke-virtual {v2}, Landroid/widget/CheckBox;->isChecked()Z

    move-result v2

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->val$edit:Landroid/content/SharedPreferences$Editor;

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    iget-object v1, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    const-string/jumbo v2, "wifi"

    invoke-virtual {v0, v2}, Lcom/android/settings/TetherSettings;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/wifi/WifiManager;

    invoke-static {v1, v0}, Lcom/android/settings/TetherSettings;->-set6(Lcom/android/settings/TetherSettings;Landroid/net/wifi/WifiManager;)Landroid/net/wifi/WifiManager;

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    invoke-static {v0}, Lcom/android/settings/TetherSettings;->-get10(Lcom/android/settings/TetherSettings;)Landroid/net/wifi/WifiManager;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/net/wifi/WifiManager;->setWifiEnabled(Z)Z

    iget-object v0, p0, Lcom/android/settings/TetherSettings$16;->this$0:Lcom/android/settings/TetherSettings;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/android/settings/TetherSettings;->-wrap4(Lcom/android/settings/TetherSettings;I)V

    :cond_0
    return-void
.end method


text:
import argparse
import redrum
import json

# read in parameter overrides
parser = argparse.ArgumentParser()
parser.add_argument('--ratio_midpoint', type=float)
parser.add_argument('--ratio_k', type=float)
parser.add_argument('--pixel_midpoint', type=float)
parser.add_argument('--pixel_k', type=float)
parser.add_argument('--views_midpoint', type=float)
parser.add_argument('--views_k', type=float)
parser.add_argument('ids', metavar='imgur_id', type=str, nargs='+', help="image ID to score from the cache")

args = parser.parse_args()
if args.ratio_midpoint:
    redrum.ratio_midpoint = args.ratio_midpoint
if args.ratio_k:
    redrum.ratio_k = args.ratio_k
if args.pixel_midpoint:
    redrum.pixel_midpoint = args.pixel_midpoint
if args.pixel_k:
    redrum.pixel_k = args.pixel_k
if args.views_midpoint:
    redrum.views_midpoint = args.views_midpoint
if args.views_k:
    redrum.views_k = args.views_k
if args.ids:
    ids = args.ids

# load images in the cache
f = open(redrum.cache_file, 'r')
j = json.loads(f.read())
images = j['images']

max_views = max([image['views'] for image in images])

# print scores in a tabular format
print("{:^60} {:<31}".format("Input Scores", "Logistic Scores"))
print("%-12s  |  %-12s%-12s%-7s  |  %-12s%-12s%-7s  |  %-12s" % ("ID", "ratio", "views", "pixel", "ratio", "views", "pixel", "final_score"))
print("=" * 103)
# calculate and print scores and logistic scores for each image
for id in ids:
    image = [image for image in images if image['id'] == id][0]

    [final_score,
     ratio_score,
     views_score,
     pixel_score,
     ratio_logistic_score,
     views_logistic_score,
     pixel_logistic_score] = redrum.score_image(image, max_views)

    print("%-12s  |  %-12.5f%-12.5f%-7.5f  |  %-12.5f%-12.5f%-7.5f  |  %-12.11f" % (image['id'],
                                                                              ratio_score,
                                                                              views_score,
                                                                              pixel_score,
                                                                              ratio_logistic_score,
                                                                              views_logistic_score,
                                                                              pixel_logistic_score,
                                                                              final_score))

    print("-" * 103)


text:
ModelViewer = function()
{
	Sim.App.call(this);
}

// Subclass Sim.App
ModelViewer.prototype = new Sim.App();

// Our custom initializer
ModelViewer.prototype.init = function(param)
{
	// Call superclass init code to set up scene, renderer, default camera
	Sim.App.prototype.init.call(this, param);

    // Create point lights to show off the model
	var light = new THREE.PointLight( 0xffffff, 1, 200);
	light.position.set(0, 20, 0);
	this.scene.add(light);

	light = new THREE.PointLight( 0xffffff, 1, 200);
	light.position.set(-20, 0, 0);
	this.scene.add(light);

	light = new THREE.PointLight( 0xffffff, 1, 200);
	light.position.set(20, 0, 20);
	this.scene.add(light);

	var light = new THREE.PointLight( 0xffffff, 1, 200);
	light.position.set(-20, 50, 20);
	this.scene.add(light);

	var amb = new THREE.AmbientLight( 0x808080, 1);
	this.scene.add(amb);

	this.camera.position.set(0, 0, ModelViewer.CAMERA_START_Z);

	this.createModel();
    this.createCameraControls();
}

ModelViewer.prototype.createModel = function()
{
    // Create the model and add it to our sim
	var sb = "../images/SwedishRoyalCastle/";
	var urls = [ sb + "px.jpg", sb + "nx.jpg",
	             sb + "py.jpg", sb + "ny.jpg",
	             sb + "pz.jpg", sb + "nz.jpg" ];

	var textureCube = THREE.ImageUtils.loadTextureCube( urls );
	//textureCube = null;

	var camaroMaterials = {

			body: new THREE.MeshLambertMaterial( { color: 0x226699, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ),
			chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
			darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
			glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
			tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
			interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
			black: new THREE.MeshLambertMaterial( { color: 0x000000 } )

		}

	var materials = [];
	materials.push(camaroMaterials.body); // car body
	materials.push(camaroMaterials.chrome); // wheels chrome
	materials.push(camaroMaterials.chrome); // grille chrome
	materials.push(camaroMaterials.darkchrome); // door lines
	materials.push(camaroMaterials.glass); // windshield
	materials.push(camaroMaterials.interior); // interior
	materials.push(camaroMaterials.tire); // tire
	materials.push(camaroMaterials.black); // tireling
	materials.push(camaroMaterials.black); // behind grille

	var model = new Model();
	// Model from Turbosquid
	// http://www.turbosquid.com/Search/Artists/dskfnwn
	// http://www.turbosquid.com/FullPreview/Index.cfm/ID/411348
    model.init({ url : "../models/Camaro/CamaroNoUv_bin.js" , materials : materials });
    this.addObject(model);
}

ModelViewer.prototype.createCameraControls = function()
{
	var controls = new THREE.TrackballControls( this.camera, this.renderer.domElement );
	var radius = ModelViewer.CAMERA_RADIUS;

	controls.rotateSpeed = ModelViewer.ROTATE_SPEED;
	controls.zoomSpeed = ModelViewer.ZOOM_SPEED;
	controls.panSpeed = ModelViewer.PAN_SPEED;
	controls.dynamicDampingFactor = ModelViewer.DAMPING_FACTOR;
	controls.noZoom = false;
	controls.noPan = false;
	controls.staticMoving = false;

	controls.minDistance = radius * ModelViewer.MIN_DISTANCE_FACTOR;
	controls.maxDistance = radius * ModelViewer.MAX_DISTANCE_FACTOR;

	this.controls = controls;
}

ModelViewer.prototype.update = function()
{
	this.controls.update();
    Sim.App.prototype.update.call(this);
}

ModelViewer.CAMERA_START_Z = 22;
ModelViewer.CAMERA_RADIUS = 20;
ModelViewer.MIN_DISTANCE_FACTOR = 1.1;
ModelViewer.MAX_DISTANCE_FACTOR = 20;
ModelViewer.ROTATE_SPEED = 1.0;
ModelViewer.ZOOM_SPEED = 3;
ModelViewer.PAN_SPEED = 0.2;
ModelViewer.DAMPING_FACTOR = 0.3;

//Custom model class
Model = function()
{
	Sim.Object.call(this);
}

Model.prototype = new Sim.Object();

Model.prototype.init = function(param)
{
	var group = new THREE.Object3D;

	var that = this;

	var url = param.url || "";
	if (!url)
		return;

	this.materials = param.materials;
	var scale = param.scale || 1;

	this.scale = new THREE.Vector3(scale, scale, scale);
	var loader = new THREE.BinaryLoader();
	loader.load( url, function( data ) {
		that.handleLoaded(data) } );

    // Tell the framework about our object
    this.setObject3D(group);
}

Model.prototype.handleLoaded = function(data)
{
	if (data instanceof THREE.Geometry)
	{
		var geometry = data;
		var material = null;
		if (this.materials)
		{
			material = new THREE.MeshFaceMaterial();

			var i, len = this.materials.length;
			for (i = 0; i < len; i++)
			{
				geometry.materials[i] = this.materials[i];
			}
		}
		else
		{
			material = new THREE.MeshFaceMaterial();
		}
		mesh = new THREE.Mesh( geometry, material );

		this.object3D.add( mesh );

		this.object3D.scale.copy(this.scale);
	}
}


text:
package org.keycloak.models.map.storage.jpa.hibernate.jsonb;

import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import org.keycloak.models.map.storage.jpa.client.entity.JpaClientMetadata;
import org.keycloak.models.map.storage.jpa.hibernate.jsonb.migration.JpaClientMigration;
import static org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_CLIENT;

public class JpaEntityMigration {

    static final Map<Class<?>, BiFunction<ObjectNode, Integer, ObjectNode>> MIGRATIONS = new HashMap<>();
    static {
        MIGRATIONS.put(JpaClientMetadata.class, (tree, entityVersion) -> migrateTreeTo(entityVersion, SUPPORTED_VERSION_CLIENT, tree, JpaClientMigration.MIGRATORS));
    }

    private static ObjectNode migrateTreeTo(int entityVersion, Integer supportedVersion, ObjectNode node, List<Function<ObjectNode, ObjectNode>> migrators) {
        if (entityVersion > supportedVersion + 1) throw new IllegalArgumentException("Incompatible entity version: " + entityVersion + ", supportedVersion: " + supportedVersion);

        if (entityVersion < supportedVersion) {
            while (entityVersion < supportedVersion) {
                Function<ObjectNode, ObjectNode> migrator = migrators.get(entityVersion);
                if (migrator != null) {
                    node = migrator.apply(node);
                }
                entityVersion++;
            }
        }
        return node;
    }

}


text:
@extends('layouts_new.authBase')

@section('header_scripts')
@include('layouts_new.proposition_share_info')
@stop

@section('title', $proposition['propositionSort'])

@section('content')

      	@if (session('status'))

				    {{ session('status') }}
				    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
						×
					</button>

		@endif

        	 {{Lang::get('messages.proposition.back')}}

                   {{Lang::get('messages.proposition.share.share')}} 0

 {{Lang::get('messages.proposition.share.facebook')}}

 {{Lang::get('messages.proposition.share.twitter')}}

 {{Lang::get('messages.proposition.share.gplus')}}

 {{Lang::get('messages.proposition.share.pin')}}

	                @if ($proposition['ending_in'] <= 0)

{{ Lang::get('messages.proposition.status.expired') }}

		         	@else

{{ Lang::choice('messages.proposition.status.ending_in', $proposition['ending_in'], ['daysleft' => $proposition['ending_in']]) }}

		         	@endif

				  <button type="button" class="btn btn-default btn-text-lg btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-toggle="tooltip" data-placement="right" title="{{Lang::get('messages.proposition.flagging.flag')}}">
				    sentiment_dissatisfied
				  </button>

{{Lang::get('messages.proposition.flagging.offensive')}}

{{Lang::get('messages.proposition.flagging.incomprehensible')}}

relationMarkerId() == \App\Marker::SUCCESS) success
	          		 @elseif ($proposition['marker']->relationMarkerId() == \App\Marker::UNDER_DISCUSSION) info
	          		 @elseif ($proposition['marker']->relationMarkerId() == \App\Marker::FAILED) warning
	          		 @endif
	          		 @endif ">

  	        	@if ($user['role'] === 2)
 @if (empty($proposition['marker']) == false) edit @else add @endif
 @endif

@if (empty($proposition['marker']) == false)
	          		 @if ($proposition['marker']->relationMarkerId() == \App\Marker::SUCCESS)check
	          		 @elseif ($proposition['marker']->relationMarkerId() == \App\Marker::UNDER_DISCUSSION) speaker_notes
	          		 @elseif ($proposition['marker']->relationMarkerId() == \App\Marker::FAILED) announcement
	          		 @endif
	          		 @endif {{{ $proposition['propositionSort'] }}}

{{{ $proposition['propositionLong'] }}}

           		{{ Lang::choice('messages.proposition.voting.stats.upvotes', $votes['upvotes'], ['votes' => $votes['upvotes']]) }} | {{ Lang::choice('messages.proposition.voting.stats.downvotes', $votes['downvotes'], ['votes' => $votes['downvotes']]) }} | {{ Lang::choice('messages.proposition.voting.stats.comments', $proposition['commentsCount'], ['comments' => $proposition['commentsCount']]) }}

        	@if (empty($proposition['marker']) == false)
        	@if ($proposition['marker']->relationMarkerId() == \App\Marker::SUCCESS)

				{{Lang::get('messages.proposition.marker.1')}}! {{ $proposition['marker']->markerText() }}

			@elseif ($proposition['marker']->relationMarkerId() == \App\Marker::UNDER_DISCUSSION)

				{{Lang::get('messages.proposition.marker.2')}}! {{ $proposition['marker']->markerText() }}

			@elseif ($proposition['marker']->relationMarkerId() == \App\Marker::FAILED)

				{{Lang::get('messages.proposition.marker.3')}}! {{ $proposition['marker']->markerText() }}

			@endif
			@endif

        @if ($proposition['ending_in'] <= 0)

			{{ Lang::get('messages.proposition.voting.expired') }}

        @elseif ($votes['userHasVoted'] == false)

		@if ($user['belongsToSchool'] == true)

          thumb_up {{ Lang::get('messages.proposition.voting.actions.upvote') }}
          thumb_down {{ Lang::get('messages.proposition.voting.actions.downvote') }}

		@else

          thumb_up {{ Lang::get('messages.proposition.voting.actions.upvote') }}
          thumb_down {{ Lang::get('messages.proposition.voting.actions.downvote') }}

{{Lang::get('messages.proposition.voting.link')}}

			{{ Lang::get('messages.profile.account.school_link_actions.link_now') }}

		@endif

		@else

			{{ Lang::get('messages.proposition.voting.already_voted') }}

		@endif

                	{{ Lang::get('messages.proposition.voting.credits') }}  {{ $proposition['proposer']['fullName'] }} {{ $proposition['date_created'] }}

        @if (($proposition['ending_in'] > 0))

        	<button class="btn btn-white btn-block" type="button" data-toggle="collapse" data-target="#comment" aria-expanded="false" aria-controls="comment">{{ Lang::get('messages.proposition.voting.actions.comment') }}</button>

	              			<form action="{{ route('comment') }}" method="POST">

	                     		<textarea  name="commentBody" class="form-control" rows="3" id="textArea" placeholder="{{ Lang::get('messages.proposition.voting.actions.comment_placeholder') }}"></textarea>

			                <input type="hidden" name="propositionId" value="{{ $proposition['propositionId'] }}"/>
							{!! csrf_field() !!}
							<input class="btn btn-primary" type="submit" value="{{ Lang::get('messages.proposition.voting.actions.post_comment') }}" @if ($user['belongsToSchool'] == false) disabled="disabled" @endif/> <button class="btn btn-default" type="button" data-toggle="collapse" data-target="#comment" aria-expanded="false" aria-controls="comment">{{Lang::get('messages.proposition.comments.cancel')}}</button>
		                	</form>

        @endif

        		@if ($comments ==! 0)
        			@foreach ($comments as $comment)

                         {{ $comment['commenter']['fullName'] }}
                        @if ($comment['commenter']['id'] == $user['userId'])  $comment['commentId']]) }}" class="text-muted">{{ Lang::get('messages.proposition.comments.delete') }} - @endif {{ $comment['date_created'] }}

{{ $comment['commentBody'] }}

thumb_up @if ($comment['userHasLiked'] == 1) {{Lang::get('messages.proposition.comments.liked')}} @else {{Lang::get('messages.proposition.comments.like')}} @endif
                       		@if($comment['likes'] > 0) •
                       		 $comment['people_likes']]) '>{{ Lang::choice('messages.proposition.comments.likes_count', $comment['likes'], ['likes' => $comment['likes']]) }} @endif

                	@endforeach
                @else

	                	{{Lang::get('messages.proposition.comments.no_comments')}} @if ($proposition['ending_in'] >= 0 or $user['belongsToSchool'] == true) {{Lang::get('messages.proposition.comments.no_comments_part2')}} {{Lang::get('messages.proposition.comments.add')}}@endif .

                @endif

@stop

@section('footer_scripts')
@if ($user['role'] === 2)
@if (empty($proposition['marker']) == true)

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">close</button>

{{Lang::get('messages.proposition.marker.modal.create_title')}}

        <form id="marker">

		    {{Lang::get('messages.proposition.marker.modal.type')}}
		    <select name="type" class="form-control" id="type">
		    	<option disabled selected>{{Lang::get('messages.form.select.please_select')}}</option>
		    	<option value="{{ \App\Marker::SUCCESS }}">{{Lang::get('messages.proposition.marker.1')}}</option>
				<option value="{{ \App\Marker::UNDER_DISCUSSION }}">{{Lang::get('messages.proposition.marker.2')}}</option>
				<option value="{{ \App\Marker::FAILED }}">{{Lang::get('messages.proposition.marker.3')}}</option>
			</select>

		    {{Lang::get('messages.proposition.marker.modal.message')}}
		    <textarea class="form-control" name="message" rows="3" id="message"></textarea>

		  {{ csrf_field() }}

		</form>

        <button type="button" id="marker_save" class="btn btn-primary btn-block">{{Lang::get('messages.proposition.marker.modal.set')}}</button>

@else

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">close</button>

{{Lang::get('messages.proposition.marker.modal.edit_title')}}

        <form id="marker">

		    {{Lang::get('messages.proposition.marker.modal.type')}}
		    <select name="type" class="form-control" id="type">
		    	<option disabled>{{Lang::get('messages.form.select.please_select')}}</option>
		    	<option value="{{ \App\Marker::SUCCESS }}" @if ($proposition['marker']->relationMarkerId() == \App\Marker::SUCCESS) selected @endif >{{Lang::get('messages.proposition.marker.1')}}</option>
				<option value="{{ \App\Marker::UNDER_DISCUSSION }}" @if ($proposition['marker']->relationMarkerId() == \App\Marker::UNDER_DISCUSSION) selected @endif >{{Lang::get('messages.proposition.marker.2')}}</option>
				<option value="{{ \App\Marker::FAILED }}" @if ($proposition['marker']->relationMarkerId() == \App\Marker::FAILED) selected @endif >{{Lang::get('messages.proposition.marker.3')}}</option>
			</select>

		    {{Lang::get('messages.proposition.marker.modal.message')}}
		    <textarea class="form-control" name="message" rows="3" id="message">{{ $proposition['marker']->markerText() }}</textarea>

		  {{ csrf_field() }}

		</form>

        <button type="button" id="marker_save" class="btn btn-primary btn-block">{{Lang::get('messages.proposition.marker.modal.update')}}</button>
      	{{Lang::get('messages.proposition.marker.modal.delete')}}

@endif
@endif

@stop