text:
#import <Foundation/Foundation.h>
#import "S3Response.h"

@class S3ListBucketsResult;

/** Contains the response from a listBuckets operation.
 *
 */
@interface S3ListBucketsResponse:S3Response {
    S3ListBucketsResult *listBucketsResult;
}

/** The result of the listBuckets operations. Contains the list of buckets. */
@property (nonatomic, retain) S3ListBucketsResult *listBucketsResult;

@end


text:
from django.conf.urls import patterns, url

from cbv import views

urlpatterns = patterns('',
    url(r'(?P<klass>[a-zA-Z_-]+)/$', views.LatestKlassDetailView.as_view(), name='klass-detail-shortcut'),
)

redpajama_set_name: RedPajamaGithub


text:
import java.io.Console;
// June 2017, JMI
// Program to do ask user input for what they ate, then to print the given input.

public class MealTime {
    public static void main(String[] args) {
        /* First iteration of MealTime, without using a custom method

        Console myConsole = System.console();
        System.out.println("What did you eat for breakfast?");
        String yourBreakfast = myConsole.readLine();
        yourBreakfast = yourBreakfast.toLowerCase(); // make string lowercase

        System.out.println("What did you eat for lunch?");
        String yourLunch = myConsole.readLine().toLowerCase(); // chaining the methods, since yourLunch is an object that is allowed

        System.out.println("What did you eat for dinner?");
        String yourDinner = myConsole.readLine().toLowerCase();

        System.out.println("You ate " + yourBreakfast + " for breakfast.");
        System.out.println("You ate " + yourLunch + " for lunch.");
        System.out.println("You ate " + yourDinner + " for dinner.");
        */
        askWhatYouAte("breakfast");
        askWhatYouAte("lunch");
        askWhatYouAte("dinner");
    } // end main

    public static void askWhatYouAte(String whichMeal) { // method to print the question to stdout, read from stdin, then call the regurgitateTheMeal method to print the gathered info
        Console myConsole = System.console();
        System.out.println("What did you eat for " + whichMeal + " ?");
        //String whichMeal = whichMeal;  //This is redundant, since "String whichMeal" is defined in the argument
        String mealName = myConsole.readLine().toLowerCase();
        regurgitateTheMeal(whichMeal, mealName);
    } // end askWhatYouAte method

    public static void regurgitateTheMeal(String whichMeal, String mealName) { // method to print the input given by user for the meal
        System.out.println("You ate " + mealName + " for " + whichMeal + ".");
    } // end regurgitateTheMeal method
} // end class MealTime


text:
<script type="text/javascript">
	var uTable = $("#user_table");
	var addUserForm = $('#add-user-form');
	var profileImageHolder = $('#image-holder');
	$(document).ready(function(){
		if (uTable[0]) {
			$.fn.editable.defaults.mode = 'inline';
			var aoColumnDefs = [
			{
				"aTargets": [0, 1, 5, 6,7],
				"bSortable": false
			}];
			usertableoptions = {
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				dom: "<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>rtp",
				buttons: [
					{extend: 'csv',title: 'Be Sure User Listing', className: 'btn-sm'},
					{extend: 'pdf', title: 'Be Sure User Listing', className: 'btn-sm'},
					{extend: 'print',className: 'btn-sm'}
				],
				"aoColumnDefs": aoColumnDefs,
				aaSorting: [[2, 'asc']],
				serverSide: true,
				processing: true,
				ajax: {
					url: "<?= @base_url('Dashboard/API/getUsers'); ?>",
					type: "POST",
					error: function(){
						console.log("There was an error pulling in your data");
					}
				},
				fnRowCallback: function( nRow, mData, iDisplayIndex){
					$('span[class^="user_"]', nRow).editable({
						source: [
							{value: "superadmin", text: 'Super Admin'},
							{value: "admin", text: "Admin"}
						]
					});
					return nRow;
				}
			};

			var oTable = uTable.DataTable(usertableoptions);
		}

		if(addUserForm[0]){
			addUserForm.validate({
				rules: {
					email: {
						required: true,
						email: true,
						remote: {
							url: "<?= @base_url('Dashboard/API/checkEmailExists'); ?>",
							type: "POST"
						}
					}
				},
				messages: {
					email: {
						required: "Please enter your email address.",
						email: "Please enter a valid email address.",
						remote: "Email already in use!"
					}
				}
			});
		}

		if(profileImageHolder[0]){
			profileImageHolder.hover(function(){
				$('#image-backdrop').show();
			}, function(){
				$('#image-backdrop').hide();
			});

			$('#image-backdrop').click(function(){
				$('input[name="user_avatar"]')[0].click();
			});

			$('input[name="user_avatar"]').change(function(){
				readURL(this);
				$('#save-changes').show();
			});

			toastr.options = {
				"debug": false,
				"newestOnTop": false,
				"positionClass": "toast-top-center",
				"closeButton": true,
				"toastClass": "animated fadeInDown",
			};
			var savechanges = $('#save-changes');
			var ladda_save = savechanges.ladda();

			$('#inputForm').submit(function(e){
				e.preventDefault();
				formdata = new FormData(this);
				$.ajax({
					url: "<?= @base_url('Dashboard/API/uploadUserImage'); ?>",
					type: "POST",
					data: formdata,
					processData: false,
					contentType: false,
					beforeSend: function(){
						ladda_save.ladda('start');
					},
					success: function(res){
						ladda_save.ladda('stop');
						toastr.success(res.message);
					},
					error: function(jqXHR, textStatus, error){
						ladda_save.ladda('stop');
						response = jqXHR.responseJSON;
						toastr.error(response.message);
					}
				});
			});

			$('#userdetailsForm').validate({
				rules: {
					user_firstname: {
						required: true
					},
					user_lastname: {
						required: true
					},
					user_username: {
						minlength: 5,
						remote: {
							url: "<?= @base_url('Dashboard/API/checkUsernameExists'); ?>",
							type: "POST"
						}
					},
					user_email: {
						required: true,
						email: true,
						remote: {
							url: "<?= @base_url('Dashboard/API/checkEmailExists'); ?>",
							type: "POST"
						}
					}
				},
				messages: {
					user_username: {
						remote: "This username is already in use"
					},
					user_email: {
						remote: "This email address is already in use"
					}
				}
			});

			$('#reset_password').click(function(){
				swal({
					title: "Confirmation!",
					text: "By requesting for a reset, your session will be closed and you will be required to go to your email and complete the process. Continue?",
					type: "info",
					showCancelButton: true,
					closeOnConfirm: false,
					showLoaderOnConfirm: false,
				}, function(){
					window.location = "<?php echo base_url('Dashboard/User/resetpass/' . $this->session->userdata('user_id')) ?>";
				});
			});
		}
	});

	function readURL(input) {

		if (input.files && input.files[0]) {
			var reader = new FileReader();

			reader.onload = function (e) {
				document.getElementById('image-holder').style.backgroundImage = "url(" + e.target.result + ")";
			}

			reader.readAsDataURL(input.files[0]);
		}
	}
</script>


text:
using aura::client::ActivationChangeObserver;

namespace ash {
namespace {

const char kDesktopTaskSwitchUserAction[] = "Desktop_SwitchTask";

// Test fixture for the DesktopTaskSwitchMetricsRecorder class. NOTE: This
// fixture extends AshTestBase so that the UserMetricsRecorder instance required
// by the test target can be obtained through Shell::GetInstance()->metrics()
// and the test target is not the same instance as the one owned by the
// UserMetricsRecorder instance.
class DesktopTaskSwitchMetricRecorderTest : public test::AshTestBase {
 public:
  DesktopTaskSwitchMetricRecorderTest();
  ~DesktopTaskSwitchMetricRecorderTest() override;

  // test::AshTestBase:
  void SetUp() override;
  void TearDown() override;

  // Resets the recorded user action counts.
  void ResetActionCounts();

  // Returns the number of times the "Desktop_SwitchTask" user action was
  // recorded.
  int GetActionCount() const;

  // Creates a positionable window such that wm::IsWindowUserPositionable(...)
  // would retun true.
  scoped_ptr<aura::Window> CreatePositionableWindow() const;

  // Creates a non-positionable window such that
  // wm::IsWindowUserPositionable(...) would retun false.
  scoped_ptr<aura::Window> CreateNonPositionableWindow() const;

  // Wrapper to notify the test target's OnWindowActivated(...) method that
  // |window| was activated due to an INPUT_EVENT.
  void ActiveTaskWindowWithUserInput(aura::Window* window);

 protected:
  // Records UMA user action counts.
  scoped_ptr<base::UserActionTester> user_action_tester_;

  // The test target.
  scoped_ptr<DesktopTaskSwitchMetricRecorder> metrics_recorder_;

