text:
package org.apache.slide.store;

import java.util.Enumeration;
import java.util.Vector;

import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.Service;
import org.apache.slide.common.ServiceAccessException;
import org.apache.slide.common.ServiceInitializationFailedException;
import org.apache.slide.common.Uri;
import org.apache.slide.content.NodeRevisionContent;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.content.NodeRevisionNumber;
import org.apache.slide.content.RevisionAlreadyExistException;
import org.apache.slide.content.RevisionDescriptorNotFoundException;
import org.apache.slide.content.RevisionNotFoundException;
import org.apache.slide.lock.LockTokenNotFoundException;
import org.apache.slide.lock.NodeLock;
import org.apache.slide.security.NodePermission;
import org.apache.slide.structure.ObjectAlreadyExistsException;
import org.apache.slide.structure.ObjectNode;
import org.apache.slide.structure.ObjectNotFoundException;
import org.apache.slide.util.HashMapObjectCache;
import org.apache.slide.util.ObjectCache;

/**
 * Abstract implementation of a store. Handles all caching operations.
 *
 * @deprecated This store is deprecated as it has no reasonable transaction support, use ExtendedStore instead.
 * @version $Revision: 1.2 $
 */
public class StandardStore extends AbstractStore {

    // ----------------------------------------------------------- Constructors

    /**
     * Constructor. Handles caches initialization.
     */
    public StandardStore() {
        super();

        objectsCache = new HashMapObjectCache(1000, 10000, 0.95);
        permissionsCache = new HashMapObjectCache(1000, 10000, 0.95);
        locksCache = new HashMapObjectCache(1000, 10000, 0.95);
        descriptorsCache = new HashMapObjectCache(1000, 10000, 0.95);
        descriptorCache = new HashMapObjectCache(1000, 10000, 0.8);
    }

    // ----------------------------------------------------- Instance Variables

    /**
     * Nodes cache.
     */
    protected ObjectCache objectsCache;

    /**
     * Permissions cache.
     */
    protected ObjectCache permissionsCache;

    /**
     * Locks cache.
     */
    protected ObjectCache locksCache;

    /**
     * Revision descriptors cache.
     */
    protected ObjectCache descriptorsCache;

    /**
     * Revision descriptor cache.
     */
    protected ObjectCache descriptorCache;

    // ---------------------------------------------------- ServiceImpl Methods

    /**
     * Initializes descriptors store.
     *
     * @exception ServiceInitializationFailedException Throws an exception
     * if the descriptors store has already been initialized before
     */
    public void initialize(NamespaceAccessToken token)
        throws ServiceInitializationFailedException {
        super.initialize(token);
    }

    // ----------------------------------------------- DescriptorsStore Methods

    /**
     * Retrive an object from the Descriptors Store.
     *
     * @param uri Uri of the object we want to retrieve
     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectNotFoundException The object to retrieve was not found
     */
    public ObjectNode retrieveObject(Uri uri)
        throws ServiceAccessException, ObjectNotFoundException {
        if (nodeStore.cacheResults()) {
            Object tempObject = objectsCache.get(uri.toString());
            if (tempObject != null) {
                return ((ObjectNode) tempObject).cloneObject();
            } else {
                ObjectNode objectNode = nodeStore.retrieveObject(uri);
                objectNode.validate(uri.toString());
                objectsCache.put(uri.toString(), objectNode.cloneObject());
                return objectNode;
            }
        } else {
            return super.retrieveObject(uri);
        }
    }

    /**
     * Store an object in the Descriptors Store.
     *
     * @param object Object to update
     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectNotFoundException The object to update was not found
     */
    public void storeObject(Uri uri, ObjectNode object)
        throws ServiceAccessException, ObjectNotFoundException {
        super.storeObject(uri, object);
        if (nodeStore.cacheResults()) {
            objectsCache.put(uri.toString(), object.cloneObject());
        }
    }

    /**
     * Create a new object in the Descriptors Store.
     *
     * @param object SlideObject
     * @param uri Uri of the object we want to create
     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectAlreadyExistsException An object already exists
     * at this Uri
     */
    public void createObject(Uri uri, ObjectNode object)
        throws ServiceAccessException, ObjectAlreadyExistsException {
        super.createObject(uri, object);
        if (nodeStore.cacheResults()) {
            objectsCache.put(uri.toString(), object.cloneObject());
        }
    }

    /**
     * Remove an object from the Descriptors Store.
     *
     * @param object Object to remove
     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectNotFoundException The object to remove was not found
     */
    public void removeObject(Uri uri, ObjectNode object)
        throws ServiceAccessException, ObjectNotFoundException {
        super.removeObject(uri, object);
        if (nodeStore.cacheResults()) {
            objectsCache.remove(uri.toString());
        }
    }

    /**
     * Store an object permissions in the Descriptors Store.
     *
     * @param permission Permission we want to create
     * @exception ServiceAccessException Error accessing the Descriptors Store
     */
    public void grantPermission(Uri uri, NodePermission permission)
        throws ServiceAccessException {
        super.grantPermission(uri, permission);
        if (securityStore.cacheResults()) {
            NodePermission tempPermission = permission.cloneObject();
            Object value = permissionsCache.get(uri.toString());
            if (value == null) {
                // populate the cache with the existing entries
                enumeratePermissions(uri);
                // and check if the cache contains a corresponding entry now
                value = permissionsCache.get(uri.toString());
                if (value == null) {
                    // no permissions for the Uri in the cache, so create a new
                    // entry
                    Vector permissionsVector = new Vector();
                    permissionsVector.addElement(tempPermission);
                    permissionsCache.put(uri.toString(), permissionsVector);
                }
            } else {
                Vector permissionsVector = (Vector) value;
                permissionsVector.addElement(tempPermission);
            }
        }
    }

    /**
     * Store an object permissions in the Descriptors Store.
     *
     * @param permission Permission we want to create
     * @exception ServiceAccessException Error accessing the Descriptors Store
     */
    public void revokePermission(Uri uri, NodePermission permission)
        throws ServiceAccessException {
        super.revokePermission(uri, permission);
        if (securityStore.cacheResults()) {
            Object value = permissionsCache.get(uri.toString());
            Vector permissionsVector = null;
            if (value != null) {
                permissionsVector = (Vector) value;
                permissionsVector.removeElement(permission);
            }
        }
    }

    /**
     * Revoke all the permissions on the object.
     *
     * @param uri The uri of the object
     * @exception ServiceAccessException Error accessing the Descriptors Store
     */
    public void revokePermissions(Uri uri)
        throws ServiceAccessException {
        super.revokePermissions(uri);
        if (securityStore.cacheResults()) {
            Object value = permissionsCache.get(uri.toString());
            Vector permissionsVector = null;
            if (value != null) {
                permissionsVector = (Vector) value;
                permissionsVector.removeAllElements();
            }
        }
    }

    /**
     * Enumerate an object permissions.
     *
     * @param uri The uri of the object
     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @return A enumeration of all
     * {@link org.apache.slide.security.NodePermission permissions} on this object.
     */
    public Enumeration enumeratePermissions(Uri uri)
        throws ServiceAccessException {
        // TODO : The vectors elements MUST be cloned for non chached Results
        if (securityStore.cacheResults()) {
            Object value = permissionsCache.get(uri.toString());
            Vector permissionsVector = null;
            if (value != null) {
                permissionsVector = (Vector) value;
            } else {
                permissionsVector = new Vector();
                Enumeration tempEnum = securityStore.enumeratePermissions(uri);
                while (tempEnum.hasMoreElements()) {
                    NodePermission tempPermission =
                        (NodePermission) tempEnum.nextElement();
                    tempPermission.validate(uri.toString());
                    permissionsVector.addElement(tempPermission);
                }
                permissionsCache.put(uri.toString(), permissionsVector);
            }
            return ((Vector) permissionsVector.clone()).elements();
        } else {
            return super.enumeratePermissions(uri);
        }
    }

    /**
     * Puts a lock on a subject.
     *
     * @param lock Lock token
     * @exception ServiceAccessException Service access error
     */
    public void putLock(Uri uri, NodeLock lock)
        throws ServiceAccessException {
        super.putLock(uri, lock);
        if (lockStore.cacheResults()) {
            Object value = locksCache.get(uri.toString());
            Vector locksVector = null;
            if (value == null) {
                locksVector = new Vector();
                locksCache.put(uri.toString(), locksVector);
            } else {
                locksVector = (Vector) value;
            }
            locksVector.addElement(lock.cloneObject());
        }
    }

    /**
     * Renews a lock.
     *
     * @param lock Token to renew
     * @exception ServiceAccessException Service access error
     * @exception LockTokenNotFoundException Lock token was not found
     */
    public void renewLock(Uri uri, NodeLock lock)
        throws ServiceAccessException, LockTokenNotFoundException {
        super.renewLock(uri, lock);
        if (lockStore.cacheResults()) {
            Object value = locksCache.get(uri.toString());
            Vector locksVector = null;
            if (value != null) {
                locksVector = (Vector) value;
                boolean wasPresent = locksVector.removeElement(lock);
                if (!wasPresent) {
                    throw new LockTokenNotFoundException(lock);
                }
                locksVector.addElement(lock.cloneObject());
            }
        }
    }

    /**
     * Removes (cancels) a lock.
     *
     * @param lock Token to remove
     * @exception ServiceAccessException Service access error
     * @exception LockTokenNotFoundException Lock token was not found
     */
    public void removeLock(Uri uri, NodeLock lock)
        throws ServiceAccessException, LockTokenNotFoundException {
        super.removeLock(uri, lock);
        if (lockStore.cacheResults()) {
            Object value = locksCache.get(uri.toString());
            Vector locksVector = null;
            if (value != null) {
                locksVector = (Vector) value;
                boolean wasPresent = locksVector.removeElement(lock);
                if (!wasPresent) {
                    throw new LockTokenNotFoundException(lock);
                }
            }
        }
    }

    /**
     * Kills a lock.
     *
     * @param lock Token to remove
     * @exception ServiceAccessException Service access error
     * @exception LockTokenNotFoundException Lock token was not found
     */
    public void killLock(Uri uri, NodeLock lock)
        throws ServiceAccessException, LockTokenNotFoundException {
        super.killLock(uri, lock);
        if (lockStore.cacheResults()) {
            Object value = locksCache.get(uri.toString());
            Vector locksVector = null;
            if (value != null) {
                locksVector = (Vector) value;
                boolean wasPresent = locksVector.removeElement(lock);
                if (!wasPresent) {
                    throw new LockTokenNotFoundException(lock);
                }
            }
        }
    }

    /**
     * Enumerate locks on an object.
     *
     * @param uri Uri of the subject
     * @return Enumeration List of {@link org.apache.slide.lock.NodeLock locks}
     * which have been put on the subject
     * @exception ServiceAccessException Service access error
     */
    public Enumeration enumerateLocks(Uri uri)
        throws ServiceAccessException {
        if (lockStore.cacheResults()) {
            Object value = locksCache.get(uri.toString());
            Vector locksVector = null;
            if (value == null) {
                locksVector = new Vector();
                Enumeration lockList = lockStore.enumerateLocks(uri);
                while (lockList.hasMoreElements()) {
                    NodeLock tempLock = (NodeLock) lockList.nextElement();
                    tempLock.validate(uri.toString());
                    locksVector.addElement(tempLock);
                }
                locksCache.put(uri.toString(), locksVector);
            } else {
                locksVector = (Vector) value;
            }
            return ((Vector) locksVector.clone()).elements();
        } else {
            return super.enumerateLocks(uri);
        }
    }

