text:
var mainServer;
var serverClientIDGen = [];
var serverIDGen;
var servers = []; //Array of server objects
var serverClients = []; //Array of array of sockets, one array per server.
var numOfServers;
var lastPingTime;
var lastPingID;
var PING_RATE = 2000;

if(typeof window  != 'undefined') {
    //CLIENT - SIDE
    define(['../../../lib/q', '../../node_modules/socketioclient/socket.io', '../../eventemitter', '../../bitstream'], function(Q, SocketIOClient, EventEmitter, BitStream) {

        function Promise(cb){
            var deferred = Q.defer();

            function resolve(result){
                deferred.resolve(result);
            }

            function reject(error) {
                deferred.reject(error);
            }

            cb(resolve,reject);

            return deferred.promise;

        }

        function Server(){
            alert('Server Cannot Be Instantiated in Browser in Server Network Mode');
        }

        function Client(){
            EventEmitter.call();
        }

        Client.prototype = new EventEmitter();;
        Client.prototype.constructor = Client;
        Client.prototype.connect = function(serverAddress, serverPort, serverID){
            var self = this;
            var promise = new Promise(function(resolve, reject){
                var socket = SocketIOClient.connect('http://' + serverAddress + ':' + serverPort, { 'reconnection': false, 'forceNew' : true});
                console.log(socket);
                self._serverID = serverID;
                self._socket = socket;
                console.log("Unregistered client created SID: ", self._serverID);

                socket.on('connecting', function(){
                    console.log('Unregistered client trying to connect');
                });

                socket.on('connect', function (){
                    console.log('sending Register message from client with SID:' + self._serverID);
                    socket.emit('register', {serverID : self._serverID});
                });

                socket.on('serverDNE', function(){
                    console.log('Client cannot connect: Server', self._serverID, 'does not exist');
                    reject(new Error('Client cannot connect: Server does not exist'));
                })

                socket.on('registerConfirm', function(data){
                  //console.log('received registerConfirm CID: ' +  data.clientID);
                    self._clientID = data.clientID;
                    console.log('Client', self._clientID, 'connected to server', self._serverID);
                    self.emit('connect');
                    resolve(self._clientID);
                });

                socket.on('connect_failed', function(){
                    console.log('Client could not connect to main server');
                    reject(new Error('Client could not connect to main server'));
                })

                socket.on('error', function(error){
                    console.log('Client error', error);
                    reject(error);
                });

                socket.on('disconnect', function(){
                    console.log('Client', self._clientID, 'disconnected from server', self._serverID);
                    self._socket = null;
                    self._clientID = null;
                    self._serverID = null;
                    self.emit('disconnect');
                });

                socket.on('data', function(message){
                    //console.log('Client', self._clientID, 'received data from server', data);
                    var messageType = message.type;
                    var data = message.data;

                    self.emit(messageType, new BitStream(data));
                });

                socket.on('ping', function(pingID){
                    //console.log('client: ping received');
                    socket.emit('ping', pingID);
                })

            });
            return promise;
        };

        Client.prototype.disconnect = function(){
            var self = this;
            var promise = new Promise(function(resolve, reject){
                console.log('Client ' + self._clientID + ' disconnecting');
                self._socket.disconnect();
                self._socket = null;
                self._clientID = null;
                self._serverID = null;
                resolve();
            });
            return promise;
        };

        Client.prototype.send = function(bitStream, messageType){
            var self = this;
            var messageType = messageType || 'data';
            //console.log('client: send:', bitStream);
            var promise = new Promise(function(resolve, reject){
               if(self._serverID == null){
                   reject(new Error('Client not connected to server'));
               }else{
                   self._socket.emit('data', {type: messageType, data: bitStream});
                   resolve();
               }
            });

            return promise;
        };

        return {
            Client: Client,
            Server: Server
        };
    });
}
else{
    //SERVER - SIDE

    var define = require('amdefine')(module);
    define(['../../../lib/q', '../../node_modules/socketio', '../../eventemitter', '../../bitstream'], function(Q, SocketIO, EventEmitter, BitStream) {

        console.log('SERVER - SIDE');

        function Promise(cb){
            var deferred = Q.defer();

            function resolve(result){
                deferred.resolve(result);
            }

            function reject(error) {
                deferred.reject(error);
            }

            cb(resolve,reject);

            return deferred.promise;

        }

        function Client(){
            console.log('Cannot instantiate Client in Server in Server Network Mode');
        }

        function sendPing(){
            if(numOfServers > 0){
                lastPingTime = new Date().getTime();
                lastPingID ++;
                //console.log('server: ping sent');
                mainServer.sockets.emit('ping', lastPingID);
            }
        }

        function Server(){
            EventEmitter.call(this);
        }

        Server.prototype = new EventEmitter();
        Server.prototype.constructor = Server;

        Server.prototype.getPing = function(clientID){
            var self = this;
            if(self._pings[clientID]){
                return self._pings[clientID];
            }

            return null;
        };

        Server.prototype.start = function(serverAddress, serverPort){
            var self = this;

            var promise = new Promise(function(resolve, reject){
                if(mainServer == undefined){
                    var baseServer = require('http').createServer(function(req, res){
                            res.writeHead(200, {
                                'Content-Type': 'text/plain',
                                'Access-Control-Allow-Origin' : '*',
                                'Access-Control-Allow-Methods':'GET,PUT,POST,DELETE'
                            });
                    });
                    baseServer.listen(serverPort);//, serverAddress);
                    mainServer = SocketIO.listen(baseServer);
                    console.log('server: MainServer started');
                    mainServer.on('listening', function(){
                    }).on('close', function(){
                        console.log('Mainserver closed');
                    }).on('error', function(){
                        console.log('Server error', error);
                        reject(error);
                    });
                    mainServer.sockets.on('connection', function (socket) {
                        socket.on('register', function(data){
                            console.log('received Register message on server SID: ' + data.serverID);
                            if(servers[data.serverID] == undefined){
                                console.log('send serverDNE message from server');
                                socket.emit('serverDNE');
                            }else{
                                if(serverClients[data.serverID] == undefined){
                                    serverClients[data.serverID] = [socket];
                                }else{
                                    serverClients[data.serverID].push(socket);
                                }
                                socket._serverID = data.serverID;
                                socket._clientID = serverClientIDGen[data.serverID]++;
                                //console.log('send registerConfirm from server, SID: ', self._serverID , ' CID: ' , socket._clientID);
                                socket.emit('registerConfirm', {serverID : self._serverID, clientID : socket._clientID});
                                self.emit('connect', socket._clientID);
                            }
                        });

                        socket.on('disconnect', function (){
                            //client disconnected
                            if(serverClients[socket._serverID] !== undefined){
                                var index = serverClients[socket._serverID].indexOf(socket);
                                if(index > -1){
                                    serverClients[socket._serverID].splice(index, 1);
                                }
                            }
                            console.log('server: client', socket._clientID,
                                        'disconnected from server', self._serverID);
                            self.emit('disconnect',socket._clientID);
                        });

                        socket.on('error', function(error){
                            //error occurred
                            console.log('Connection error ', error);
                        });

                        socket.on('data', function(message){
                            //received data from client
                            //console.log('server: received: ', message , 'from CID: ' , socket._clientID);
                            var type = message.type;
                            var data = message.data;

                            servers[socket._serverID].emit(type, {data: new BitStream(data), client : socket._clientID});
                        });

                        socket.on('ping', function(pingID){
                            //console.log('server: ping received');
                            var endTime = new Date().getTime();
                            var elapsedTime = endTime - lastPingTime;
                            elapsedTime = elapsedTime * (1+(lastPingID - pingID));
                            servers[socket._serverID]._pings[socket._clientID] = elapsedTime;
                        });

                    });

                    //Main Server Instantiated, Instantiating globals
                    serverIDGen = 0;
                    numOfServers = 0;
                    lastPingID = 0;
                    mainServer._pingTimer = setInterval(function(){
                        sendPing();
                    }, PING_RATE);
                }

                //Instantiate the abstract game server
                self._serverID = serverIDGen++;
                numOfServers++;
                servers[self._serverID] = self;
                serverClientIDGen[self._serverID] = 0;
                self._pings = [];
                console.log('Starting server', self._serverID, ' using socketio host: ', serverAddress, serverPort);
                resolve(self._serverID);
            });
            return promise;
        };

        Server.prototype.stop = function(){
            var self = this;
            console.log('Server Stopped SID: ', self._serverID);
            var promise = new Promise(function(resolve, reject) {
                if((servers[self._serverID] != undefined) && (mainServer != undefined)){
                    var clients = serverClients[self._serverID];
                    while(clients.length != 0){
                        clients.pop().disconnect();
                    }
                    serverClients[self._serverID] = undefined;
                    servers[self._serverID] = undefined;
                    self._serverID = undefined;
                    if(numOfServers > 0){
                        numOfServers--;
                    }
                }
                resolve();
            });
        };

        Server.prototype.send = function(bitStream, clientID, messageType) {
            var self = this;
            var messageType = messageType || 'data';
            var promise = new Promise(function(resolve, reject) {
                if(typeof clientID == 'undefined'){
                    //broadcast
                    var sockets = serverClients[self._serverID];
                    if(sockets){
                        sockets.forEach(function(socket){
                            socket.emit('data', {type: messageType,
                                                 data: bitStream});
                        });
                    }
                    resolve();
                }else{
                    var socketToSend = null;
                    var sockets = serverClients[self._serverID];
                    if(sockets){
                        sockets.forEach(function(socket){
                            if(socket._clientID == clientID){
                                socketToSend = socket;
                            }
                        });
                    }
                    if(socketToSend == null){
                        //invalid client specified
                        reject(new Error('Invalid client ID (' + clientID + ')'));
                    }else{
                        socketToSend.emit('data', {type: messageType, data: bitStream});
                        resolve();
                    }
                }
            });
            return promise;
        };

        return {
            Client: Client,
            Server: Server
        };
    });
}
/*
define(['../../node_modules/rsvp', '../../node_modules/socketio', '../../node_modules/socketioclient', '../../eventemitter'], function(RSVP, SocketIO, SocketIOClient, EventEmitter) {
    function Server(){
        EventEmitter.call(this);
    }

    Server.prototype = new EventEmitter();
    Server.prototype.constructor = Server;
    Server.prototype.start = function(serverAddress, serverPort){
        var self = this;

        var promise = new Promise(function(resolve, reject){
            if(mainServer == undefined){
                var baseServer = require('http').createServer();
                baseServer.listen(serverPort, serverAddress);
                mainServer = SocketIO.listen(baseServer);
                console.log('server: MainServer started');
                mainServer.on('listening', function(){
                }).on('close', function(){
                    console.log('Mainserver closed');
                }).on('error', function(){
                    console.log('Server error', error);
                    reject(error);
                });
                mainServer.sockets.on('connection', function (socket) {
                    socket.on('register', function(data){
                        console.log('received Register message on server SID: ' + data.serverID);
                        if(servers[data.serverID] == undefined){
                            console.log('send serverDNE message from server');
                            socket.emit('serverDNE');
                        }else{
                            if(serverClients[data.serverID] == undefined){
                                serverClients[data.serverID] = [socket];
                            }else{
                                serverClients[data.serverID].push(socket);
                            }
                            socket._serverID = data.serverID;
                            socket._clientID = serverClientIDGen[data.serverID]++;
                            console.log('send registerConfirm from server, SID: ', self._serverID , ' CID: ' , socket._clientID);
                            socket.emit('registerConfirm', {serverID : self._serverID, clientID : socket._clientID});
                            self.emit('connect', socket._clientID);
                        }
                    });

                    socket.on('disconnect', function (){
                        //client disconnected
                        var index = serverClients[socket._serverID].indexOf(socket);
                        if(index > -1){
                            serverClients[socket._serverID].splice(index, 1);
                        }
                        console.log('server: client', socket._clientID,
                                    'disconnected from server', self._serverID);
                        self.emit('disconnect',socket._clientID);
                        delete socket;

                    socket.on('data', function(data){
                        //received data from client
                        console.log('server: received: ', data);
                        var dataToSend = {data : data, client : socket._clientID}
                        servers[socket._serverID].emit('data', dataToSend);
                    });
                });

                //Main Server Instantiated, Instantiating globals
                serverIDGen = 0;
                numOfServers = 0;
            }

            //Instantiate the abstract game server
            self._serverID = serverIDGen++;
            numOfServers++;
            servers[self._serverID] = self;
            serverClientIDGen[self._serverID] = 0;
            resolve(self._serverID);
            console.log('Starting server', self._serverID, ' using socketio host: ', serverAddress, serverPort);
        });
        return promise;
    };

    Server.prototype.stop = function(){
        var self = this;
        console.log('Server Stopped SID: ', self._serverID);
        var promise = new Promise(function(resolve, reject) {
            if((servers[self._serverID] != undefined) && (mainServer != undefined)){
                var clients = serverClients[self._serverID];
                clients.forEach(function(client){
                    client.disconnect();
                });
                serverClients[self._serverID] = undefined;
                servers[self._serverID] = undefined;
                self._serverID = undefined;
                if(numOfServers > 0){
                    numOfServers--;
                }
            }
            resolve();
        });
    };

    Server.prototype.send = function(data, clientID) {
        var self = this;
        var promise = new Promise(function(resolve, reject) {
            if(typeof clientID == 'undefined'){
                //broadcast
                var clients = serverClients[self._serverID];
                clients.forEach(function(client){
                    client.emit('data', data);
                });
                resolve();
            }else{
                var socketToSend = null;
                var clients = serverClients[self._serverID];
                clients.forEach(function(client){
                    if(client._clientID == clientID){
                        socketToSend = client;
                    }
                });
            }
        });
        return promise;
    };

    function Client(){
        EventEmitter.call();
    }

    Client.prototype = new EventEmitter();;
    Client.prototype.constructor = Client;
    Client.prototype.connect = function(serverAddress, serverPort, serverID){
        var self = this;
        var promise = new Promise(function(resolve, reject){
            var socket = SocketIOClient.connect('http://' + serverAddress + ':' + serverPort);
            self._serverID = serverID;
            self._socket = socket;
            console.log("Unregistered client created SID: ", self._serverID);

            socket.on('connecting', function(){
                console.log('Unregistered client trying to connect');
            });

            socket.on('connect', function (){
                console.log('sending Register message from client with SID:' + self._serverID);
                socket.emit('register', {serverID : self._serverID});
            });

            socket.on('serverDNE', function(){
                console.log('Client cannot connect: Server', self._serverID, 'does not exist');
                reject(new Error('Client cannot connect: Server does not exist'));
            })

            socket.on('registerConfirm', function(data){
                console.log('received registerConfirm CID: ' +  data.clientID);
                self._clientID = data.clientID;
                console.log('Client', self._clientID, 'connected to server', self._serverID);
                self.emit('connect');
                resolve(self._clientID);
            });

            socket.on('connect_failed', function(){
                console.log('Client could not connect to main server');
                reject(new Error('Client could not connect to main server'));
            });

            socket.on('error', function(error){
                console.log('Client error', error);
                reject(error);
            });

            socket.on('disconnect', function(){
                self._socket = null;
                self._clientID = null;
                self._serverID = null;
                console.log('Client', self._clientID, 'disconnected from server', self._serverID);
                self.emit('disconnect');
            });

            socket.on('data', function(data){
                console.log('Client', self._clientID, 'received data from server', data);
                self.emit('data', data);
            });

            self._socket = socket;
        });

        return promise;
    };

    Client.prototype.disconnect = function(){
        var self = this;
        var promise = new Promise(function(resolve, reject){
            console.log('Client ' + self._clientID + ' disconnecting');
            self._socket.disconnect();
            self._socket = null;
            self._clientID = null;
            self._serverID = null;
            resolve();
        });
        return promise;
    };

    Client.prototype.send = function(bitStream){
        var self = this;
        console.log('client: send:', bitStream);
        var promise = new Promise(function(resolve, reject){
           if(self._serverID == null){
               reject(new Error('Client not connected to server'));

           }else{
               self._socket.emit('data', bitStream);
               resolve();
           }
        });

        return promise;
    };

    return {
        Client: Client,
        Server: Server
    };
});
*/


