text:
void MakeADChargeEqualizationEntry(const char *outputCDB = "local://$ALICE_ROOT/../AliRoot/OCDB")
{
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(outputCDB);

  AliCDBMetaData *md = new AliCDBMetaData();
  md->SetResponsible("C. Mayer");
  md->SetBeamPeriod(0);
  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  md->SetComment("AD charge equalization factors");
  md->PrintMetaData();

  AliCDBId id("AD/Calib/ChargeEqualization", 0, AliCDBRunRange::Infinity());

  // make a default charge equalization object
  AliADChargeEqualization *eq = new AliADChargeEqualization;

  man->Put(eq, id, md);

  delete md;
}


text:
module PufferPages
  module Liquid
    module Tags

      class Helper < ::Liquid::Tag
        def render(context)
          context.registers[:tracker].register("<%= #{@tag_name} %>")
        end
      end

    end
  end
end

Liquid::Template.register_tag('csrf_meta_tags', PufferPages::Liquid::Tags::Helper)

redpajama_set_name: RedPajamaGithub


text:
mapshaper-xl raw/nycg.shp \
  -dissolve2 \
  -o temp/shore.shp

# calculate bounding box of nyc
# mapshaper temp/shore.shp -info
# // 913175.1090087891,120121.8812543377,1067382.5084228516,272844.29400634766

# dissolve, simplify and project buildings
mapshaper-xl raw/buildings.geojson \
  -drop target=2 \
  -proj match=raw/nycg.prj \
  -clip bbox2=913175.1090087891,120121.8812543377,1067382.5084228516,272844.29400634766 \
  -dissolve2 \
  -simplify resolution=4000 \
  -o format=geojson temp/buildings-simple-projected.json

node ../bin/merge.js

# project and clip neighborhoods
mapshaper-xl raw/neighborhoods.json \
  -proj match=raw/nycg.prj \
  -clip bbox2=913175.1090087891,120121.8812543377,1067382.5084228516,272844.29400634766 \
  -each 'this.properties.centroidX = this.centroidX' \
  -each 'this.properties.centroidY = this.centroidY' \
  -o temp/neighborhoods-projected.json

node ../bin/calc-colors.js

# this is silly...
# but couldn't figure out how to align buildings and neighborhoods w/o copy/paste

mapshaper-xl -i \
    temp/shore.shp \
    temp/buildings-simple-projected.json \
    temp/neighborhoods-projected.json \
    temp/neighborhoods-centroids.csv \
    temp/neighborhoods-centroids.csv \
  combine-files \
  -target 1 \
  -style fill='#f3f3f3' stroke='none' stroke-width=.1 \
  -target 2 \
  -style fill='#d3d3d3' \
  -target 3 \
  -style fill='none' stroke='calcStroke' opacity='calcOpacity*.5' stroke-width=0 \
  -target 4 \
  -points x=x y=y \
  -style  font-size=5 dy=dy dx=dx text-anchor=middle font-family=monospace \
          label-text=place fill=calcStroke opacity=0 stroke='#fff' stroke-width=.8 \
  -target 5 \
  -points x=x y=y \
  -style  font-size=5 dy=dy dx=dx text-anchor=middle font-family=monospace \
          label-text=place fill=calcStroke opacity=0 \
  -o temp/buildings.svg target=1,2,3,4,5 width=6000

svgexport temp/buildings.svg final/buildings.png 1x

mapshaper-xl -i \
    temp/shore.shp \
    temp/buildings-simple-projected.json \
    temp/neighborhoods-projected.json \
    temp/neighborhoods-centroids.csv \
    temp/neighborhoods-centroids.csv \
  combine-files \
  -target 1 \
  -style fill='none' stroke='none' stroke-width=.1 \
  -target 2 \
  -style fill='#ccc' opacity=0 \
  -target 3 \
  -style fill='none' stroke='calcStroke' opacity='calcOpacity*2' stroke-width=.5 class='filename' \
  -target 4 \
  -points x=x y=y \
  -style  font-size=5 dy=dy dx=dx text-anchor=middle font-family=monospace \
          label-text=place fill=calcStroke opacity=0 class='filename' stroke='#fff' stroke-width=.8 \
  -target 5 \
  -points x=x y=y \
  -style  font-size=5 dy=dy dx=dx text-anchor=middle font-family=monospace \
          label-text=place fill=calcStroke opacity=0 class='filename' \
  -o temp/outlines.svg target=1,2,3,4,5 width=6000

svgexport temp/outlines.svg final/outlines.png 1x

node ../bin/label-svg.js


text:
#region Copyright
//=======================================================================================
// Microsoft Azure Customer Advisory Team
//
// This sample is supplemental to the technical guidance published on my personal
// blog at http://blogs.msdn.com/b/paolos/.
//
// Author: Paolo Salvatori
//=======================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THESE
// FILES EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT
// http://www.apache.org/licenses/LICENSE-2.0
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE DISTRIBUTED UNDER THE
// LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
// PERMISSIONS AND LIMITATIONS UNDER THE LICENSE.
//=======================================================================================
#endregion