    /**
     * Retrieve a revision descriptors.
     *
     * @param uri Uri
     * @exception ServiceAccessException Service access error
     * @exception RevisionDescriptorNotFoundException Revision descriptor
     * was not found
     */
    public NodeRevisionDescriptors retrieveRevisionDescriptors(Uri uri)
        throws ServiceAccessException, RevisionDescriptorNotFoundException {
        if (revisionDescriptorsStore.cacheResults()) {
            Object tempObject = descriptorsCache.get(uri.toString());
            if (tempObject != null) {
                return ((NodeRevisionDescriptors) tempObject).cloneObject();
            } else {
                NodeRevisionDescriptors revisionDescriptors =
                    revisionDescriptorsStore.retrieveRevisionDescriptors(uri);
                revisionDescriptors = revisionDescriptors.cloneObject();
                descriptorsCache.put(uri.toString(),
                                     revisionDescriptors);
                revisionDescriptors.validate(uri.toString());
                return revisionDescriptors;
            }
        } else {
            return super.retrieveRevisionDescriptors(uri);
        }
    }

    /**
     * Create new revision descriptors.
     *
     * @param uri Uri
     * @param revisionDescriptors Node revision descriptors
     * @exception ServiceAccessException Service access error
     */
    public void createRevisionDescriptors
        (Uri uri, NodeRevisionDescriptors revisionDescriptors)
        throws ServiceAccessException {
        super.createRevisionDescriptors(uri, revisionDescriptors);
        if (revisionDescriptorsStore.cacheResults()) {
            descriptorsCache.put(uri.toString(),
                                 revisionDescriptors.cloneObject());
        }
    }

    /**
     * Update revision descriptors.
     *
     * @param uri Uri
     * @param revisionDescriptors Node revision descriptors
     * @exception ServiceAccessException Service access error
     * @exception RevisionDescriptorNotFoundException Revision descriptor
     * was not found
     */
    public void storeRevisionDescriptors
        (Uri uri, NodeRevisionDescriptors revisionDescriptors)
        throws ServiceAccessException, RevisionDescriptorNotFoundException {
        super.storeRevisionDescriptors(uri, revisionDescriptors);
        if (revisionDescriptorsStore.cacheResults()) {
            descriptorsCache.put(uri.toString(),
                                 revisionDescriptors.cloneObject());
        }
    }

    /**
     * Remove revision descriptors.
     *
     * @param uri Uri
     * @exception ServiceAccessException Service access error
     */
    public void removeRevisionDescriptors(Uri uri)
        throws ServiceAccessException {
        if (revisionDescriptorsStore.cacheResults()) {
            descriptorsCache.remove(uri.toString());
        }
        super.removeRevisionDescriptors(uri);
    }

    /**
     * Retrieve revision descriptor.
     *
     * @param uri Uri
     * @param revisionNumber Node revision number
     */
    public NodeRevisionDescriptor retrieveRevisionDescriptor
        (Uri uri, NodeRevisionNumber revisionNumber)
        throws ServiceAccessException, RevisionDescriptorNotFoundException {
        if (revisionDescriptorStore.cacheResults()) {
            Object result = descriptorCache.get(uri + "-" + revisionNumber);
            if (result != null) {
                return ((NodeRevisionDescriptor) result).cloneObject();
            } else {
                NodeRevisionDescriptor revisionDescriptor =
                    revisionDescriptorStore
                    .retrieveRevisionDescriptor(uri, revisionNumber)
                    .cloneObject();
                revisionDescriptor.validate();
                descriptorCache.put(uri + "-" + revisionNumber,
                                    revisionDescriptor);
                return revisionDescriptor;
            }
        } else {
            return super.retrieveRevisionDescriptor(uri, revisionNumber);
        }
    }

    /**
     * Create new revision descriptor.
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     * @exception ServiceAccessException Service access error
     */
    public void createRevisionDescriptor
        (Uri uri, NodeRevisionDescriptor revisionDescriptor)
        throws ServiceAccessException {
        super.createRevisionDescriptor(uri, revisionDescriptor);
        if (revisionDescriptorStore.cacheResults()) {
            descriptorCache.put(uri + "-"
                                + revisionDescriptor.getRevisionNumber(),
                                revisionDescriptor.cloneObject());
        }
    }

    /**
     * Update revision descriptor.
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     * @exception ServiceAccessException Service access error
     * @exception RevisionDescriptorNotFoundException Revision descriptor
     * was not found
     */
    public void storeRevisionDescriptor
        (Uri uri, NodeRevisionDescriptor revisionDescriptor)
        throws ServiceAccessException, RevisionDescriptorNotFoundException {
        super.storeRevisionDescriptor(uri, revisionDescriptor);
        if (revisionDescriptorStore.cacheResults()) {
            String key = uri + "-" + revisionDescriptor.getRevisionNumber();
            descriptorCache.put(key, revisionDescriptor.cloneObject());
        }
    }

    /**
     * Remove revision descriptor.
     *
     * @param uri Uri
     * @param number Revision number
     * @exception ServiceAccessException Service access error
     */
    public void removeRevisionDescriptor(Uri uri, NodeRevisionNumber number)
        throws ServiceAccessException {
        super.removeRevisionDescriptor(uri, number);
        if (revisionDescriptorStore.cacheResults()) {
            descriptorCache.remove(uri + "-" + number);
        }
    }

    /**
     * Retrive revision content.
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     */
    public NodeRevisionContent retrieveRevisionContent
        (Uri uri, NodeRevisionDescriptor revisionDescriptor)
        throws ServiceAccessException, RevisionNotFoundException {
        return super.retrieveRevisionContent(uri, revisionDescriptor);
    }

    /**
     * Create a new revision
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     * @param revisionContent Node revision content
     */
    public void createRevisionContent
        (Uri uri, NodeRevisionDescriptor revisionDescriptor,
         NodeRevisionContent revisionContent)
        throws ServiceAccessException, RevisionAlreadyExistException {
        super.createRevisionContent(uri, revisionDescriptor, revisionContent);
    }

    /**
     * Modify the latest revision of an object.
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     * @param revisionContent Node revision content
     */
    public void storeRevisionContent
        (Uri uri, NodeRevisionDescriptor revisionDescriptor,
         NodeRevisionContent revisionContent)
        throws ServiceAccessException, RevisionNotFoundException {
        super.storeRevisionContent(uri, revisionDescriptor, revisionContent);
    }

    /**
     * Remove revision.
     *
     * @param uri Uri
     * @param revisionDescriptor Node revision descriptor
     */
    public void removeRevisionContent(Uri uri,
                                      NodeRevisionDescriptor revisionDescriptor)
        throws ServiceAccessException {
        super.removeRevisionContent(uri, revisionDescriptor);
    }

    /**
     * Return the name of this store
     *
     */
    public String toString() {
        return getName() + "(" + getClass().getName() + ")";
    }

    // ------------------------------------------------------ Protected Methods

    /**
     * Delist (suspend) the resource manager in the current transaction.
     */
    protected void delist(Service service, boolean success)
        throws ServiceAccessException {
        if (!success) {
            // If there's a failure which will cause the transaction to be
            // rollbacked, flush the caches
            resetCaches();
        }
        super.delist(service, success);
    }

    /**
     * Reset the caches.
     */
    protected void resetCaches() {
        objectsCache.clear();
        permissionsCache.clear();
        locksCache.clear();
        descriptorsCache.clear();
        descriptorCache.clear();
    }

}


text:
#pragma once

#include <core/ITrack.h>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>

//////////////////////////////////////////////////////////////////////////////
// Forward declare
namespace musik{ namespace core{
    namespace Library{
        class  Base;
    }
	typedef boost::shared_ptr<Library::Base> LibraryPtr;
    class  Track;
    typedef boost::shared_ptr<Track> TrackPtr;
    typedef std::vector<TrackPtr> TrackVector;
} }
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////
///\brief
///The most basic implementation of a track
//////////////////////////////////////////
class  Track : public ITrack {
    public:
        virtual ~Track();
        virtual DBINT Id();
        virtual musik::core::LibraryPtr Library();
        virtual int LibraryId();

        typedef std::multimap<std::string,utfstring> MetadataMap;
        typedef std::pair<MetadataMap::iterator,MetadataMap::iterator> MetadataIteratorRange;
        virtual MetadataIteratorRange GetValues(const char* metakey) = 0;
        virtual MetadataIteratorRange GetAllValues() = 0;

        virtual TrackPtr Copy() = 0;

};

//////////////////////////////////////////////////////////////////////////////
} } // musik::core

redpajama_set_name: RedPajamaGithub


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function tamaño(tam){
    tam+="px";
    $('body').css('font-size', tam);
};

$(function() {
        $("#range").mousemove(function() {
            var slide = $(this);
            var tam = slide.val();
            tamaño(tam);
        }).trigger('mousemove');
        $("#range").change(function() {
            var slide = $(this);
            var tam = slide.val();
            tamaño(tam);
        }).trigger('change');
});


text:
package spout;

import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.S3Object;

import java.util.UUID;

public class S3 {

    public AWSCredentials credentials;
    public AmazonS3 s3;
    public String bucketName;

    public S3() {

        try {
            credentials = new ProfileCredentialsProvider().getCredentials();
        } catch (Exception e) {
            throw new AmazonClientException(
                    "Cannot load the credentials from the credential profiles file. " +
                            "Please make sure that your credentials file is at the correct " +
                            "location (~/.aws/credentials), and is in valid format.",
                    e);
        }

        s3 = new AmazonS3Client(credentials);
        Region usWest2 = Region.getRegion(Regions.US_WEST_2);
        s3.setRegion(usWest2);

        System.out.println("===========================================");
        System.out.println("Getting Started with Amazon S3");
        System.out.println("===========================================\n");
    }

    public S3(String bucketName){
        this();
        setBucketName(bucketName);
    }

    public void setBucketName(String bucketName){
        this.bucketName = bucketName;
    }

    public S3Object get(String key){
        return s3.getObject(new GetObjectRequest(bucketName, key));
    }

    public void delete(String key){
        s3.deleteObject(bucketName, key);
    }

    public static void main(){

        String bucketName = "my-first-s3-bucket-" + UUID.randomUUID();

    }
}


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<title>
			Untitled
		</title>
		<meta name="description" />
		<meta name="author" />
		<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=2.0;" />
		<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/siteDefaults.css" />
		<link rel="stylesheet" href="css/sprites.css" />
		<link rel="stylesheet" href="css/challenges.css" />
		<link media="all" rel="stylesheet" href="assets/css/pro-bars.min.css" type="text/css" />

C#er

Scoreboard

Challenges

Skills

Options

Dashboard

Challenges

Critical Thinking

Time Trial

Recognition

Definitions

Above and Beyond