 private:
  DISALLOW_COPY_AND_ASSIGN(DesktopTaskSwitchMetricRecorderTest);
};

DesktopTaskSwitchMetricRecorderTest::DesktopTaskSwitchMetricRecorderTest() {
}

DesktopTaskSwitchMetricRecorderTest::~DesktopTaskSwitchMetricRecorderTest() {
}

void DesktopTaskSwitchMetricRecorderTest::SetUp() {
  test::AshTestBase::SetUp();
  metrics_recorder_.reset(new DesktopTaskSwitchMetricRecorder);
  user_action_tester_.reset(new base::UserActionTester);
}

void DesktopTaskSwitchMetricRecorderTest::TearDown() {
  user_action_tester_.reset();
  metrics_recorder_.reset();
  test::AshTestBase::TearDown();
}

void DesktopTaskSwitchMetricRecorderTest::ActiveTaskWindowWithUserInput(
    aura::Window* window) {
  metrics_recorder_->OnWindowActivated(
      ActivationChangeObserver::ActivationReason::INPUT_EVENT, window, nullptr);
}

void DesktopTaskSwitchMetricRecorderTest::ResetActionCounts() {
  user_action_tester_->ResetCounts();
}

int DesktopTaskSwitchMetricRecorderTest::GetActionCount() const {
  return user_action_tester_->GetActionCount(kDesktopTaskSwitchUserAction);
}

scoped_ptr<aura::Window>
DesktopTaskSwitchMetricRecorderTest::CreatePositionableWindow() const {
  scoped_ptr<aura::Window> window(new aura::Window(
      aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
  window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
  window->Init(ui::LAYER_NOT_DRAWN);
  return window;
}

scoped_ptr<aura::Window>
DesktopTaskSwitchMetricRecorderTest::CreateNonPositionableWindow() const {
  scoped_ptr<aura::Window> window(new aura::Window(
      aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
  window->SetType(ui::wm::WINDOW_TYPE_UNKNOWN);
  window->Init(ui::LAYER_NOT_DRAWN);
  return window;
}

// Verify user action is recorded when a positionable window is activated given
// that a null window was activated last.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
       ActivatePositionableWindowWhenNullWindowWasActivatedLast) {
  scoped_ptr<aura::Window> null_window;
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();

  ActiveTaskWindowWithUserInput(null_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  EXPECT_EQ(1, GetActionCount());
}

// Verify user action is recorded whena positionable window is activated given
// a different positionable window was activated last.
TEST_F(
    DesktopTaskSwitchMetricRecorderTest,
    ActivatePositionableWindowWhenADifferentPositionableWindowWasActivatedLast) {
  scoped_ptr<aura::Window> positionable_window_1 = CreatePositionableWindow();
  scoped_ptr<aura::Window> positionable_window_2 = CreatePositionableWindow();

  ActiveTaskWindowWithUserInput(positionable_window_1.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(positionable_window_2.get());
  EXPECT_EQ(1, GetActionCount());
}

// Verify user action is not recorded when a positionable window is activated
// given the same positionable window was activated last.
TEST_F(
    DesktopTaskSwitchMetricRecorderTest,
    ActivatePositionableWindowWhenTheSamePositionableWindowWasActivatedLast) {
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  EXPECT_EQ(0, GetActionCount());
}

// Verify user action is recorded when a positionable window is activated given
// a non-positionable window was activated last.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
       ActivatePositionableWindowWhenANonPositionableWindowWasActivatedLast) {
  scoped_ptr<aura::Window> non_positionable_window =
      CreateNonPositionableWindow();
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();

  ActiveTaskWindowWithUserInput(non_positionable_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  EXPECT_EQ(1, GetActionCount());
}

// Verify user action is not recorded when a non-positionable window is
// activated between two activations of the same positionable window.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
       ActivateNonPositionableWindowBetweenTwoPositionableWindowActivations) {
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
  scoped_ptr<aura::Window> non_positionable_window =
      CreateNonPositionableWindow();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(non_positionable_window.get());
  EXPECT_EQ(0, GetActionCount());

  ActiveTaskWindowWithUserInput(positionable_window.get());
  EXPECT_EQ(0, GetActionCount());
}

// Verify user action is not recorded when a null window is activated.
TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNullWindow) {
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
  scoped_ptr<aura::Window> null_window = nullptr;

  ActiveTaskWindowWithUserInput(positionable_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(null_window.get());
  EXPECT_EQ(0, GetActionCount());
}

// Verify user action is not recorded when a non-positionable window is
// activated.
TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNonPositionableWindow) {
  scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
  scoped_ptr<aura::Window> non_positionable_window =
      CreateNonPositionableWindow();

  ActiveTaskWindowWithUserInput(positionable_window.get());
  ResetActionCounts();

  ActiveTaskWindowWithUserInput(non_positionable_window.get());
  EXPECT_EQ(0, GetActionCount());
}

// Verify user action is not recorded when the ActivationReason is not an
// INPUT_EVENT.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
       ActivatePositionableWindowWithNonInputEventReason) {
  scoped_ptr<aura::Window> positionable_window_1 = CreatePositionableWindow();
  scoped_ptr<aura::Window> positionable_window_2 = CreatePositionableWindow();

  ActiveTaskWindowWithUserInput(positionable_window_1.get());
  ResetActionCounts();

  metrics_recorder_->OnWindowActivated(
      ActivationChangeObserver::ActivationReason::ACTIVATION_CLIENT,
      positionable_window_2.get(), nullptr);
  EXPECT_EQ(0, GetActionCount());
}

// Test fixture to test the integration of the DesktopTaskSwitchMetricsRecorder
// class with ash::Shell environment.
class DesktopTaskSwitchMetricRecorderWithShellIntegrationTest
    : public test::AshTestBase {
 public:
  DesktopTaskSwitchMetricRecorderWithShellIntegrationTest();
  ~DesktopTaskSwitchMetricRecorderWithShellIntegrationTest() override;

  // test::AshTestBase:
  void SetUp() override;
  void TearDown() override;

  // Returns the number of times the "Desktop_SwitchTask" user action was
  // recorded.
  int GetActionCount() const;

  // Creates a positionable window with the given |bounds| such that
  // wm::IsWindowUserPositionable(...) would retun true.
  aura::Window* CreatePositionableWindowInShellWithBounds(
      const gfx::Rect& bounds);

 protected:
  // Records UMA user action counts.
  scoped_ptr<base::UserActionTester> user_action_tester_;

  // Delegate used when creating new windows using the
  // CreatePositionableWindowInShellWithBounds(...) method.
  aura::test::TestWindowDelegate test_window_delegate_;

 private:
  DISALLOW_COPY_AND_ASSIGN(
      DesktopTaskSwitchMetricRecorderWithShellIntegrationTest);
};

DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::
    DesktopTaskSwitchMetricRecorderWithShellIntegrationTest() {
}

DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::
    ~DesktopTaskSwitchMetricRecorderWithShellIntegrationTest() {
}

void DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::SetUp() {
  test::AshTestBase::SetUp();
  user_action_tester_.reset(new base::UserActionTester);
}

void DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::TearDown() {
  user_action_tester_.reset();
  test::AshTestBase::TearDown();
}

int DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::GetActionCount()
    const {
  return user_action_tester_->GetActionCount(kDesktopTaskSwitchUserAction);
}

aura::Window* DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::
    CreatePositionableWindowInShellWithBounds(const gfx::Rect& bounds) {
  return CreateTestWindowInShellWithDelegate(&test_window_delegate_, 0, bounds);
}

// Verify a user action is recorded when a positionable window is activated by
// a INPUT_EVENT.
TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest,
       ActivatePositionableWindowWithInputEvent) {
  aura::Window* positionable_window =
      CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10));

  ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow());

  event_generator.MoveMouseToCenterOf(positionable_window);
  event_generator.ClickLeftButton();

  EXPECT_EQ(1, GetActionCount());
}

// Verify a user action is not recorded when a positionable window is activated
// by a non INPUT_EVENT.
TEST_F(DesktopTaskSwitchMetricRecorderWithShellIntegrationTest,
       ActivatePositionableWindowWithNonInputEvent) {
  aura::Window* positionable_window =
      CreatePositionableWindowInShellWithBounds(gfx::Rect(0, 0, 10, 10));

  Shell::GetInstance()->activation_client()->ActivateWindow(
      positionable_window);

  EXPECT_EQ(0, GetActionCount());
}

}  // namespace
}  // namespace ash