namespace Microsoft.WindowsAzure.CAT.ServiceBusExplorer
{
    partial class AboutForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        #region Private Fields
        private System.ComponentModel.IContainer components = null;
        #endregion

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm));
            this.lblCorporation = new System.Windows.Forms.Label();
            this.lblName = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.mailLinkLabel = new System.Windows.Forms.LinkLabel();
            this.blogLinkLabel = new System.Windows.Forms.LinkLabel();
            this.twitterLinkLabel = new System.Windows.Forms.LinkLabel();
            this.label1 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // lblCorporation
            //
            this.lblCorporation.AutoSize = true;
            this.lblCorporation.BackColor = System.Drawing.Color.Transparent;
            this.lblCorporation.Location = new System.Drawing.Point(368, 360);
            this.lblCorporation.Name = "lblCorporation";
            this.lblCorporation.Size = new System.Drawing.Size(107, 13);
            this.lblCorporation.TabIndex = 39;
            this.lblCorporation.Text = "Microsoft Corporation";
            //
            // lblName
            //
            this.lblName.AutoSize = true;
            this.lblName.BackColor = System.Drawing.Color.Transparent;
            this.lblName.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblName.Location = new System.Drawing.Point(368, 340);
            this.lblName.Name = "lblName";
            this.lblName.Size = new System.Drawing.Size(117, 16);
            this.lblName.TabIndex = 37;
            this.lblName.Text = "Paolo Salvatori";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.BackColor = System.Drawing.Color.Transparent;
            this.label3.Location = new System.Drawing.Point(368, 320);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(81, 13);
            this.label3.TabIndex = 42;
            this.label3.Text = "Version: 2.4.3.0";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.Transparent;
            this.label2.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(368, 300);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(158, 16);
            this.label2.TabIndex = 41;
            this.label2.Text = "Service Bus Explorer";
            //
            // mailLinkLabel
            //
            this.mailLinkLabel.AutoSize = true;
            this.mailLinkLabel.BackColor = System.Drawing.Color.Transparent;
            this.mailLinkLabel.Location = new System.Drawing.Point(424, 385);
            this.mailLinkLabel.Name = "mailLinkLabel";
            this.mailLinkLabel.Size = new System.Drawing.Size(114, 13);
            this.mailLinkLabel.TabIndex = 43;
            this.mailLinkLabel.TabStop = true;
            this.mailLinkLabel.Text = "paolos@microsoft.com";
            this.mailLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.mailLinkLabel_LinkClicked);
            //
            // blogLinkLabel
            //
            this.blogLinkLabel.AutoSize = true;
            this.blogLinkLabel.BackColor = System.Drawing.Color.Transparent;
            this.blogLinkLabel.Location = new System.Drawing.Point(424, 401);
            this.blogLinkLabel.Name = "blogLinkLabel";
            this.blogLinkLabel.Size = new System.Drawing.Size(150, 13);
            this.blogLinkLabel.TabIndex = 44;
            this.blogLinkLabel.TabStop = true;
            this.blogLinkLabel.Text = "http://blogs.msdn.com/paolos";
            this.blogLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.blogLinkLabel_LinkClicked);
            //
            // twitterLinkLabel
            //
            this.twitterLinkLabel.AutoSize = true;
            this.twitterLinkLabel.BackColor = System.Drawing.Color.Transparent;
            this.twitterLinkLabel.Location = new System.Drawing.Point(424, 417);
            this.twitterLinkLabel.Name = "twitterLinkLabel";
            this.twitterLinkLabel.Size = new System.Drawing.Size(145, 13);
            this.twitterLinkLabel.TabIndex = 45;
            this.twitterLinkLabel.TabStop = true;
            this.twitterLinkLabel.Text = "https://twitter.com/babosbird";
            this.twitterLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.twitterLinkLabel_LinkClicked);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(368, 384);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(47, 13);
            this.label1.TabIndex = 46;
            this.label1.Text = "Email:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.BackColor = System.Drawing.Color.Transparent;
            this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(368, 400);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(39, 13);
            this.label4.TabIndex = 47;
            this.label4.Text = "Blog:";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.BackColor = System.Drawing.Color.Transparent;
            this.label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.Location = new System.Drawing.Point(368, 416);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(57, 13);
            this.label5.TabIndex = 48;
            this.label5.Text = "Twitter:";
            //
            // AboutForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(228)))), ((int)(((byte)(242)))));
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.ClientSize = new System.Drawing.Size(584, 441);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.twitterLinkLabel);
            this.Controls.Add(this.blogLinkLabel);
            this.Controls.Add(this.mailLinkLabel);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.lblCorporation);
            this.Controls.Add(this.lblName);
            this.Controls.Add(this.label5);
            this.DoubleBuffered = true;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "AboutForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = " About Service Bus Explorer 2.4.3.0";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label lblCorporation;
        private System.Windows.Forms.Label lblName;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.LinkLabel mailLinkLabel;
        private System.Windows.Forms.LinkLabel blogLinkLabel;
        private System.Windows.Forms.LinkLabel twitterLinkLabel;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;

    }
}


text:
package com.vmware.vim25;

/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/

@SuppressWarnings("all")
public class HostDiagnosticPartitionCreateOption extends DynamicData {
  public String storageType;
  public String diagnosticType;
  public HostScsiDisk disk;

  public String getStorageType() {
    return this.storageType;
  }

  public String getDiagnosticType() {
    return this.diagnosticType;
  }

  public HostScsiDisk getDisk() {
    return this.disk;
  }

  public void setStorageType(String storageType) {
    this.storageType=storageType;
  }

  public void setDiagnosticType(String diagnosticType) {
    this.diagnosticType=diagnosticType;
  }

  public void setDisk(HostScsiDisk disk) {
    this.disk=disk;
  }
}


text:
import React, { Component } from 'react';
import {
    AppRegistry
} from 'react-native';
import App from './rn/app.js';

class RNRouter extends Component {
  render() {
    return <App />
  }
}

AppRegistry.registerComponent('RNRouter', () => RNRouter);


text: A quick test to make sure LEDs are correctly addressable and their color can be set correctly


text:
/* $Id: DataURIResolver.java 985537 2010-08-14 17:17:00Z jeremias $ */

package org.apache.fop.util;

import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;

/**
 * @deprecated
 * @see org.apache.xmlgraphics.util.uri.DataURIResolver
 */
public class DataURIResolver implements URIResolver {

    private final URIResolver newResolver = new org.apache.xmlgraphics.util.uri.DataURIResolver();

    /**
     * @param href an href
     * @param base a base
     * @return a source
     * @throws TransformerException if not caught
     * @deprecated
     * @see org.apache.xmlgraphics.util.uri.DataURIResolver#resolve(String,
     *      String)
     */
    public Source resolve(String href, String base) throws TransformerException {
        return newResolver.resolve(href, base);
    }

}


text:
/**
 * SMTI06, 54411850, M Haidar Hanif
 * Task Five: Automated Teller Machine
 * Auteline | Simple ATM simulator with basic features
 */

package main.frame;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class KeypadPanel extends JPanel {

  public KeypadPanel() {
    setLayout(new BorderLayout());

    // add display field
    display = new JTextField();
    add(display, "North");

    // create button panel
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(4, 3));

    // add digit buttons
    ActionListener listener = new DigitButtonListener();
    addButton("7", listener);
    addButton("8", listener);
    addButton("9", listener);
    addButton("4", listener);
    addButton("5", listener);
    addButton("6", listener);
    addButton("1", listener);
    addButton("2", listener);
    addButton("3", listener);
    addButton("0", listener);
    addButton(".", listener);

    // add clear entry button
    clearButton = new JButton("CE");
    buttonPanel.add(clearButton);
    clearButton.addActionListener
        (new ClearButtonListener());
    add(buttonPanel, "Center");
  }

  /**
   * Gets the value that the user entered.
   * @return the value in the text field of the keypad
   */
  public double getValue() {// modified by JD to issue error dialog
    while (display.getText().equals("")) {
      String UserInput = JOptionPane.showInputDialog
          ("Please enter the required input value:");
      display.setText(UserInput);
    }
    return Double.parseDouble(display.getText());
  }

  /**
   * Clear the display.
   */
  public void clear() {
    display.setText("");
  }

  /**
   * Adds a button to the button panel
   * @param label    the button label
   * @param listener the button listener
   */
  public void addButton(String label, ActionListener listener) {
    JButton button = new JButton(label);
    buttonPanel.add(button);
    button.addActionListener(listener);
  }

  private JPanel buttonPanel;
  private JButton clearButton;
  private JTextField display;

  private class DigitButtonListener implements ActionListener {
    // Get the button label
    public void actionPerformed(ActionEvent event) {
      // it is a digit or decimal point
      JButton source = (JButton) event.getSource();
      String label = source.getText();
      // don't add two decimal points
      if (label.equals(".") && display.getText().indexOf(".") != -1) {
        return;
      }
      display.setText(display.getText() + label);
    }
  }

  private class ClearButtonListener implements ActionListener {
    public void actionPerformed(ActionEvent event) {
      clear();
    }
  }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: harikrishnan
 * Date: 6/14/2017
 * Time: 1:07 PM
 */?>

Press Releases

 <a href="<?php echo site_url(''); ?>">Home

 <a href="<?php echo site_url('company/pressreleases'); ?>">Press Releases

Fiorano MQTT

Fiorano announces general availability of Fiorano MQTT: the preferred messaging protocol for the IoT revolution