text:
> Minify HTML with Fly.

## Install

```
npm install --save-dev fly-htmlmin
```

## Usage

```js
exports.minify = function * (fly) {
  yield fly.source('src/*.html')
    .htmlmin({
      removeComments: false
    })
    .target('dist');
}
```

## API

### .htmlmin(options)

This plugin offers no unique options.

However, it has a number of [default settings](config.js) that you may override.

Please see [HTML-Minifier's Options](https://github.com/kangax/html-minifier#options-quick-reference) for a full list of available options.

## License

MIT © [Luke Edwards](https://lukeed.com)

[travis-link]:  https://travis-ci.org/lukeed/fly-htmlmin
[travis-badge]: http://img.shields.io/travis/lukeed/fly-htmlmin.svg?style=flat-square

redpajama_set_name: RedPajamaGithub


text:
 define(['ext'], function(Ext) {

	return Ext.define('modules.sample-app.AbstractPanel', {
		extend: 'Ext.panel.Panel',

		config: {
			layout: {
				type: 'vbox',
				align: 'stretch'
			},
			padding: 5
		},

		buttons: [{
			text: 'Draw',
			reference: 'DrawButton',
			handler: 'onDrawClick',
			toggleHandler: 'onDrawToggle',
			enableToggle: true

		}
		],

		listeners: {
			'deactivate': 'onDeactivate'
		}
	});
});


text:
package sg.ncl.service.team.data.jpa;

import lombok.Getter;
import lombok.Setter;
import sg.ncl.common.jpa.AbstractEntity;
import sg.ncl.service.team.domain.MemberStatus;
import sg.ncl.service.team.domain.MemberType;
import sg.ncl.service.team.domain.TeamMember;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.time.ZonedDateTime;

/**
 * @author Christopher Zhong
 */
@Getter
@Setter
@Entity
@Table(name = "team_members", uniqueConstraints = @UniqueConstraint(columnNames = {"team_id", "user_id"}))
public class TeamMemberEntity extends AbstractEntity implements TeamMember {

    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false, unique = true, updatable = false)
    private Long id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "team_id", nullable = false, updatable = false)
    private TeamEntity team;

    @Column(name = "user_id", nullable = false, updatable = false)
    private String userId;

    @Column(name = "joined_date", nullable = false)
    private ZonedDateTime joinedDate;

    @Column(name = "member_type", nullable = false)
    @Enumerated(EnumType.STRING)
    private MemberType memberType = MemberType.MEMBER;

    @Column(name = "status", nullable = false)
    @Enumerated(EnumType.STRING)
    private MemberStatus memberStatus = MemberStatus.PENDING;

}