text:
var sliceplane = (function(module) {

    module.Plane = function(viewer, dir) {
        this.viewer = viewer;
        this.dir = dir;
        this._visible = false;
        this._angle = 0;
    }

    module.Plane.prototype.setData = function(active) {
	if (this.viewer.active.vertex) {
	    return;
	}
        this.scene = viewer.views[0].scene;

        this.uniforms = THREE.UniformsUtils.merge( [
            THREE.UniformsLib[ "lights" ],
            {
                diffuse:    { type:'v3', value:new THREE.Vector3( .4,.4,.4 )},
                specular:   { type:'v3', value:new THREE.Vector3( 0, 0, 0)},
                emissive:   { type:'v3', value:new THREE.Vector3( .6,.6,.6 )},
                shininess:  { type:'f',  value:1},

                framemix:   { type:'f',  value:0},

                colormap:   { type:'t',  value:0, texture: null },
                vmin:       { type:'fv1',value:[0,0]},
                vmax:       { type:'fv1',value:[1,1]},

                voxlineColor:{type:'v3', value:new THREE.Vector3( 0,0,0 )},
                voxlineWidth:{type:'f', value:viewopts.voxline_width},
            }
        ]);
        this.uniforms.data = active.uniforms.data;
        this.uniforms.dataAlpha = active.uniforms.dataAlpha;
        this.uniforms.mosaic = active.uniforms.mosaic;
        this.uniforms.dshape = active.uniforms.dshape;
        this.uniforms.volxfm = active.uniforms.volxfm;
        this.uniforms.colormap = active.cmap[0];
        //this.uniforms.colormap.texture = viewer.uniforms.colormap.texture;
        this.uniforms.vmin.value = active.vmin[0].value;
        this.uniforms.vmax.value = active.vmax[0].value;

        if (this.mesh !== undefined) {
            this.scene.remove(this.object);
            this.geometry.dispose();
            this.shader.dispose();
        }

        this.object = new THREE.Group();

        this.geometry = new THREE.PlaneGeometry();
        this.geometry.dynamic = true;
        this._makeShader(active);

        this.mesh = new THREE.Mesh(this.geometry, this.shader);
        this.mesh.doubleSided = true;

        this.object.add(this.mesh);
        //this.scene.add(this.mesh);
        this.scene.add(this.object);
        //viewer.surfs[0].surf.pivots.left.back.add(this.mesh);

        // var wiremat = new THREE.LineBasicMaterial({color:0xffffff, linewidth:2});
        // this.wireframe = new THREE.Line(this.geometry, wiremat);
        // this.scene.add(this.wireframe);

        this.viewer.addEventListener("setData", this.update.bind(this));
        this.update();
    }

    module.Plane.prototype._makeShader = function(active) {
        var raw = active === undefined ? false : active.data[0].raw;
        var twod = active == undefined ? false : active.data.length > 1;
        // var shaders = Shaders.main("nearest", raw, twod, viewopts.voxlines, 0, false);
        // var shader_func = Shaders.surface_pixel;
        var opts = {sampler: "nearest",
                    raw: raw,
                    twod: twod,
                    voxline: false,
                    viewspace: true};
        var shaders = Shaders.main(opts);
        //var shadecode = Shaders.surface_pixel(opts);
        this.shader = new THREE.ShaderMaterial({
            vertexShader:shaders.vertex,
            fragmentShader:shaders.fragment,
            uniforms: this.uniforms,
            lights:true,
            blending:THREE.CustomBlending,
            transparent:true,
            side:THREE.DoubleSide,
            // depthWrite:false
        });
    }
    module.Plane.prototype.update = function(slice) {
	if (this.viewer.active.vertex) {
	    return;
	}
        //var brain = this.viewer.active.data[0];
        var dshape = this.viewer.active.uniforms.dshape.value[0];
        var mosaic = this.viewer.active.uniforms.mosaic.value[0];
        var shape = [dshape.x, dshape.y, this.viewer.active.data[0].numslices];

        if (slice === undefined || slice.type !== undefined)
            slice = Math.round(shape[this.dir] / 2);

        this.shape = shape;
        this.slice = slice;

        var xfm = this.viewer.active.uniforms.volxfm.value[0];
        var imat = new THREE.Matrix4()
        imat.getInverse(xfm);

        if (this.dir == 0) {
            imat.multiplyVector3(this.geometry.vertices[0].set(slice,-0.5,-0.5));
            imat.multiplyVector3(this.geometry.vertices[1].set(slice,-0.5, shape[2]-0.5));
            imat.multiplyVector3(this.geometry.vertices[2].set(slice,shape[1]-0.5,-0.5));
            imat.multiplyVector3(this.geometry.vertices[3].set(slice,shape[1]-0.5,shape[2]-0.5));
        } else if (this.dir == 1) {
            imat.multiplyVector3(this.geometry.vertices[0].set(-0.5,slice,-0.5));
            imat.multiplyVector3(this.geometry.vertices[1].set(-0.5,slice,shape[2]-0.5));
            imat.multiplyVector3(this.geometry.vertices[2].set(shape[0]-0.5,slice,-0.5));
            imat.multiplyVector3(this.geometry.vertices[3].set(shape[0]-0.5,slice,shape[2]-0.5));
        } else if (this.dir == 2) {
            imat.multiplyVector3(this.geometry.vertices[0].set(-0.5,-0.5,slice));
            imat.multiplyVector3(this.geometry.vertices[1].set(-0.5,shape[1]-0.5,slice));
            imat.multiplyVector3(this.geometry.vertices[2].set(shape[0]-0.5,-0.5,slice));
            imat.multiplyVector3(this.geometry.vertices[3].set(shape[0]-0.5,shape[1]-0.5,slice));
        }

        this.geometry.computeBoundingSphere();
        var center = this.geometry.boundingSphere.center;
        this.object.position.copy(center);

        var trans = new THREE.Matrix4().makeTranslation(-center.x, -center.y, -center.z);
        this.geometry.applyMatrix(trans);

        this.geometry.computeFaceNormals();
        this.geometry.computeVertexNormals();
        this.geometry.verticesNeedUpdate = true;
        this.geometry.normalsNeedUpdate = true;

        // this._makeShader(this.viewer.active);
        // this.mesh.material = this.shader;

        this.setVisible(this._visible);
        this.viewer.schedule();
    }
    module.Plane.prototype.next = function() {

        this.setSmoothSlice((Math.round(this.slice+1)).mod(this.shape[this.dir]) / this.shape[this.dir]);
    }
    module.Plane.prototype.prev = function() {
        this.setSmoothSlice((Math.round(this.slice-1)).mod(this.shape[this.dir]) / this.shape[this.dir]);
    }
    module.Plane.prototype.setSmoothSlice = function(slice_fraction) {
        if (slice_fraction === undefined)
            if (this.slice === undefined)
                return 0.5;
            else
                return this.slice / this.shape[this.dir];

        this.update(slice_fraction * this.shape[this.dir]);
    }
    module.Plane.prototype.setAngle = function(angle) {
        if (angle === undefined)
            return this._angle;

        var axis;
        var xfm = this.viewer.active.uniforms.volxfm.value[0];
        var imat = new THREE.Matrix4();
        imat.getInverse(xfm);
        var rot_imat = (new THREE.Matrix4).extractRotation(imat);

        if (this.dir == 0) {
            axis = (new THREE.Vector3(0,1,0)).applyMatrix4(rot_imat);
        } else if (this.dir == 1) {
            axis = (new THREE.Vector3(1,0,0)).applyMatrix4(rot_imat);
        } else if (this.dir == 2) {
            axis = (new THREE.Vector3(0,1,0)).applyMatrix4(rot_imat);
        }

        axis.normalize();

        this.mesh.rotation.set(0,0,0);
        this.mesh.rotateOnAxis(axis, angle / 180 * Math.PI);
    }
    module.Plane.prototype.setVisible = function(val) {
        if (val === undefined)
            return this._visible;

        this._visible = val;

        if (this.mesh !== undefined)
            this.mesh.visible = this._visible;
    }

    module.MIP = function(viewer) {

    }

    return module;
}(sliceplane || {}));


text:
(function() {
    'use strict';

    var $panel = $bundle.filter('.twitter');
    var $take = $panel.find('button[command="take"]');
    var $show = $panel.find('button[command="show"]');
    var $hide = $panel.find('button[command="hide"]');
    var $pulse = $panel.find('button[command="pulse"]');
    var $preview = $panel.find('.js-preview');
    var $program = $panel.find('.js-program');

    var tweet = nodecg.Replicant('tweet')
        .on('change', function(oldVal, newVal) {
            $program.find('.js-id').val(newVal.id);
            $program.find('.js-content').val(newVal.text);
        });

    var tweetShowing = nodecg.Replicant('tweetShowing')
        .on('change', function(oldVal, newVal) {
            $show.prop('disabled', newVal);
            $pulse.prop('disabled', newVal);
            $hide.prop('disabled', !newVal);

            // When this changes, disable the "take" button for a bit
            if ($take.data('cooldownTimer')) {
                clearTimeout($take.data('cooldownTimer'));
            }

            $take.prop('disabled', true);
            $take.data('cooldownTimer', setTimeout(function() {
                $take.prop('disabled', false);
            }, 1000));
        });

    nodecg.Replicant('tweetPulsing')
        .on('change', function(oldVal, newVal) {
            $hide.prop('disabled', !tweetShowing.value ? true : newVal);
        });

    $take.click(function () {
        nodecg.sendMessage('getTweet', $preview.find('.js-url').val());
    });

    $show.click(function () {
        tweetShowing.value = true;
    });

    $hide.click(function () {
        tweetShowing.value = false;
    });

    $pulse.click(function () {
        nodecg.sendMessage('pulseTweet', $(this).data('duration'));
    });
})();


text:
package org.netbeans.modules.multilangsourcefilepalette.python.Files.WriteFile;

import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import org.netbeans.modules.multilangsourcefilepalette.PaletteUtilities;
import org.openide.text.ActiveEditorDrop;

/**
 * @author Ozias Gonet
 * @author Joseph Agwanda
 * @version 8.65
 */
public class WriteFile implements ActiveEditorDrop {

    private String comment = "";
    private String outputFile = "";
    private String output = "";

    /**
     * Code to be inserted into the GUI text editor.
     *
     * @return the code.
     */
    public String createBody() {
        String body = "";

        if (!comment.equals("")) body += "# " + comment + "\n";

        body += String.format("print(\"%s\",file=\"%s\")",output, outputFile);

         return body;
    }

    /**
     * Protocol to insert text into GUI text editor.
     *
     * @return whether operation was a success.
     */
    @Override
    public boolean handleTransfer(JTextComponent targetComponent) {
        WriteFileCustomizer c = new WriteFileCustomizer(this, targetComponent);
        boolean accept = c.showDialog();
        if (accept) {
            String body = createBody();
            try {
                PaletteUtilities.insert(body, targetComponent);
            } catch (BadLocationException ble) {
                accept = false;
            }
        }
        return accept;
    }