<img class="img-responsive" src="<?php echo base_url('assets/images/fiorano_logo.png')?>">

"With an estimated projection of 50 billion connected devices by 2020, IoT is the key trend in the technology industry today and enterprises are keen to leverage the IoT technology for driving their business. They require an enterprise class; standards based scalable solution to provide real-time data. Fiorano MQTT will enable these organizations to make informed decisions based on actionable information gathered from various heterogeneous sources."

 Atul Saini

                        CEO, Fiorano Software

                        PALO ALTO, California, 15th Dec, 2015. Fiorano Software, a leading provider of enterprise integration and messaging infrastructure technology, today announced general availability of Fiorano MQTT, the enterprise scale MQTT message broker. Modern organizations facing the challenge of connecting large enterprise systems with multiple devices can leverage Fiorano MQTT's best-in-class performance to gain access to real-time data.

IoT is often quoted as the next disruptive technology and MQTT (MQ Telemetry Transport) is the preferred messaging protocol for IoT and connected devices. MQTT provides a minimalistic approach towards machine-to-machine communication among resource constrained devices. Fiorano MQTT takes this charter forward and provides added performance, scalability and security to match the requirements of an enterprise.

MQTT v3.1.1 is now an OASIS Standard and Fiorano MQTT supports all the features of the latest version of the protocol like LWT (last will & testament), retained messages and all QoS Levels (Quality of Service) among others. The product comes with added features like MQTT-JMS conversion - allowing any device/sensor to communicate seamlessly with any JMS based backend system, shared and replicated High-Availability (HA) models - for better performance, client authentication via LDAP plug-in and TLS 1.2 - for added security.

Fiorano MQTT can be used either as a message broker for IoT, connecting a myriad of devices with backend enterprise applications, as a hub for machine-to-machine real-time communication, or as a local hub connecting devices and sensors. Client-side persistence provides enhanced reliability of message delivery by Fiorano MQTT ensuring all devices and systems are always updated with the latest information, even during server-down conditions.

    Always at the forefront of technology, Fiorano has helped a vast number of organizations worldwide with their integration needs. With the launch of Fiorano MQTT, Fiorano brings the IoT revolution at the door steps of enterprises, enabling them to effectively capitalize on this emerging technology.

About Fiorano

                        Founded in 1995, Fiorano is a trusted provider of enterprise integration middleware, high performance messaging and distributed systems. Fiorano's innovative event-driven SOA platform integrates applications and complex technologies into an enterprise nervous system. Fiorano's hybrid Cloud-ESB integrates applications across SaaS, PaaS and on-premise worlds.

                        Global leaders including Federal Bank, Commercial Bank of Africa, NASA, US Coast Guard, POSCO, British Telecom, AT&T Labs, Vodafone and L'Oréal have deployed Fiorano's solutions to drive innovation through open, standards-based, event-driven SOA applications yielding unprecedented productivity.

Share this Press release

                                <a class="fb-share-button btn facebook fb-xfbml-parse-ignore" target="_blank" data-href="<?php echo site_url('pressreleases/fiorano_announces_general_availability_mqtt');?>" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.fiorano.com%2Fnew%2Findex.php%2Fpressreleases%2Ffiorano_announces_general_availability_mqtt&src=sdkpreparse" onclick="return !window.open(this.href, 'Facebook', 'width=600,height=500, left=24, top=24, scrollbars, resizable')">

            <img src="<?php echo base_url('assets/images/company/press-release-bottom-image.jpg') ?>" class="img-responsiveq"/>


text:
package org.elasticsearch.xpack.runtimefields.query;

import static org.hamcrest.Matchers.equalTo;

public class DoubleScriptFieldExistsQueryTests extends AbstractDoubleScriptFieldQueryTestCase<DoubleScriptFieldExistsQuery> {
    @Override
    protected DoubleScriptFieldExistsQuery createTestInstance() {
        return new DoubleScriptFieldExistsQuery(randomScript(), leafFactory, randomAlphaOfLength(5));
    }

    @Override
    protected DoubleScriptFieldExistsQuery copy(DoubleScriptFieldExistsQuery orig) {
        return new DoubleScriptFieldExistsQuery(orig.script(), leafFactory, orig.fieldName());
    }

    @Override
    protected DoubleScriptFieldExistsQuery mutate(DoubleScriptFieldExistsQuery orig) {
        if (randomBoolean()) {
            new DoubleScriptFieldExistsQuery(randomValueOtherThan(orig.script(), this::randomScript), leafFactory, orig.fieldName());
        }
        return new DoubleScriptFieldExistsQuery(orig.script(), leafFactory, orig.fieldName() + "modified");
    }

    @Override
    public void testMatches() {
        assertTrue(createTestInstance().matches(new double[0], randomIntBetween(1, Integer.MAX_VALUE)));
        assertFalse(createTestInstance().matches(new double[0], 0));
        assertFalse(createTestInstance().matches(new double[] { 1, 2, 3 }, 0));
    }

    @Override
    protected void assertToString(DoubleScriptFieldExistsQuery query) {
        assertThat(query.toString(query.fieldName()), equalTo("DoubleScriptFieldExistsQuery"));
    }
}


text:
namespace GameEngine.Factories
{
    using System;
    using System.Collections.Generic;
    using GameEngine;
    using Models;
    using Models.Creatures;
    using Models.Extensions;
    using Models.Interfaces;

    public class CreatureFactory : ICreatureFactory
    {
        public ICharacter CreateCharacter(string name, GenderType gender)
        {
            return new Character(name, gender);
        }

        public ICreature CreateEnemy(string name, GenderType gender)
        {
            return new Enemy(
                name,
                Enemy.InitialEnemyAttack,
                Enemy.InitialEnemyHealth,
                gender);
        }
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta name="author" content="Julien Tournay">
    <meta name="keywords" content="playframework,scala,hotreload,sbt">

    <link rel="shortcut icon" href="/media/images/favicon.ico">
    <link rel="stylesheet" href="/assets/css/blog.css" type="text/css" media="screen" title="no title" charset="utf-8">
    <link rel="alternate" type="application/rss+xml" title="jto.github.io rss feed" href="/feed.xml">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:creator" content="@skaalf">
    <meta property="og:title" content="Play, Anatomy of a web framework: Hot redeploy.">
    <meta property="og:description" content="Today, I'll show how playframework hot reloads code, and explain the relationship between play and sbt.">
    <meta property="og:image" content="http://www.playframework.com/assets/images/logos/normal.png">

    <title>Play, Anatomy of a web framework: Hot redeploy.</title>

          hi!
          I'm Julien







  Follow @skaalf
  Tweet