text:
module FullTextSearch
  class QueryExpansionRequest
    include ActiveModel::Model
    extend ActiveModel::Naming

    attr_writer :query

    def to_params
      {
        "query" => query,
      }
    end

    def query
      (@query || "").strip
    end
  end
end


text:
package org.codenergic.theskeleton.core.mail;

import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;

import javax.mail.internet.InternetAddress;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.scheduling.annotation.Async;

import it.ozimov.springboot.mail.model.Email;
import it.ozimov.springboot.mail.model.defaultimpl.DefaultEmail;
import it.ozimov.springboot.mail.service.exception.CannotSendEmailException;

@Async
class EmailServiceImpl implements EmailService {
	private final Logger logger = LoggerFactory.getLogger(getClass());
	private it.ozimov.springboot.mail.service.EmailService emailSender;
	private String sender;
	private String senderAlias;

	public EmailServiceImpl(it.ozimov.springboot.mail.service.EmailService emailService, MailProperties mailProps) {
		this.emailSender = emailService;
		Map<String, String> mailProperties = mailProps.getProperties();
		this.sender = mailProperties.get("sender");
		this.senderAlias = mailProperties.get("senderAlias");
	}

	@Override
	public void sendSimpleEmail(String alias, List<InternetAddress> to, String subject, String text) {
		try {
			emailSender.send(buildEmail(new InternetAddress(sender, alias == null ? senderAlias : alias), to, subject, text));
		} catch (UnsupportedEncodingException e) {
			logger.error(e.getMessage(), e);
		}
	}

	@Override
	public void sendEmail(String alias, List<InternetAddress> to, String subject, Map<String, Object> templateParams,
			String mailTemplate) {
		try {
			emailSender.send(buildEmail(new InternetAddress(sender, alias == null ? senderAlias : alias), to, subject, ""),
					mailTemplate, templateParams);
		} catch (CannotSendEmailException | UnsupportedEncodingException e) {
			logger.error(e.getMessage(), e);
		}
	}

	private Email buildEmail(InternetAddress from, List<InternetAddress> to, String subject, String text) {
		return DefaultEmail.builder()
				.from(from)
				.to(to)
				.subject(subject)
				.body(text)
				.encoding("UTF-8")
				.build();
	}
}


text:
@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

set __ThisScriptShort=%0
set __ThisScriptFull="%~f0"

:: Set the default arguments for build
set __BuildArch=x64
set __BuildType=Debug
set __BuildOS=Windows_NT

:: Default to highest Visual Studio version available
set __VSVersion=vs2015

:: Set the various build properties here so that CMake and MSBuild can pick them up
set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
set __MSBCleanBuildArgs=
set __SkipTestBuild=
set __ToolchainMilestone=testing
set "__DotNetCliPath=%__ProjectDir%\Tools\dotnetcli"

:Arg_Loop
if "%1" == "" goto ArgsDone

if /i "%1" == "/?"    goto Usage
if /i "%1" == "-?"    goto Usage
if /i "%1" == "/h"    goto Usage
if /i "%1" == "-h"    goto Usage
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage

if /i "%1" == "x64"    (set __BuildArch=x64&&shift&goto Arg_Loop)
if /i "%1" == "x86"    (set __BuildArch=x86&&shift&goto Arg_Loop)
if /i "%1" == "arm"    (set __BuildArch=arm&&shift&goto Arg_Loop)