    /**
     * The setter that works with the Customizer class
     *
     * @param comment the comment to be set.
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    public void setOutputFile(String outputFile) {
        this.outputFile = outputFile;
    }

    public void setOutput(String output) {
        this.output = output;
    }
}


text:
package meshconn

import (
	"errors"
	"net"
	"time"

	"github.com/weaveworks/mesh"
)

var (
	// ErrShortRead is returned by ReadFrom when the
	// passed buffer is too small for the packet.
	ErrShortRead = errors.New("short read")

	// ErrPeerClosed is returned by ReadFrom and WriteTo
	// when the peer is closed during the operation.
	ErrPeerClosed = errors.New("peer closed")

	// ErrGossipNotRegistered is returned by Write to when attempting
	// to write before a mesh.Gossip has been registered in the peer.
	ErrGossipNotRegistered = errors.New("gossip not registered")

	// ErrNotMeshAddr is returned by WriteTo when attempting
	// to write to a non-mesh address.
	ErrNotMeshAddr = errors.New("not a mesh addr")

	// ErrNotSupported is returned by methods that are not supported.
	ErrNotSupported = errors.New("not supported")
)

// Peer implements mesh.Gossiper and net.PacketConn.
type Peer struct {
	name    mesh.PeerName
	uid     mesh.PeerUID
	gossip  mesh.Gossip
	recv    chan pkt
	actions chan func()
	quit    chan struct{}
	logger  mesh.Logger
}

// NewPeer returns a Peer, which can be used as a net.PacketConn.
// Clients must Register a mesh.Gossip before calling ReadFrom or WriteTo.
// Clients should aggressively consume from ReadFrom.
func NewPeer(name mesh.PeerName, uid mesh.PeerUID, logger mesh.Logger) *Peer {
	p := &Peer{
		name:    name,
		uid:     uid,
		gossip:  nil, // initially no gossip
		recv:    make(chan pkt),
		actions: make(chan func()),
		quit:    make(chan struct{}),
		logger:  logger,
	}
	go p.loop()
	return p
}

func (p *Peer) loop() {
	for {
		select {
		case f := <-p.actions:
			f()
		case <-p.quit:
			return
		}
	}
}

// Register injects the mesh.Gossip and enables full-duplex communication.
// Clients should consume from ReadFrom without blocking.
func (p *Peer) Register(gossip mesh.Gossip) {
	p.actions <- func() { p.gossip = gossip }
}

// ReadFrom implements net.PacketConn.
// Clients should consume from ReadFrom without blocking.
func (p *Peer) ReadFrom(b []byte) (n int, remote net.Addr, err error) {
	c := make(chan struct{})
	p.actions <- func() {
		go func() { // so as not to block loop
			defer close(c)
			select {
			case pkt := <-p.recv:
				n = copy(b, pkt.Buf)
				remote = MeshAddr{PeerName: pkt.SrcName, PeerUID: pkt.SrcUID}
				if n < len(pkt.Buf) {
					err = ErrShortRead
				}
			case <-p.quit:
				err = ErrPeerClosed
			}
		}()
	}
	<-c
	return n, remote, err
}

// WriteTo implements net.PacketConn.
func (p *Peer) WriteTo(b []byte, dst net.Addr) (n int, err error) {
	c := make(chan struct{})
	p.actions <- func() {
		defer close(c)
		if p.gossip == nil {
			err = ErrGossipNotRegistered
			return
		}
		meshAddr, ok := dst.(MeshAddr)
		if !ok {
			err = ErrNotMeshAddr
			return
		}
		pkt := pkt{SrcName: p.name, SrcUID: p.uid, Buf: b}
		if meshAddr.PeerName == p.name {
			p.recv <- pkt
			return
		}
		// TODO(pb): detect and support broadcast
		buf := pkt.encode()
		n = len(buf)
		err = p.gossip.GossipUnicast(meshAddr.PeerName, buf)
	}
	<-c
	return n, err
}

// Close implements net.PacketConn.
func (p *Peer) Close() error {
	close(p.quit)
	return nil
}

// LocalAddr implements net.PacketConn.
func (p *Peer) LocalAddr() net.Addr {
	return MeshAddr{PeerName: p.name, PeerUID: p.uid}
}

// SetDeadline implements net.PacketConn.
// SetDeadline is not supported.
func (p *Peer) SetDeadline(time.Time) error {
	return ErrNotSupported
}

// SetReadDeadline implements net.PacketConn.
// SetReadDeadline is not supported.
func (p *Peer) SetReadDeadline(time.Time) error {
	return ErrNotSupported
}

// SetWriteDeadline implements net.PacketConn.
// SetWriteDeadline is not supported.
func (p *Peer) SetWriteDeadline(time.Time) error {
	return ErrNotSupported
}

// Gossip implements mesh.Gossiper.
func (p *Peer) Gossip() (complete mesh.GossipData) {
	return pktSlice{} // we're stateless
}

// OnGossip implements mesh.Gossiper.
// The buf is a single pkt.
func (p *Peer) OnGossip(buf []byte) (delta mesh.GossipData, err error) {
	return pktSlice{makePkt(buf)}, nil
}

// OnGossipBroadcast implements mesh.Gossiper.
// The buf is a single pkt
func (p *Peer) OnGossipBroadcast(_ mesh.PeerName, buf []byte) (received mesh.GossipData, err error) {
	pkt := makePkt(buf)
	p.recv <- pkt // to ReadFrom
	return pktSlice{pkt}, nil
}

// OnGossipUnicast implements mesh.Gossiper.
// The buf is a single pkt.
func (p *Peer) OnGossipUnicast(_ mesh.PeerName, buf []byte) error {
	pkt := makePkt(buf)
	p.recv <- pkt // to ReadFrom
	return nil
}


text:
/**************************************************************/
/*                                                            */
/*      Copyright Mentor Graphics Corporation 2006 - 2015     */
/*                  All Rights Reserved                       */
/*                                                            */
/*       THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY      */
/*         INFORMATION WHICH IS THE PROPERTY OF MENTOR        */
/*         GRAPHICS CORPORATION OR ITS LICENSORS AND IS       */
/*                 SUBJECT TO LICENSE TERMS.                  */
/*                                                            */
/**************************************************************/

//*<
//* Generated By Model Builder, Mentor Graphics Computer Systems, Inc.
//*
//* This file is write protected.
//* DO NOT MODIFY THIS FILE.
//*
//* This file is generated according to the parameters in the
//* Model Builder form.
//* This class contains the infrastructure to define the behavior of the component.
//* The WaveSampleGenerator_pv will be derived from this class.
//*
//* Model Builder version: 4.2.1
//* Generated on: Aug. 15, 2016 06:02:58 PM, (user: kenm)
//*>

#pragma once

#include "model_builder.h"

#ifdef MODEL_BUILDER_VERSION_NUMBER
#if 4201 != MODEL_BUILDER_VERSION_NUMBER
#error "This model was generated using Model Builder version: 4.2.1. Please regenerate model."
#endif
#else
#error "Please regenerate model."
#endif

#include "generic_protocol.h"

using namespace ::tlm;

class WaveSampleGenerator_pv_base;
class WaveSampleGenerator_pv_base_mb_compatibility : public mb::mb_module {
  friend class WaveSampleGenerator_pv_base;
 public:
  typedef unsigned int mb_address_type;
 protected:
  WaveSampleGenerator_pv_base_mb_compatibility(sc_core::sc_module_name& module_name)
    : mb::mb_module(module_name) {}

  ////////////////////////////////////////
  // functions for target port: Slave
  ////////////////////////////////////////
  protected:
   virtual bool Slave_callback_read(mb_address_type address,
                                                      unsigned char* data,
                                                      unsigned size) {
     return true;
   }
   virtual bool Slave_callback_write(mb_address_type address,
                                                       unsigned char* data,
                                                       unsigned size) {
     return true;
   }
   virtual unsigned Slave_callback_read_dbg(mb_address_type address,
                                                              unsigned char* data,
                                                              unsigned size) {
     return 0;
   }
   virtual unsigned Slave_callback_write_dbg(mb_address_type address,
                                                               unsigned char* data,
                                                               unsigned size) {
     return 0;
   }
   virtual bool Slave_get_direct_memory_ptr(mb_address_type address,
                                                              tlm::tlm_dmi& dmiData) {
     return false;
   }
};

class WaveSampleGenerator_pv_base_parameters {
 public :
  WaveSampleGenerator_pv_base_parameters(sc_object* object);
  void print_parameters();

 protected:
  sc_object* m_object;