text:
module UbiquoI18n
  module Extensions
    module TestCase
      def self.included(base)
        base.send :include, InstanceMethods
        base.send :alias_method_chain, :process, :locale
      end

      module InstanceMethods
        # set the locale parameter in the functional test method process
        # to avoid errors related to the tests and no the app
        def process_with_locale(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
          parameters = { :locale => ::Locale.default }.merge(parameters || {})
          process_without_locale(action, parameters, session, flash, http_method)
        end
      end
    end
  end
end


text:
/* Importing core module */
import {Component} 			from 'angular2/core';
import {ROUTER_DIRECTIVES} 	from 'angular2/router';
import {HTTP_PROVIDERS}		from 'angular2/http';

/* Importing service */
import {UserService}		from '../service/user.service';
import {HttpClient}			from '../service/http-client.service';

/* Importing model */
import {UserModel}			from '../model/user.model';

/* Importing configuration */
import {Configuration}      from '../app.constants';

@Component({
 	selector: 'user-list',
 	templateUrl: 'app/template/user-list.component.html',
 	directives: [ROUTER_DIRECTIVES],
 	providers: [UserService, HTTP_PROVIDERS, Configuration, HttpClient]
})

export class UserListComponent {

	private _errorMessage: string;
	private userModel: UserModel[];

	constructor (private _userService: UserService) { }

	ngOnInit() {
		this.getUsers();
	}

	/**
	*  Get list of all users
	*/
	getUsers() {
		this._userService.getAllUsers()
						  .subscribe(
							userModel => this.userModel = userModel,
							error => this._errorMessage = <any>error);
	}
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using MessageStream2;
using DarkMultiPlayerCommon;
namespace DarkMultiPlayer
{
    public class VesselRecorder
    {
        public bool active;
        public bool playback;
        private Guid playbackID;
        ScreenMessage screenMessage;
        private MemoryStream recording;
        private MemoryStream recordingVector;
        private WarpWorker warpWorker;
        private Queue<VesselUpdate> playbackQueue;
        private VesselUpdate lastUpdate;
        private string recordPath = Path.Combine(KSPUtil.ApplicationRootPath, "DMPRecording.bin");
        private string recordVectorPath = Path.Combine(KSPUtil.ApplicationRootPath, "DMPRecording-vector.bin");
        private Action<ByteArray> HandleProtoUpdate, HandleVesselRemove;
        private Action<ByteArray, bool> HandleVesselUpdate;
        private VesselWorker vesselWorker;
        private NetworkWorker networkWorker;
        private Settings dmpSettings;
        private DMPGame dmpGame;
        private double firstTime;
        private double lastTime;
        private NamedAction updateAction;

        public VesselRecorder(DMPGame dmpGame, WarpWorker warpWorker, VesselWorker vesselWorker, NetworkWorker networkWorker, Settings dmpSettings)
        {
            this.warpWorker = warpWorker;
            this.vesselWorker = vesselWorker;
            this.networkWorker = networkWorker;
            this.dmpSettings = dmpSettings;
            this.dmpGame = dmpGame;
            updateAction = new NamedAction(Update);
            dmpGame.updateEvent.Add(updateAction);
        }

        public void SetHandlers(Action<ByteArray> HandleProtoUpdate, Action<ByteArray, bool> HandleVesselUpdate, Action<ByteArray> HandleVesselRemove)
        {
            this.HandleProtoUpdate = HandleProtoUpdate;
            this.HandleVesselUpdate = HandleVesselUpdate;
            this.HandleVesselRemove = HandleVesselRemove;
        }

        public void RecordSend(ByteArray data, ClientMessageType messageType, Guid vesselID)
        {
            if (!active)
            {
                return;
            }
            if (HighLogic.LoadedSceneIsFlight && FlightGlobals.fetch != null && FlightGlobals.fetch.activeVessel != null && FlightGlobals.fetch.activeVessel.id == vesselID)
            {
                using (MessageWriter mw = new MessageWriter())
                {
                    mw.Write<int>((int)messageType);
                    mw.Write<int>(data.Length);
                    byte[] headerData = mw.GetMessageBytes();
                    recording.Write(headerData, 0, headerData.Length);
                }
                recording.Write(data.data, 0, data.Length);
            }
        }

        public void StartRecord()
        {
            active = true;
            recording = new MemoryStream();
            recordingVector = new MemoryStream();
            VesselUpdate update = Recycler<VesselUpdate>.GetObject();
            update.SetVesselWorker(vesselWorker);
            update.CopyFromVessel(FlightGlobals.fetch.activeVessel);
            networkWorker.SendVesselUpdate(update);
            Recycler<VesselUpdate>.ReleaseObject(update);
        }

        public void StopRecord()
        {
            active = false;
            if (File.Exists(recordPath))
            {
                File.Delete(recordPath);
            }
            using (FileStream fs = new FileStream(recordPath, FileMode.Create, FileAccess.Write))
            {
                byte[] recordingData = recording.ToArray();
                fs.Write(recordingData, 0, recordingData.Length);
            }
            recording.Dispose();
            recording = null;

            if (File.Exists(recordVectorPath))
            {
                File.Delete(recordVectorPath);
            }
            using (FileStream fs = new FileStream(recordVectorPath, FileMode.Create, FileAccess.Write))
            {
                byte[] recordingData = recordingVector.ToArray();
                fs.Write(recordingData, 0, recordingData.Length);
            }
            recordingVector.Dispose();
            recordingVector = null;
        }

        public void CancelRecord()
        {
            active = false;
            recording.Dispose();
            recording = null;
            recordingVector.Dispose();
            recordingVector = null;
        }

        byte[] headerBytesInt = new byte[4];
        public void StartPlayback()
        {
            int messagesLoaded = 0;
            bool firstMessage = true;
            ByteArray headerBytes = ByteRecycler.GetObject(8);
            using (FileStream fs = new FileStream(recordPath, FileMode.Open))
            {
                while (fs.Position < fs.Length)
                {
                    messagesLoaded++;
                    fs.Read(headerBytes.data, 0, 8);
                    using (MessageReader mr = new MessageReader(headerBytes.data))
                    {
                        ClientMessageType messageType = (ClientMessageType)mr.Read<int>();
                        int length = mr.Read<int>();
                        ByteArray dataBytes = ByteRecycler.GetObject(length);
                        fs.Read(dataBytes.data, 0, length);
                        using (MessageReader timeReader = new MessageReader(dataBytes.data))
                        {
                            //Planet time is the first part of the message for the three types we care about here
                            double planetTime = timeReader.Read<double>();
                            lastTime = planetTime;
                            if (firstMessage)
                            {
                                firstTime = planetTime;
                                firstMessage = false;
                                Planetarium.SetUniversalTime(planetTime - 5d);
                                warpWorker.SendNewSubspace();
                            }
                        }
                        using (MessageReader mrignore = new MessageReader(dataBytes.data))
                        {
                            //Planet time, don't care here
                            mrignore.Read<double>();
                            string vesselID = mrignore.Read<string>();
                            vesselWorker.IgnoreVessel(new Guid(vesselID));
                        }
                        switch (messageType)
                        {
                            case ClientMessageType.VESSEL_PROTO:
                                HandleProtoUpdate(dataBytes);
                                break;
                            case ClientMessageType.VESSEL_UPDATE:
                                HandleVesselUpdate(dataBytes, false);
                                break;
                            case ClientMessageType.VESSEL_REMOVE:
                                HandleVesselRemove(dataBytes);
                                break;
                            default:
                                break;
                        }
                        ByteRecycler.ReleaseObject(dataBytes);
                    }
                }
                ByteRecycler.ReleaseObject(headerBytes);
            }

            playbackQueue = new Queue<VesselUpdate>();
            using (FileStream fs = new FileStream(recordVectorPath, FileMode.Open))
            {
                while (fs.Position < fs.Length)
                {
                    fs.Read(headerBytesInt, 0, 4);
                    if (BitConverter.IsLittleEndian)
                    {
                        Array.Reverse(headerBytesInt);
                    }
                    int updateLength = BitConverter.ToInt32(headerBytesInt, 0);
                    ByteArray updateBytes = ByteRecycler.GetObject(updateLength);
                    fs.Read(updateBytes.data, 0, updateLength);
                    VesselUpdate vu = networkWorker.VeselUpdateFromBytes(updateBytes.data, false);
                    playbackQueue.Enqueue(vu);
                    ByteRecycler.ReleaseObject(updateBytes);
                }
            }

            ScreenMessages.PostScreenMessage("Loaded " + messagesLoaded + " saved updates.", 5f, ScreenMessageStyle.UPPER_CENTER);
            screenMessage = ScreenMessages.PostScreenMessage("Playback 0 / " + (int)(lastTime - firstTime) + " seconds.", float.MaxValue, ScreenMessageStyle.UPPER_CENTER);
            playback = true;
        }

        public void Update()
        {
            if (playback)
            {
                DisplayUpdateVesselOffset();
                if (Planetarium.GetUniversalTime() > (lastTime))
                {
                    playback = false;
                    ScreenMessages.RemoveMessage(screenMessage);
                    screenMessage = null;
                }
                else
                {
                    int timeLeft = (int)(lastTime - Planetarium.GetUniversalTime());
                    ScreenMessages.RemoveMessage(screenMessage);
                    screenMessage = ScreenMessages.PostScreenMessage("Playback time left: " + timeLeft + " / " + (int)(lastTime - firstTime) + " seconds", float.MaxValue, ScreenMessageStyle.UPPER_CENTER);
                }
            }

            if (active)
            {
                VesselUpdate vu = Recycler<VesselUpdate>.GetObject();
                vu.SetVesselWorker(vesselWorker);
                vu.CopyFromVessel(FlightGlobals.fetch.activeVessel);
                ClientMessage updateBytes = networkWorker.GetVesselUpdateMessage(vu);
                byte[] lengthBytes = BitConverter.GetBytes(updateBytes.data.Length);
                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(lengthBytes);
                }
                recordingVector.Write(lengthBytes, 0, lengthBytes.Length);
                recordingVector.Write(updateBytes.data.data, 0, updateBytes.data.Length);
                ByteRecycler.ReleaseObject(updateBytes.data);
                Recycler<VesselUpdate>.ReleaseObject(vu);
            }
        }

        public void DisplayUpdateVesselOffset()
        {
            double interpolatorDelay = 0;
            if (dmpSettings.interpolatorType == InterpolatorType.INTERPOLATE1S)
            {
                interpolatorDelay = 1;
            }
            if (dmpSettings.interpolatorType == InterpolatorType.INTERPOLATE3S)
            {
                interpolatorDelay = 3;
            }

            while (playbackQueue.Count > 0 && Planetarium.GetUniversalTime() > (playbackQueue.Peek().planetTime + interpolatorDelay))
            {
                if (lastUpdate != null)
                {
                    Recycler<VesselUpdate>.ReleaseObject(lastUpdate);
                }
                lastUpdate = playbackQueue.Dequeue();
                playbackID = lastUpdate.vesselID;
            }
            if (playbackQueue.Count > 0)
            {
                VesselUpdate vu = playbackQueue.Peek();
                if (lastUpdate != null && vu != null && lastUpdate.isSurfaceUpdate && vu.isSurfaceUpdate)
                {
                    Vessel av = FlightGlobals.fetch.vessels.Find(v => v.id == vu.vesselID);
                    if (av != null)
                    {
                        double scaling = (Planetarium.GetUniversalTime() - interpolatorDelay - lastUpdate.planetTime) / (vu.planetTime - lastUpdate.planetTime);
                        Vector3d orgPos = new Vector3d(lastUpdate.position[0], lastUpdate.position[1], lastUpdate.position[2]);
                        Vector3d nextPos = new Vector3d(vu.position[0], vu.position[1], vu.position[2]);
                        Vector3d updatePos = Vector3d.Lerp(orgPos, nextPos, scaling);
                        Vector3d distanceInPos = av.mainBody.GetWorldSurfacePosition(av.latitude, av.longitude, av.altitude) - av.mainBody.GetWorldSurfacePosition(updatePos.x, updatePos.y, updatePos.z);
                        double timeDiff = Planetarium.GetUniversalTime() - interpolatorDelay - lastUpdate.planetTime;
                        DarkLog.Debug("Difference in position: " + Math.Round(distanceInPos.magnitude, 3) + ", scaling: " + Math.Round(scaling, 3));
                    }
                }
            }
            else
            {
                //Free the last update too!
                if (lastUpdate != null)
                {
                    Recycler<VesselUpdate>.ReleaseObject(lastUpdate);
                    lastUpdate = null;
                }
            }
        }

        public void Stop()
        {
            dmpGame.updateEvent.Remove(updateAction);
        }
    }
}


text:
@class TKCheckView;

@interface TKListViewCellBackgroundView : TKView

@property (nonatomic, strong, readonly, nonnull) TKCheckView *checkView;

@property (nonatomic) BOOL allowsMultipleSelection;

@property (nonatomic) BOOL isSelectedBackground;

@property (nonatomic) BOOL isVertical;

@property (nonatomic) CGFloat checkInset;

- (void)updateStyle;

@end


text:
ACCEPTED

#### According to
IRMNG Homonym List

#### Published in
Bot. Zhurn. (Moscow & Leningrad) 86 (12): 21.

#### Original name
null

### Remarks
null


text:
layout: post
title: 'Hist 697: Portfolio is live'
author: jeri.elizabeth

tags: coursework
---
So the first iteration of my portfolio is live.

Well, not the first.

More like the 10th.

But the first that I'm willing to go live with.

Some outstanding issues that I am still working on:

*   getting the sidebar to fill in to equal length with the content section.
*   the footer needs to be narrower – but there is something funky with the "badges" that is adding padding or margins.
*   manipulating the CSS for the links! This one I am completely stuck on. I've tried a couple of things, but they either don't work, or don't work like I expect. Also, I would love to have links in the sidebar, but I can't seem to create separate styling, so both the nav bar and the sidebar links are either black or my background grey. Which means one of them is unintelligible.

You can find it at[ jeriwieringa.com/portfolio][1]

If you have any ideas or suggestions, please let me know! Also if anyone has IE, could you tell me how it looks? <img src='http://jeriwieringa.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />

*update: apparently I should have watched the typography tutorials earlier – I think the key to different styles for links may be there.

 [1]: http://jeriwieringa.com/portfolio/index.html


text:
require 'spec_helper'

RSpec.describe BrickFTP::RESTfulAPI::ListBundles, type: :lib do
  describe '#call' do
    context 'correct request' do
      it 'return Array of Bundle object' do
        expected_bundle = BrickFTP::Types::Bundle.new(
          id: 212_228,
          code: '4d3d3d3d3',
          url: 'https://site.files.com/f/4d3d3d3d3',
          user_id: 12_345,
          created_at: '2015-10-14T12:52:25-04:00',
          paths: %w[accounts.xls]
        )

        stub_request(:get, 'https://subdomain.files.com/api/rest/v1/bundles.json')
          .with(
            basic_auth: %w[api-key x],
            headers: {
              'User-Agent' => 'BrickFTP Client/1.0 (https://github.com/koshigoe/brick_ftp)',
            }
          )
          .to_return(body: [expected_bundle.to_h].to_json)

        rest = BrickFTP::RESTfulAPI::Client.new('subdomain', 'api-key')
        command = BrickFTP::RESTfulAPI::ListBundles.new(rest)

        expect(command.call).to eq([expected_bundle])
      end
    end
  end
end


text:
from __future__ import division, print_function, unicode_literals
__doc__ = """
Asks you for an image file and inserts it as background image into all selected layers.
"""

Font = Glyphs.font
selectedLayers = Font.selectedLayers

def process(thisLayer, imageFilePath):
	try:
		thisImage = GSBackgroundImage.alloc().initWithPath_(imageFilePath)
		thisLayer.setBackgroundImage_(thisImage)
	except Exception as e:
		if "NoneType" in str(e):
			return "No image found."
		else:
			return "Error: %s." % e
	return "OK."

Font.disableUpdateInterface()
try:
	imageFilePath = GetOpenFile(message="Select an image:", allowsMultipleSelection=False, filetypes=["jpeg", "png", "tif", "gif", "pdf"])

	print("Putting %s into:" % imageFilePath)

	for thisLayer in selectedLayers:
		thisGlyph = thisLayer.parent
		# thisGlyph.beginUndo() # undo grouping causes crashes
		print("-- %s: %s" % (thisGlyph.name, process(thisLayer, imageFilePath)))
		# thisGlyph.endUndo() # undo grouping causes crashes

except Exception as e:
	Glyphs.showMacroWindow()
	print("\n⚠ Script Error:\n")
	import traceback
	print(traceback.format_exc())
	print()
	raise e

finally:
	Font.enableUpdateInterface()


text:
"""Entry points into the Face layer of RPC Framework."""

from grpc.framework.base import exceptions as _base_exceptions
from grpc.framework.base import interfaces as base_interfaces
from grpc.framework.face import _calls
from grpc.framework.face import _service
from grpc.framework.face import exceptions
from grpc.framework.face import interfaces

class _BaseServicer(base_interfaces.Servicer):

  def __init__(self, methods, multi_method):
    self._methods = methods
    self._multi_method = multi_method

  def service(self, name, context, output_consumer):
    method = self._methods.get(name, None)
    if method is not None:
      return method(output_consumer, context)
    elif self._multi_method is not None:
      try:
        return self._multi_method.service(name, output_consumer, context)
      except exceptions.NoSuchMethodError:
        raise _base_exceptions.NoSuchMethodError()
    else:
      raise _base_exceptions.NoSuchMethodError()

class _UnaryUnarySyncAsync(interfaces.UnaryUnarySyncAsync):

  def __init__(self, front, name):
    self._front = front
    self._name = name

  def __call__(self, request, timeout):
    return _calls.blocking_value_in_value_out(
        self._front, self._name, request, timeout, 'unused trace ID')

  def async(self, request, timeout):
    return _calls.future_value_in_value_out(
        self._front, self._name, request, timeout, 'unused trace ID')

class _StreamUnarySyncAsync(interfaces.StreamUnarySyncAsync):

  def __init__(self, front, name, pool):
    self._front = front
    self._name = name
    self._pool = pool

  def __call__(self, request_iterator, timeout):
    return _calls.blocking_stream_in_value_out(
        self._front, self._name, request_iterator, timeout, 'unused trace ID')

  def async(self, request_iterator, timeout):
    return _calls.future_stream_in_value_out(
        self._front, self._name, request_iterator, timeout, 'unused trace ID',
        self._pool)

class _Server(interfaces.Server):
  """An interfaces.Server implementation."""

class _Stub(interfaces.Stub):
  """An interfaces.Stub implementation."""

  def __init__(self, front, pool):
    self._front = front
    self._pool = pool

  def blocking_value_in_value_out(self, name, request, timeout):
    return _calls.blocking_value_in_value_out(
        self._front, name, request, timeout, 'unused trace ID')

  def future_value_in_value_out(self, name, request, timeout):
    return _calls.future_value_in_value_out(
        self._front, name, request, timeout, 'unused trace ID')

  def inline_value_in_stream_out(self, name, request, timeout):
    return _calls.inline_value_in_stream_out(
        self._front, name, request, timeout, 'unused trace ID')

  def blocking_stream_in_value_out(self, name, request_iterator, timeout):
    return _calls.blocking_stream_in_value_out(
        self._front, name, request_iterator, timeout, 'unused trace ID')

  def future_stream_in_value_out(self, name, request_iterator, timeout):
    return _calls.future_stream_in_value_out(
        self._front, name, request_iterator, timeout, 'unused trace ID',
        self._pool)

  def inline_stream_in_stream_out(self, name, request_iterator, timeout):
    return _calls.inline_stream_in_stream_out(
        self._front, name, request_iterator, timeout, 'unused trace ID',
        self._pool)

  def event_value_in_value_out(
      self, name, request, response_callback, abortion_callback, timeout):
    return _calls.event_value_in_value_out(
        self._front, name, request, response_callback, abortion_callback,
        timeout, 'unused trace ID')

  def event_value_in_stream_out(
      self, name, request, response_consumer, abortion_callback, timeout):
    return _calls.event_value_in_stream_out(
        self._front, name, request, response_consumer, abortion_callback,
        timeout, 'unused trace ID')

  def event_stream_in_value_out(
      self, name, response_callback, abortion_callback, timeout):
    return _calls.event_stream_in_value_out(
        self._front, name, response_callback, abortion_callback, timeout,
        'unused trace ID')

  def event_stream_in_stream_out(
      self, name, response_consumer, abortion_callback, timeout):
    return _calls.event_stream_in_stream_out(
        self._front, name, response_consumer, abortion_callback, timeout,
        'unused trace ID')

  def unary_unary_sync_async(self, name):
    return _UnaryUnarySyncAsync(self._front, name)

  def stream_unary_sync_async(self, name):
    return _StreamUnarySyncAsync(self._front, name, self._pool)

def _aggregate_methods(
    pool,
    inline_value_in_value_out_methods,
    inline_value_in_stream_out_methods,
    inline_stream_in_value_out_methods,
    inline_stream_in_stream_out_methods,
    event_value_in_value_out_methods,
    event_value_in_stream_out_methods,
    event_stream_in_value_out_methods,
    event_stream_in_stream_out_methods):
  """Aggregates methods coded in according to different interfaces."""
  methods = {}

  def adapt_unpooled_methods(adapted_methods, unadapted_methods, adaptation):
    if unadapted_methods is not None:
      for name, unadapted_method in unadapted_methods.iteritems():
        adapted_methods[name] = adaptation(unadapted_method)

  def adapt_pooled_methods(adapted_methods, unadapted_methods, adaptation):
    if unadapted_methods is not None:
      for name, unadapted_method in unadapted_methods.iteritems():
        adapted_methods[name] = adaptation(unadapted_method, pool)

  adapt_unpooled_methods(
      methods, inline_value_in_value_out_methods,
      _service.adapt_inline_value_in_value_out)
  adapt_unpooled_methods(
      methods, inline_value_in_stream_out_methods,
      _service.adapt_inline_value_in_stream_out)
  adapt_pooled_methods(
      methods, inline_stream_in_value_out_methods,
      _service.adapt_inline_stream_in_value_out)
  adapt_pooled_methods(
      methods, inline_stream_in_stream_out_methods,
      _service.adapt_inline_stream_in_stream_out)
  adapt_unpooled_methods(
      methods, event_value_in_value_out_methods,
      _service.adapt_event_value_in_value_out)
  adapt_unpooled_methods(
      methods, event_value_in_stream_out_methods,
      _service.adapt_event_value_in_stream_out)
  adapt_unpooled_methods(
      methods, event_stream_in_value_out_methods,
      _service.adapt_event_stream_in_value_out)
  adapt_unpooled_methods(
      methods, event_stream_in_stream_out_methods,
      _service.adapt_event_stream_in_stream_out)

  return methods

def servicer(
    pool,
    inline_value_in_value_out_methods=None,
    inline_value_in_stream_out_methods=None,
    inline_stream_in_value_out_methods=None,
    inline_stream_in_stream_out_methods=None,
    event_value_in_value_out_methods=None,
    event_value_in_stream_out_methods=None,
    event_stream_in_value_out_methods=None,
    event_stream_in_stream_out_methods=None,
    multi_method=None):
  """Creates a base_interfaces.Servicer.

  The key sets of the passed dictionaries must be disjoint. It is guaranteed
  that any passed MultiMethod implementation will only be called to service an
  RPC if the RPC method name is not present in the key sets of the passed
  dictionaries.

  Args:
    pool: A thread pool.
    inline_value_in_value_out_methods: A dictionary mapping method names to
      interfaces.InlineValueInValueOutMethod implementations.
    inline_value_in_stream_out_methods: A dictionary mapping method names to
      interfaces.InlineValueInStreamOutMethod implementations.
    inline_stream_in_value_out_methods: A dictionary mapping method names to
      interfaces.InlineStreamInValueOutMethod implementations.
    inline_stream_in_stream_out_methods: A dictionary mapping method names to
      interfaces.InlineStreamInStreamOutMethod implementations.
    event_value_in_value_out_methods: A dictionary mapping method names to
      interfaces.EventValueInValueOutMethod implementations.
    event_value_in_stream_out_methods: A dictionary mapping method names to
      interfaces.EventValueInStreamOutMethod implementations.
    event_stream_in_value_out_methods: A dictionary mapping method names to
      interfaces.EventStreamInValueOutMethod implementations.
    event_stream_in_stream_out_methods: A dictionary mapping method names to
      interfaces.EventStreamInStreamOutMethod implementations.
    multi_method: An implementation of interfaces.MultiMethod.

  Returns:
    A base_interfaces.Servicer that services RPCs via the given implementations.
  """
  methods = _aggregate_methods(
      pool,
      inline_value_in_value_out_methods,
      inline_value_in_stream_out_methods,
      inline_stream_in_value_out_methods,
      inline_stream_in_stream_out_methods,
      event_value_in_value_out_methods,
      event_value_in_stream_out_methods,
      event_stream_in_value_out_methods,
      event_stream_in_stream_out_methods)

  return _BaseServicer(methods, multi_method)

def server():
  """Creates an interfaces.Server.

  Returns:
    An interfaces.Server.
  """
  return _Server()

def stub(front, pool):
  """Creates an interfaces.Stub.

  Args:
    front: A base_interfaces.Front.
    pool: A futures.ThreadPoolExecutor.

  Returns:
    An interfaces.Stub that performs RPCs via the given base_interfaces.Front.
  """
  return _Stub(front, pool)


text:
{- draw sprite with image clipping -}
{-# LANGUAGE OverloadedStrings #-}
module Lesson13 where
--
import qualified SDL
--
import Data.Monoid
import Data.Word (Word8(..))
import Linear.Affine (Point(..))
import Linear.V2 (V2(..))
import Linear.V3 (V3(..))
import Linear.V4 (V4(..))
import Foreign.C.Types (CInt)
--
import Control.Monad (unless)
--
import qualified Config
--

-- definition of LTexture
data LTexture = LTexture {getTx :: SDL.Texture, getWH :: V2 CInt}
--
class Renderable a where
   renderQuad :: a -> CInt -> CInt -> Maybe (SDL.Rectangle CInt)
   render :: SDL.Renderer -> a -> CInt -> CInt -> IO ()
   free :: a ->  IO ()
--
instance Renderable LTexture where
   renderQuad ltx x y =
      Just $ SDL.Rectangle (P $ V2 x y) $ getWH ltx
   render rdr ltx x y =
      SDL.copy rdr (getTx ltx) Nothing (renderQuad ltx x y)
   free ltx = SDL.destroyTexture (getTx ltx)

-- definition of loading function
loadFromFile :: SDL.Renderer -> FilePath -> IO LTexture
loadFromFile rdr path = do
   tempSf <- SDL.loadBMP path
   wh <- SDL.surfaceDimensions tempSf
   -- ************ --
   SDL.surfaceColorKey tempSf SDL.$= Just (V4 maxBound maxBound maxBound maxBound)
   tx <- SDL.createTextureFromSurface rdr tempSf
   SDL.freeSurface tempSf
   return (LTexture tx wh)

--

class (Bounded a, Num a, Ord a) => BoundedNum a where
    (>+<) :: a -> a -> a
    (>+<) a diff
        | diff <= maxDiff = a + diff
        | diff > maxDiff = maxBound
        where maxDiff = maxBound - a
    (>-<) :: a -> a -> a
    (>-<) a diff
        | diff <= minDiff = a - diff
        | diff > minDiff = minBound
        where minDiff = a - minBound

instance BoundedNum Word8

lesson13 :: IO ()
lesson13 = do
   -- initialize SDL
   SDL.initialize [SDL.InitVideo]

   -- create window
   window <- SDL.createWindow "Lesson13" Config.winConfig
   renderer <- SDL.createRenderer window (-1) Config.rdrConfig
   SDL.HintRenderScaleQuality SDL.$= SDL.ScaleLinear
   SDL.rendererDrawColor renderer SDL.$=
      V4 maxBound maxBound minBound maxBound

   gLeftTexture <- loadFromFile renderer "./img/13/left.bmp"
   gRightTexture <- loadFromFile renderer "./img/13/right.bmp"

   let
      loop alpha = do
         events <- SDL.pollEvents
         let quit = any (== SDL.QuitEvent) $ map SDL.eventPayload events
         -- *** beginning of drawing region ***

         let checkKeySym (SDL.KeyboardEvent keysym:xs) = keysym : checkKeySym xs
             checkKeySym (sym:xs) = checkKeySym xs
             checkKeySym [] = []

         let pressedKey =  map (SDL.keysymKeycode . SDL.keyboardEventKeysym) $ checkKeySym $ map SDL.eventPayload events

         let adjustAlpha SDL.KeycodeW = (>+< 9)
             adjustAlpha SDL.KeycodeS = (>-< 9)
             adjustAlpha _ = (>+< 0)

         let alpha' =  foldr adjustAlpha alpha pressedKey

         SDL.rendererDrawColor renderer SDL.$= V4 maxBound maxBound maxBound maxBound
         SDL.clear renderer
         -- render with our own function

         render renderer gRightTexture 0 0

         SDL.textureAlphaMod (getTx gLeftTexture) SDL.$= alpha'
         render renderer gLeftTexture 0 0

         SDL.present renderer
         -- *** end of drawing region ***
         unless quit (loop alpha')
   loop 255

   free gRightTexture
   free gLeftTexture
   SDL.destroyRenderer renderer
   SDL.destroyWindow window
   SDL.quit


text:
package de.tum.in.niedermr.ta.core.code.tests.detector.junit;

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

import java.io.IOException;
import java.util.List;
import java.util.Optional;

import org.junit.BeforeClass;
import org.junit.Test;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;

import de.tum.in.niedermr.ta.core.code.tests.detector.ClassType;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.AbstractJUnit4TestClass;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.JUnit3TestClass;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.JUnit4TestClass;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.JUnit4TestClassInheritingTestCase;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.NoTestClass1;
import de.tum.in.niedermr.ta.core.code.tests.detector.junit.JUnitTestClassDetectorTestData.NoTestClass2;
import de.tum.in.niedermr.ta.core.code.util.BytecodeUtility;

/** Test {@link JUnitTestClassDetector}. */
public class JUnitTestClassDetectorTest {

	private static final String[] EMPTY_PATTERN_STRINGS = new String[0];
	private static JUnitTestClassDetector s_detector;

	/** Set up. */
	@BeforeClass
	public static void setUp() {
		s_detector = new JUnitTestClassDetector(false, EMPTY_PATTERN_STRINGS, EMPTY_PATTERN_STRINGS);
	}

	/** Test. */
	@Test
	public void testDetector() throws IOException {
		ClassNode cn;

		cn = BytecodeUtility.getAcceptedClassNode(JUnit4TestClass.class);
		assertEquals(JUnitClassTypeResult.TEST_CLASS_JUNIT_4, s_detector.analyzeIsTestClass(cn));

		cn = BytecodeUtility.getAcceptedClassNode(JUnit3TestClass.class);
		assertEquals(JUnitClassTypeResult.TEST_CLASS_JUNIT_3, s_detector.analyzeIsTestClass(cn));

		cn = BytecodeUtility.getAcceptedClassNode(JUnit4TestClassInheritingTestCase.class);
		assertEquals("JUnit 4 should be preferred over JUnit 3", JUnitClassTypeResult.TEST_CLASS_JUNIT_4,
				s_detector.analyzeIsTestClass(cn));

		cn = BytecodeUtility.getAcceptedClassNode(NoTestClass1.class);
		assertEquals(ClassType.NO_TEST_CLASS, s_detector.analyzeIsTestClass(cn));

		cn = BytecodeUtility.getAcceptedClassNode(NoTestClass2.class);
		assertEquals(ClassType.NO_TEST_CLASS, s_detector.analyzeIsTestClass(cn));
	}

	/** Test. */
	@Test
	public void testAbstractTestClasses() throws IOException {
		ClassNode cn = BytecodeUtility.getAcceptedClassNode(AbstractJUnit4TestClass.class);

		assertEquals(ClassType.NON_EXECUTABLE_TEST_CLASS, s_detector.analyzeIsTestClass(cn));
		assertEquals(JUnitClassTypeResult.TEST_CLASS_JUNIT_4,
				new JUnitTestClassDetector(true, EMPTY_PATTERN_STRINGS, EMPTY_PATTERN_STRINGS).analyzeIsTestClass(cn));
	}

	/** Test. */
	/** Test. */
	@Test
	public void testIgnoredClasses() throws IOException {
		JUnitTestClassDetector detectorWithIgnore = new JUnitTestClassDetector(false, EMPTY_PATTERN_STRINGS,
				new String[] { "^" + JUnit4TestClass.class.getPackage().getName() });

		ClassNode cn = BytecodeUtility.getAcceptedClassNode(JUnit4TestClass.class);
		assertEquals(ClassType.IGNORED_TEST_CLASS, detectorWithIgnore.analyzeIsTestClass(cn));
	}

	/** Test. */
	@Test
	public void testAnalyzeIsTestcaseForJUnit3() throws IOException {
		ClassNode classNode = BytecodeUtility.getAcceptedClassNode(JUnit3TestClass.class);

		@SuppressWarnings("unchecked")
		List<MethodNode> methods = classNode.methods;

		Optional<MethodNode> methodNodeTestA = methods.stream().filter(methodNode -> methodNode.name.equals("testA"))
				.findAny();
		Optional<MethodNode> methodNodeTestButNoTestcase = methods.stream()
				.filter(methodNode -> methodNode.name.equals("testButNoTestcase")).findAny();

		assertTrue("test data corrupt", methodNodeTestA.isPresent());
		assertTrue("test data corrupt", methodNodeTestButNoTestcase.isPresent());

		assertTrue(s_detector.analyzeIsTestcase(methodNodeTestA.get(), JUnitClassTypeResult.TEST_CLASS_JUNIT_3));
		assertFalse(s_detector.analyzeIsTestcase(methodNodeTestButNoTestcase.get(),
				JUnitClassTypeResult.TEST_CLASS_JUNIT_3));
	}

	/** Test. */
	@Test
	public void testAnalyzeIsTestcaseForJUnit4() throws IOException {
		ClassNode classNode = BytecodeUtility.getAcceptedClassNode(JUnit4TestClass.class);

		@SuppressWarnings("unchecked")
		List<MethodNode> methods = classNode.methods;

		Optional<MethodNode> methodNodeA = methods.stream().filter(methodNode -> methodNode.name.equals("a")).findAny();
		Optional<MethodNode> methodNodeIgnored = methods.stream()
				.filter(methodNode -> methodNode.name.equals("ignored")).findAny();

		assertTrue("test data corrupt", methodNodeA.isPresent());
		assertTrue("test data corrupt", methodNodeIgnored.isPresent());

		assertTrue(s_detector.analyzeIsTestcase(methodNodeA.get(), JUnitClassTypeResult.TEST_CLASS_JUNIT_4));
		assertFalse(s_detector.analyzeIsTestcase(methodNodeIgnored.get(), JUnitClassTypeResult.TEST_CLASS_JUNIT_4));
	}

	/** Test. */
	@Test
	public void testInnerClassInTestClass() throws IOException {
		ClassNode cn = BytecodeUtility.getAcceptedClassNode(TestClassWithInnerClass.class);
		assertEquals(JUnitClassTypeResult.TEST_CLASS_JUNIT_4, s_detector.analyzeIsTestClass(cn));

		cn = BytecodeUtility.getAcceptedClassNode(TestClassWithInnerClass.InnerClassInTestClass.class);
		assertEquals(ClassType.INNER_CLASS_IN_TEST_OR_IGNORED_CLASS, s_detector.analyzeIsTestClass(cn));
	}

	/** Test. */
	@Test
	public void testNonPublicTestClass() throws IOException {
		ClassNode cn = BytecodeUtility.getAcceptedClassNode(JUnitTestClassDetectorTestData.NonPublicTestClass.class);
		assertEquals(ClassType.NON_EXECUTABLE_TEST_CLASS, s_detector.analyzeIsTestClass(cn));
	}
}


text:
a:hover {color:#FEAD51;}
.menunav{
/*-webkit-box-shadow: 0 -.1rem #fff inset;*/
display: -webkit-box;
width:65%; float:right;
}
.menunav a{
display: block;
-webkit-box-flex: 1;
text-align: center;
width: 100%;
font-size: 12px;
position: relative;
}
.menunav a i{
display: block;
width: 100%;
height:43px;
clear: both;
}
.menunav a:after {
content: '';
display: block;
height: 40%;
position: absolute;
right: 0;
top: 20%;
}
.logoqu{ background:#FEAD51}
.menunav a{ color:#FFF}
.indexitem .ptitle{background:url(../../images/2/dian2.jpg) 3px center no-repeat #FFF;}
.indexitem .ptitle span{ margin:auto; text-align:left; padding-left:12px; display:inline;}
.indexitem .ptitle span a{ color:#FEAD51}
.buyfals{width:56px; height:22px; display:block; text-align:center; line-height:22px; font-size:12px; background:#FEAD51;border-radius:5px; position:absolute; bottom:13px; right:10px; z-index:10; color:#FFFFFF;}

.addcar {background-color: #FEAD51;}
.footers{ background:#fafafa; border-top:1px solid #ededed}
.rexian{font-size:14px; color:#FEAD51}
.footers p,.footers p a{ color:#666}

#header { background:#FEAD51; border-bottom:1px solid #F49A91}
.shoptitle span{ text-shadow:none; font-size:14px}
.mainhead .shopinfol p.gdesc{ color:#FEAD51}
.price{ color:#FEAD51}
.logoright p span{line-height:46px;background:#FEC483; width:85px; float:right; text-align:center; color:#FFF; font-size:14px; font-weight:bold}
.logoright div{background: url(../../images/dian.png) right 17px no-repeat; position:relative;background-size:auto}
.logoright div a{ height:47px; line-height:47px;}
.logoright div .showmenu{  display:none;height:auto; width:120px; background:#ededed; position:absolute; right:-10px; top:47px; z-index:9; background:url(../../images/cbg.png) repeat;border-radius:0px 0px  5px 5px;}
.logoright div .showmenu p{ text-shadow:none; height:24px; border-bottom:1px solid #e8e8e8; line-height:24px; text-align:center}
.logoright div .showmenu p a{ height:24px; line-height:24px; width:100%; display:block; color:#666}
.logoright div .showmenu p a:hover{ background:#ededed}

.top_bar{ height:50px; border-top:1px solid #e8e8e8;background:#fafafa; position: fixed; z-index: 900; bottom: 0; left: 0; right: 0; margin: auto; font-family: Helvetica, Tahoma, Arial, Microsoft YaHei, sans-serif;padding-bottom:4px;}
.top_menu{ height:50px;}
.top_menu li{ cursor:pointer; width:20%; float:left; height:50px;}
.top_menu li a{ display:block; text-align:center; padding-top:32px;}
.top_menu li a label{ cursor:pointer; display:block; height:18px; line-height:18px;}
.top_menu li.li1 a{ background:url(../../images/2/li1.png) center 5px no-repeat}
.top_menu li.li1 a:hover{ background:url(../../images/2/li1_h.png) center 5px no-repeat}
.top_menu li.li2 a{ background:url(../../images/2/li2.png) center 5px no-repeat}
.top_menu li.li2 a:hover{ background:url(../../images/2/li2_h.png) center 5px no-repeat}
.top_menu li.li5 a{ background:url(../../images/2/li4.png) center 5px no-repeat}
.top_menu li.li5 a:hover{ background:url(../../images/2/li4_h.png) center 5px no-repeat}
.top_menu li.li4 a{ background:url(../../images/2/li5.png) center 5px no-repeat}
.top_menu li.li4 a:hover{ background:url(../../images/2/li5_h.png) center 5px no-repeat}
.top_menu li.li3{ text-align:center;}
.top_menu li.li3 a{ position:fixed; bottom:0px; right:auto; left:auto;z-index:999; margin:0 auto; color:#FFF;padding-top:40px; padding-right:2px;display:block; width:65px; height:27px;background:url(../../images/2/yy.png) center 0px no-repeat}
.top_menu li.li3 a:hover{ background:url(../../images/2/yy_h.png) center 0px no-repeat}
.mainbottombg{ background:#fafafa;}
.loginbut{padding:5px; background:#FEAD51; color:#fff;width:100%; line-height:25px; cursor:pointer; font-weight:bold; border:none; font-size:14px}
.top_menu li.li1 a,.top_menu li a label{ font-size:12px;}


text:
<?php

namespace Likeme\SystemBundle\Form\Type;

use Likeme\SystemBundle\Form\DataTransformer\LocationToIdTransformer;

use Symfony\Component\Security\Core\SecurityContext;

use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

class MessageFormType extends AbstractType
{

    public function getName()
    {
        return 'likeme_chat_profile';
    }

    public function buildForm(FormBuilder $builder, array $options)
    {

        $builder
            ->add('message', 'textarea', array('label' => 'Chat'))
        ;
    }
}


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>Uses of Interface org.apache.taverna.scufl2.api.port.ActivityPort (Apache Taverna Language APIs (Scufl2, Databundle) 0.15.1-incubating API)</title>
<meta name="date" content="2016-03-14">
<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

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.taverna.scufl2.api.port.ActivityPort

Packages that use ActivityPort

Package
Description

org.apache.taverna.scufl2.api.common

org.apache.taverna.scufl2.api.port

org.apache.taverna.scufl2.api.profiles

org.apache.taverna.scufl2.validation.correctness

Uses of ActivityPort in org.apache.taverna.scufl2.api.common

Methods in org.apache.taverna.scufl2.api.common with parameters of type ActivityPort

Modifier and Type
Method and Description

com.fasterxml.jackson.databind.JsonNode
Scufl2Tools.portDefinitionFor(ActivityPort activityPort,
                 Profile profile)

Uses of ActivityPort in org.apache.taverna.scufl2.api.port

Classes in org.apache.taverna.scufl2.api.port that implement ActivityPort

Modifier and Type
Class and Description

class
InputActivityPort

An InputActivityPort is a <Port> that inputs data to an
 Activity.

class
OutputActivityPort

An OutputActivityPort is a <Port> that outputs data from an
 Activity.

Uses of ActivityPort in org.apache.taverna.scufl2.api.profiles

Classes in org.apache.taverna.scufl2.api.profiles with type parameters of type ActivityPort

Modifier and Type
Class and Description

class
ProcessorPortBinding<A extends ActivityPort,P extends ProcessorPort>

The binding between an ActivityPort and a
 ProcessorPort.

Uses of ActivityPort in org.apache.taverna.scufl2.validation.correctness

Methods in org.apache.taverna.scufl2.validation.correctness with parameters of type ActivityPort

Modifier and Type
Method and Description

protected abstract void
DispatchingVisitor.visitActivityPort(ActivityPort bean)

void
DefaultDispatchingVisitor.visitActivityPort(ActivityPort bean)

void
CorrectnessVisitor.visitActivityPort(ActivityPort bean)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

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


text:
class AI_Response;

struct recentNPCSpeech_t
{
	float	time;
	char	name[ 512 ];
	char	sceneName[ 128 ];
};

int GetRecentNPCSpeech( recentNPCSpeech_t speech[ SPEECH_LIST_MAX_SOUNDS ] );
float InstancedScriptedScene( CBaseFlex *pActor, const char *pszScene, EHANDLE *phSceneEnt = NULL, float flPostDelay = 0.0f, bool bIsBackground = false, AI_Response *response = NULL );
float InstancedAutoGeneratedSoundScene( CBaseFlex *pActor, char const *soundname, EHANDLE *phSceneEnt = NULL );
void StopScriptedScene( CBaseFlex *pActor, EHANDLE hSceneEnt );
void RemoveActorFromScriptedScenes( CBaseFlex *pActor, bool instancedscenesonly, bool nonidlescenesonly = false, const char *pszThisSceneOnly = NULL );
void PauseActorsScriptedScenes( CBaseFlex *pActor, bool instancedscenesonly );
void ResumeActorsScriptedScenes( CBaseFlex *pActor, bool instancedscenesonly );
void QueueActorsScriptedScenesToResume( CBaseFlex *pActor, bool instancedscenesonly );
bool IsRunningScriptedScene( CBaseFlex *pActor, bool bIgnoreInstancedScenes = true );
bool IsRunningScriptedSceneWithSpeech( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false );
float GetSceneDuration( char const *pszScene );
int GetSceneSpeechCount( char const *pszScene );
bool IsInInterruptableScenes( CBaseFlex *pActor );

void PrecacheInstancedScene( char const *pszScene );
void ResetPrecacheInstancedSceneDictionary();

char const *GetSceneFilename( CBaseEntity *ent );
void ReloadSceneFromDisk( CBaseEntity *ent );

#endif // SCENEENTITY_H


text:
{{define "help-challenge"}}
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>RIPACrypt - Help | Generate a Challenge</title>
    <link rel="shortcut icon" href="../../images/icons/favicon.png" />
    <link href='//fonts.googleapis.com/css?family=Hind:400,300,600,500,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>

    <link href="../../css/bootstrap.css" rel="stylesheet">
    <link href="../../css/bootstrap-theme.css" rel="stylesheet">
    <link href="../../css/block_grid_bootstrap.css" rel="stylesheet">
    <link href="../../css/font-awesome.min.css" rel="stylesheet">
    <link href="../../css/owl.carousel.css" rel="stylesheet">
    <link href="../../css/owl.theme.css" rel="stylesheet">
    <link href="../../css/animate.min.css" rel="stylesheet" />
    <link href="../../css/jquery.circliful.css" rel="stylesheet" />
    <link href="../../css/slicknav.css" rel="stylesheet" />
    <link href="../../css/style.css" rel="stylesheet">

Home

About

FAQ

Help

Download, Install & Getting Started

Create a Crypt

Check in

View a Crypt

Destroy a Crypt

Generate a Challenge

You are here:

Home

Help

Generating a Challenge

Generating a Challenge

Last updated: 1st June 2016

 Using The Official Client

 Using CURL

 Other Clients

RIPACrypt uses challenges that are encrypted with your GPG public key as a way of proving that you are authorised to make changes to your account.

The RIPACrypt client transparently requests and decrypts challenges before performing other actions.

Recommended Usage

We do not recommend manually requesting a challenge as it is rarely part of the normal application usage to require an out of band challenge.

rcrypt getchallenge

Acquiring a challenge requires sending your User ID and corresponding GPG fingerprint.

curl -v -H "Accept: application/json" -X POST -d "{\"fingerprint\":\"447055F36F6D60C1\",\"user_id\":9}" https://ripacrypt.download/1/challenge/

There are no 3rd party clients we are aware of. If this changes please let us know.

HELP

Download, Install & Getting Started

Create a Crypt

Check in

View a Crypt

Destroy a Crypt

Advanced Usage

Generate a Challenge

Generate a new Bitcoin Address

Navigation.

About

FAQ

Help

Brass Horn Communications

Projects

Tor Relays

Warrant Canary

Ask.

 E-MAIL US

{{end}}


text:
using UnityEngine;

public class ReadOnlyAttribute : PropertyAttribute {}
public class BeginReadOnlyGroupAttribute : PropertyAttribute {}
public class EndReadOnlyGroupAttribute : PropertyAttribute {}


text: google-site-verification: google071a0f2b30c7f497.html


text:
package org.citygml4j.core.model.deprecated.bridge;

import org.citygml4j.core.model.core.ImplicitGeometryProperty;
import org.citygml4j.core.model.deprecated.core.DeprecatedPropertiesOfAbstractCityObject;
import org.xmlobjects.gml.model.geometry.GeometryProperty;

public class DeprecatedPropertiesOfBridgeInstallation extends DeprecatedPropertiesOfAbstractCityObject {
    private GeometryProperty<?> lod2Geometry;
    private GeometryProperty<?> lod3Geometry;
    private GeometryProperty<?> lod4Geometry;
    private ImplicitGeometryProperty lod4ImplicitRepresentation;

    public GeometryProperty<?> getLod2Geometry() {
        return lod2Geometry;
    }

    public void setLod2Geometry(GeometryProperty<?> lod2Geometry) {
        this.lod2Geometry = asChild(lod2Geometry);
    }

    public GeometryProperty<?> getLod3Geometry() {
        return lod3Geometry;
    }

    public void setLod3Geometry(GeometryProperty<?> lod3Geometry) {
        this.lod3Geometry = asChild(lod3Geometry);
    }

    public GeometryProperty<?> getLod4Geometry() {
        return lod4Geometry;
    }

    public void setLod4Geometry(GeometryProperty<?> lod4Geometry) {
        this.lod4Geometry = asChild(lod4Geometry);
    }

    public ImplicitGeometryProperty getLod4ImplicitRepresentation() {
        return lod4ImplicitRepresentation;
    }

    public void setLod4ImplicitRepresentation(ImplicitGeometryProperty lod4ImplicitRepresentation) {
        this.lod4ImplicitRepresentation = asChild(lod4ImplicitRepresentation);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <corners android:radius="2.0dip" />
            <solid android:color="#fff0f0f0" />
            <stroke android:width="1.3399963dip" android:color="#ffe8e8e8" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="2.0dip" />
            <solid android:color="#fff7f7f7" />
            <stroke android:width="1.3399963dip" android:color="#ffe8e8e8" />
        </shape>
    </item>
</selector>


text:
package org.mengyun.tcctransaction.api;

import java.lang.reflect.Method;

/**
 * Created  on 1/18/17.
 */
public interface TransactionContextEditor {

    public TransactionContext get(Object target, Method method, Object[] args);

    public void set(TransactionContext transactionContext, Object target, Method method, Object[] args);

}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1"
          android:versionName="1.0"
          package="com.commonsware.android.sysevents.boot"
          xmlns:android="http://schemas.android.com/apk/res/android">

  <uses-sdk android:minSdkVersion="3"
            android:targetSdkVersion="6" />
  <supports-screens android:largeScreens="false"
                    android:normalScreens="true"
                    android:smallScreens="false" />
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <application android:icon="@drawable/cw"
               android:label="@string/app_name">
    <receiver android:name=".OnBootReceiver">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
      </intent-filter>
    </receiver>
  </application>
</manifest>


text:
@interface SAPIState : SAPIGenericApiObject

@property (strong) NSArray *open;
@property (strong) NSNumber *lastchange;
@property (strong) NSString *trigger_person;
@property (strong) NSString *message;
@property (strong) SAPIIcon *icon;

@end


text:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Youtan.Compile.Codegen where

-- import Data.String
import Data.List
import Data.Function
import qualified Data.Map as Map

import Control.Monad.State

import LLVM.General.AST
import LLVM.General.AST.Global
import qualified LLVM.General.AST as AST

import qualified LLVM.General.AST.AddrSpace as AS
import qualified LLVM.General.AST.Constant as C
import qualified LLVM.General.AST.Attribute as A
import qualified LLVM.General.AST.CallingConvention as CC
import qualified LLVM.General.AST.FloatingPointPredicate as FP
import qualified LLVM.General.AST.IntegerPredicate as IP

-------------------------------------------------------------------------------
-- Module Level
-------------------------------------------------------------------------------

newtype LLVM a = LLVM { unLLVM :: State AST.Module a }
  deriving (Functor, Applicative, Monad, MonadState AST.Module )

runLLVM :: AST.Module -> LLVM a -> AST.Module
runLLVM = flip (execState . unLLVM)

emptyModule :: String -> AST.Module
emptyModule label = defaultModule { moduleName = label }

addDefn :: Definition -> LLVM ()
addDefn d = do
  defs <- gets moduleDefinitions
  modify $ \s -> s { moduleDefinitions = defs ++ [d] }

define ::  Type -> String -> [(Type, Name)] -> [BasicBlock] -> LLVM ()
define retty label argtys body = addDefn $
  GlobalDefinition $ functionDefaults {
    name        = Name label
  , parameters  = ([Parameter ty nm [] | (ty, nm) <- argtys], False)
  , returnType  = retty
  , basicBlocks = body
  }

external ::  Type -> String -> [(Type, Name)] -> LLVM ()
external retty label argtys = addDefn $
  GlobalDefinition $ functionDefaults {
    name        = Name label
  , parameters  = ([Parameter ty nm [] | (ty, nm) <- argtys], False)
  , returnType  = retty
  , basicBlocks = []
  }

---------------------------------------------------------------------------------
-- Types
-------------------------------------------------------------------------------

-- IEEE 754 double
double :: Type
double = FloatingPointType 64 IEEE

-------------------------------------------------------------------------------
-- Names
-------------------------------------------------------------------------------

type Names = Map.Map String Int

uniqueName :: String -> Names -> (String, Names)
uniqueName nm ns =
  case Map.lookup nm ns of
    Nothing -> (nm,  Map.insert nm 1 ns)
    Just ix -> (nm ++ show ix, Map.insert nm (ix+1) ns)

-- instance IsString Name where
  -- fromString = Name . fromString

-------------------------------------------------------------------------------
-- Codegen State
-------------------------------------------------------------------------------

type SymbolTable = [(String, Operand)]

data CodegenState
  = CodegenState {
    currentBlock :: Name                     -- Name of the active block to append to
  , blocks       :: Map.Map Name BlockState  -- Blocks for function
  , symtab       :: SymbolTable              -- Function scope symbol table
  , blockCount   :: Int                      -- Count of basic blocks
  , count        :: Word                     -- Count of unnamed instructions
  , names        :: Names                    -- Name Supply
  } deriving Show

data BlockState
  = BlockState {
    idx   :: Int                            -- Block index
  , stack :: [Named Instruction]            -- Stack of instructions
  , term  :: Maybe (Named Terminator)       -- Block terminator
  } deriving Show

-------------------------------------------------------------------------------
-- Codegen Operations
-------------------------------------------------------------------------------

newtype Codegen a = Codegen { runCodegen :: State CodegenState a }
  deriving (Functor, Applicative, Monad, MonadState CodegenState )

sortBlocks :: [(Name, BlockState)] -> [(Name, BlockState)]
sortBlocks = sortBy (compare `on` (idx . snd))

createBlocks :: CodegenState -> [BasicBlock]
createBlocks m = map makeBlock $ sortBlocks $ Map.toList (blocks m)

makeBlock :: (Name, BlockState) -> BasicBlock
makeBlock (l, (BlockState _ s t)) = BasicBlock l s (maketerm t)
  where
    maketerm (Just x) = x
    maketerm Nothing = error $ "Block has no terminator: " ++ (show l)

entryBlockName :: String
entryBlockName = "entry"

emptyBlock :: Int -> BlockState
emptyBlock i = BlockState i [] Nothing

emptyCodegen :: CodegenState
emptyCodegen = CodegenState (Name entryBlockName) Map.empty [] 1 0 Map.empty

execCodegen :: Codegen a -> CodegenState
execCodegen m = execState (runCodegen m) emptyCodegen

fresh :: Codegen Word
fresh = do
  i <- gets count
  modify $ \s -> s { count = 1 + i }
  return $ i + 1

instr :: Instruction -> Codegen (Operand)
instr ins = do
  n <- fresh
  let ref = (UnName n)
  blk <- current
  let i = stack blk
  modifyBlock (blk { stack = i ++ [ref := ins] } )
  return $ local ref

terminator :: Named Terminator -> Codegen (Named Terminator)
terminator trm = do
  blk <- current
  modifyBlock (blk { term = Just trm })
  return trm

-------------------------------------------------------------------------------
-- Block Stack
-------------------------------------------------------------------------------

entry :: Codegen Name
entry = gets currentBlock

addBlock :: String -> Codegen Name
addBlock bname = do
  bls <- gets blocks
  ix <- gets blockCount
  nms <- gets names
  let new = emptyBlock ix
      (qname, supply) = uniqueName bname nms
  modify $ \s -> s { blocks = Map.insert (Name qname) new bls
                   , blockCount = ix + 1
                   , names = supply
                   }
  return (Name qname)

setBlock :: Name -> Codegen ()
setBlock bname = do
  modify $ \s -> s { currentBlock = bname }

getBlock :: Codegen Name
getBlock = gets currentBlock

modifyBlock :: BlockState -> Codegen ()
modifyBlock new = do
  active <- gets currentBlock
  modify $ \s -> s { blocks = Map.insert active new (blocks s) }

current :: Codegen BlockState
current = do
  c <- gets currentBlock
  blks <- gets blocks
  case Map.lookup c blks of
    Just x -> return x
    Nothing -> error $ "No such block: " ++ show c

-------------------------------------------------------------------------------
-- Symbol Table
-------------------------------------------------------------------------------

assign :: String -> Operand -> Codegen ()
assign var x = do
  lcls <- gets symtab
  modify $ \s -> s { symtab = [(var, x)] ++ lcls }

getVar :: String -> Codegen Operand
getVar var = do
  syms <- gets symtab
  case lookup var syms of
    Just x  -> return x
    Nothing -> error $ "Local variable not in scope: " ++ show var

-------------------------------------------------------------------------------

-- References
local ::  Name -> Operand
local = LocalReference double

global ::  Name -> C.Constant
global = C.GlobalReference double

externf :: Name -> Operand
externf = ConstantOperand . C.GlobalReference double

-- Arithmetic and Constants
fadd :: Operand -> Operand -> Codegen Operand
fadd a b = instr $ FAdd NoFastMathFlags a b []

fsub :: Operand -> Operand -> Codegen Operand
fsub a b = instr $ FSub NoFastMathFlags a b []

fmul :: Operand -> Operand -> Codegen Operand
fmul a b = instr $ FMul NoFastMathFlags a b []

fdiv :: Operand -> Operand -> Codegen Operand
fdiv a b = instr $ FDiv NoFastMathFlags a b []

add :: Operand -> Operand -> Codegen Operand
add a b = instr $ Add False False a b []

getPtr :: Operand -> [ Operand ] -> Codegen Operand
getPtr addr idx = instr $ GetElementPtr False addr idx []

bitCast :: Operand -> Type -> Codegen Operand
bitCast from to = instr $ BitCast from to []

cmp :: IP.IntegerPredicate -> Operand -> Operand -> Codegen Operand
cmp cond a b = instr $ ICmp cond a b []

fcmp :: FP.FloatingPointPredicate -> Operand -> Operand -> Codegen Operand
fcmp cond a b = instr $ FCmp cond a b []

pointer :: Type -> Type
pointer t = PointerType t ( AS.AddrSpace 0 )

cons :: C.Constant -> Operand
cons = ConstantOperand

uitofp :: Type -> Operand -> Codegen Operand
uitofp ty a = instr $ UIToFP a ty []

toArgs :: [Operand] -> [(Operand, [A.ParameterAttribute])]
toArgs = map (\x -> (x, []))

-- Effects
call :: Operand -> [Operand] -> Codegen Operand
call fn args = instr $ Call Nothing CC.C [] (Right fn) (toArgs args) [] []

alloca :: Type -> Codegen Operand
alloca ty = instr $ Alloca ty Nothing 0 []

store :: Operand -> Operand -> Codegen ()
store ptr val = void $ instr $ Store False ptr val Nothing 0 []

load :: Operand -> Codegen Operand
load ptr = instr $ Load False ptr Nothing 0 []

-- Control Flow
br :: Name -> Codegen (Named Terminator)
br val = terminator $ Do $ Br val []

cbr :: Operand -> Name -> Name -> Codegen (Named Terminator)
cbr cond tr fl = terminator $ Do $ CondBr cond tr fl []

ret :: Operand -> Codegen (Named Terminator)
ret val = terminator $ Do $ Ret (Just val) []

phi :: Type -> [(Operand, Name)] -> Codegen Operand
phi ty incoming = instr $ Phi ty incoming []


text:
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <title>Bio</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" th:href="@{https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css}"/>
    <link th:href="@{/css/main.css}" rel="stylesheet" type="text/css" />

                Download Results


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- "shadow" -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/translucent_grey_dark"/>

            <corners
                android:radius="12dp"
                android:bottomRightRadius="0dp"
                android:bottomLeftRadius="0dp"
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                />
        </shape>
    </item>

    <item
        android:top="2dp"
        android:bottom="2dp"
        android:right="2dp">
        <shape android:shape="rectangle">
            <gradient
                android:startColor="@color/translucent_blue_grey"
                android:endColor="@color/translucent_blue"
                android:gradientRadius="300"
                android:centerX="25%"
                android:centerY="50%"
                android:type="radial"/>
            <corners
                android:radius="12dp"
                android:bottomRightRadius="0dp"
                android:bottomLeftRadius="0dp"
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                />
        </shape>
    </item>

</layer-list>


text:
namespace MarsRovers.Instructions
{
    public class MissingPlateauInfoInstructionException : MarsRoversException
    {
        public MissingPlateauInfoInstructionException()
        {
        }

        public MissingPlateauInfoInstructionException(string message)
            : base(message)
        {
        }
    }
}


text:
using System.Linq;
using FluentValidation;
using Talifun.Commander.Command.Configuration;
using Talifun.Commander.Command.YouTubeUploader.Properties;

namespace Talifun.Commander.Command.YouTubeUploader.Configuration
{
	public class YouTubeUploaderElementValidator : AbstractValidator<YouTubeUploaderElement>
	{
		public YouTubeUploaderElementValidator()
		{
			RuleFor(x => x.Name).NotEmpty().WithLocalizedMessage(() => Resource.ValidatorMessageYouTubeUploaderElementNameMandatory)
				.Must((name) => !CurrentConfiguration.CommanderSettings.Projects
					.Where(x => x.CommandPlugins
						.Where(y => y.Setting.ElementType == typeof(YouTubeUploaderElement))
						.Cast<YouTubeUploaderElementCollection>()
						.SelectMany(y => y)
						.Where(y=>y.Name == name)
						.Count() > 1)
					.Any())
				.WithLocalizedMessage(() => Talifun.Commander.Command.Properties.Resource.ValidatorMessageProjectElementNameHasAlreadyBeenUsed);
		}
	}
}


text:
/**
 * @file
 * @brief Basic echo client
 *
 * This is echo client, the value given to the program is sent to the echo server
 * and the response is printed out.
 * To see the usage help, -h or --help.
 */

#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include "soletta.h"
#include "sol-buffer.h"
#include "sol-socket.h"
#include "sol-network.h"
#include "sol-vector.h"
#include "sol-util.h"

static struct sol_socket *sock;
static struct sol_network_link_addr address = {
    .port = 7,
    .family = SOL_NETWORK_FAMILY_INET6,
};

static bool
on_can_read(void *data, struct sol_socket *s)
{
    ssize_t r;
    struct sol_buffer buffer = SOL_BUFFER_INIT_EMPTY;
    struct sol_network_link_addr addr;

    r = sol_socket_recvmsg(s, &buffer, &addr);
    if (r < 0) {
        fprintf(stderr, "ERROR: Failed in receiving the message\n");
        goto err;
    }

    printf("Received: %.*s\n", SOL_STR_SLICE_PRINT(sol_buffer_get_slice(&buffer)));
    sol_buffer_fini(&buffer);
    sol_quit_with_code(EXIT_SUCCESS);

    return true;

err:
    sol_buffer_fini(&buffer);
    sol_quit_with_code(EXIT_FAILURE);
    return false;
}

static bool
on_can_write(void *data, struct sol_socket *s)
{
    int r = -1;
    struct sol_buffer buffer = SOL_BUFFER_INIT_CONST(data, strlen(data));

    r = sol_socket_sendmsg(sock, &buffer, &address);
    sol_buffer_fini(&buffer);
    if (r < 0) {
        fprintf(stderr, "ERROR: Could not send data\n");
        sol_quit_with_code(EXIT_FAILURE);
        return false;
    }

    return false;
}

static void
startup_client(void)
{
    char **argv = sol_argv();
    char *addr = NULL;
    int c, opt_idx, argc = sol_argc();
    static const struct option opts[] = {
        { "address", required_argument, NULL, 'a' },
        { "port", required_argument, NULL, 'p' },
        { "help", no_argument, NULL, 'h' },
        { 0, 0, 0, 0 }
    };
    struct sol_socket_ip_options options = {
        .base  = {
            SOL_SET_API_VERSION(.api_version = SOL_SOCKET_OPTIONS_API_VERSION, )
            SOL_SET_API_VERSION(.sub_api = SOL_SOCKET_OPTIONS_API_VERSION, )
            .on_can_write = on_can_write,
            .on_can_read = on_can_read,
        },
        .family = SOL_NETWORK_FAMILY_INET6,
        .secure = false,
        .reuse_addr = true,
    };

    while ((c = getopt_long(argc, argv, "a:p:h", opts, &opt_idx)) != -1) {
        switch (c) {
        case 'a':
            addr = optarg;
            break;
        case 'p':
            address.port = atoi(optarg);
            break;
        case 'h':
        default:
            fprintf(stderr,
                "Usage:\n\t%s -a <ip address> -p <address port> value\n", argv[0]);
            sol_quit_with_code(EXIT_SUCCESS);
            return;
        }
    }

    if (!addr) {
        fprintf(stderr, "ERROR: No address was given\n");
        goto err;
    }

    options.base.data = argv[optind];
    if (!options.base.data) {
        fprintf(stderr, "ERROR: No data was given, use -h for help\n");
        goto err;
    }

    sock = sol_socket_ip_new(&options.base);
    if (!sock) {
        fprintf(stderr, "ERROR: Could not create the socket\n");
        goto err;
    }

    if (!sol_network_link_addr_from_str(&address, addr)) {
        fprintf(stderr, "ERROR: Could not convert the address: %s\n", addr);
        goto err;
    }

    sol_socket_set_read_monitor(sock, true);
    sol_socket_set_write_monitor(sock, true);
    return;

err:
    sol_quit_with_code(EXIT_FAILURE);
}

static void
shutdown_client(void)
{
    if (sock)
        sol_socket_del(sock);
}

SOL_MAIN_DEFAULT(startup_client, shutdown_client);


text:
Run the following command:

{% highlight bash %}
pip install mxnet
{% endhighlight %}

MKL-DNN enabled pip packages are optimized for Intel hardware. You can find
performance numbers
in the MXNet tuning guide.

{% highlight bash %}
pip install mxnet-mkl
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.5.1
{% endhighlight %}

MKL-DNN enabled pip packages are optimized for Intel hardware. You can find
performance numbers
in the MXNet tuning guide.

{% highlight bash %}
pip install mxnet-mkl==1.5.1
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.4.1
{% endhighlight %}

MKL-DNN enabled pip packages are optimized for Intel hardware. You can find
performance numbers
in the MXNet tuning guide.

{% highlight bash %}
pip install mxnet-mkl==1.4.1
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.3.1
{% endhighlight %}

MKL-DNN enabled pip packages are optimized for Intel hardware. You can find
performance numbers
in the MXNet tuning guide.

{% highlight bash %}
pip install mxnet-mkl==1.3.1
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.2.1
{% endhighlight %}

MKL-DNN enabled pip packages are optimized for Intel hardware. You can find
performance numbers
in the MXNet tuning guide.

{% highlight bash %}
pip install mxnet-mkl==1.2.1
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.1.0
{% endhighlight %}

{% highlight bash %}
pip install mxnet==1.0.0
{% endhighlight %}

{% highlight bash %}
pip install mxnet==0.12.1
{% endhighlight %}

For MXNet 0.12.0:

{% highlight bash %}
pip install mxnet==0.12.0
{% endhighlight %}

{% highlight bash %}
pip install mxnet==0.11.0
{% endhighlight %}

{% highlight bash %}
pip install --pre mxnet -f https://dist.mxnet.io/python/all
{% endhighlight %}

{% include /get_started/pip_snippet.md %}


text:
.editable-handler .popover{
  width: auto;
}
.editable .popover-title{
  white-space:nowrap;
}
.editable .popover-title .close {
  margin: -4px 0px 0px 10px;
}
.editable form .btn-ajax{
  display: none;
}
.editable form{
  margin-bottom: 0px;
}
.editable form .text-field,
.editable form .textinput {
    width: 200px;
}

.editable form .int-field {
    width: 150px;
}
.editable form .textarea-field{
    width: 250px;
    height: 50px;
}

.editable form select,
.editable form .select2-container {
  max-width: 200px;
  min-width: 100px;
  width: 100%;
  margin-bottom: 10px;
}

.editable form .control-group,
.editable form .controls{
  margin: 0px;
  padding: 0px;
  border: 0px;
}
.editable form .control-label{
  display: none;
}
.editable form .controls label {
  white-space:nowrap;
}


text:
'use strict';
var moment = require('moment');

module.exports = function(sequelize, DataTypes) {
  var Event = sequelize.define('Event', {
    location: {
      type: DataTypes.STRING,
      allowNull: false
    },
    name: {
      type: DataTypes.STRING,
      allowNull: false
    },
    date: {
      type: DataTypes.DATE,
      get() {
        return moment(this.getDataValue('date')).format('YYYY-MM-DD');
      }
    }
  }, {
    classMethods: {
      associate: function(models) {
        // associations can be defined here
        Event.belongsToMany(models.Driver, {through: 'EventDrivers'});
      }
    }
  });
  return Event;
};