if /i "%1" == "debug"    (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release"   (set __BuildType=Release&shift&goto Arg_Loop)

if /i "%1" == "clean"   (set __CleanBuild=1&shift&goto Arg_Loop)

if /i "%1" == "skiptests" (set __SkipTests=1&shift&goto Arg_Loop)
if /i "%1" == "skipvsdev" (set __SkipVsDev=1&shift&goto Arg_Loop)
if /i "%1" == "/milestone" (set __ToolchainMilestone=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "/dotnetclipath" (set __DotNetCliPath=%2&shift&shift&goto Arg_Loop)

echo Invalid command line argument: %1
goto Usage

:ArgsDone

echo Commencing CoreRT Repo build
echo.

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__ObjDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\Native\%__BuildOS%.%__BuildArch%.%__BuildType%\"
set "__RelativeProductBinDir=bin\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"

set "__ReproProjectDir=%__ProjectDir%\src\ILCompiler\repro"
set "__ReproProjectBinDir=%__ReproProjectDir%\bin"
set "__ReproProjectObjDir=%__ReproProjectDir%\obj"

:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
set "__CMakeBinDir=%__BinDir%"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"

:: Configure environment if we are doing a clean build.
if not defined __CleanBuild goto MakeDirs
echo Doing a clean build
echo.

:: MSBuild projects would need a rebuild
set __MSBCleanBuildArgs=/t:rebuild /p:CleanedTheBuild=1

:: Cleanup the previous output for the selected configuration
if exist "%__BinDir%" rd /s /q "%__BinDir%"
if exist "%__ObjDir%" rd /s /q "%__ObjDir%"
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"

if exist "%__ReproProjectBinDir%" rd /s /q "%__ReproProjectBinDir%"
if exist "%__ReproProjectObjDir%" rd /s /q "%__ReproProjectObjDir%"

if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"

:MakeDirs
if not exist "%__BinDir%" md "%__BinDir%"
if not exist "%__ObjDir%" md "%__ObjDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
if not exist "%__LogsDir%" md "%__LogsDir%"

:CheckPrereqs
:: Check prerequisites
echo Checking pre-requisites...
echo.

:: Validate that PowerShell is accessibile.
for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
if defined __PSDir goto EvaluatePS
echo PowerShell is a prerequisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:EvaluatePS
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\Native\probe-win.ps1"""') do %%a

:CheckVS

set __VSProductVersion=
if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140

:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence
echo Visual Studio 2015 (Community is free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:CheckVSExistence
:: Does VS VS 2015 really exist?
if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild
echo Visual Studio 2015 (Community is free) is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:CheckMSBuild
:: Note: We've disabled node reuse because it causes file locking issues.
::       The issue is that we extend the build with our own targets which
::       means that that rebuilding cannot successfully delete the task
::       assembly.
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1

:: All set to commence the build

setlocal
echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.

:: Set the environment for the native build
set __VCBuildArch=x86_amd64
if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)
call "!VS%__VSProductVersion%COMNTOOLS!\..\..\VC\vcvarsall.bat" %__VCBuildArch%

:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__SourceDir%\Native\gen-buildsys-win.bat" "%__ProjectDir%\src\Native" %__VSVersion% %__BuildArch%
popd

:BuildComponents
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNative
echo Failed to generate native component build project!
exit /b 1

:BuildNative
set "__NativeBuildLog=%__LogsDir%\Native_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__IntermediatesDir%\install.vcxproj" %__MSBCleanBuildArgs% /nologo /maxcpucount /nodeReuse:false /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% /fileloggerparameters:Verbosity=normal;LogFile="%__NativeBuildLog%"
IF NOT ERRORLEVEL 1 goto ManagedBuild
echo Native component build failed. Refer !__NativeBuildLog! for details.
exit /b 1

:ManagedBuild
REM endlocal to rid us of environment changes from vcvarsall.bat
endlocal

REM setlocal to prepare for vsdevcmd.bat
setlocal

rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt
set Platform=

:: Restore the Tools directory
call %~dp0init-tools.cmd

echo Using CLI tools version:
dir /b "%__DotNetCliPath%\sdk"

:: Set the environment for the managed build
:SetupManagedBuild
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of managed components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__BuildLog=%__LogsDir%\msbuild_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__ProjectDir%\build.proj" %__MSBCleanBuildArgs% /p:RepoPath="%__ProjectDir%" /p:RepoLocalBuild="true" /p:RelativeProductBinDir="%__RelativeProductBinDir%" /p:ToolchainMilestone=%__ToolchainMilestone% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%"
IF NOT ERRORLEVEL 1 (
  findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%__BuildLog%"
  goto AfterILCompilerBuild
)
echo ILCompiler build failed. Refer !__BuildLog! for details.
exit /b 1

:AfterILCompilerBuild

:VsDevGenerateRespFiles
if defined __SkipVsDev goto :AfterVsDevGenerateRespFiles
set __GenRespFiles=0
if not exist "%__ObjDir%\ryujit.rsp" set __GenRespFiles=1
if not exist "%__ObjDir%\cpp.rsp" set __GenRespFiles=1
if "%__GenRespFiles%"=="1" (
    "%__DotNetCliPath%\dotnet.exe" restore --quiet --source "https://dotnet.myget.org/F/dotnet-core" "%__ReproProjectDir%"
    call "!VS140COMNTOOLS!\..\..\VC\vcvarsall.bat" %__BuildArch%
    "%__DotNetCliPath%\dotnet.exe" build --native --ilcpath "%__BinDir%\packaging\publish1" "%__ReproProjectDir%" -c %__BuildType%
    call :CopyResponseFile "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\ryujit.rsp"

    rem Workaround for https://github.com/dotnet/cli/issues/1956
    rmdir /s /q "%__ReproProjectBinDir%"
    rmdir /s /q "%__ReproProjectObjDir%"

    set __AdditionalCompilerFlags=
    if /i "%__BuildType%"=="debug" (
        set __AdditionalCompilerFlags=--cppcompilerflags /MTd
    )
    "%__DotNetCliPath%\dotnet.exe" build --native --cpp --ilcpath "%__BinDir%\packaging\publish1" "%__ReproProjectDir%" -c %__BuildType% !__AdditionalCompilerFlags!
    call :CopyResponseFile "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\cpp.rsp"
)
:AfterVsDevGenerateRespFiles

:RunTests
if defined __SkipTests exit /b 0

pushd "%__ProjectDir%\tests"
call "runtest.cmd" %__BuildType% %__BuildArch% /dotnetclipath %__DotNetCliPath%
set TEST_EXIT_CODE=%ERRORLEVEL%
popd
exit /b %TEST_EXIT_CODE%

:Usage
echo.
echo Build the CoreRT repo.
echo.
echo Usage:
echo     %__ThisScriptShort% [option1] [option2] ...
echo.
echo All arguments are optional. The options are:
echo.
echo./? -? /h -h /help -help: view this message.
echo Build architecture: one of x64, x86, arm ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo Visual Studio version: ^(default: VS2015^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo skiptests: skip building tests ^(default: tests are built^).
exit /b 1

rem Copies the dotnet generated response file while patching up references
rem to System.Private assemblies to the live built ones.
rem This is to make sure that making changes in a private library doesn't require
rem a full rebuild. It also helps with locating the symbols.
:CopyResponseFile
setlocal
> %~2 (
  for /f "tokens=*" %%l in (%~1) do (
    set line=%%l
    if "!line:publish1\sdk=!"=="!line!" (
        echo !line!
    ) ELSE (
        set assemblyPath=!line:~3!
        call :ExtractFileName !assemblyPath! assemblyFileName
        echo -r:%__BinDir%\!assemblyFileName!\!assemblyFileName!.dll
    )
  )
)
endlocal
goto:eof

rem Extracts a file name from a full path
rem %1 Full path to the file, %2 Variable to receive the file name
:ExtractFileName
setlocal
for %%i in ("%1") DO set fileName=%%~ni
endlocal & set "%2=%fileName%"
goto:eof


text:
package org.vitrivr.adampro.data.index

import org.apache.spark.sql.{DataFrame, Row}
import org.apache.spark.util.random.Sampling
import org.vitrivr.adampro.config.AttributeNames
import org.vitrivr.adampro.data.datatypes.TupleID._
import org.vitrivr.adampro.data.datatypes.vector.Vector.DenseSparkVector
import org.vitrivr.adampro.data.index.structures.IndexTypes
import org.vitrivr.adampro.query.distance.DistanceFunction
import org.vitrivr.adampro.utils.Logging
import org.vitrivr.adampro.data.datatypes.vector.Vector
import org.vitrivr.adampro.process.SharedComponentContext
import org.vitrivr.adampro.query.tracker.QueryTracker

/**
  * adamtwo
  *
  * Ivan Giangreco
  * August 2015
  */
trait IndexGenerator extends Serializable with Logging {
  private[index] val MINIMUM_NUMBER_OF_TUPLE = 1000

  //TODO: have index generator support pre-processing steps, e.g., PCA, etc. (but only if accepted by the index)

  /**
    *
    * @return
    */
  def indextypename: IndexTypes.IndexType

  /**
    * Indexes the data.
    *
    * @param data      raw data to index
    * @param attribute name of attribute to index
    * @return
    */
  def index(data: DataFrame, attribute: String)(tracker : QueryTracker): (DataFrame, Serializable)

  /**
    *
    * @param data
    * @param minN
    * @param distinct
    * @return
    */
  private def getSample(data: DataFrame, minN: Int, distinct: Boolean = false): Seq[Row] = {
    val n = data.count()
    val fraction = Sampling.computeFractionForSampleSize(minN, n, withReplacement = false)

    var sample = data.sample(false, fraction).collect()
    if (sample.length < minN) sample = sample ++ data.take(minN)

    if (distinct) sample = sample.distinct

    if (sample.length < minN) {
      log.warn("not enough distinct data found when indexing, possibly retry")
    }

    sample
  }

  /**
    *
    * @param minN
    * @return
    */
  protected def getSample(minN: Int): (DataFrame) => Seq[Row] = (data: DataFrame) => getSample(data, minN)

  /**
    *
    * @param minN
    * @return
    */
  protected def getSample(minN: Int, attribute : String): (DataFrame) => Seq[IndexingTaskTuple] =
    (data: DataFrame) => {
    getSample(data, minN).map(r => IndexingTaskTuple(r.getAs[TupleID](AttributeNames.internalIdColumnName), Vector.conv_dspark2vec(r.getAs[DenseSparkVector](attribute))))
  }

}

trait IndexGeneratorFactory extends Serializable with Logging {
  def getIndexGenerator(distance: DistanceFunction, properties: Map[String, String] = Map[String, String]())(implicit ac: SharedComponentContext): IndexGenerator

  def parametersInfo: Seq[ParameterInfo]
}

case class ParameterInfo(name: String, description: String, suggestedValues: Seq[String]) {}


text:
package org.gluu.service.cache;

import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

import javax.net.ssl.SSLParameters;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Important : keep it weld free. It's reused by oxd !
 *
 * @author yuriyz on 02/23/2017.
 */
public class RedisShardedProvider extends AbstractRedisProvider {

    private static final Logger LOG = LoggerFactory.getLogger(RedisShardedProvider.class);

    private ShardedJedisPool pool;

    public RedisShardedProvider(RedisConfiguration redisConfiguration) {
        super(redisConfiguration);
    }

    public void create() {
        try {
            LOG.debug("Starting RedisShardedProvider ... configuration:" + redisConfiguration);

            GenericObjectPoolConfig<ShardedJedis> poolConfig = new GenericObjectPoolConfig<>();
            poolConfig.setMaxTotal(redisConfiguration.getMaxTotalConnections());
            poolConfig.setMaxIdle(redisConfiguration.getMaxIdleConnections());
            poolConfig.setMinIdle(2);

            pool = new ShardedJedisPool(poolConfig, shards(redisConfiguration));

            testConnection();
            LOG.debug("RedisShardedProvider started.");
        } catch (Exception e) {
            LOG.error("Failed to start RedisShardedProvider.", e);
            throw new IllegalStateException("Error starting RedisShardedProvider", e);
        }
    }

    private static List<JedisShardInfo> shards(RedisConfiguration configuration) {
        final String[] serverWithPorts = StringUtils.split(configuration.getServers().trim(), ",");

        List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
        for (String serverWithPort : serverWithPorts) {
            serverWithPort = serverWithPort.trim();
            if (serverWithPort.contains(":") && !serverWithPort.contains("@") && !configuration.getServers().contains("//")) {
                final String[] split = serverWithPort.trim().split(":");
                String host = split[0];
                int port = Integer.parseInt(split[1].trim());

                try {
                    final JedisShardInfo shardInfo;
                    if (configuration.getUseSSL()) {
                        if (StringUtils.isNotBlank(configuration.getSslTrustStoreFilePath())
                                && StringUtils.isNotBlank(configuration.getSslKeyStoreFilePath())) {
                            shardInfo = new JedisShardInfo(host, port, true,
                                    RedisProviderFactory.createSslSocketFactory(configuration),
                                    new SSLParameters(), new DefaultHostnameVerifier());
                        } else {
                            shardInfo = new JedisShardInfo(host, port, true);
                        }
                    } else {
                        shardInfo = new JedisShardInfo(host, port);
                    }
                    shards.add(shardInfo);
                } catch (Exception e) {
                    LOG.error("Failed to create shard info.", e);
                }
            } else {
                shards.add(new JedisShardInfo(serverWithPort));
            }
        }
        return shards;
    }

    public void destroy() {
        LOG.debug("Destroying RedisShardedProvider");

        pool.close();

        LOG.debug("Destroyed RedisShardedProvider");
    }

    @Override
    public ShardedJedisPool getDelegate() {
        return pool;
    }

	@Override
	public boolean hasKey(String key) {
        try (final ShardedJedis resource = pool.getResource()) {
            Boolean hasKey = resource.exists(key);

            return Boolean.TRUE.equals(hasKey);
        }
	}

    @Override
    public Object get(String key) {
        ShardedJedis jedis = pool.getResource();
        try {
            byte[] value = jedis.get(key.getBytes());
            Object deserialized = null;
            if (value != null && value.length > 0) {
                deserialized = SerializationUtils.deserialize(value);
            }
            return deserialized;
        } finally {
            jedis.close();
        }
    }

    @Override
    public void put(int expirationInSeconds, String key, Object object) {
        ShardedJedis jedis = pool.getResource();
        try {
            String status = jedis.setex(key.getBytes(), expirationInSeconds, SerializationUtils.serialize((Serializable) object));
            LOG.trace("put - key: " + key + ", status: " + status);
        } finally {
            jedis.close();
        }
    }

    @Override
    public void put(String key, Object object) {
        ShardedJedis jedis = pool.getResource();
        try {
            String status = jedis.set(key.getBytes(), SerializationUtils.serialize((Serializable) object));
            LOG.trace("put - key: " + key + ", status: " + status);
        } finally {
            jedis.close();
        }
    }

    @Override
    public void remove(String key) {
        ShardedJedis jedis = pool.getResource();
        try {
            Long entriesRemoved = jedis.del(key.getBytes());
            LOG.trace("remove - key: " + key + ", entriesRemoved: " + entriesRemoved);
        } finally {
            jedis.close();
        }
    }

    @Override
    public void clear() {
        LOG.trace("clear not supported by sharded implemented");
    }
}


text:
namespace Google.Cloud.AIPlatform.V1.Snippets
{
    // [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync_flattened]
    using Google.Api.Gax;
    using Google.Cloud.AIPlatform.V1;
    using System;

    public sealed partial class GeneratedFeaturestoreServiceClientSnippets
    {
        /// <summary>Snippet for ListFeatures</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ListFeatures()
        {
            // Create client
            FeaturestoreServiceClient featurestoreServiceClient = FeaturestoreServiceClient.Create();
            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/locations/[LOCATION]/featurestores/[FEATURESTORE]/entityTypes/[ENTITY_TYPE]";
            // Make the request
            PagedEnumerable<ListFeaturesResponse, Feature> response = featurestoreServiceClient.ListFeatures(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Feature item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListFeaturesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Feature item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page<Feature> singlePage = response.ReadPage(pageSize);
            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Feature item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
    }
    // [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync_flattened]
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.taverna.activities.dataflow (Apache Taverna Engine and Platform 3.1.0-incubating API)</title>
<meta name="date" content="2016-06-30">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.apache.taverna.activities.dataflow

Class Summary

Class
Description

DataflowActivity

An Activity providing nested Dataflow functionality.

DataflowActivityFactory

An ActivityFactory for creating DataflowActivity.

DataflowActivityHealthChecker

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.


text:
.class public Lcom/tencent/stat/event/CustomEvent$Key;
.super Ljava/lang/Object;

# instance fields
.field a:Ljava/lang/String;

.field b:[Ljava/lang/String;

.field c:Ljava/util/Properties;

# direct methods
.method public constructor <init>()V
    .locals 1

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

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    return-void
.end method

# virtual methods
.method public equals(Ljava/lang/Object;)Z
    .locals 4

    const/4 v1, 0x1

    const/4 v2, 0x0

    if-ne p0, p1, :cond_1

    :cond_0
    :goto_0
    return v1

    :cond_1
    instance-of v0, p1, Lcom/tencent/stat/event/CustomEvent$Key;

    if-eqz v0, :cond_6

    check-cast p1, Lcom/tencent/stat/event/CustomEvent$Key;

    iget-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->a:Ljava/lang/String;

    iget-object v3, p1, Lcom/tencent/stat/event/CustomEvent$Key;->a:Ljava/lang/String;

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_3

    iget-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    iget-object v3, p1, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    invoke-static {v0, v3}, Ljava/util/Arrays;->equals([Ljava/lang/Object;[Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_3

    move v0, v1

    :goto_1
    iget-object v3, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    if-eqz v3, :cond_4

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    iget-object v3, p1, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    invoke-virtual {v0, v3}, Ljava/util/Properties;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    :cond_2
    move v1, v2

    goto :goto_0

    :cond_3
    move v0, v2

    goto :goto_1

    :cond_4
    if-eqz v0, :cond_5

    iget-object v0, p1, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    if-eqz v0, :cond_0

    :cond_5
    move v1, v2

    goto :goto_0

    :cond_6
    move v1, v2

    goto :goto_0
.end method

.method public hashCode()I
    .locals 2

    const/4 v0, 0x0

    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->a:Ljava/lang/String;

    if-eqz v1, :cond_0

    iget-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->a:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->hashCode()I

    move-result v0

    :cond_0
    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    if-eqz v1, :cond_1

    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    invoke-static {v1}, Ljava/util/Arrays;->hashCode([Ljava/lang/Object;)I

    move-result v1

    xor-int/2addr v0, v1

    :cond_1
    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    invoke-virtual {v1}, Ljava/util/Properties;->hashCode()I

    move-result v1

    xor-int/2addr v0, v1

    :cond_2
    return v0
.end method

.method public toString()Ljava/lang/String;
    .locals 4

    iget-object v2, p0, Lcom/tencent/stat/event/CustomEvent$Key;->a:Ljava/lang/String;

    const-string v0, ""

    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    if-eqz v1, :cond_1

    iget-object v0, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    const/4 v1, 0x0

    aget-object v1, v0, v1

    const/4 v0, 0x1

    :goto_0
    iget-object v3, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    array-length v3, v3

    if-ge v0, v3, :cond_0

    new-instance v3, Ljava/lang/StringBuilder;

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

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v3, ","

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v3, p0, Lcom/tencent/stat/event/CustomEvent$Key;->b:[Ljava/lang/String;

    aget-object v3, v3, v0

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v3, "["

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "]"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :cond_1
    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    if-eqz v1, :cond_2

    new-instance v1, Ljava/lang/StringBuilder;

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

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/tencent/stat/event/CustomEvent$Key;->c:Ljava/util/Properties;

    invoke-virtual {v1}, Ljava/util/Properties;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :cond_2
    new-instance v1, Ljava/lang/StringBuilder;

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

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
AreaFormatRecord (POI API Documentation)
</TITLE>

<META NAME="date" CONTENT="2012-11-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.hssf.record.chart

Class AreaFormatRecord

java.lang.Object
  org.apache.poi.hssf.record.RecordBase
      org.apache.poi.hssf.record.Record
          org.apache.poi.hssf.record.StandardRecord
              org.apache.poi.hssf.record.chart.AreaFormatRecord

public final class AreaFormatRecord
extends StandardRecord

The area format record is used to define the colours and patterns for an area.

Author:

Glen Stampoultzis (glens at apache.org)

Field Summary

static short
sid

Constructor Summary

AreaFormatRecord()

AreaFormatRecord(RecordInputStream in)

Method Summary

 java.lang.Object
clone()

 short
getBackcolorIndex()

          Get the backcolor index field for the AreaFormat record.

 int
getBackgroundColor()

          Get the background color field for the AreaFormat record.

protected  int
getDataSize()

 short
getForecolorIndex()

          Get the forecolor index field for the AreaFormat record.

 int
getForegroundColor()

          Get the foreground color field for the AreaFormat record.

 short
getFormatFlags()

          Get the format flags field for the AreaFormat record.

 short
getPattern()

          Get the pattern field for the AreaFormat record.

 short
getSid()

          return the non static version of the id for this record.

 boolean
isAutomatic()

          automatic formatting

 boolean
isInvert()

          swap foreground and background colours when data is negative

 void
serialize(LittleEndianOutput out)

          Write the data content of this BIFF record.

 void
setAutomatic(boolean value)

          Sets the automatic field value.

 void
setBackcolorIndex(short field_6_backcolorIndex)

          Set the backcolor index field for the AreaFormat record.

 void
setBackgroundColor(int field_2_backgroundColor)

          Set the background color field for the AreaFormat record.

 void
setForecolorIndex(short field_5_forecolorIndex)

          Set the forecolor index field for the AreaFormat record.

 void
setForegroundColor(int field_1_foregroundColor)

          Set the foreground color field for the AreaFormat record.

 void
setFormatFlags(short field_4_formatFlags)

          Set the format flags field for the AreaFormat record.

 void
setInvert(boolean value)

          Sets the invert field value.

 void
setPattern(short field_3_pattern)

          Set the pattern field for the AreaFormat record.

 java.lang.String
toString()

          get a string representation of the record (for biffview/debugging)

Methods inherited from class org.apache.poi.hssf.record.StandardRecord

getRecordSize, serialize

Methods inherited from class org.apache.poi.hssf.record.Record

cloneViaReserialise, serialize

Methods inherited from class java.lang.Object

equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

sid

public static final short sid

See Also:
Constant Field Values

Constructor Detail

AreaFormatRecord

public AreaFormatRecord()

AreaFormatRecord

public AreaFormatRecord(RecordInputStream in)

Method Detail

toString

public java.lang.String toString()

Description copied from class: Record

get a string representation of the record (for biffview/debugging)

Overrides:
toString in class Record

serialize

public void serialize(LittleEndianOutput out)

Description copied from class: StandardRecord

Write the data content of this BIFF record.  The 'ushort sid' and 'ushort size' header fields
 have already been written by the superclass.

 The number of bytes written must equal the record size reported by
  RecordBase.getRecordSize()} minus four
  ( record header consiting of a 'ushort sid' and 'ushort reclength' has already been written
  by thye superclass).

Specified by:
serialize in class StandardRecord

getDataSize

protected int getDataSize()

Specified by:
getDataSize in class StandardRecord

getSid

public short getSid()

Description copied from class: Record

return the non static version of the id for this record.

Specified by:
getSid in class Record

clone

public java.lang.Object clone()

Overrides:
clone in class Record

getForegroundColor

public int getForegroundColor()

Get the foreground color field for the AreaFormat record.

setForegroundColor

public void setForegroundColor(int field_1_foregroundColor)

Set the foreground color field for the AreaFormat record.

getBackgroundColor

public int getBackgroundColor()

Get the background color field for the AreaFormat record.

setBackgroundColor

public void setBackgroundColor(int field_2_backgroundColor)

Set the background color field for the AreaFormat record.

getPattern

public short getPattern()

Get the pattern field for the AreaFormat record.

setPattern

public void setPattern(short field_3_pattern)

Set the pattern field for the AreaFormat record.

getFormatFlags

public short getFormatFlags()

Get the format flags field for the AreaFormat record.

setFormatFlags

public void setFormatFlags(short field_4_formatFlags)

Set the format flags field for the AreaFormat record.

getForecolorIndex

public short getForecolorIndex()

Get the forecolor index field for the AreaFormat record.

setForecolorIndex

public void setForecolorIndex(short field_5_forecolorIndex)

Set the forecolor index field for the AreaFormat record.

getBackcolorIndex

public short getBackcolorIndex()

Get the backcolor index field for the AreaFormat record.

setBackcolorIndex

public void setBackcolorIndex(short field_6_backcolorIndex)

Set the backcolor index field for the AreaFormat record.

setAutomatic

public void setAutomatic(boolean value)

Sets the automatic field value.
 automatic formatting

isAutomatic

public boolean isAutomatic()

automatic formatting

Returns:
the automatic field value.

setInvert

public void setInvert(boolean value)

Sets the invert field value.
 swap foreground and background colours when data is negative

isInvert

public boolean isInvert()

swap foreground and background colours when data is negative

Returns:
the invert field value.

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2012 The Apache Software Foundation or
        its licensors, as applicable.


text:
layout:     post
title:      "First Post"
subtitle:   "Cuz I Like to Think and Write"
date:       2014-10-31 12:00:00
author:     "Connor Laubenstein"
header-img: "img/post-bg-01.jpg"
---

Hi all.  This is my first post.  I'll be blogging about all sorts of things.  Like the patriots, and film reviews and everything else I nerd out about.


text:
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Win32;
using SIL.Keyboarding;

namespace SIL.Windows.Forms.Keyboarding.Windows
{
	/// ----------------------------------------------------------------------------------------
	/// <summary>
	/// Keyboard description for a Windows system keyboard
	/// </summary>
	/// <remarks>Holds information about a specific keyboard, especially for IMEs (e.g. whether
	/// English input mode is selected) in addition to the default keyboard description. This
	/// is necessary to restore the current setting when switching between fields with
	/// differing keyboards. The user expects that a keyboard keeps its state between fields.
	/// </remarks>
	/// ----------------------------------------------------------------------------------------
	[SuppressMessage("Gendarme.Rules.Design", "TypesWithNativeFieldsShouldBeDisposableRule",
		Justification = "WindowHandle is a reference to a control")]
	internal class WinKeyboardDescription : KeyboardDescription
	{
		private string _localizedName;
		private readonly bool _useNfcContext;

		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="T:SIL.Windows.Forms.Keyboarding.Windows.WinKeyboardDescription"/> class.
		/// </summary>
		internal WinKeyboardDescription(string id, string name, string layout, string locale, bool isAvailable,
			IInputLanguage inputLanguage, WinKeyboardAdaptor engine, string localizedName, TfInputProcessorProfile profile)
			: base(id, name, layout, locale, isAvailable, engine)
		{
			InputLanguage = inputLanguage;
			_localizedName = localizedName;
			InputProcessorProfile = profile;
			ConversionMode = (int) (Win32.IME_CMODE.NATIVE | Win32.IME_CMODE.SYMBOL);
			_useNfcContext = !IsKeymanKeyboard(profile);
		}

		private static bool IsKeymanKeyboard(TfInputProcessorProfile profile)
		{
			if (profile.ProfileType != TfProfileType.InputProcessor)
				return false;

			// check the default key value for profile.ClsId.
			var subKey = string.Format(@"CLSID\{{{0}}}", profile.ClsId);
			using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(subKey))
			{
				if (key == null)
					return false;
				var value = key.GetValue(null) as string;
				return value != null && value.Contains("Keyman");
			}
		}

		/// <summary>
		/// Indicates whether we should pass NFC or NFD data to the keyboard. This implementation
		/// returns <c>false</c> for Keyman keyboards and <c>true</c> for other keyboards.
		/// </summary>
		public override bool UseNfcContext { get { return _useNfcContext; } }

		/// <summary>
		/// Gets a localized human-readable name of the input language.
		/// </summary>
		public override string LocalizedName
		{
			get { return _localizedName; }
		}

		internal int ConversionMode { get; set; }
		internal int SentenceMode { get; set; }
		internal IntPtr WindowHandle { get; set; }

		internal TfInputProcessorProfile InputProcessorProfile { get; set; }

		internal void SetIsAvailable(bool isAvailable)
		{
			IsAvailable = isAvailable;
		}

		internal void SetLocalizedName(string localizedName)
		{
			_localizedName = localizedName;
		}
	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>Doodle.js -- Making Things Move: Ch.3, p.73: Circular Movement</title>


text:
($ => {
    "use strict";

    window.NewtabHelper = function (b) {

        let config = {};

        this.init = () => {
            return new Promise((resolve) => {
                this.updateConfig().then(() => {
                    initEvents();
                    resolve();
                });
            });
        };

        /**
         * Retrieves the configuration about the new tab replacement from the storage
         */
        this.updateConfig = () => {
            return new Promise((resolve) => {
                chrome.storage.sync.get(["newtab"], (obj) => {
                    if (typeof obj.newtab === "undefined") {
                        config = {};
                    } else {
                        config = obj.newtab;
                    }
                    resolve();
                });
            });
        };

        /**
         * Initialises eventlistener for the new tab replacement
         *
         * @returns {Promise}
         */
        let initEvents = async () => {
            chrome.tabs.onCreated.addListener((tab) => {
                if (tab.url && tab.url === 'chrome://newtab/') {
                    if (typeof config.override !== "undefined" && config.override === true) {
                        let func = "create";
                        if (tab.index === 0) {
                            func = "update";
                        } else {
                            chrome.tabs.remove(tab.id);
                        }

                        if (config.website && config.website.length > 0) {
                            overrideWithUrl(func);
                        } else {
                            overrideWithNewTabReplacement(func);
                        }
                    }
                }
            });
        };

        /**
         * Overrides the current tab with the new tab replacement,
         * removes the current tab and reopens it to prevent the cursor to focus the omnibox, but focus the search field
         *
         * @param {string} func
         */
        let overrideWithNewTabReplacement = (func) => {
            chrome.tabs[func]({
                url: chrome.extension.getURL('html/newtab.html'),
                active: true
            });
        };

        /**
         * Overrides the current tab with a redirection to the configured url
         *
         * @param {string} func
         */
        let overrideWithUrl = (func) => {
            chrome.tabs[func]({
                url: addParameterToUrl(config.website, "bs_nt", 1),
                active: true
            });
        };

        /**
         * Adds a parameter to the given url,
         * maintains existing querystring and anchors
         *
         * @param {string} url
         * @param {string} key
         * @param {string|int} value
         * @returns {string}
         */
        let addParameterToUrl = (url, key, value) => {
            let re = new RegExp("([?&])" + key + "=.*?(&|#|$)", "i");
            if (url.match(re)) {
                return url.replace(re, '$1' + key + "=" + value + '$2');
            } else {
                let hash = '';
                if (url.indexOf('#') !== -1) {
                    hash = url.replace(/.*#/, '#');
                    url = url.replace(/#.*/, '');
                }
                let separator = url.indexOf('?') !== -1 ? "&" : "?";
                return url + separator + key + "=" + value + hash;
            }
        }
    };

})(jsu);


text:
<?php
$this->breadcrumbs=array(
	'Product Specifications'=>array('index'),
	$model->title,
);

$this->menu=array(
	array('label'=>'List ProductSpecification', 'url'=>array('index')),
	array('label'=>'Create ProductSpecification', 'url'=>array('create')),
	array('label'=>'Update ProductSpecification', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete ProductSpecification', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage ProductSpecification', 'url'=>array('admin')),
);
?>

View ProductSpecification #<?php echo $model->id; ?>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		'title',
		'is_user_input',
		'required',
	),
)); ?>


text:
<macros>
    <token name="@TOOL_VERSION@">2.1</token>
    <token name="@INTYPES@">
        fasta,fasta.gz,fastq,fastq.gz,fastqsanger,fastqsanger.gz
    </token>
</macros>


text:
layout: lecture
title: "Hello World"
date: 2015-08-31
presentation: "0B71BxANYTHrEeGFGSGdkNldxa1U"
categories : [lectures, 2015]
tags:
---

In this lecture we discussed the fundamentals of Javascript. Here are some important things to remember:
- Use `===` over `==`, you will get more consistent results
- Javascript, a lot of the time, will not throw an error, but rather will return `undefined` or `null`. Check for these error values when making programs
- `console.log` is your best friend. It's probably the easiest way to debug code


text:
layout: about
---

Storm guarantees every tuple will be fully processed. One of Storm's core mechanisms is the ability to track the lineage of a tuple as it makes its way through the topology in an extremely efficient way. Read more about how this works [here](/documentation/Guaranteeing-message-processing.html).

Storm's basic abstractions provide an at-least-once processing guarantee, the same guarantee you get when using a queueing system. Messages are only replayed when there are failures.

Using [Trident](/documentation/Trident-tutorial.html), a higher level abstraction over Storm's basic abstractions, you can achieve exactly-once processing semantics.


text:
package mobi.bbhn.brightberry;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;

import org.json.me.JSONObject;

import net.rim.device.api.ui.component.Dialog;

public class UpgradeThread extends Thread {
	static Settings settings = Settings.getInstance();
	BrightBerryMain screen;
	HttpConnection httpConnection = null;
	InputStream httpInput = null;

	public UpgradeThread(BrightBerryMain BrightBerryMain) {
		this.screen = BrightBerryMain;
	}

	public void run() {
		try {
			String url = "http://bbhn.mobi/version.php?version=" + BrightBerry.version;
			url += NetworkConfig.getConnectionParameters(settings.getConnectionMode());
			this.httpConnection = ((HttpConnection)Connector.open(url));
			this.httpConnection.setRequestProperty("User-Agent", BrightBerry.useragent);
			this.httpConnection.setRequestProperty("Content-Language", "en-US");
			this.httpConnection.setRequestProperty("x-rim-transcode-content", "none");
			this.httpInput = this.httpConnection.openInputStream();
			StringBuffer buffer = new StringBuffer();
			int ch = 0;
			while (ch != -1) {
				ch = httpInput.read();
				buffer.append((char)ch);
			}
			this.screen.callUpgrade(parseJSON(buffer.toString()));
			if (this.httpInput != null) {
				this.httpInput.close();
			}
			if (this.httpConnection != null) {
				this.httpConnection.close();
			}
		} catch (IOException e) {
			Dialog.alert("Caught Exception");
		}
	}

	private static boolean parseJSON(String json) {
		JSONObject me = null;
		try {
			me = new JSONObject(json);
			String upgrade = me.getString("upgradeavailable");
			if (upgrade.equals("true")) {
				return true;
			} else {
				return false;
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
		return false;
	}
}


text:
<?php
/**
 * Adds the meta box for the Content Permissions component.  This allows users with
 * the 'restrict_content' capability to restrict posts/pages on a post/page basis. Roles
 * with the 'restrict_content' capability should be able to see all content, regardless
 * of the settings.
 *
 * @package Members
 * @subpackage Components
 */

/**
 * Adds the meta box to the post/page edit screen if the current user has
 * the 'restrict_content' capability.
 *
 * @since 0.1
 * @uses add_meta_box() Creates an additiona meta box.
 */
function members_content_permissions_create_meta_box() {
	if ( current_user_can( 'restrict_content' ) ) {
		add_meta_box( 'content-permissions-meta-box', 'Content Permissions', 'members_content_permissions_meta_box', 'post', 'advanced', 'high' );
		add_meta_box( 'content-permissions-meta-box', 'Content Permissions', 'members_content_permissions_meta_box', 'page', 'advanced', 'high' );
	}
}

/**
 * Controls the display of the content permissions meta box.  This allows users
 * to select roles that should have access to an individual post/page.
 *
 * @since 0.1
 * @global $post
 * @global $wp_roles
 * @param $object
 * @param $box
 */
function members_content_permissions_meta_box( $object, $box ) {
	global $post, $wp_roles; ?>

	<input type="hidden" name="content_permissions_meta_nonce" value="<?php echo wp_create_nonce(plugin_basename(__FILE__)); ?>" />

		<?php _e('Roles: Restrict the content to these roles on the front end of the site.  If all boxes are left unchecked, everyone can view the content.', 'members'); ?>

		<?php

		/* Get the 'Role' meta key. */
		$meta = get_post_meta( $post->ID, '_role', false );

		/* Loop through each of the available roles. */
		foreach ( $wp_roles->role_names as $role => $name ) {
			$checked = false;

			/* If the role has been selected, make sure it's checked. */
			if ( is_array( $meta ) && in_array( $role, $meta ) )
				$checked = ' checked="checked" '; ?>

				<label for="role-<?php echo $role; ?>">
					<input type="checkbox" name="role[<?php echo $role; ?>]" id="role-<?php echo $role; ?>" <?php echo $checked; ?> value="<?php echo $role; ?>" />
					<?php echo str_replace( '|User role', '', $name ); ?>

		<?php } ?>

<?php
}

/**
 * Saves the content permissions metabox data to a custom field.
 *
 * @since 0.1
 */
function members_content_permissions_save_meta( $post_id, $post ) {
	global $wp_roles;

	/* Only allow users that can edit the current post to submit data. */
	if ( 'post' == $post->post_type && !current_user_can( 'edit_posts', $post_id ) )
		return;

	/* Only allow users that can edit the current page to submit data. */
	elseif ( 'page' == $post->post_type && !current_user_can( 'edit_pages', $post_id ) )
		return;

	/* Don't save if the post is only a revision. */
	if ( 'revision' == $post->post_type )
		return;

	/* Loop through each of the site's available roles. */
	foreach ( $wp_roles->role_names as $role => $name ) {

		/* Get post metadata for the custom field key 'Role'. */
		$meta = (array)get_post_meta( $post_id, '_role', false );

		/* Check if the role was selected. */
		if ( $_POST['role'][$role] ) {

			/* If selected and already saved, continue looping through the roles and do nothing for this role. */
			if ( in_array( $role, $meta ) )
				continue;

			/* If the role was seleted and not already saved, add the role as a new value to the 'Role' custom field. */
			else
				$add = add_post_meta( $post_id, '_role', $role, false );
		}

		/* If role not selected, delete. */
		else
			$delete = delete_post_meta( $post_id, '_role', $role );

	} // End loop through site's roles.
}

?>


text:
package org.apache.river.reggie.proxy;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Proxy;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.jini.core.constraint.RemoteMethodControl;
import net.jini.core.lookup.ServiceMatches;
import net.jini.lookup.ServiceAttributesAccessor;
import net.jini.lookup.ServiceProxyAccessor;
import org.apache.river.api.io.AtomicSerial;
import org.apache.river.api.io.AtomicSerial.GetArg;
import org.apache.river.api.io.AtomicSerial.PutArg;
import org.apache.river.api.io.AtomicSerial.SerialForm;
import org.apache.river.api.io.Valid;

/**
 * A Matches contains the fields of a ServiceMatches packaged up for
 * transmission between client-side proxies and the registrar server.
 * Instances are never visible to clients, they are private to the
 * communication between the proxies and the server.
 * <p>
 * This class only has a bare minimum of methods, to minimize
 * the amount of code downloaded into clients.
 *
 * @author Sun Microsystems, Inc.
 *
 */
@AtomicSerial
public class Matches implements Serializable {

    private static final long serialVersionUID = 2L;

    public static SerialForm[] serialForm(){
        return new SerialForm[]{
            new SerialForm("items", List.class),
            new SerialForm("totalMatches", Integer.TYPE)
        };
    }

    public static void serialize(PutArg arg, Matches m) throws IOException{
        arg.put("items", m.items);
        arg.put("totalMatches", m.totalMatches);
        arg.writeArgs();
    }

    /**
     * ServiceMatches.items as an ArrayList of Item
     *
     * @serial
     */
    private final List<Item> items;
    /**
     * ServiceMatches.totalMatches
     *
     * @serial
     */
    private final int totalMatches;

    Matches(GetArg arg) throws IOException, ClassNotFoundException{
	this(Valid.copyCol(arg.get("items", null, List.class),
			   new LinkedList<Item>(),
			   Item.class),
	    arg.get("totalMatches",0));
    }

    /** Simple constructor. */
    public Matches(List<Item> items, int totalMatches) {
	this.items = items;
	this.totalMatches = totalMatches;
    }

    /** Converts a Matches to a ServiceMatches. */
    ServiceMatches get() throws RemoteException {
	return new ServiceMatches(Item.toServiceItem(items), totalMatches);
    }

    public Object [] getProxys() {
	if (items == null) return new Object [0];
	List result = new ArrayList(items.size());
	Iterator<Item> it = items.iterator();
	while (it.hasNext()) {
	    Object proxy = it.next().getProxy();
	    if(!(proxy instanceof RemoteMethodControl)) continue;
	    if(!(proxy instanceof ServiceProxyAccessor)) continue;
	    if(!(proxy instanceof ServiceAttributesAccessor)) continue;
	    if(!Proxy.isProxyClass(proxy.getClass())) continue;
	    result.add(proxy);
	}
	return result.toArray();
    }

    private void writeObject(ObjectOutputStream out) throws IOException {
	out.defaultWriteObject();
    }
}


text:
var http = require('http');
var options = {
  port: '8080'
};

function sendRequest() {
  http.request(options, function(response) {
    var serverData = '';
    response.on('data', function(chunk) {
      serverData += chunk;
    });
    response.on('end', function() {
      console.log(serverData);
    });
  }).end();
}

for (var i = 0; i < 2; i++) {
  console.log('Sending Request');
  sendRequest();
}


text:
require 'user'

ActiveRecord::Base.connection.schema_cache.clear!

class BlackholeSession
  def initialize(*args)
  end

  def method_missing(*args)
  end
end

Sunspot.session = BlackholeSession.new

unless User.where(:username => "chorusadmin").present?
  puts "Creating chorusadmin user..."
  user = User.new(
    :username => "chorusadmin",
    :first_name => "Chorus",
    :last_name => "Admin",
    :email => "chorusadmin@example.com",
    :password => "secret",
    :password_confirmation => "secret"
  )
  user.admin = true
  user.save!
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>PendingRequestViewCell</title>
<meta name="date" content="2016-11-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.cloudycrew.cloudycar.viewcells

Class PendingRequestViewCell

java.lang.Object

ca.antonious.viewcelladapter.ViewCell<VH>

ca.antonious.viewcelladapter.SingleViewCell<VH>

ca.antonious.viewcelladapter.GenericSingleViewCell<VH,T>

com.cloudycrew.cloudycar.viewcells.BaseRequestViewCell<PendingRequestViewCell.ViewHolder,PendingRequest>

com.cloudycrew.cloudycar.viewcells.PendingRequestViewCell

public class PendingRequestViewCell
extends BaseRequestViewCell<PendingRequestViewCell.ViewHolder,PendingRequest>

Created by George on 2016-11-17.

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
PendingRequestViewCell.ViewHolder

Nested classes/interfaces inherited from class com.cloudycrew.cloudycar.viewcells.BaseRequestViewCell

BaseRequestViewCell.OnRequestClickedListener

Constructor Summary

Constructors

Constructor and Description

PendingRequestViewCell(PendingRequest model)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
bindViewCell(PendingRequestViewCell.ViewHolder viewHolder)

int
getLayoutId()

Methods inherited from class com.cloudycrew.cloudycar.viewcells.BaseRequestViewCell

bindListeners

Methods inherited from class ca.antonious.viewcelladapter.GenericSingleViewCell

getItemId, getModel, getViewHolderClass

Methods inherited from class ca.antonious.viewcelladapter.SingleViewCell

bindListeners, bindViewCell, get, getItemCount, getItemId, getLayoutId, remove

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

PendingRequestViewCell

public PendingRequestViewCell(PendingRequest model)

Method Detail

getLayoutId

public int getLayoutId()

Specified by:

getLayoutId in class ca.antonious.viewcelladapter.SingleViewCell<PendingRequestViewCell.ViewHolder>

bindViewCell

public void bindViewCell(PendingRequestViewCell.ViewHolder viewHolder)

Specified by:

bindViewCell in class ca.antonious.viewcelladapter.SingleViewCell<PendingRequestViewCell.ViewHolder>

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
using System;
using Server;

namespace Server.Items
{
	public class OfficialSealingWax : Item
	{
		public override int LabelNumber{ get{ return 1072744; } } // Official Sealing Wax

		public override bool Nontransferable { get { return true; } }

		public override void AddNameProperties( ObjectPropertyList list )
		{
			base.AddNameProperties( list );
			AddQuestItemProperty( list );
		}

		[Constructable]
		public OfficialSealingWax() : base( 0x1426 )
		{
			LootType = LootType.Blessed;
			Hue = 0x84;
		}

		public OfficialSealingWax( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}


text:
> TL;DR on the previous three sections: randomly mixing safe pointers like `&`, `&mut`, and `Box` with unsafe pointers like `*mut` and `*const` is a recipe for Undefined Behaviour because the safe pointers introduce extra constraints that we aren't obeying with the raw pointers.

Oh god I need to write linked lists again. Fine. FINE. It's Fine. We're fine.

We're gonna knock a lot of this section out real quick since we already discussed the design in the first try around, and everything we did *was* basically correct except for how we mixed together safe and unsafe pointers.

# Layout

So in the new layout we're only going to only use raw pointers and everything will be perfect and we'll never make mistakes again.

Here's our old broken layout:

```rust
pub struct List<T> {
    head: Link<T>,
    tail: *mut Node<T>, // INNOCENT AND KIND
}

type Link<T> = Option<Box<Node<T>>>; // THE REAL EVIL

struct Node<T> {
    elem: T,
    next: Link<T>,
}
```

And here's our new layout:

```rust
pub struct List<T> {
    head: Link<T>,
    tail: *mut Node<T>,
}

type Link<T> = *mut Node<T>; // MUCH BETTER

struct Node<T> {
    elem: T,
    next: Link<T>,
}
```

Remember: Option isn't as nice or useful when we're using raw pointers, so we're not using that anymore. In later sections we'll look at the `NonNull` type, but don't worry about that for now.

# Basics

List::new is basically the same.

```rust ,ignore
use ptr;

impl<T> List<T> {
    pub fn new() -> Self {
        List { head: ptr::null_mut(), tail: ptr::null_mut() }
    }
}
```

Push is basically the s-

```rust ,ignore
pub fn push(&mut self, elem: T) {
    let mut new_tail = Box::new(
```

Wait we're not using Box anymore. How do we allocate memory without Box?

Well, we *could* with `std::alloc::alloc`, but that's like bringing a katana into the kitchen. It'll get the job done but it's kinda overkill and unwieldy.

We want to *have* boxes, but, *not*. One completely wild but *maybe* viable option would be to do something like this:

```
struct Node<T> {
    elem: T,
    real_next: Option<Box<Node<T>>>,
    next: *mut Node<T>,
}
```

With the idea that we create the Boxes and store them in our node, but then we take a raw pointer into them and only use that raw pointer until we're done with the Node and want to destroy it. Then we can `take` the Box out of `real_next` and drop it. I *think* that would conform to our very simplified stacked borrows model?

If you wanna try to make that, have "fun", but that just looks awful right? This isn't the chapter on Rc and RefCell, we're not gonna play this *game* anymore. We're gonna just make simple and clean stuff.

So instead we're going to use the very nice [Box::into_raw][] function:

> ```rust ,ignore
>   pub fn into_raw(b: Box<T>) -> *mut T
> ```
>
> Consumes the Box, returning a wrapped raw pointer.
>
> The pointer will be properly aligned and non-null.
>
>After calling this function, the caller is responsible for the memory previously managed by the Box. In particular, the caller should properly destroy T and release the memory, taking into account the memory layout used by Box. The easiest way to do this is to convert the raw pointer back into a Box with the `Box::from_raw` function, allowing the Box destructor to perform the cleanup.
>
> Note: this is an associated function, which means that you have to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This is so that there is no conflict with a method on the inner type.
>
> **Examples**
>
> Converting the raw pointer back into a Box with Box::from_raw for automatic cleanup:
>
> ```
>  let x = Box::new(String::from("Hello"));
>  let ptr = Box::into_raw(x);
>  let x = unsafe { Box::from_raw(ptr) };
> ```

Nice, that looks *literally* designed for our use case. It also matches the rules we're trying to follow: start with safe stuff, turn into into raw pointers, and then only convert back to safe stuff at the end (when we want to Drop it).

This is basically exactly like doing the weird `real_next` thing but without having to faff around storing the Box when it's the exact same pointer as the raw pointer anyway.

Also now that we're just using raw pointers everywhere, let's not worry about keeping those `unsafe` blocks narrow: it's all unsafe now. (It always was, but it's nice to lie to yourself sometimes.)

```rust ,ignore
pub fn push(&mut self, elem: T) {
    unsafe {
        // Immediately convert the Box into a raw pointer
        let new_tail = Box::into_raw(Box::new(Node {
            elem: elem,
            next: ptr::null_mut(),
        }));

        if !self.tail.is_null() {
            (*self.tail).next = new_tail;
        } else {
            self.head = new_tail;
        }

        self.tail = new_tail;
    }
}
```

Hey that code's actually looking a lot cleaner now that we're sticking to raw pointers!

On to pop, which is also pretty similar to how we left it, although we've got to remember to use `Box::from_raw` to clean up the allocation:

```rust ,ignore
pub fn pop(&mut self) -> Option<T> {
    unsafe {
        if self.head.is_null() {
            None
        } else {
            // RISE FROM THE GRAVE
            let head = Box::from_raw(self.head);
            self.head = head.next;

            if self.head.is_null() {
                self.tail = ptr::null_mut();
            }

            Some(head.elem)
        }
    }
}
```

Our nice little `take`s and `map`s are dead, gotta just check and set `null` manually now.

And while we're here, let's slap in the destructor. This time we'll implement it as just repeatedly popping, because it's cute and simple:

```rust ,ignore
impl<T> Drop for List<T> {
    fn drop(&mut self) {
        while let Some(_) = self.pop() { }
    }
}
```

Now, for the moment of truth:

```rust ,ignore
#[cfg(test)]
mod test {
    use super::List;
    #[test]
    fn basics() {
        let mut list = List::new();

        // Check empty list behaves right
        assert_eq!(list.pop(), None);

        // Populate list
        list.push(1);
        list.push(2);
        list.push(3);

        // Check normal removal
        assert_eq!(list.pop(), Some(1));
        assert_eq!(list.pop(), Some(2));

        // Push some more just to make sure nothing's corrupted
        list.push(4);
        list.push(5);

        // Check normal removal
        assert_eq!(list.pop(), Some(3));
        assert_eq!(list.pop(), Some(4));

        // Check exhaustion
        assert_eq!(list.pop(), Some(5));
        assert_eq!(list.pop(), None);

        // Check the exhaustion case fixed the pointer right
        list.push(6);
        list.push(7);

        // Check normal removal
        assert_eq!(list.pop(), Some(6));
        assert_eq!(list.pop(), Some(7));
        assert_eq!(list.pop(), None);
    }
}
```

```text
cargo test

running 12 tests
test fifth::test::basics ... ok
test first::test::basics ... ok
test fourth::test::basics ... ok
test fourth::test::peek ... ok
test second::test::basics ... ok
test fourth::test::into_iter ... ok
test second::test::into_iter ... ok
test second::test::iter ... ok
test second::test::iter_mut ... ok
test second::test::peek ... ok
test third::test::basics ... ok
test third::test::iter ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured
```

Good, but does miri agree?

```text
MIRIFLAGS="-Zmiri-tag-raw-pointers" cargo +nightly-2022-01-21 miri test

running 12 tests
test fifth::test::basics ... ok
test first::test::basics ... ok
test fourth::test::basics ... ok
test fourth::test::peek ... ok
test second::test::basics ... ok
test fourth::test::into_iter ... ok
test second::test::into_iter ... ok
test second::test::iter ... ok
test second::test::iter_mut ... ok
test second::test::peek ... ok
test third::test::basics ... ok
test third::test::iter ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured
```

EYYYY!!!!!

IT FRIGGIN WORKED!

PROBABLY!

FAILING TO FIND UNDEFINED BEHAVIOUR IS NOT A PROOF THAT IT ISN'T THERE WAITING TO CAUSE PROBLEMS BUT THERE IS A LIMIT TO HOW RIGOROUS I AM WILLING TO BE FOR A JOKE BOOK ABOUT LINKED LISTS SO WE'RE GONNA CALL THIS A 100% MACHINE VERIFIED PROOF AND ANYONE WHO SAYS OTHERWISE CAN SUCK MY COQ!

∴ QED □

[Box::into_raw]: https://doc.rust-lang.org/std/boxed/struct.Box.html#method.into_raw


text:
<!DOCTYPE html>

  <title>::distributed pseudo elements with dynamic attribute change</title>

I should be green.