  sc_core::sc_time clock;
  sc_core::sc_time generic_clock;
  double nominal_voltage;
  bool mb_debug;
  bool call_to_default_if;
  bool verbose_parameters;
  bool dmi_enabled;
  const char* warning_level;
  unsigned int Slave_pipeline_length;
  unsigned int Max;
  unsigned int Min;
  sc_core::sc_time Period;
  const char* Type;
};

class WaveSampleGenerator_pv_base : public WaveSampleGenerator_pv_base_mb_compatibility,
                           public WaveSampleGenerator_pv_base_parameters
{
 private:
  typedef WaveSampleGenerator_pv_base_mb_compatibility mb_compatibility_class;
  typedef WaveSampleGenerator_pv_base_mb_compatibility BASE_TYPE;
 public:
  typedef esl::tlm_types::Address mb_address_type;
 public:
  typedef WaveSampleGenerator_pv_base self;
  SC_HAS_PROCESS(WaveSampleGenerator_pv_base);
  WaveSampleGenerator_pv_base(sc_core::sc_module_name& module_name);
  virtual void reset_registers();
  virtual void reset_model();
  enum port_enum {Slave_idx = 0 };

 private:

  mb::tlm20::fw_process<tlm::tlm_base_protocol_types> m_Slave_fw_process;

 protected:

  virtual void Slave_callback(tlm::tlm_base_protocol_types::tlm_payload_type& trans, sc_core::sc_time& t) {
    bool status;

    if (mb_debug) {
      std::cout.unsetf(std::ios::showbase);
      bool isWrite = trans.is_write();
      unsigned char* data = trans.get_data_ptr();
      sc_dt::uint64 address = trans.get_address();
      unsigned size = trans.get_data_length();
      std::cout << this->name() << "::Slave_callback_" <<
        (isWrite ? "write" : "read") << ", address = 0x" << std::hex << address;
      if (isWrite) {
        std::cout << ", data = {";
        std::cout << std::hex;
        for (unsigned u=0; u<size; u++) {
          std::cout << "0x" << (unsigned int)(data[u]);
          if (u+1 != size) {
            std::cout << ", ";
          }
        }
        std::cout << std::dec << "}";
      }
      std::cout << ", size = " << std::dec << size << std::endl;
    }
    if (trans.get_byte_enable_ptr() && trans.get_byte_enable_length()) {
      std::stringstream str;
      str << std::showbase << std::hex;
      if (trans.is_write())
        str << "writing to address " << trans.get_address() << " : byte enable pointer defined but not used ";
      else
        str << "reading from address " << trans.get_address() << " : byte enable pointer defined but not used ";
      mb::sysc::complain(str.str().c_str(), this->name());
    }
    payload_for_token = &trans;

    if (trans.is_write()) {
      status = Slave_callback_write(trans.get_address(), trans.get_data_ptr(), trans.get_data_length());
    } else if (trans.is_read()) {
      status = Slave_callback_read(trans.get_address(), trans.get_data_ptr(), trans.get_data_length());
    } else {
      status = false;
    }
    payload_for_token = 0;

    tlm::tlm_response_status trans_status = trans.get_response_status();
    if (trans_status == tlm::TLM_INCOMPLETE_RESPONSE ||
        trans_status == tlm::TLM_OK_RESPONSE)
      trans.set_response_status(status ? TLM_OK_RESPONSE : TLM_GENERIC_ERROR_RESPONSE);
  }

  virtual unsigned Slave_callback_dbg(tlm::tlm_base_protocol_types::tlm_payload_type& trans) {

    unsigned status = 0;
    if (trans.is_write()) {
      status = Slave_callback_write_dbg(trans.get_address(), trans.get_data_ptr(), trans.get_data_length());
    } else if (trans.is_read()) {
      status = Slave_callback_read_dbg(trans.get_address(), trans.get_data_ptr(), trans.get_data_length());
    }

    return status;
  }

  virtual bool Slave_get_direct_memory_ptr_callback(tlm::tlm_base_protocol_types::tlm_payload_type& trans,
                                                                      tlm::tlm_dmi& dmiData) {
    if (trans.get_command() == tlm::TLM_IGNORE_COMMAND)
      return false;
    payload_on_stack = &trans;
    bool ret_value = Slave_get_direct_memory_ptr(trans.get_address(), dmiData);
    if (ret_value) {
      get_dmi_delay_cb(trans, dmiData, Slave_idx);
    }
    payload_on_stack = 0;
    return ret_value;
  }

  virtual void get_dmi_delay_cb(tlm::tlm_generic_payload& trans, tlm::tlm_dmi& dmiData, unsigned port_index) {
    sc_time t = sc_core::SC_ZERO_TIME;

    getPVTBaseModel()->get_write_delay_for_dmi(port_index, trans, t);
    dmiData.set_write_latency(t);
    t = sc_core::SC_ZERO_TIME;
    getPVTBaseModel()->get_read_delay_for_dmi(port_index, trans, t);
    dmiData.set_read_latency(t);

  }

  virtual void invalidate_direct_mem_ptr_callback(unsigned master_index, sc_dt::uint64 start_range, sc_dt::uint64 end_range) {
  }

 public:

  tlm::tlm_generic_payload* payload_on_stack;
  tlm::tlm_generic_payload* payload_for_token;

  ////////////////////////////////////////
  // functions for target port: Slave
  ////////////////////////////////////////
  protected:
  virtual bool Slave_callback_read(mb_address_type address,
                                                      unsigned char* data,
                                                      unsigned size) {
    mb_address_type local_address = address;
     mb_compatibility_class *This = this;
     return This->Slave_callback_read(mb_compatibility_class::mb_address_type(local_address),
                                                        data,
                                                        size);
   }
   virtual bool Slave_callback_write(mb_address_type address,
                                                       unsigned char* data,
                                                       unsigned size) {
     mb_address_type local_address = address;
     mb_compatibility_class *This = this;
     return This->Slave_callback_write(mb_compatibility_class::mb_address_type(local_address),
                                                         data,
                                                         size);
   }

   virtual unsigned Slave_callback_read_dbg(mb_address_type address,
                                                              unsigned char* data,
                                                              unsigned size) {
     mb_compatibility_class *This = this;
     return This->Slave_callback_read_dbg(mb_compatibility_class::mb_address_type(address),
                                                            data,
                                                            size);
   }
   virtual unsigned Slave_callback_write_dbg(mb_address_type address,
                                                               unsigned char* data,
                                                               unsigned size) {
     mb_compatibility_class *This = this;
     return This->Slave_callback_write_dbg(mb_compatibility_class::mb_address_type(address),
                                                             data,
                                                             size);
   }
   virtual bool Slave_get_direct_memory_ptr(mb_address_type address, tlm::tlm_dmi& dmiData) {
     mb_compatibility_class *This = this;
     return This->Slave_get_direct_memory_ptr(mb_compatibility_class::mb_address_type(address), dmiData);
   }

 public:
  typedef tlm::tlm_base_protocol_types Slave_protocol_types;
  typedef tlm::tlm_base_protocol_types::tlm_payload_type Slave_payload_type;

 public:
  // port declarations

  tlm::tlm_target_socket <16, tlm::tlm_base_protocol_types>  Slave;

 public:
  mb::mb_token_ptr get_current_token() {
    mb::mb_token_ptr token_ptr = mb_module::get_current_token();
    if (token_ptr)
      return token_ptr;
    if (payload_for_token) {
      mb::tlm20::pvt_ext* extension = mb::tlm20::setup_pvt_ext(*payload_for_token);
      if (extension) {
        mb_module::set_current_token(extension->getToken());
        return extension->getToken();
      }
    }
    return 0;
  }

 protected:
  mb::mb_variable<int> Waveform;
};

/**************************************************************/
/*                                                            */
/*      Copyright Mentor Graphics Corporation 2006 - 2015     */
/*                  All Rights Reserved                       */
/*                                                            */
/*       THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY      */
/*         INFORMATION WHICH IS THE PROPERTY OF MENTOR        */
/*         GRAPHICS CORPORATION OR ITS LICENSORS AND IS       */
/*                 SUBJECT TO LICENSE TERMS.                  */
/*                                                            */
/**************************************************************/

//*<
//* Generated By Model Builder, Mentor Graphics Computer Systems, Inc.
//*
//* This file is write protected.
//* DO NOT MODIFY THIS FILE.
//*
//* This file is generated according to the parameters in the
//* Model Builder form.
//*
//* Any change in parameters, policies, ports, protocols, etc. will change this file
//* upon generation of the timing model (using generate_timing_model command).
//* The WaveSampleGenerator_t will be derived from this class.
//*
//* Model Builder version: 4.2.1
//* Generated on: Aug. 15, 2016 06:02:58 PM, (user: kenm)
//*>

#pragma once

#include "model_builder.h"
#include "generic_protocol.h"

class WaveSampleGenerator_t_base : public papoulis::SystemCBaseModel {
public:
  static WaveSampleGenerator_t_base* create_t(const char* _name, long simulation);
public:
  WaveSampleGenerator_t_base(sc_core::sc_module_name& module_name, long simulation);

  enum port_enum {Slave = 0};

protected:
  // The following callbacks are called whenever there is a transaction start or end in the port

  virtual void accept_generic_READ
    (long port_index,
     sc_dt::int64 time,
     long& burst_size,
     sc_dt::uint64 ADDR,
     sc_dt::uint64 rDATA,
     sc_dt::uint64& PRIORITY,
     sc_dt::uint64& BURST,
     sc_dt::uint64 SIZE,
     sc_dt::uint64& STATUS) {};
  virtual void end_generic_READ
    (long port_index,
     sc_dt::uint64 time,
     long& burst_size,
     sc_dt::uint64 ADDR,
     sc_dt::uint64 rDATA,
     sc_dt::uint64& PRIORITY,
     sc_dt::uint64& BURST,
     sc_dt::uint64 SIZE,
     sc_dt::uint64& STATUS) {};

  virtual void accept_generic_WRITE
    (long port_index,
     sc_dt::int64 time,
     long& burst_size,
     sc_dt::uint64 ADDR,
     sc_dt::uint64 wDATA,
     sc_dt::uint64& PRIORITY,
     sc_dt::uint64& BURST,
     sc_dt::uint64 SIZE,
     sc_dt::uint64& STATUS) {};
  virtual void end_generic_WRITE
    (long port_index,
     sc_dt::uint64 time,
     long& burst_size,
     sc_dt::uint64 ADDR,
     sc_dt::uint64 wDATA,
     sc_dt::uint64& PRIORITY,
     sc_dt::uint64& BURST,
     sc_dt::uint64 SIZE,
     sc_dt::uint64& STATUS) {};

public:
  virtual bool portHasRegisters(unsigned portIndex);
  virtual bool triggerRegistersGotHit(unsigned portIndex, tlm::tlm_generic_payload& trans);

  virtual const char* get_library_name() {return "SharedModels";}
  virtual const char* get_model_vendor() {return "Mentor.com";}
  virtual const char* get_model_version() {return "1.0";}

protected:
  /* schedule functions */
public:
  /* called when "params.m_phase" is sent through the "port_index" port */
  virtual void sent_phase_cb(unsigned port_index,
                             esl::sc_sim::mb_cb_params& params) {

  }

  /* called when "params.m_phase" is received by the "port_index" port */
  virtual void received_phase_cb(unsigned port_index,
                                 esl::sc_sim::mb_cb_params& params) {

  }

protected:
  friend class WaveSampleGenerator_model;

protected:
  // parameters
  sc_core::sc_time clock;
  sc_core::sc_time generic_clock;
  double nominal_voltage;
  bool mb_debug;
  bool call_to_default_if;
  bool verbose_parameters;
  bool dmi_enabled;
  const char* warning_level;
  unsigned int Slave_pipeline_length;
  unsigned int Max;
  unsigned int Min;
  sc_core::sc_time Period;
  const char* Type;

protected:
  long m_simulation;

public:
  enum variable_enum {Waveform_idx };
protected:
  mb::mb_t_variable<int> Waveform;

  static const unsigned port_count = 1;
  papoulis::SystemCBaseModel::PortDescription port_descriptions[port_count];

protected:
  std::vector<esl::sc_sim::pipeline_policy*> m_pipeline_vector;
  std::vector<esl::sc_sim::sequential_policy*> m_sequential_vector;
  std::vector<esl::sc_sim::delay_policy*> m_delay_vector;
  std::vector<esl::sc_sim::uniform_bus_policy*> m_bus_vector;
  std::vector<esl::sc_sim::power_policy*> m_power_vector;
  std::vector<esl::sc_sim::state_power_policy*> m_state_power_vector;
public:
  virtual void update_sync_all();
  virtual void update_pipeline_parameters(esl::sc_sim::pipeline_policy* handle);
  virtual void update_sequential_parameters(esl::sc_sim::sequential_policy* handle);
  virtual void update_delay_parameters(esl::sc_sim::delay_policy* handle);
  virtual void update_bus_parameters(esl::sc_sim::uniform_bus_policy* handle);
  virtual void update_power_parameters(esl::sc_sim::power_policy* handle);
  virtual void update_global_power_parameters(esl::sc_sim::constant_global_power_policy* handle);
  virtual void update_state_power_parameters(esl::sc_sim::state_power_policy* handle);
protected: /* InterfaceFunctions */
  virtual TransactionCallbackFunctionPointer getTransactionCallback(unsigned callbackIndex);
  config::real80 get_state_power();
protected:

  void start_transaction_generic_READ
    (esl::include::TRequest* request,
     unsigned port_index,
     sc_dt::uint64 startTime,
     sc_dt::uint64 endTime,
     sc_dt::uint64* parameters,
     bool hasBeenError);
  void end_transaction_generic_READ
    (esl::include::TRequest* request,
     unsigned port_index,
     sc_dt::uint64 startTime,
     sc_dt::uint64 endTime,
     sc_dt::uint64* parameters,
     bool hasBeenError);
  void start_transaction_generic_WRITE
    (esl::include::TRequest* request,
     unsigned port_index,
     sc_dt::uint64 startTime,
     sc_dt::uint64 endTime,
     sc_dt::uint64* parameters,
     bool hasBeenError);
  void end_transaction_generic_WRITE
    (esl::include::TRequest* request,
     unsigned port_index,
     sc_dt::uint64 startTime,
     sc_dt::uint64 endTime,
     sc_dt::uint64* parameters,
     bool hasBeenError);
};

/**************************************************************/
/*                                                            */
/*      Copyright Mentor Graphics Corporation 2006 - 2015     */
/*                  All Rights Reserved                       */
/*                                                            */
/*       THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY      */
/*         INFORMATION WHICH IS THE PROPERTY OF MENTOR        */
/*         GRAPHICS CORPORATION OR ITS LICENSORS AND IS       */
/*                 SUBJECT TO LICENSE TERMS.                  */
/*                                                            */
/**************************************************************/

//*<
//* Generated By Model Builder, Mentor Graphics Computer Systems, Inc.
//*
//* This file is write protected.
//* DO NOT MODIFY THIS FILE.
//*
//* This file contains the PVT class for WaveSampleGenerator.
//* It connects between the PV and T models.
//* Your top-level design should instantiate this model.
//*
//* In order to synchronize the activty between the PV and the T models, every
//* PV transaction is monitored and queued in the T sync ports.
//* Whenever a synchronization point is reached, the T models are executed and
//* the corresponding T transactions are launched.
//* A synchronization point is reached whenever there is a wait statement on a testbench thread.
//*
//* Model Builder version: 4.2.1
//* Generated on: Aug. 15, 2016 06:02:58 PM, (user: kenm)
//*>

#pragma once

#include "model_builder.h"

// forward declaration for pv class
class WaveSampleGenerator_pv;

using namespace std;

class WaveSampleGenerator_pvt_param_defaults {

public:
  WaveSampleGenerator_pvt_param_defaults(const char* hier_name) {

    sc_core::sc_time clock;
    sc_core::sc_time generic_clock;
    double nominal_voltage;
    bool mb_debug;
    bool call_to_default_if;
    bool verbose_parameters;
    bool dmi_enabled;
    const char* warning_level;
    unsigned int Slave_pipeline_length;
    unsigned int Max;
    unsigned int Min;
    sc_core::sc_time Period;
    const char* Type;
    clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("clock", sc_core::sc_time(10, sc_core::SC_NS), hier_name);
    generic_clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("generic_clock", clock, hier_name);
    nominal_voltage = ::mb::sysc::sdInitParameter<double>("nominal_voltage", 1, hier_name);
    mb_debug = ::mb::sysc::sdInitParameter<bool>("mb_debug", false, hier_name);
    call_to_default_if = ::mb::sysc::sdInitParameter<bool>("call_to_default_if", false, hier_name);
    verbose_parameters = ::mb::sysc::sdInitParameter<bool>("verbose_parameters", true, hier_name);
    dmi_enabled = ::mb::sysc::sdInitParameter<bool>("dmi_enabled", true, hier_name);
    warning_level = ::mb::sysc::sdInitParameter<const char*>("warning_level", "WARNING", hier_name);
    Slave_pipeline_length = ::mb::sysc::sdInitParameter<unsigned int>("Slave_pipeline_length", 2, hier_name);
    Max = ::mb::sysc::sdInitParameter<unsigned int>("Max", USHRT_MAX, hier_name);
    Min = ::mb::sysc::sdInitParameter<unsigned int>("Min", 0, hier_name);
    Period = ::mb::sysc::sdInitParameter<sc_core::sc_time>("Period", sc_core::sc_time(1.0, sc_core::SC_MS), hier_name);
    Type = ::mb::sysc::sdInitParameter<const char*>("Type", "sine", hier_name);
    ::mb::sysc::sdPropagateParameters();
  }

  WaveSampleGenerator_pvt_param_defaults(const char* hier_name, sc_core::sc_time clock_init, sc_core::sc_time generic_clock_init, double nominal_voltage_init, bool mb_debug_init, bool call_to_default_if_init, bool verbose_parameters_init, bool dmi_enabled_init, const char* warning_level_init, unsigned int Slave_pipeline_length_init, unsigned int Max_init, unsigned int Min_init, sc_core::sc_time Period_init, const char* Type_init) {

    sc_core::sc_time clock;
    sc_core::sc_time generic_clock;
    double nominal_voltage;
    bool mb_debug;
    bool call_to_default_if;
    bool verbose_parameters;
    bool dmi_enabled;
    const char* warning_level;
    unsigned int Slave_pipeline_length;
    unsigned int Max;
    unsigned int Min;
    sc_core::sc_time Period;
    const char* Type;
    clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("clock", clock_init, hier_name);
    generic_clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("generic_clock", generic_clock_init, hier_name);
    nominal_voltage = ::mb::sysc::sdInitParameter<double>("nominal_voltage", nominal_voltage_init, hier_name);
    mb_debug = ::mb::sysc::sdInitParameter<bool>("mb_debug", mb_debug_init, hier_name);
    call_to_default_if = ::mb::sysc::sdInitParameter<bool>("call_to_default_if", call_to_default_if_init, hier_name);
    verbose_parameters = ::mb::sysc::sdInitParameter<bool>("verbose_parameters", verbose_parameters_init, hier_name);
    dmi_enabled = ::mb::sysc::sdInitParameter<bool>("dmi_enabled", dmi_enabled_init, hier_name);
    warning_level = ::mb::sysc::sdInitParameter<const char*>("warning_level", warning_level_init, hier_name);
    Slave_pipeline_length = ::mb::sysc::sdInitParameter<unsigned int>("Slave_pipeline_length", Slave_pipeline_length_init, hier_name);
    Max = ::mb::sysc::sdInitParameter<unsigned int>("Max", Max_init, hier_name);
    Min = ::mb::sysc::sdInitParameter<unsigned int>("Min", Min_init, hier_name);
    Period = ::mb::sysc::sdInitParameter<sc_core::sc_time>("Period", Period_init, hier_name);
    Type = ::mb::sysc::sdInitParameter<const char*>("Type", Type_init, hier_name);

    ::mb::sysc::sdPropagateParameters();
    }

  WaveSampleGenerator_pvt_param_defaults(const char* hier_name, std::vector<std::pair<char*, unsigned int> > &change_parameters){

    sc_core::sc_time clock;
    sc_core::sc_time generic_clock;
    double nominal_voltage;
    bool mb_debug;
    bool call_to_default_if;
    bool verbose_parameters;
    bool dmi_enabled;
    const char* warning_level;
    unsigned int Slave_pipeline_length;
    unsigned int Max;
    unsigned int Min;
    sc_core::sc_time Period;
    const char* Type;
    for (unsigned i =0; i<change_parameters.size(); i++){
      ::mb::sysc::sdInitParameter<unsigned int>(change_parameters[i].first, change_parameters[i].second, hier_name);
    }

    clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("clock", sc_core::sc_time(10, sc_core::SC_NS), hier_name);
    generic_clock = ::mb::sysc::sdInitParameter<sc_core::sc_time>("generic_clock", clock, hier_name);
    nominal_voltage = ::mb::sysc::sdInitParameter<double>("nominal_voltage", 1, hier_name);
    mb_debug = ::mb::sysc::sdInitParameter<bool>("mb_debug", false, hier_name);
    call_to_default_if = ::mb::sysc::sdInitParameter<bool>("call_to_default_if", false, hier_name);
    verbose_parameters = ::mb::sysc::sdInitParameter<bool>("verbose_parameters", true, hier_name);
    dmi_enabled = ::mb::sysc::sdInitParameter<bool>("dmi_enabled", true, hier_name);
    warning_level = ::mb::sysc::sdInitParameter<const char*>("warning_level", "WARNING", hier_name);
    Slave_pipeline_length = ::mb::sysc::sdInitParameter<unsigned int>("Slave_pipeline_length", 2, hier_name);
    Max = ::mb::sysc::sdInitParameter<unsigned int>("Max", USHRT_MAX, hier_name);
    Min = ::mb::sysc::sdInitParameter<unsigned int>("Min", 0, hier_name);
    Period = ::mb::sysc::sdInitParameter<sc_core::sc_time>("Period", sc_core::sc_time(1.0, sc_core::SC_MS), hier_name);
    Type = ::mb::sysc::sdInitParameter<const char*>("Type", "sine", hier_name);

    ::mb::sysc::sdPropagateParameters();
  }

  //void set_clock (

};

class WaveSampleGenerator_pvt : public esl::sc_sim::PVTBaseModel,
                          public mb::utl::cb_owner,
                          private WaveSampleGenerator_pvt_param_defaults {

 public:
  typedef WaveSampleGenerator_pvt self_type;

 public:
  // Constructor
  WaveSampleGenerator_pvt(sc_core::sc_module_name module_name);
  WaveSampleGenerator_pvt(sc_core::sc_module_name module_name, sc_core::sc_time clock_init, sc_core::sc_time generic_clock_init, double nominal_voltage_init, bool mb_debug_init, bool call_to_default_if_init, bool verbose_parameters_init, bool dmi_enabled_init, const char* warning_level_init, unsigned int Slave_pipeline_length_init, unsigned int Max_init, unsigned int Min_init, sc_core::sc_time Period_init, const char* Type_init);
  WaveSampleGenerator_pvt(sc_core::sc_module_name module_name, std::vector<std::pair<char*, unsigned int> > &change_parameters);
  ~WaveSampleGenerator_pvt();

 public:
    //access the T instance
  inline WaveSampleGenerator_t_base* getT() const {
    return m_WaveSampleGenerator_t;
  }

  //access the PV instance
  inline WaveSampleGenerator_pv* getPV() const {
    return m_WaveSampleGenerator_pv;
  }

  virtual const SystemCBaseModel* getSystemCBaseModel() const {
    return getT();
  }
  virtual SystemCBaseModel* getSystemCBaseModel() {
    return getT();
  }

 private:
  void bind();

 private:

  //T instance
  WaveSampleGenerator_t_base* m_WaveSampleGenerator_t;

  //PV instance
  WaveSampleGenerator_pv* m_WaveSampleGenerator_pv;

 public:
  // External ports

  typedef esl::sc_sim::pvt_target_socket<16, tlm::tlm_base_protocol_types, 1, sc_core::SC_ONE_OR_MORE_BOUND> Slave_type;
  Slave_type Slave;

 private:
  // PV connection ports

  typedef mb::tlm20::initiator_socket_cb<16> Slave_entry_type;
  Slave_entry_type Slave_entry;

 private:

  struct Slave_nb_connector : public tlm::tlm_bw_nonblocking_transport_if<>, public ::mb::tlm20::socket_tracer_holder {
    WaveSampleGenerator_pvt& m_owner;

    Slave_nb_connector(WaveSampleGenerator_pvt& owner) : m_owner(owner) {
    }
    virtual tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload& trans,
                                               tlm::tlm_phase& phase,
                                               sc_core::sc_time& t) {
      return m_owner.Slave.nb_transport_bw((tlm::tlm_base_protocol_types::tlm_payload_type&)trans, phase, t);
    }
    virtual ::mb::tlm20::socket_tracer *get_socket_tracer() {
      return &m_owner.Slave;
    }
  };
  friend struct Slave_nb_connector;
  Slave_nb_connector m_Slave_nb_connector;