    Play, Anatomy of a web framework: Hot redeploy.

In this series of article, I'll explain the internals of playframework. I'll try to show how play works, from starting an application to rendering the HTTP response. Today, I'll show how playframework compiles and hot reloads code, and explain the relationship between play and sbt.

Play and SBT

One of the key features in Play is its ability, unlike most JVM based framework, to hot reload all code modifications in DEV mode without relying on any external tool (You don't need JRebel). In order to understand how that works, we first need to see how Play uses SBT to compile classes, and how SBT is tightly integrated into Play.

We've seen in the previous article that SBT in the entry point of any play application, and that the play command is essentially just an alias on sbt. The crucial part making a play application different from a typical scala application built with SBT is play's sbt plugin.

As you can see, this is a pretty big SBT plugin. There's a good reason for that: It does A LOT.

First of all, play adds a bunch of settings:

play-assets-directories           play-build-require-assets        play-closure-compiler-options
play-coffeescript-entry-points    play-coffeescript-options        play-common-classloader
play-compile-everything           play-conf                        play-copy-assets
play-default-port                 play-dev-settings                play-dist
play-external-assets              play-javascript-entry-points     play-less-entry-points
play-less-options                 play-monitored-files             play-onStarted
play-onStopped                    play-package-everything          play-plugin
play-reload                       play-require-js                  play-require-js-folder
play-require-js-shim              play-require-native-path         play-routes-imports
play-templates-formats            play-templates-imports           play-version

It also adds Tasks:

classpath                  Display the project classpath.
clean                      Clean all generated files.
compile                    Compile the current application.
console                    Launch the interactive Scala console (use :quit to exit).
dependencies               Display the dependencies summary.
dist                       Construct standalone application package.
exit                       Exit the console.
h2-browser                 Launch the H2 Web browser.
license                    Display licensing informations.
package                    Package your application as a JAR.
play-version               Display the Play version.
publish                    Publish your application in a remote repository.
publish-local              Publish your application in the local repository.
reload                     Reload the current application build file.
run <port>                 Run the current application in DEV mode.
test                       Run Junit tests and/or Specs from the command line
eclipse                    generate eclipse project file
idea                       generate Intellij IDEA project file
sh <command to run>        execute a shell command
start <port>               Start the current application in another JVM in PROD mode.
update                     Update application dependencies.

Now you want to have a look at PlaySettings.scala. This is where all the default settings are defined. We're interested in run.

Typing play run calls playRunSetting, which is defined in PlayRun.scala.

Let's have a look at what it does:

it keeps the sbt classloader (l72).

it creates a "common" classloader able to load "common" jars (l74).
Those jar are used both by your application and sbt. They won't be reloaded.

it creates the application classloader, child of the common classloadder, which loads all the application dependencies (l90).

This particular classloader is especially interesting.
First of all, it's the one "in charge" of class reloading.
Although it's not a child of sbtClassloader, it will delegate the loading of shared classes to it.

Running a play application

So we've created a fancy classloader hierarchy. We're now ready to run the application. Obviously, like for start, it's just a matter of calling a main somewhere. We've seen in the previous article that main is in play.core.server.NettyServer.
Interestingly, play is not using a SBT setting here, the class name is just hardcoded.

So, all we have to do is to invoke mainDevHttpMode.

We're almost there, but hey, we haven't talked about class reloading yet! The methods is given a reloader.
That reloader has type SBTLink.

Each time a request hits the server, the application calls the reloader, asking to check if there's any code changes.
The reloader will then delegate recompilation (or other necessary tasks, like copying static assets) to SBT.

Ok that was fairly simple, but why should we bother creating an SBTLink when SBT is absolutely capable of watching files for modifications natively?

Two reasons:

First, Play needs to know when a compilation error happens, so that it can pop a nice error page in your browser.

Then, Hot reload of course! It's nice to have code recompiled, but the application is still running on the old classes. There's more todo

Where the magic begins

Here's the real trick. Assuming the compilation succeeded, we need to update the loaded classes in the JVM.
How do we do that? Simple. We just remove the old application classloader, and create a new one with the updated classes.

Then, we simply restart the application, and only the application. No need to restart the JVM.

And that's it! New code is executed. All happened in a few seconds (hopefully), developers are happy :)

It's a tradeoff

Replacing classloader to hot reload code is simple and works very well, but it comes at a price.

First of all, it's only possible because Play is stateless, and is pretty lightweight (quick start).
Then, it creates a tight dependency between the build system and the framework.

Most Java or Scala framework can be used with any build system you like, in play, you're not getting rid of SBT anytime soon.

Finally, it occasionally messes with with certain libraries that are not using the "correct" classloader.

Why it's not possible in JEE frameworks.

Wait a minute!
If it's THAT simple why is not everybody using that technique !!!??? I mean... I wait for my beloved "Java Enterprise Server®" to restart for AGES every day! Also, My ruby on rails coworkers are making fun of me.

Why are those people wasting my time, making me feel miserable !!!???
Enterprise Java Architect, having an epiphany

The answer is pretty simple. Because your application is stateful!

You're keeping object instances in memory between requests. Assuming the code changed, what do you do with those "old" object instances ? Their class definitions may have changed. If you discard the classloader, you're also discarding all the instances it has created. That would typically mean loosing all session data at each reload, which in a typical application, would be very annoying.

In a JEE app, redeploying also means restarting a bunch of "services" provided by the application server (JNDI, Database connections pools, EBJ, JMX, CDI, etc.), which takes a long long time. Hot reload is not the only problem here.

Since play is completely stateless and fairly lightweight, trashing everything is not a problem a all.

The "all inclusive" philosophy of a enterprise application servers comes at a price, and let's face it, your not using 10% of the features anyway.

I don't care, I use JRebel!

Good for you!

Since Jrebel is not open source, it's pretty hard to know how exactly it is working. Their faq does not say a lot, but they published a blog post a while ago explaining the basics:

It adds a java agent that rewrite the bytecode loaded into the JVM which:

adds a field to each class, holding references to fields added to the object

adds a field to each class, holding references to anonymous classes with actual methods implementations

modify the methods of the classes to mask the above changes.

Of course when a class is modified you need to track the changes impact, and "reload" classes accordingly. That alone is pretty hard.

TD;DR

Play simply reloads code by trashing the application classloader and restarting everything, which comes at the price of SBT being deeply integrated into the framework.

The JEE architecture is stateful, and too heavy anyway to allow that kind of feature.

JRebel is rocket surgery (yes, surgery) compared to play.

Next time we'll see how play routes request and invoke the application code. It should be the last article of the series.

  Play, Anatomy of a web framework: The Web Server.

  Play, Anatomy of a web framework: Routing.

Please enable JavaScript to view the comments powered by Disqus.
comments powered by Disqus


text:
from itertools import permutations

#generates all possible permutations and saves them as a list
x = list(map("".join, permutations('1234')))

#prints
for i in range(len(x)):
    print x[i]


text: google-site-verification: google1a278b0bf4e57a6f.html


text:
import colander

from ichnaea.api.schema import (
    InternalMappingSchema,
    InternalSchemaNode,
    InternalSequenceSchema,
)
from ichnaea.api.locate.schema import (
    BaseLocateSchema,
    FallbackSchema,
)

RADIO_STRINGS = ['gsm', 'cdma', 'umts', 'wcdma', 'lte']

class CellsSchema(InternalSequenceSchema):

    @colander.instantiate()
    class SequenceItem(InternalMappingSchema):

        radio = InternalSchemaNode(
            colander.String(),
            validator=colander.OneOf(RADIO_STRINGS), missing=None)
        mcc = InternalSchemaNode(colander.Integer(), missing=None)
        mnc = InternalSchemaNode(colander.Integer(), missing=None)
        lac = InternalSchemaNode(colander.Integer(), missing=None)
        cid = InternalSchemaNode(colander.Integer(), missing=None)

        asu = InternalSchemaNode(colander.Integer(), missing=None)
        psc = InternalSchemaNode(colander.Integer(), missing=None)
        signal = InternalSchemaNode(colander.Integer(), missing=None)
        ta = InternalSchemaNode(colander.Integer(), missing=None)

class WifisSchema(InternalSequenceSchema):

    @colander.instantiate()
    class SequenceItem(InternalMappingSchema):

        key = InternalSchemaNode(
            colander.String(), missing=None, internal_name='mac')
        frequency = InternalSchemaNode(colander.Integer(), missing=None)
        channel = InternalSchemaNode(colander.Integer(), missing=None)
        signal = InternalSchemaNode(colander.Integer(), missing=None)
        signalToNoiseRatio = InternalSchemaNode(
            colander.Integer(), missing=None, internal_name='snr')

class LocateV1Schema(BaseLocateSchema):

    radio = InternalSchemaNode(
        colander.String(),
        validator=colander.OneOf(RADIO_STRINGS), missing=None)
    cell = CellsSchema(missing=())
    wifi = WifisSchema(missing=())
    fallbacks = FallbackSchema(missing=None)

LOCATE_V1_SCHEMA = LocateV1Schema()


text:
module Dotide
  module Collections
    class AccessTokens

      attr_reader :conn, :model, :url

      def initialize(conn)
        raise 'Database need to be setted!' unless conn.database
        raise 'Need basic authentication' unless conn.basic_authenticated?
        @conn = conn
        @model = Dotide::Models::AccessToken
        @url = '/access_tokens'
      end

      # List all access tokens for the authenticated database
      # @return [Array<Dotide::Models::AccessToken>]
      def all
        conn.get(url).map do |m|
          model.new(conn, m, url)
        end
      end

      # Fetch an access token by access_token string
      # @param id [String] The 'access_token' string
      # @return [Dotide::Models::AccessToken]
      def find_one(id)
        _url = "#{url}/#{id}"
        model.new(conn, conn.get(_url), url)
      end

      # Create an access token
      # @params scopes [Array<Hash>] scopes of an access token
      # @return [Dotide::Models::AccessToken]
      # @see http://developer.dotide.com/docs/refs/basics/auth.html#para-2
      def create(data = {})
        model.new(conn, conn.post(url, data), url)
      end

      # Build an access token instance and not save to Dotide Server
      # @params scopes [Array<Hash>] scopes of an access token
      # @return [Dotide::Models::AccessToken]
      # @see http://developer.dotide.com/docs/refs/basics/auth.html#para-2
      def build(data = {})
        model.new(conn, data, url)
      end

      # Destroy an existed access token
      # @param id [String] The 'access_token' string
      def destroy_one(id)
        _url = "#{url}/#{id}"
        conn.delete(_url)
      end
    end
  end
end


text:
package org.spongycastle.crypto.params;

import org.spongycastle.crypto.DerivationParameters;

/**
 * parameters for Key derivation functions for ISO-18033
 */
public class ISO18033KDFParameters
    implements DerivationParameters
{
    byte[]  seed;

    public ISO18033KDFParameters(
        byte[]  seed)
    {
        this.seed = seed;
    }

    public byte[] getSeed()
    {
        return seed;
    }
}


text:
> Enough Spacegray! It's time to get back to the good old trusty monokai: Where the colors are bright and the syntax highlighting [works properly](https://github.com/chriskempson/base16-builder/issues/60).

A minimalistic Sublime UI for the Monokai theme. For the optimal experience I recommend the [Monokai Extended](https://github.com/jonschlinkert/sublime-monokai-extended) theme.

![Minimal Monokai](https://raw.githubusercontent.com/chriskjaer/sublime-minimal-monokai/gh-pages/minimal-monokai.png)

## Getting Started

### Prerequisites

This UI is based on the [Spacegray](https://github.com/kkga/spacegray) theme. This **must** be installed before enabling the UI, since it uses its assets.

### 1. Installation

#### Manual Installation

Go to `Preferences -> Browse Packages`, and then either download and unzip this plugin into that directory, or:

``` bash
git clone https://github.com/chriskjaer/sublime-minimal-monokai.git "sublime-minimal-monokai"
```

### 2. Activate UI

Activate the UI theme by modifying your user preferences file, which you can find using the menu item `Sublime Text -> Preferences -> Settings - User` (⌘, on Mac).

``` json
{
  "theme": "minimal-monokai.sublime-theme"
}
```

***Note: Sublime Text needs to be restarted after activating the theme.***

## Author

**Chris Kjær Sørensen**

+ [http://twitter.com/ckjaer](http://twitter.com/ckjaer)
+ [http://github.com/chriskjaer](http://github.com/chriskjaer)

## Copyright and license
Copyright Chris Kjær Sørensen

[MIT License](LICENSE-MIT)


text:
from django_hosts import patterns, host
from django_hosts.tests.hosts.simple import host_patterns

host_patterns += patterns('',
    host(r'special', 'django_hosts.tests.urls.simple', name='special'),
)


text:
package com.twu.biblioteca;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by fergyo on 22/12/2016.
 */
public class MovieTest {

    private final int RATING = 10;
    private final String DIRECTOR = "Frank Darabont";
    private final int YEAR = 1995;
    private final String NAME = "The Shawshank Redemption";
    private final Movie movie = new Movie(NAME, DIRECTOR, RATING, YEAR);
    private final Movie unratedMovie = new Movie(NAME, DIRECTOR, YEAR);

    private final String COL_FORMAT = "%-30.30s  %-30.30s %-10.8s %-8.4s\n";

    @Test
    public void moviesHaveNames() {
        assertEquals(movie.getName(), NAME);
    }

    @Test
    public void moviesInitialisedAsCheckedIn() throws Exception {
        assertTrue(movie.isCheckedIn());
    }

    @Test
    public void moviesCanBeCheckedOut() throws Exception {
        movie.checkoutItem();
        assertFalse(movie.isCheckedIn());
    }

    @Test
    public void moviesCanBeReturned() throws Exception {
        movie.checkoutItem();
        movie.returnItem();
        assertTrue(movie.isCheckedIn());
    }

    @Test
    public void toStringPrintsMoviesDetailsInColumnFormat() {
        String movieDetails = String.format(COL_FORMAT, NAME, DIRECTOR, RATING, YEAR);
        assertEquals(movieDetails, movie.toString());
    }

    @Test
    public void unratedMoviesPrintUnratedInRatingColumn() {
        String movieDetails = String.format(COL_FORMAT, NAME, DIRECTOR, "Unrated", YEAR);
        assertEquals(movieDetails, unratedMovie.toString());
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="description" content="Draw a polygon or extruded polygon on the globe surface.">
    <meta name="cesium-sandcastle-labels" content="Development">
    <title>Cesium Demo</title>

Loading...


text:
// -----------------------------------------------------------------------
// <copyright file="MemberStrategy.cs" company="Asynkron AB">
//      Copyright (C) 2015-2020 Asynkron AB All rights reserved
// </copyright>
// -----------------------------------------------------------------------
using System.Collections.Immutable;
using System.Linq;
using Proto.Cluster.Partition;

namespace Proto.Cluster
{
    public interface IMemberStrategy
    {
        ImmutableList<Member> GetAllMembers();

        void AddMember(Member member);

        void RemoveMember(Member member);

        Member? GetActivator(string senderAddress);
    }

    class SimpleMemberStrategy : IMemberStrategy
    {
        private readonly Rendezvous _rdv;
        private readonly RoundRobinMemberSelector _rr;
        private ImmutableList<Member> _members = ImmutableList<Member>.Empty;

        public SimpleMemberStrategy()
        {
            _rdv = new Rendezvous();
            _rr = new RoundRobinMemberSelector(this);
        }

        public ImmutableList<Member> GetAllMembers() => _members;

        //TODO: account for Member.MemberId
        public void AddMember(Member member)
        {
            // Avoid adding the same member twice
            if (_members.Any(x => x.Address == member.Address)) return;

            _members = _members.Add(member);
            _rdv.UpdateMembers(_members);
        }

        //TODO: account for Member.MemberId
        public void RemoveMember(Member member)
        {
            _members = _members.RemoveAll(x => x.Address == member.Address);
            _rdv.UpdateMembers(_members);
        }

        public Member? GetActivator(string senderAddress) => _rr.GetMember();
    }
}


text:
package apps::apache::serverstatus::mode::cpuload;

use base qw(centreon::plugins::mode);

use strict;
use warnings;
use centreon::plugins::http;

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $self->{version} = '1.0';
    $options{options}->add_options(arguments =>
            {
            "hostname:s"        => { name => 'hostname' },
            "port:s"            => { name => 'port', },
            "proto:s"           => { name => 'proto' },
            "urlpath:s"         => { name => 'url_path', default => "/server-status/?auto" },
            "credentials"       => { name => 'credentials' },
            "basic"             => { name => 'basic' },
            "username:s"        => { name => 'username' },
            "password:s"        => { name => 'password' },
            "proxyurl:s"        => { name => 'proxyurl' },
            "header:s@"         => { name => 'header' },
            "warning:s"         => { name => 'warning' },
            "critical:s"        => { name => 'critical' },
            "timeout:s"         => { name => 'timeout' },
            "ssl-opt:s@"        => { name => 'ssl_opt' },
            });
    $self->{http} = centreon::plugins::http->new(output => $self->{output});
    return $self;
}

sub check_options {
    my ($self, %options) = @_;
    $self->SUPER::init(%options);

    if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
        $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
        $self->{output}->option_exit();
    }
    if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
        $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
        $self->{output}->option_exit();
    }
    $self->{http}->set_options(%{$self->{option_results}});
}

sub run {
    my ($self, %options) = @_;

    my $webcontent = $self->{http}->request();
    # If not present: cpuload is 0
    my ($cpuload) = 0;

    if ($webcontent !~ /^ReqPerSec:\s+([^\s]+)/mi) {
        $self->{output}->add_option_msg(short_msg => "Apache 'ExtendedStatus' option is off.");
        $self->{output}->option_exit();
    }
    if ($webcontent =~ /^CPULoad:\s+([^\s]+)/mi) {
        $cpuload = $1;
        $cpuload = '0' . $cpuload if ($cpuload =~ /^\./);
    }

    my $exit = $self->{perfdata}->threshold_check(value => $cpuload, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);

    $self->{output}->output_add(severity => $exit,
                                short_msg => sprintf("CPU Load: %.2f %%", $cpuload));
    $self->{output}->perfdata_add(label => "cpuload", unit => '%',
                                  value => sprintf("%.2f", $cpuload),
                                  warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
                                  critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
                                  min => 0
                                  );

    $self->{output}->display();
    $self->{output}->exit();

}

1;

__END__

=head1 MODE

Check Apache WebServer CpuLoad

=over 8

=item B<--hostname>

IP Addr/FQDN of the webserver host

=item B<--port>

Port used by Apache

=item B<--proxyurl>

Proxy URL if any

=item B<--proto>

Specify https if needed

=item B<--urlpath>

Set path to get server-status page in auto mode (Default: '/server-status/?auto')

=item B<--credentials>

Specify this option if you access server-status page with authentication

=item B<--username>

Specify username for authentication (Mandatory if --credentials is specified)

=item B<--password>

Specify password for authentication (Mandatory if --credentials is specified)

=item B<--basic>

Specify this option if you access server-status page over basic authentication and don't want a '401 UNAUTHORIZED' error to be logged on your webserver.

Specify this option if you access server-status page over hidden basic authentication or you'll get a '404 NOT FOUND' error.

(Use with --credentials)

=item B<--timeout>

Threshold for HTTP timeout

=item B<--ssl-opt>

Set SSL Options (--ssl-opt="SSL_version => TLSv1" --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE").

=item B<--header>

Set HTTP headers (Multiple option)

=item B<--warning>

Warning Threshold for CpuLoad

=item B<--critical>

Critical Threshold for CpuLoad

=back

=cut


text:
package org.jetbrains.plugins.scala.codeInspection.collections

import org.jetbrains.plugins.scala.codeInspection.InspectionBundle
import org.jetbrains.plugins.scala.lang.psi.api.expr._
import org.jetbrains.plugins.scala.lang.psi.impl.ScalaPsiElementFactory

/**
  * @author Ignat Loskutov
  */

class ExistsForallReplaceInspection extends OperationOnCollectionInspection {
  override def possibleSimplificationTypes: Array[SimplificationType] =
    Array(ReplaceForallWithExists, ReplaceExistsWithForall)
}

private object NegatedPredicate {
  def unapply(arg: ScExpression): Option[ScExpression] = arg match {
    case `!`(pred) => Some(pred)
    case fExpr @ ScFunctionExpr(_, Some(`!`(pred))) =>
      val newText = s"${fExpr.params.getText} => ${pred.getText}"
      Some(ScalaPsiElementFactory.createExpressionWithContextFromText(newText, arg.getContext, arg))
    case _ => None
  }
}

object ReplaceForallWithExists extends SimplificationType {
  override def hint: String = InspectionBundle.message("replace.with.exists")
  override def getSimplification(expr: ScExpression): Option[Simplification] = {
    expr match {
      case `!`(qual`.forall`(NegatedPredicate(pred))) =>
        Some(replace(expr).withText(invocationText(qual, "exists", pred)).highlightAll)
      case _ => None
    }
  }
}

object ReplaceExistsWithForall extends SimplificationType {
  override def hint: String = InspectionBundle.message("replace.with.forall")
  override def getSimplification(expr: ScExpression): Option[Simplification] = {
    expr match {
      case `!`(qual`.exists`(NegatedPredicate(pred))) =>
        Some(replace(expr).withText(invocationText(qual, "forall", pred)).highlightAll)
      case _ => None
    }
  }
}


text:
module TestImport
    ( module TestImport
    , module X
    ) where

import Application           (makeFoundation)
import ClassyPrelude         as X
import Database.Persist      as X hiding (get)
import Database.Persist.Sql  (SqlPersistM, runSqlPersistMPool)
import Foundation            as X
import Model                 as X
import Test.Hspec            as X
import Yesod.Default.Config2 (ignoreEnv, loadAppSettings)
import Yesod.Test            as X

runDB :: SqlPersistM a -> YesodExample App a
runDB query = do
    pool <- fmap appConnPool getTestYesod
    liftIO $ runSqlPersistMPool query pool

withApp :: SpecWith App -> Spec
withApp = before $ do
    settings <- loadAppSettings
        ["config/test-settings.yml", "config/settings.yml"]
        []
        ignoreEnv
    makeFoundation settings


text:
/*
 * FORE Systems 200-Series Adapter Support
 * ---------------------------------------
 *
 * Driver statistics definitions
 *
 */

#ifndef _FORE_STATS_H
#define _FORE_STATS_H

/*
 * Fore Driver Statistics
 */
struct Stats_driver {
	u_long		drv_xm_notact;	/* PDU drops out - VCC not active */
	u_long		drv_xm_full;	/* Xmit queue full */
	u_long		drv_xm_maxpdu;	/* PDU drops out - max segment/size */
	u_long		drv_xm_segnoal;	/* Non-aligned segments */
	u_long		drv_xm_seglen;	/* Padded length segments */
	u_long		drv_xm_segdma;	/* PDU drops out - no dma address */
	u_long		drv_rv_novcc;	/* PDU drops in - no VCC */
	u_long		drv_rv_nosbf;	/* No small buffers */
	u_long		drv_rv_nomb;	/* PDU drops in - no buffer */
	u_long		drv_rv_ifull;	/* PDU drops in - intr queue full */
	u_long		drv_bf_segdma;	/* Buffer supply - no dma address */
	u_long		drv_cm_full;	/* Command queue full */
	u_long		drv_cm_nodma;	/* Command failed - no dma address */
};
typedef struct Stats_driver	Stats_driver;

/*
 * Fore Device Statistics
 *
 * This structure is used by pass all statistics (including CP maintained
 * and driver maintained) data to user space (atm command).
 */
struct fore_stats {
	Fore_cp_stats	st_cpstat;	/* CP stats */
	Stats_driver	st_drv;		/* Driver maintained stats */
};
typedef struct fore_stats	Fore_stats;

#define	st_taxi		st_cpstat.st_cp_taxi
#define	st_oc3		st_cpstat.st_cp_oc3
#define	st_atm		st_cpstat.st_cp_atm
#define	st_aal0		st_cpstat.st_cp_aal0
#define	st_aal4		st_cpstat.st_cp_aal4
#define	st_aal5		st_cpstat.st_cp_aal5
#define	st_misc		st_cpstat.st_cp_misc

#endif	/* _FORE_STATS_H */


text:
ComponentRegistration HealthComponent::s_HealthComponentRegistration("Health", &HealthComponent::CreateComponent);

//===========================================================================================================
///----------------------------------------------------------------------------------------------------------
///Destructible Component

HealthComponent::HealthComponent(const XMLNode& node): BaseComponent(node)
{
	int healthToSet = ReadXMLAttributeAsInt(node, "health", 100);

	SetHealth(healthToSet);
}

HealthComponent::HealthComponent(const std::string& name) : BaseComponent(name){

}

//-----------------------------------------------------------------------------------------------------------

void HealthComponent::OnCreate(){
	//can specify something on create here
}

//-----------------------------------------------------------------------------------------------------------

void HealthComponent::OnDestroy(){
	//can specify something on destroy here
}

//-----------------------------------------------------------------------------------------------------------

void HealthComponent::Update(double deltaSeconds){
	UNUSED(deltaSeconds);

	ClampHealth();

}

//===========================================================================================================


text:
import node from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import cjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import { terser as minify } from 'rollup-plugin-terser';
import gzipPlugin from 'rollup-plugin-gzip'

function build({ outputPrefix, externals = [], gzip = false }) {
  return {
    input: './src/index.js',
    output: {
      file: `./public/js/${outputPrefix}.min.js`,
      format: 'cjs',
      sourcemap: true
    },
    external(id) {
      return externals.indexOf(id) >= 0;
    },
    treeshake: true,
    plugins: [
      node(),
      replace({
        'process.env.NODE_ENV': JSON.stringify('production')
      }),
      babel({
        exclude: 'node_modules/**',
        presets: [require('@babel/preset-react')]
      }),
      cjs({
        namedExports: {
          'react': [
            'useRef',
            'useContext',
            'useReducer',
            'useEffect',
            'useState'
          ],
          'react-dom': [
            'render',
          ],
        }
      }),
      minify({
        mangle: {
          toplevel: true
        },
        compress: {
          dead_code: true,
          global_defs: {
            '@process.env.NODE_ENV': JSON.stringify('production')
          }
        }
      }),
      gzip && gzipPlugin()
    ]
  };
}

export default [
  build({
    externals: [],
    outputPrefix: 'app',
    gzip: true
  }),
  build({
    externals: ['react', 'react-dom'],
    outputPrefix: 'app-no-react',
    gzip: true
  }),
];


text:
package dk.lessismore.nojpa.db.statements.h2;

import dk.lessismore.nojpa.db.statements.DeleteSQLStatement;
import dk.lessismore.nojpa.db.statements.WhereSQLStatement;
import dk.lessismore.nojpa.db.statements.mysql.MySqlDeleteStatement;

/**
 * Mysql statement implementation
 *
 * @author LESS-IS-MORE
 * @version 1.0 25-7-02
 */
public class H2DeleteStatement extends MySqlDeleteStatement implements DeleteSQLStatement {

}


text:
/**
 * @fileoverview Provides the "ngeoLayertree" directive, a layer tree widget
 * directive. This directive uses the "ngeoLayertreenode" directive.
 *
 * Example usage:
 *
 *

 *

 *
 * The "ngeo-layertree", "ngeo-layertree-map" and "ngeo-layertree-layer"
 * attributes are mandatory.
 *
 * - The "ngeo-layertree" attribute specifies the scope property whose value
 *   is a reference to the layer tree structure/object.
 *
 * - The "ngeo-layertree-map" attribute specifies the scope property whose
 *   value is a reference to the map.
 *
 * -  The "ngeo-layertree-layer" attribute specifies the expression to evaluate
 *    to get the layer object for a specific node of the tree. The directive
 *    will evaluate this expression for each node of the tree. `node` can be
 *    used in the expression to refer to the current tree node.
 *
 * Things to know about this directive:
 *
 * - The directive assumes that the root of the tree includes a "children"
 *   property containing tree nodes.
 *
 * - By default the directive uses "layertree.html" as its templateUrl. This
 *   can be changed by redefining the "ngeoLayertreeTemplateUrl" value.
 *
 * - The directive has its own scope, but it is not isolate scope. That scope
 *   includes a reference to the directive's controller: the "layertreeCtrl"
 *   scope property.
 *
 * - The directive creates a watcher on the "tree" expression ("ctrl.tree" in
 *   the usage example given above). Use a one-time binding expression if you
 *   know that the layer tree definition won't change:
 *
 *

 *

 */

goog.provide('ngeo.layertreeDirective');

goog.require('ngeo');
goog.require('ngeo.layertreenodeDirective');

/**
 * @const
 * @type {string}
 */
ngeo.layertreeTemplateUrl = 'layertree.html';

ngeoModule.value('ngeoLayertreeTemplateUrl',
    ngeo.layertreeTemplateUrl);

/**
 * @param {string|function(!angular.JQLite=, !angular.Attributes=)}
 *     ngeoLayertreeTemplateUrl Template URL for the directive.
 * @return {angular.Directive} The Directive Definition Object.
 * @ngInject
 */
ngeo.layertreeDirective = function(ngeoLayertreeTemplateUrl) {
  return {
    restrict: 'A',
    scope: true,
    controller: 'NgeoLayertreeController',
    templateUrl: ngeoLayertreeTemplateUrl
  };
};

ngeoModule.directive('ngeoLayertree', ngeo.layertreeDirective);

/**
 * @constructor
 * @param {angular.Scope} $scope Scope.
 * @param {angular.JQLite} $element Element.
 * @param {angular.Attributes} $attrs Attributes.
 * @ngInject
 */
ngeo.NgeoLayertreeController = function($scope, $element, $attrs) {

  var treeExpr = $attrs['ngeoLayertree'];
  var tree = /** @type {Object} */ ($scope.$eval(treeExpr));
  this['tree'] = tree;

  var mapExpr = $attrs['ngeoLayertreeMap'];
  var map = /** @type {ol.Map} */ ($scope.$eval(mapExpr));
  this['map'] = map;

  var nodelayerExpr = $attrs['ngeoLayertreeNodelayer'];
  this['layerExpr'] = nodelayerExpr;

  $scope.$watch(treeExpr, goog.bind(function(newVal, oldVal) {
    this['tree'] = newVal;
  }, this));

  $scope['uid'] = this['uid'] = goog.getUid(this);
  $scope['depth'] = 0;

  $scope['layertreeCtrl'] = this;
};

ngeoModule.controller('NgeoLayertreeController',
    ngeo.NgeoLayertreeController);


text:
__author__ = 'Viktor Winkelmann'

import sys

sys.path.append('../..')
from core.Plugins.DataRecognizer import *

def getClassReference():
    return BMPFile

class BMPFile(DataRecognizer):
    signatures = [(b'\x42\x4D.{4}\x00\x00\x00\x00', None)]
    fileEnding = "bmp"
    dataType = "Bitmap file"
    dataCategory = DataCategory.IMAGE


text:
const path = require('path');
const stackTrace = require('stack-trace');
import {Listener, Middleware} from "hubot";
import {inspect} from "util";
import {addPermissions, CHANNELS, CHANNELS_ALL, createLogger, PERMISSIONS, PERMISSIONS_ALL} from "../common";
import TextBuilder from "../core/builder";
const NamedRegExp = require('named-regexp-groups');
const Promise = require('bluebird');

const TICKER = (cb) => {
    if (typeof setImmediate === "function") {
        return setImmediate(cb);
    } else {
        process.nextTick(cb)
    }
};
export default class BaseCommand {

    _id;
    _permission = PERMISSIONS_ALL;
    _channel = CHANNELS_ALL;
    _enabled = true;
    log;
    _pattern = '';
    _fmt;
    _provider;

    constructor(robot, id) {
        this._id = id;
        this.robot = robot;
        this.log = createLogger(robot.logger, this.id);
        this.init();
        this._fmt = new this.provider.Formatter();
        this._users = this.provider.Users(robot);
        this.log.debug('Added %s Command', this.id);
        this._pattern = this._buildRegex();
    }

    get provider() {
        return this.brain.get('provider');
    }

    userResolve(resp) {
        let name = typeof resp === 'string' ? resp : resp.envelope.user.name;
        return this._users.byName(name);

    }

    userResolveId(resp) {
        let user = this.userResolve(resp);
        return user && user.id ? '' + user.id : null;
    }

    /**
     * @return PermissionStorage
     */
    get permissions() {
        return this.brain.get('permissions');
    }

    addPermissions(current, toAdd) {
        return addPermissions(current, toAdd)
    }

    getTimezone(idOrName) {
        let user = this.userResolve(++idOrName);
        if (!user) user = this.brain.userForId(idOrName);

        if (user && user.slack.tz) {
            return user.slack.tz;
        }
        return 'America/Chicago';

    }

    get fmt() {
        return this._fmt;
    }

    get text() {
        return new TextBuilder(this._fmt);
    }

    get id() {
        return this._id;
    }

    init() {

        if (this._permission.constructor === String) {
            this._permission = PERMISSIONS.get(this._permission);
        }
        if (this._channel.constructor === String) {
            this._channel = CHANNELS.get(this._channel);
        }
        this.log.debug('Called init() for %s', this.id);
    }

    get brain() {
        return this.robot.brain;
    }

    mount() {

        const options = {
            id: this._id,
            permission: this._permission,
            channel: this._channel
        };

        this.log.debug('Mounting %s Command with options = %j', this.id, options);
        this.robot.listeners.push(new AsyncListener(this.robot, this._matcher.bind(this),
            options, this._handle.bind(this)));
    }

    unmount() {

    }

    _handle(response) {

    }

    _matcher(message) {

        if (!this._enabled) {
            return false;
        }

        let text = message.text || message.message && message.message.text;
        let isDM = this.provider.Checks.isDM(this.robot, message.room);
        let match;
        if (isDM && this._pattern.dm) {
            match = this._pattern.dm.exec(text);
        } else {
            match = this._pattern.public.exec(text);
        }

        if (match) {
            this.log.debug('Matched message %s with %j', text, match.groups);
        }
        return match;

    }

    _createPatterns() {
        return this.provider.Pattern(this.id, this._pattern);
    }

    _buildRegex() {
        let pattern = this._createPatterns();

        this.log.debug('Creating matcher for %s = %j', this.id, pattern);

        const regex = (value) => {
            if (!value) return null;
            if (pattern.flags) {
                return new NamedRegExp(value, pattern.flags)
            }
            return new NamedRegExp(value);
        };

        return {
            dm: regex(pattern.dm),
            public: regex(pattern.public)
        }

    }
}

class AsyncListener extends Listener {

    call(message, middleware, cb) {
        let match;

        // middleware argument is optional
        if (cb === null && typeof middleware === 'function') {
            cb = middleware;
            middleware = undefined;
        }

        // ensure we have a Middleware object
        if (middleware === null) {
            middleware = new Middleware(this.robot);
        }

        if (match = this.matcher(message)) {
            if (this.regex) {
                this.robot.logger.debug(
                    `Message '${message}' matched regex /${inspect(this.regex)}/;
          listener.options = ${inspect(this.options)}`
                );
            }
            // special middleware-like function that always executes the Listener's
            // callback and calls done (never calls 'next')
            let executeListener = (context, done) => {
                this.robot.logger.debug(
                    `ASYNC Executing listener callback for Message \'${message}\'`);
                let p = Promise.resolve(true);
                let rtn;
                try {

                    p = Promise.resolve(this.callback(context.response));
                } catch (err) {
                    this.robot.emit('error', err, context.response);
                }
                p.then((v) => {
                    return done();
                })

            };

            // When everything is finished (down the middleware stack and back up),
            // pass control back to the robot
            let allDone = () => {
                // Yes, we tried to execute the listener callback (middleware may
                // have intercepted before actually executing though)
                if (cb) {
                    TICKER(() => cb(true));
                }
            };

            let response = new this.robot.Response(this.robot, message, match);
            middleware.execute({
                listener: this,
                response,
            }, executeListener, allDone);
            return true;
        } else {
            if (cb) {
                // No, we didn't try to execute the listener callback
                process.nextTick(() => cb(false));
            }
            return false;
        }
    }

}