  tlm::tlm_sync_enum receive_nb_transport_Slave(tlm::tlm_generic_payload& trans,
                                                    tlm::tlm_phase& phase,
                                                    sc_core::sc_time& t) {
    return getT()->receive_nb_transport(0, trans, phase, t);
  }

};


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rnan.example">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name=".MainApplication"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

        <receiver
            android:name="com.emekalites.react.alarm.notification.AlarmReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="ACTION_DISMISS" />
                <action android:name="ACTION_SNOOZE" />
            </intent-filter>
        </receiver>

        <receiver
            android:name="com.emekalites.react.alarm.notification.AlarmDismissReceiver"
            android:enabled="true"
            android:exported="true" />

        <receiver
            android:name="com.emekalites.react.alarm.notification.AlarmBootReceiver"
            android:directBootAware="true"
            android:enabled="false"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
                <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>


text:
<?php

/**
 * sfDoctrine pager class
 *
 * @package    sfDoctrinePlugin
 * @author     Jonathan H. Wage <jonwage@gmail.com>
 * @version    SVN: $Id$
 */
class sfDoctrinePager extends sfPager implements Serializable
{
  protected $query;

  /**
   * __construct
   *
   * @return void
   */
  public function __construct($class, $defaultMaxPerPage = 10)
  {
    parent::__construct($class, $defaultMaxPerPage);

    $this->setQuery(Doctrine_Query::create()->from($class));
  }

  /**
   * Serialize the pager object
   *
   * @return string $serialized
   */
  public function serialize()
  {
    $vars = get_object_vars($this);
    unset($vars['query']);
    return serialize($vars);
  }

  /**
   * Unserialize a pager object
   *
   * @param string $serialized
   * @return void
   */
  public function unserialize($serialized)
  {
    $array = unserialize($serialized);

    foreach($array as $name => $values)
    {
      $this->$name = $values;
    }
  }

  /**
   * Initialize the pager instance and prepare it to be used for rendering
   *
   * @return void
   */
  public function init()
  {
    $count = $this->getQuery()->offset(0)->limit(0)->count();

    $this->setNbResults($count);

    $p = $this->getQuery();
    $p->offset(0);
    $p->limit(0);
    if ($this->getPage() == 0 || $this->getMaxPerPage() == 0 || $this->getNbResults() == 0)
    {
      $this->setLastPage(0);
    }
    else
    {
      $offset = ($this->getPage() - 1) * $this->getMaxPerPage();

      $this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage()));

      $p->offset($offset);
      $p->limit($this->getMaxPerPage());
    }
  }

  /**
   * Get the query for the pager
   *
   * @return Doctrine_Query $query
   */
  public function getQuery()
  {
    return $this->query;
  }

  /**
   * Set query object for the pager
   *
   * @param Doctrine_Query $query
   * @return void
   */
  public function setQuery($query)
  {
    $this->query = $query;
  }

  /**
   * Retrieve the object for a certain offset
   *
   * @param integer $offset
   * @return Doctrine_Record $record
   */
  protected function retrieveObject($offset)
  {
    $cForRetrieve = clone $this->getQuery();
    $cForRetrieve->offset($offset - 1);
    $cForRetrieve->limit(1);

    $results = $cForRetrieve->execute();

    return $results[0];
  }

  /**
   * Get all the results for the pager instance
   *
   * @param integer $fetchtype Doctrine::HYDRATE_* constants
   * @return Doctrine_Collection
   */
  public function getResults($fetchtype = null)
  {
    $p = $this->getQuery();

    if ($fetchtype == 'array')
    {
      return $p->execute(array(), Doctrine::HYDRATE_ARRAY);
    }

    return $p->execute();
  }
}


text:
"""Tests the load_backend_services_pipeline."""

from google.apputils import basetest
import mock
import MySQLdb

# pylint: disable=line-too-long
from google.cloud.security.common.data_access import errors as data_access_errors
from google.cloud.security.common.data_access import backend_service_dao as bsdao
from google.cloud.security.common.data_access import project_dao
from google.cloud.security.common.gcp_api import compute
from google.cloud.security.common.gcp_api import errors as api_errors
from google.cloud.security.inventory import errors as inventory_errors
from google.cloud.security.inventory.pipelines import base_pipeline
from google.cloud.security.inventory.pipelines import load_backend_services_pipeline
from tests.inventory.pipelines.test_data import fake_configs
from tests.inventory.pipelines.test_data import fake_backend_services
from tests.inventory.pipelines.test_data import fake_projects
# pylint: enable=line-too-long

def _set_count(*args, **kwargs):
    """Set the pipeline count."""

class LoadBackendServicesPipelineTest(basetest.TestCase):
    """Tests for the load_backend_services_pipeline."""

    def setUp(self):
        """Set up."""
        self.cycle_timestamp = '20001225T120000Z'
        self.configs = fake_configs.FAKE_CONFIGS
        self.resource_name = 'backend_services'
        self.maxDiff = None
        self.mock_compute_client = mock.create_autospec(compute.ComputeClient)
        self.mock_dao = mock.create_autospec(bsdao.BackendServiceDao)
        self.pipeline = (
            load_backend_services_pipeline.LoadBackendServicesPipeline(
                self.cycle_timestamp,
                self.configs,
                self.mock_compute_client,
                self.mock_dao))

        self.project_ids = fake_backend_services \
            .FAKE_PROJECT_BACKEND_SERVICES_MAP.keys()
        self.projects = [project_dao.ProjectDao.map_row_to_object(p)
             for p in fake_projects.EXPECTED_LOADABLE_PROJECTS
             if p['project_id'] in self.project_ids]

    def test_can_transform_backend_services(self):
        """Test transform function works."""
        actual = self.pipeline._transform(
            fake_backend_services.FAKE_PROJECT_BACKEND_SERVICES_MAP)
        self.assertEquals(
            fake_backend_services.EXPECTED_LOADABLE_BACKEND_SERVICES,
            list(actual))

    @mock.patch.object(MySQLdb, 'connect')
    @mock.patch('google.cloud.security.common.data_access.project_dao.ProjectDao.get_projects')
    def test_api_is_called_to_retrieve_backend_services(
            self, mock_get_projects, mock_conn):
        """Test that API is called to retrieve backend services."""
        mock_get_projects.return_value = self.projects
        self.pipeline._retrieve()
        self.assertEqual(
            len(self.project_ids),
            self.pipeline.api_client.get_backend_services.call_count)

    @mock.patch.object(MySQLdb, 'connect')
    @mock.patch('google.cloud.security.common.data_access.project_dao.ProjectDao.get_projects')
    def test_retrieve_data_is_correct(
            self, mock_get_projects, mock_conn):
        """Test _retrieve() data is correct."""
        mock_get_projects.return_value = self.projects

        self.pipeline.api_client.get_backend_services = mock.MagicMock(
            side_effect=[fake_backend_services.FAKE_API_RESPONSE1,
                         fake_backend_services.FAKE_API_RESPONSE2])

        actual = self.pipeline._retrieve()

        self.assertEquals(
            fake_backend_services.FAKE_PROJECT_BACKEND_SERVICES_MAP,
            actual)

    @mock.patch.object(MySQLdb, 'connect')
    @mock.patch('google.cloud.security.common.data_access.project_dao.ProjectDao.get_projects')
    def test_retrieve_error_logged_when_api_error(
            self, mock_get_projects, mock_conn):
        """Test that LOGGER.error() is called when there is an API error."""
        mock_get_projects.return_value = self.projects
        self.pipeline.api_client.get_backend_services.side_effect = (
            api_errors.ApiExecutionError(self.resource_name, mock.MagicMock()))
        load_backend_services_pipeline.LOGGER = mock.MagicMock()
        self.pipeline._retrieve()

        self.assertEqual(
            len(self.project_ids),
            load_backend_services_pipeline.LOGGER.error.call_count)

    @mock.patch.object(MySQLdb, 'connect')
    @mock.patch('google.cloud.security.common.data_access.project_dao.ProjectDao.get_projects')
    def test_pipeline_no_rules_loads_nothing(
            self, mock_get_projects, mock_conn):
        """Test the pipeline with no forwarding rules."""
        mock_get_projects.return_value = self.projects
        base_pipeline.LOGGER = mock.MagicMock()
        self.pipeline.api_client.get_backend_services = mock.MagicMock(
            side_effect=[[], []])
        self.pipeline.dao.select_record_count = mock.MagicMock(
            side_effect=data_access_errors.MySQLError(
                'backend_services', mock.MagicMock()))

        self.pipeline.run()

        self.assertEquals(None, self.pipeline.count)

    @mock.patch.object(
        load_backend_services_pipeline.LoadBackendServicesPipeline,
        '_get_loaded_count')
    @mock.patch.object(
        load_backend_services_pipeline.LoadBackendServicesPipeline,
        '_load')
    @mock.patch.object(
        load_backend_services_pipeline.LoadBackendServicesPipeline,
        '_transform')
    @mock.patch.object(
        load_backend_services_pipeline.LoadBackendServicesPipeline,
        '_retrieve')
    def test_subroutines_are_called_by_run(
            self,
            mock_retrieve,
            mock_transform,
            mock_load,
            mock_get_loaded_count):
        """Test that the subroutines are called by run."""
        mock_retrieve.return_value = \
            fake_backend_services.FAKE_PROJECT_BACKEND_SERVICES_MAP
        mock_transform.return_value = (
            fake_backend_services.EXPECTED_LOADABLE_BACKEND_SERVICES)
        self.pipeline.run()

        mock_transform.assert_called_once_with(
            fake_backend_services.FAKE_PROJECT_BACKEND_SERVICES_MAP)

        self.assertEquals(1, mock_load.call_count)

        # The regular data is loaded.
        called_args, called_kwargs = mock_load.call_args_list[0]
        expected_args = (
            self.pipeline.RESOURCE_NAME,
            fake_backend_services.EXPECTED_LOADABLE_BACKEND_SERVICES)
        self.assertEquals(expected_args, called_args)


text:
{{/* Portfolio Widget */}}

{{/* Initialise */}}
{{ $ := .root }}
{{ $st := .page }}
{{ $items_type := $st.Params.content.page_type | default "project" }}
{{ $columns := $st.Params.design.columns | default "2" }}
{{ $view := $st.Params.design.view | default "masonry" }}

  {{ with $st.Content }}{{ . }}{{ end }}

  {{ if $st.Params.content.filter_button }}

    {{ $filter_default := default (int $st.Params.content.filter_default) 0 }}

    {{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
    {{ $default_filter_tag_raw := (index $st.Params.content.filter_button ($filter_default)).tag }}
    {{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
    {{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
      {{ $default_filter_tag = $default_filter_tag_raw }}
    {{ end }}

    {{ $default_filter_tag }}

    {{/* Only show filter buttons if there are multiple filters. */}}
    {{ if gt (len $st.Params.content.filter_button) 1 }}

            {{ range $idx, $item := $st.Params.content.filter_button }}
              {{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
              {{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
              {{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
                {{ $data_filter = .tag }}
              {{ end }}
              {{ .name }}
            {{ end }}

    {{ end }}
  {{ end }}

    {{ $query := "" }}
    {{ if $st.Params.content.filters.tags }}
      {{ $query = where site.Pages "Params.tags" "intersect" $st.Params.content.filters.tags }}
    {{ else }}
      {{ $query = where site.RegularPages "Type" $items_type }}
    {{ end }}

    {{ range $index, $item := $query }}
      {{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
        {{ if in (slice "masonry" 3) $view }}

        {{else}}

        {{end}}
        {{ partial "functions/render_view" (dict "page" $st "item" . "view" $view "index" $index) }}

    {{end}}


text:
package org.apache.http.impl.client;

import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;

import android.util.Log;

import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.auth.AuthSchemeProvider;
import org.apache.http.auth.AuthStateHC4;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.Configurable;
import org.apache.http.client.methods.HttpExecutionAware;
import org.apache.http.client.methods.HttpRequestWrapper;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.client.params.HttpClientParamConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.config.Lookup;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ClientConnectionRequest;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.conn.ManagedClientConnection;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.routing.HttpRoutePlanner;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.cookie.CookieSpecProvider;
import org.apache.http.impl.execchain.ClientExecChain;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpParamsNames;
import org.apache.http.protocol.BasicHttpContextHC4;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Args;

/**
 * Internal class.
 *
 * @since 4.3
 */
@ThreadSafe
@SuppressWarnings("deprecation")
class InternalHttpClient extends CloseableHttpClient {

    private final static String TAG = "HttpClient";

    private final ClientExecChain execChain;
    private final HttpClientConnectionManager connManager;
    private final HttpRoutePlanner routePlanner;
    private final Lookup<CookieSpecProvider> cookieSpecRegistry;
    private final Lookup<AuthSchemeProvider> authSchemeRegistry;
    private final CookieStore cookieStore;
    private final CredentialsProvider credentialsProvider;
    private final RequestConfig defaultConfig;
    private final List<Closeable> closeables;

    public InternalHttpClient(
            final ClientExecChain execChain,
            final HttpClientConnectionManager connManager,
            final HttpRoutePlanner routePlanner,
            final Lookup<CookieSpecProvider> cookieSpecRegistry,
            final Lookup<AuthSchemeProvider> authSchemeRegistry,
            final CookieStore cookieStore,
            final CredentialsProvider credentialsProvider,
            final RequestConfig defaultConfig,
            final List<Closeable> closeables) {
        super();
        Args.notNull(execChain, "HTTP client exec chain");
        Args.notNull(connManager, "HTTP connection manager");
        Args.notNull(routePlanner, "HTTP route planner");
        this.execChain = execChain;
        this.connManager = connManager;
        this.routePlanner = routePlanner;
        this.cookieSpecRegistry = cookieSpecRegistry;
        this.authSchemeRegistry = authSchemeRegistry;
        this.cookieStore = cookieStore;
        this.credentialsProvider = credentialsProvider;
        this.defaultConfig = defaultConfig;
        this.closeables = closeables;
    }

    private HttpRoute determineRoute(
            final HttpHost target,
            final HttpRequest request,
            final HttpContext context) throws HttpException {
        HttpHost host = target;
        if (host == null) {
            host = (HttpHost) request.getParams().getParameter(ClientPNames.DEFAULT_HOST);
        }
        return this.routePlanner.determineRoute(host, request, context);
    }

    private void setupContext(final HttpClientContext context) {
        if (context.getAttribute(HttpClientContext.TARGET_AUTH_STATE) == null) {
            context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, new AuthStateHC4());
        }
        if (context.getAttribute(HttpClientContext.PROXY_AUTH_STATE) == null) {
            context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, new AuthStateHC4());
        }
        if (context.getAttribute(HttpClientContext.AUTHSCHEME_REGISTRY) == null) {
            context.setAttribute(HttpClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
        }
        if (context.getAttribute(HttpClientContext.COOKIESPEC_REGISTRY) == null) {
            context.setAttribute(HttpClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);
        }
        if (context.getAttribute(HttpClientContext.COOKIE_STORE) == null) {
            context.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
        }
        if (context.getAttribute(HttpClientContext.CREDS_PROVIDER) == null) {
            context.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
        }
        if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
            context.setAttribute(HttpClientContext.REQUEST_CONFIG, this.defaultConfig);
        }
    }

    @Override
    protected CloseableHttpResponse doExecute(
            final HttpHost target,
            final HttpRequest request,
            final HttpContext context) throws IOException, ClientProtocolException {
        Args.notNull(request, "HTTP request");
        HttpExecutionAware execAware = null;
        if (request instanceof HttpExecutionAware) {
            execAware = (HttpExecutionAware) request;
        }
        try {
            final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(request);
            final HttpClientContext localcontext = HttpClientContext.adapt(
                    context != null ? context : new BasicHttpContextHC4());
            RequestConfig config = null;
            if (request instanceof Configurable) {
                config = ((Configurable) request).getConfig();
            }
            if (config == null) {
                final HttpParams params = request.getParams();
                if (params instanceof HttpParamsNames) {
                    if (!((HttpParamsNames) params).getNames().isEmpty()) {
                        config = HttpClientParamConfig.getRequestConfig(params);
                    }
                } else {
                    config = HttpClientParamConfig.getRequestConfig(params);
                }
            }
            if (config != null) {
                localcontext.setRequestConfig(config);
            }
            setupContext(localcontext);
            final HttpRoute route = determineRoute(target, wrapper, localcontext);
            return this.execChain.execute(route, wrapper, localcontext, execAware);
        } catch (final HttpException httpException) {
            throw new ClientProtocolException(httpException);
        }
    }

    public void close() {
        this.connManager.shutdown();
        if (this.closeables != null) {
            for (final Closeable closeable: this.closeables) {
                try {
                    closeable.close();
                } catch (final IOException ex) {
                    Log.e(TAG, ex.getMessage(), ex);
                }
            }
        }
    }

    public HttpParams getParams() {
        throw new UnsupportedOperationException();
    }

    public ClientConnectionManager getConnectionManager() {

        return new ClientConnectionManager() {

            public void shutdown() {
                connManager.shutdown();
            }

            public ClientConnectionRequest requestConnection(
                    final HttpRoute route, final Object state) {
                throw new UnsupportedOperationException();
            }

            public void releaseConnection(
                    final ManagedClientConnection conn,
                    final long validDuration, final TimeUnit timeUnit) {
                throw new UnsupportedOperationException();
            }

            public SchemeRegistry getSchemeRegistry() {
                throw new UnsupportedOperationException();
            }

            public void closeIdleConnections(final long idletime, final TimeUnit tunit) {
                connManager.closeIdleConnections(idletime, tunit);
            }

            public void closeExpiredConnections() {
                connManager.closeExpiredConnections();
            }

        };

    }

}


text:
cask "vysor" do
  version "4.1.62"
  sha256 "68eacfe2832a34b62e37111a9ae19011e5b6ffaa5964762be6e45ba9a6846132"

  url "https://github.com/koush/vysor.io/releases/download/v#{version}/Vysor-mac-#{version}.zip",
      verified: "github.com/koush/vysor.io/"
  name "Vysor"
  desc "Mirror and control your phone"
  homepage "https://www.vysor.io/"

  livecheck do
    url "http://vysornuts.clockworkmod.com/download/mac"
    strategy :header_match
  end

  app "Vysor.app"

  zap trash: [
    "~/Library/Application Support/Vysor",
    "~/Library/Caches/com.electron.vysor",
    "~/Library/Caches/com.electron.vysor.ShipIt",
    "~/Library/Preferences/com.electron.vysor.plist",
    "~/Library/Preferences/com.electron.vysor.helper.plist",
    "~/Library/Saved Application State/com.electron.vysor.savedState",
  ]
end


text:
<html><head><title>Results for RegressionsTest - 1</title></head>
<frameset cols="26%,74%">
<frame src="toc.html" name="navFrame">
<frame src="main.html" name="mainFrame">
</frameset>
</html>