text:
#import "CC3Matrix.h"

#pragma mark CC3Matrix implementation

@implementation CC3Matrix

@synthesize isIdentity=_isIdentity, isRigid=_isRigid, isDirty=_isDirty;

#pragma mark Allocation and initialization

-(id) init {
	if( (self = [super init]) ) {
		[self populateIdentity];
		_isDirty = NO;
	}
	return self;
}

+(id) matrix { return [[[self alloc] init] autorelease]; }

+(id) matrixByMultiplying: (CC3Matrix*) mL by: (CC3Matrix*) mR {
	CC3Matrix* m = [mL copy];
	[m multiplyBy: mR];
	return [m autorelease];
}

-(id) copyWithZone: (NSZone*) zone {
	CC3Matrix* aCopy = [[[self class] allocWithZone: zone] init];
	[aCopy populateFrom: self];
	return aCopy;
}

-(NSString*) description { return [NSString stringWithFormat: @"%@", [self class]]; }

#pragma mark Population

-(void) populateZero {
	[self implPopulateZero];
	_isIdentity = NO;
	_isRigid = NO;
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateZero {
	CC3Assert(NO, @"%@ does not implement the implPopulateZero method", self);
}

-(void) populateIdentity {
	if (!_isIdentity) {
		[self implPopulateIdentity];
		_isIdentity = YES;
		_isRigid = YES;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateIdentity {
	CC3Assert(NO, @"%@ does not implement the implPopulateIdentity method", self);
}

-(void) populateFrom: (CC3Matrix*) aMatrix {
	if (!aMatrix || aMatrix.isIdentity) {
		[self populateIdentity];
	} else {
		[self implPopulateFrom: aMatrix];
		_isIdentity = NO;
		_isRigid = aMatrix.isRigid;
	}
}

/**
 * Template method. Subclasses will provide implementation.
 * Subclass implementations will double-dispatch to the other matrix.
 * Subclass implementation does not need to set isIdentity or isRigid.
 */
-(void) implPopulateFrom: (CC3Matrix*) aMatrix {
	CC3Assert(NO, @"%@ does not implement the implPopulateFrom: method", self);
}

-(void) populateFromCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	[self implPopulateFromCC3Matrix3x3: mtx];
	_isIdentity = CC3Matrix3x3IsIdentity(mtx);
	_isRigid = _isIdentity;
}

-(void) implPopulateFromCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromCC3Matrix3x3: method", self);
}

-(void) populateCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the populateCC3Matrix3x3: method", self);
}

-(void) populateFromCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	[self implPopulateFromCC3Matrix4x3: mtx];
	_isIdentity = CC3Matrix4x3IsIdentity(mtx);
	_isRigid = _isIdentity;
}

-(void) implPopulateFromCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromCC3Matrix3x3: method", self);
}

-(void) populateCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the populateCC3Matrix4x3: method", self);
}

-(void) populateFromCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	[self implPopulateFromCC3Matrix4x4: mtx];
	_isIdentity = CC3Matrix4x4IsIdentity(mtx);
	_isRigid = _isIdentity;
}

-(void) implPopulateFromCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromCC3Matrix4x4: method", self);
}

-(void) populateCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the populateCC3Matrix4x4: method", self);
}

-(void) populateFromRotation: (CC3Vector) aRotation {
	if (CC3VectorsAreEqual(aRotation, kCC3VectorZero)) {
		[self populateIdentity];
	} else {
		[self implPopulateFromRotation: aRotation];
		_isIdentity = NO;
		_isRigid = YES;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateFromRotation: (CC3Vector) aRotation {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromRotation: method", self);
}

-(void) populateFromQuaternion: (CC3Quaternion) aQuaternion {
	if (CC3QuaternionsAreEqual(aQuaternion, kCC3QuaternionIdentity)) {
		[self populateIdentity];
	} else {
		[self implPopulateFromQuaternion: aQuaternion];
		_isIdentity = NO;
		_isRigid = YES;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateFromQuaternion: (CC3Quaternion) aQuaternion {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromQuaternion: method", self);
}

-(void) populateFromScale: (CC3Vector) aScale {
	if (CC3VectorsAreEqual(aScale, kCC3VectorUnitCube)) {
		[self populateIdentity];
	} else {
		[self implPopulateFromScale: aScale];
		_isIdentity = NO;
		_isRigid = NO;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateFromScale: (CC3Vector) aScale {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromScale: method", self);
}

-(void) populateFromTranslation: (CC3Vector) aTranslation {
	if (CC3VectorsAreEqual(aTranslation, kCC3VectorZero)) {
		[self populateIdentity];
	} else {
		[self implPopulateFromTranslation: aTranslation];
		_isIdentity = NO;
		_isRigid = YES;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateFromTranslation: (CC3Vector) aTranslation {
	CC3Assert(NO, @"%@ does not implement the implPopulateFromTranslation: method", self);
}

-(void) populateToPointTowards: (CC3Vector) fwdDirection withUp: (CC3Vector) upDirection {
	[self implPopulateToPointTowards: fwdDirection withUp: upDirection];
	_isIdentity = NO;
	_isRigid = YES;
}

/** Template method. Subclasses will provide implementation. */
-(void) implPopulateToPointTowards: (CC3Vector) fwdDirection withUp: (CC3Vector) upDirection {
	CC3Assert(NO, @"%@ does not implement the implPopulateToPointTowards:withUp: method", self);
}

-(void) populateToLookAt: (CC3Vector) targetLocation
			   withEyeAt: (CC3Vector) eyeLocation
				  withUp: (CC3Vector) upDirection {

	CC3Vector fwdDir = CC3VectorDifference(targetLocation, eyeLocation);
	[self populateToPointTowards: fwdDir withUp: upDirection];
	[self transpose];
	[self translateBy: CC3VectorNegate(eyeLocation)];
	_isIdentity = NO;
	_isRigid = YES;
}

-(void) populateFromFrustumLeft: (GLfloat) left
					   andRight: (GLfloat) right
						 andTop: (GLfloat) top
					  andBottom: (GLfloat) bottom
						andNear: (GLfloat) near
						 andFar: (GLfloat) far {
	[self implPopulateFromFrustumLeft: left andRight: right andTop: top
							andBottom: bottom andNear: near andFar: far];
	_isIdentity = NO;
	_isRigid = NO;
}

-(void) implPopulateFromFrustumLeft: (GLfloat) left
						   andRight: (GLfloat) right
							 andTop: (GLfloat) top
						  andBottom: (GLfloat) bottom
							andNear: (GLfloat) near
							 andFar: (GLfloat) far {
	CC3Assert(NO, @"%@ does not support perspective projection. Use the CC3ProjectionMatrix instead", self);
}

-(void) populateFromFrustumLeft: (GLfloat) left
					   andRight: (GLfloat) right
						 andTop: (GLfloat) top
					  andBottom: (GLfloat) bottom
						andNear: (GLfloat) near {
	[self implPopulateFromFrustumLeft: left andRight: right andTop: top andBottom: bottom andNear: near];
	_isIdentity = NO;
	_isRigid = NO;
}

-(void) implPopulateFromFrustumLeft: (GLfloat) left
						   andRight: (GLfloat) right
							 andTop: (GLfloat) top
						  andBottom: (GLfloat) bottom
							andNear: (GLfloat) near {
	CC3Assert(NO, @"%@ does not support perspective projection. Use the CC3ProjectionMatrix instead", self);
}

-(void) populateOrthoFromFrustumLeft: (GLfloat) left
							andRight: (GLfloat) right
							  andTop: (GLfloat) top
						   andBottom: (GLfloat) bottom
							 andNear: (GLfloat) near
							  andFar: (GLfloat) far {
	[self implPopulateOrthoFromFrustumLeft: left andRight: right andTop: top
								 andBottom: bottom andNear: near andFar: far];
	_isIdentity = NO;
	_isRigid = NO;
}

-(void) implPopulateOrthoFromFrustumLeft: (GLfloat) left
								andRight: (GLfloat) right
								  andTop: (GLfloat) top
							   andBottom: (GLfloat) bottom
								 andNear: (GLfloat) near
								  andFar: (GLfloat) far {
	CC3Assert(NO, @"%@ does not support orthographic projection. Use the CC3ProjectionMatrix instead", self);
}

-(void) populateOrthoFromFrustumLeft: (GLfloat) left
							andRight: (GLfloat) right
							  andTop: (GLfloat) top
						   andBottom: (GLfloat) bottom
							 andNear: (GLfloat) near {
	[self implPopulateOrthoFromFrustumLeft: left andRight: right andTop: top andBottom: bottom andNear: near];
	_isIdentity = NO;
	_isRigid = NO;
}

-(void) implPopulateOrthoFromFrustumLeft: (GLfloat) left
								andRight: (GLfloat) right
								  andTop: (GLfloat) top
							   andBottom: (GLfloat) bottom
								 andNear: (GLfloat) near {
	CC3Assert(NO, @"%@ does not support orthographic projection. Use the CC3ProjectionMatrix instead", self);
}

#pragma mark Accessing content

-(CC3Vector) extractRotation {
	CC3Assert(NO, @"%@ does not implement the extractRotation method", self);
	return kCC3VectorNull;
}

-(CC3Quaternion) extractQuaternion  {
	CC3Assert(NO, @"%@ does not implement the extractQuaternion method", self);
	return kCC3QuaternionNull;
}

-(CC3Vector) extractForwardDirection  {
	CC3Assert(NO, @"%@ does not implement the extractForwardDirection method", self);
	return kCC3VectorNull;
}

-(CC3Vector) extractUpDirection  {
	CC3Assert(NO, @"%@ does not implement the extractUpDirection method", self);
	return kCC3VectorNull;
}

-(CC3Vector) extractRightDirection  {
	CC3Assert(NO, @"%@ does not implement the extractRightDirection method", self);
	return kCC3VectorNull;
}

-(CC3Vector) extractTranslation {
	CC3Assert(NO, @"%@ does not implement the extractTranslation method", self);
	return kCC3VectorNull;
}

#pragma mark Matrix transformations

// Short-circuit the identity transform. isRigid unchanged under rotation.
-(void) rotateBy: (CC3Vector) aRotation {
	if ( !CC3VectorsAreEqual(aRotation, kCC3VectorZero) ) {
		[self implRotateBy: aRotation];
		_isIdentity = NO;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implRotateBy: (CC3Vector) aRotation {
	CC3Assert(NO, @"%@ does not implement the implRotateBy: method", self);
}

// Short-circuit the identity transform. isRigid unchanged under rotation.
-(void) rotateByQuaternion: (CC3Quaternion) aQuaternion {
	if ( !CC3QuaternionsAreEqual(aQuaternion, kCC3QuaternionIdentity) ) {
		[self implRotateByQuaternion: aQuaternion];
		_isIdentity = NO;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implRotateByQuaternion: (CC3Quaternion) aQuaternion {
	CC3Assert(NO, @"%@ does not implement the implRotateByQuaternion: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) orthonormalizeRotationStartingWith: (NSUInteger) startColNum {
	CC3Assert(NO, @"%@ does not implement the orthonormalizeRotationStartingWith: method", self);
}

// Short-circuit the identity transform
-(void) scaleBy: (CC3Vector) aScale {
	if ( !CC3VectorsAreEqual(aScale, kCC3VectorUnitCube) ) {
		[self implScaleBy: aScale];
		_isIdentity = NO;
		_isRigid = NO;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implScaleBy: (CC3Vector) aScale {
	CC3Assert(NO, @"%@ does not implement the implScaleBy: method", self);
}

// Short-circuit the identity transform. isRigid unchanged under translation.
-(void) translateBy: (CC3Vector) aTranslation {
	if ( !CC3VectorsAreEqual(aTranslation, kCC3VectorZero) ) {
		[self implTranslateBy: aTranslation];
		_isIdentity = NO;
	}
}

/** Template method. Subclasses will provide implementation. */
-(void) implTranslateBy: (CC3Vector) aTranslation {
	CC3Assert(NO, @"%@ does not implement the implTranslateBy: method", self);
}

#pragma mark Matrix multiplication

// Includes short-circuits when one of the matrix is an identity matrix
-(void) multiplyBy: (CC3Matrix*) aMatrix {

	// If other matrix is identity, this matrix doesn't change, so leave
	if (!aMatrix || aMatrix.isIdentity) return;

	// If this matrix is identity, it just becomes the other matrix
	if (_isIdentity) {
		[self populateFrom: aMatrix];
		return;
	}

	// Otherwise, go through with the multiplication
	[self implMultiplyBy: aMatrix];
	_isIdentity = NO;
	if ( !aMatrix.isRigid ) _isRigid = NO;
}

/**
 * Template method for multiplying this matrix by the other, once it is known that neither
 * this matrix nor the other are identity matrices.
 *
 * Subclass implementations will double-dispatch to the other matrix.
 * Subclass implementation does not need to set isIdentity or isRigid.
 */
-(void) implMultiplyBy: (CC3Matrix*) aMatrix {
	CC3Assert(NO, @"%@ does not implement the implMultiplyBy: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyIntoCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyIntoCC3Matrix3x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyByCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyByCC3Matrix3x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyIntoCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyIntoCC3Matrix4x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyByCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyByCC3Matrix4x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyIntoCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyIntoCC3Matrix4x4: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) multiplyByCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the multiplyByCC3Matrix4x4: method", self);
}

// Includes short-circuits when one of the matrix is an identity matrix
-(void) leftMultiplyBy: (CC3Matrix*) aMatrix {

	// If other matrix is identity, this matrix doesn't change, so leave
	if (!aMatrix || aMatrix.isIdentity) return;

	// If this matrix is identity, it just becomes the other matrix
	if (_isIdentity) {
		[self populateFrom: aMatrix];
		return;
	}

	// Otherwise, go through with the multiplication
	[self implLeftMultiplyBy: aMatrix];
	_isIdentity = NO;
	if ( !aMatrix.isRigid ) _isRigid = NO;
}

/**
 * Template method for multiplying this matrix by the other, once it is known that neither
 * this matrix nor the other are identity matrices.
 *
 * Subclass implementations will double-dispatch to the other matrix.
 * Subclass implementation does not need to set isIdentity or isRigid.
 */
-(void) implLeftMultiplyBy: (CC3Matrix*) aMatrix {
	CC3Assert(NO, @"%@ does not implement the implLeftMultiplyBy: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyIntoCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyIntoCC3Matrix3x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyByCC3Matrix3x3: (CC3Matrix3x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyByCC3Matrix3x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyIntoCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyIntoCC3Matrix4x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyByCC3Matrix4x3: (CC3Matrix4x3*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyByCC3Matrix4x3: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyIntoCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyIntoCC3Matrix4x4: method", self);
}

/** Template method. Subclasses will provide implementation. */
-(void) leftMultiplyByCC3Matrix4x4: (CC3Matrix4x4*) mtx {
	CC3Assert(NO, @"%@ does not implement the leftMultiplyByCC3Matrix4x4: method", self);
}

#pragma mark Matrix operations

// Short-circuit if this is an identity matrix
-(CC3Vector) transformLocation: (CC3Vector) aLocation {
	if (_isIdentity) return aLocation;
	CC3Assert(NO, @"%@ does not implement the transformLocation: method", self);
	return kCC3VectorNull;
}

// Short-circuit if this is an identity matrix
-(CC3Vector) transformDirection: (CC3Vector) aDirection {
	if (_isIdentity) return aDirection;
	CC3Assert(NO, @"%@ does not implement the transformDirection: method", self);
	return kCC3VectorNull;
}

// Short-circuit if this is an identity matrix
-(CC3Vector4) transformHomogeneousVector: (CC3Vector4) aVector {
	if (_isIdentity) return aVector;
	CC3Assert(NO, @"%@ does not implement the transformHomogeneousVector: method", self);
	return kCC3Vector4Null;
}

// Short-circuit if this is an identity matrix
-(CC3Ray) transformRay: (CC3Ray) aRay {
	if (_isIdentity) return aRay;
	CC3Ray rayOut;
	rayOut.startLocation = [self transformLocation: aRay.startLocation];
	rayOut.direction = [self transformDirection: aRay.direction];
	return rayOut;
}

// Short-circuit if this is an identity matrix
-(void) transpose {
	if (_isIdentity) return;
	CC3Assert(NO, @"%@ does not implement the transpose method", self);
}

// Short-circuit if this is an identity or rigid matrix
-(BOOL) invert {
	if (_isIdentity) return YES;
	if (_isRigid) {
		[self invertRigid];
		return YES;
	}
	return [self invertAdjoint];
}

// Short-circuit if this is an identity or rigid matrix
-(BOOL) invertAdjoint {
	if (_isIdentity) return YES;
	CC3Assert(NO, @"%@ does not implement the invertAdjoint method", self);
	return NO;
}

// Short-circuit if this is an identity matrix
-(void) invertRigid {
	if (_isIdentity) return;
	CC3Assert(NO, @"%@ does not implement the invertRigid method", self);
}

@end


text:
package org.keycloak.models.map.storage.jpa.group;

import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Selection;
import org.keycloak.models.GroupModel;
import org.keycloak.models.map.group.MapGroupEntity;
import org.keycloak.models.map.group.MapGroupEntityDelegate;
import static org.keycloak.models.map.storage.jpa.Constants.CURRENT_SCHEMA_VERSION_GROUP;
import org.keycloak.models.map.storage.jpa.group.delegate.JpaGroupDelegateProvider;
import org.keycloak.models.map.storage.jpa.group.entity.JpaGroupEntity;
import org.keycloak.models.map.storage.jpa.JpaMapKeycloakTransaction;
import org.keycloak.models.map.storage.jpa.JpaModelCriteriaBuilder;
import org.keycloak.models.map.storage.jpa.JpaRootEntity;

public class JpaGroupMapKeycloakTransaction extends JpaMapKeycloakTransaction<JpaGroupEntity, MapGroupEntity, GroupModel> {

    @SuppressWarnings("unchecked")
    public JpaGroupMapKeycloakTransaction(EntityManager em) {
        super(JpaGroupEntity.class, GroupModel.class, em);
    }

    @Override
    public Selection<JpaGroupEntity> selectCbConstruct(CriteriaBuilder cb, Root<JpaGroupEntity> root) {
        return cb.construct(JpaGroupEntity.class,
            root.get("id"),
            root.get("version"),
            root.get("entityVersion"),
            root.get("realmId"),
            root.get("name"),
            root.get("parentId")
        );
    }

    @Override
    public void setEntityVersion(JpaRootEntity entity) {
        entity.setEntityVersion(CURRENT_SCHEMA_VERSION_GROUP);
    }

    @Override
    public JpaModelCriteriaBuilder createJpaModelCriteriaBuilder() {
        return new JpaGroupModelCriteriaBuilder();
    }

    @Override
    protected MapGroupEntity mapToEntityDelegate(JpaGroupEntity original) {
        return new MapGroupEntityDelegate(new JpaGroupDelegateProvider(original, em));
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.example.bharathramh.StorageClassCollection;

import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

/**
 * Created by bharathramh on 4/14/15.
 */
public class GooglePlacesCS implements Serializable, Parcelable{

    private Double lat, lng, rating;
    private String photoReference;
    private String vicinity;
    private String name;
    private String placeId;
    private Uri websiteUri;
    private boolean favFlag = true;

    public boolean isFavFlag() {
        return favFlag;
    }

    public void setFavFlag(boolean favFlag) {
        this.favFlag = favFlag;
    }

    public Uri getWebsiteUri() {
        return websiteUri;
    }

    public void setWebsiteUri(Uri websiteUri) {
        this.websiteUri = websiteUri;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    private String phoneNumber;
    private int priceLevel;
    private String smallPhotoURL;

    public String getLargePhotoURL() {
        return largePhotoURL;
    }

    public void setLargePhotoURL(String largePhotoURL) {
        this.largePhotoURL = largePhotoURL;
    }

    private String largePhotoURL;

    public String getSmallPhotoURL() {
        return smallPhotoURL;
    }

    public void setSmallPhotoURL(String smallPhotoURL) {
        this.smallPhotoURL = smallPhotoURL;
    }

    public int getPriceLevel() {
        return priceLevel;
    }

    public void setPriceLevel(int priceLevel) {
        this.priceLevel = priceLevel;
    }

    public GooglePlacesCS(){

    }

    public String getVicinity() {
        return vicinity;
    }

    public void setVicinity(String vicinity) {
        this.vicinity = vicinity;
    }

    @Override
    public String toString() {
        return "GooglePlacesCS{" +
                "lat=" + lat +
                ", lng=" + lng +
                ", rating=" + rating +
                ", photoReference='" + photoReference + '\'' +
                ", vicinity='" + vicinity + '\'' +
                ", name='" + name + '\'' +
                ", placeId='" + placeId + '\'' +
                ", priceLevel=" + priceLevel +
                '}';
    }

    public void setRating(Double rating) {
        this.rating = rating;
    }

    public Double getRating() {

        return rating;
    }

    public Double getLat() {
        return lat;
    }

    public void setLat(Double lat) {
        this.lat = lat;
    }

    public Double getLng() {
        return lng;
    }

    public void setLng(Double lng) {
        this.lng = lng;
    }

    public String getPhotoReference() {
        return photoReference;
    }

    public void setPhotoReference(String photoReference) {
        this.photoReference = photoReference;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPlaceId() {
        return placeId;
    }

    public void setPlaceId(String placeId) {
        this.placeId = placeId;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

    }
}


text:
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using AnotherCM.Library.Import.Character;

namespace AnotherCM.Library.Import.Common {
    [XmlRoot]
    public class D20Rules {
        [XmlElement("RulesElement")]
        public Rules Rules { get; set; }

        public static async Task<Rules> LoadFromAppDataAsync () {
            var d20Rules = new D20Rules() { Rules = new Rules() };
            var appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            var basePath = Path.Combine(appPath, "CBLoader");
            var rulesPath = Path.Combine(basePath, "combined.dnd40");

            if (!File.Exists(rulesPath)) {
                return d20Rules.Rules;
            }

            Stopwatch timer = Stopwatch.StartNew();
            try {
                d20Rules = await Task.Run<D20Rules>(() => {
                    XmlSerializer serializer = new XmlSerializer(typeof(D20Rules));
                    using (var file = new FileStream(rulesPath, FileMode.Open, FileAccess.Read, FileShare.Read, 0x1000, useAsync: true)) {
                        using (var reader = new XmlTextReader(file)) {
                            if (serializer.CanDeserialize(reader)) {
                                return serializer.Deserialize(reader) as D20Rules;
                            }
                        }
                    }
                    return d20Rules;
                }).ConfigureAwait(false);
            }
            finally {
                timer.Stop();
                Trace.TraceInformation("Deserializing D20Rules took {0}ms", timer.ElapsedMilliseconds);
            }

            return d20Rules.Rules;
        }
    }
}


text:
'use strict';

/**
 * Dependencies
 */

const allFacts = require('./cat-facts.json');
const catFacts = require('./');
const test = require('ava');

/**
 * Tests
 */

test('random fact', t => {
	const randomFact = catFacts.random();

	t.true(allFacts.indexOf(randomFact) >= 0);
});

test('all facts', t => {
	t.same(catFacts.all, allFacts);
});

test('no facts should have extranous whitespace', t => {
	catFacts.all.forEach(fact => {
		t.same(fact.trim(), fact);
	});
});

test('no facts should be duplicate', t => {
	const set = new Set(catFacts.all);

	t.same(set.size, catFacts.all.length);
});


text:
require 'open-uri'
require 'nokogiri'

module Prism
  VERSION = "0.1.1"
  PRODID = "-//markwunsch.com//Prism #{VERSION}//EN"

  # Convenience method for Prism::Microformat.find method
  def self.find(document, format=nil)
    Prism::Microformat.find(document, format)
  end

  # Get a string of html or a url and convert it to a Nokogiri Document
  def self.get(html)
    return html if html.is_a?(Nokogiri::XML::Node)
    begin
      url = URI.parse(html)
      doc = url.is_a?(URI::HTTP) ? get_url(url.normalize.to_s) : get_document(html)
    rescue URI::InvalidURIError
      doc = get_document(html)
    end
    doc
  end

  # Open a URL and convert the contents to a Nokogiri Document
  def self.get_url(url)
    uri = URI.parse(url)
    doc = ''
    uri.open do |web|
      doc = web.read
    end
    get_document(doc, url)
  end

  # Convert HTML to a Nokogiri Document
  def self.get_document(html, url=nil)
    html.is_a?(Nokogiri::XML::Node) ? html : Nokogiri::HTML.parse(html, url)
  end

  def self.normalize(name)
    name.to_s.strip.downcase.intern
  end

  # Map a key to an element or design pattern
  def self.map(key)
    case normalize(key)
      when :valueclass, :abbr, :uri, :url, :typevalue
        Prism::Pattern.map(key)
      when :hcard, :geo, :rellicense, :reltag, :votelinks, :xfn, :xmdp, :xoxo, :adr
        Prism::Microformat.map(key)
      when :base
        Prism::POSH::Base
      else
        raise "#{key} is not a recognized parser."
    end
  end

  # Get/Set a function that defines how to find an element in a node.
  # The Search function should return a Nokogiri::XML::NodeSet.
  # eg. <tt>search {|node| node.css(element) }
  def search(&block)
    @search = block if block_given?
    @search || lambda {|node| node }
  end

  # Define a function to search a node with a specific selector
  def search_for(selector=nil)
    search {|node| node.css(selector) } if selector
    search
  end

  # Search for the element in a document
  def find_in(document)
    search.call(document)
  end

  # Is the element found in node?
  def found_in?(node)
    find_in(node).eql?(node) || !find_in(node).empty?
  end

  # Get/Set a function that tests to make sure a given node is
  # the element we want. Should return truthy.
  # Default just tests to see if the node passed is a child of its parent node.
  def validate(&block)
    @validate = block if block_given?
    @validate || lambda { |node| find_in(node.parent).children.include?(node) }
  end

  # Is this a valid node?
  def valid?(node)
    validate.call(node)
  end

  # Define the pattern used to extract contents from node
  # Can be a symbol that match to an Element parser, or a block
  def extract(pattern = nil, &block)
    if block_given?
      @extract = block
    elsif pattern
      @extract = Prism.map(pattern).extract
    end
    @extract || lambda{|node| node.content.strip }
  end

  # Extract the content from the node
  def extract_from(node)
    extract.call(node)
  end

  # Parse the document, finding every instance of the desired element, and extract their contents
  def parse(document)
    if found_in?(document)
      nodes = find_in(document)
      if nodes.respond_to?(:collect) and !nodes.instance_of? Nokogiri::XML::Element
        nodes.collect { |element| extract_from(element) }
      else
        extract_from(document)
      end
    end
  end

  # Parse the document, extracting the content for the first instance of the element
  def parse_first(document)
    if found_in?(document)
      elements = find_in(document)
	# Fix for https://github.com/mwunsch/prism/issues/5
	if elements.respond_to?(:first) and !elements.instance_of? Nokogiri::XML::Element then
	  elements = elements.first
	end
      extract_from elements
    end
  end

end

require 'prism/pattern'
require 'prism/posh'
require 'prism/microformat'


text:
<!DOCTYPE HTML>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>restSQL Release Notes - 0.8.9</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="../assets/favicon.ico" />
<link rel="stylesheet" href="../assets/bootstrap.min.css">
<link rel="stylesheet" href="../assets/site.css">

			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
				Toggle navigation
			</button>
			restSQL

About

Overview

Architecture

Concepts

Explore Service

API

HTTP API Reference

HTTP API Status Codes

HTTP API Explorer

HTTP API Swagger UI

Java API Javadoc

Java API Examples

Full Javadoc

Config

Deployment

Default Config

Example Config

Logging

Monitoring

Security

Triggers

Project

Roadmap

Support

License

Sponsors

Release History

Download

			<form id="searchform" class="navbar-form navbar-right" role="search" onsubmit="return search()">

					<input id="searchtext" type="text" class="form-control searchfor" placeholder="Search for..." oninput="enableSearch()">
						<button id="searchbutton" class="btn btn-default disabled" type="submit">

						</button>

			</form>

Release Notes - 0.8.9

Summary

restSQL 0.8.9 adds binary object support and improves security.

Binary Object Support

Binary object reads and writes are now supported in both Java and HTTP APIs. The tested column types are BLOB in MySQL and bytea in PostgreSQL.

			In the Java API, use the framework-provided, BinaryObject, to wrap a byte array or translate from/to base 64 encoded string. The HTTP API (both XML and JSON forms) use base 64 encoded strings as well. For browser applications, the Javascript functions btoa() and atob() encode and decode base64 respectively.

Security Hardening

			SQL generation was converted from standard name-value concatenation to prepared statements. The value portion of an SQL expression is set as a question mark (and with PostgreSQL a type case, e.g.
			?::integer
			) and a JDBC method setXxx() is called with the value. The database will process column values as values. Harmful execution statements cannot be injected into restSQL parameter values. Addtionally the framework now converts all String input parameter values for numeric and boolean column type to Inter, Long, Float, Double or Boolean. An exception is thrown if the value cannot be converted.

			Example 1: the request
			restsql/res/Actor?id=47%20or%201%3d1
			(decoded this is
			id=47 or 1=1
			) previously would return all rows, since the SQL generated would be
			select * from actor where id = 47; or 1=1
			. restSQL will now return HTTP status 400 with the message
			Could not convert id value 47 or 1=1 to number
			.

			Example 2: the request
			restsql/res/film?year=2000%3B%20DELETE%20FROM%20actor_genre
			(decoded this is
			year=2000;DELETE FROM actor_genre
			) previously would return all films from 2000 and delete all rows from actor_genre since the SQL generated would be
			select * from film where year=2000; DELETE FROM actor_genre
			. restSQL will now return HTTP status 400 with the message
			Could not convert id value 1000; DELETE FROM actor_genre to number
			.

restsql.properties changes

MySQL-specific implementation of ColumnMetaData was added.

Following are the excerpts with the additional properties

# DB-specific implementation classes - match the implementation to your database
# For MySQL:
# 	org.restsql.core.ColumnMetaData=org.restsql.core.impl.mysql.MySqlColumnMetaData
# For PostgreSQL:
# 	org.restsql.core.ColumnMetaData=org.restsql.core.impl.ColumnMetaDataImpl

org.restsql.core.ColumnMetaData=org.restsql.core.impl.mysql.MySqlColumnMetaData

If you are using MySQL with the built-in implementation classes, none of the preceeding properties are required. Please refer to the following examples:

Complete

Minimal MySQL

Minimal PostgreSQL

Migration

Possibly change restsql.properties per above.


text:
package com.nextdoor.bender.operation.substitution.metadata;

import com.nextdoor.bender.config.AbstractConfig;
import com.nextdoor.bender.operation.substitution.Substitution;
import com.nextdoor.bender.operation.substitution.SubstitutionFactory;

public class MetadataSubstitutionFactory implements SubstitutionFactory {
  public MetadataSubstitutionConfig conf;

  @Override
  public void setConf(AbstractConfig config) {
    this.conf = (MetadataSubstitutionConfig) config;
  }

  @Override
  public Class<MetadataSubstitution> getChildClass() {
    return MetadataSubstitution.class;
  }

  @Override
  public Substitution newInstance() {
    return new MetadataSubstitution(this.conf.getKey(), this.conf.getIncludes(),
        this.conf.getExcludes(), this.conf.getFailDstNotFound());
  }
}


text: Eduardo Silva <eduardo@monkey.io>


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.robotpajamas.android.bgscriptdebugger.ui.DebuggerActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/firmware_version" />

        <TextView
            android:id="@+id/firmware_version"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <TextView
        android:id="@+id/textview_debug"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/textview_info" />

    <Button
        android:id="@+id/debugger_button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="@string/enable_debugging" />

</LinearLayout>


text:
require( "../setup" );
var config = require( "../../src/config.js" )( {
	index: {
		frequency: 100
	},
	package: { // jshint ignore : line
		branch: "master",
		owner: "me",
		project: "test"
	}
} );

describe( "Index Client", function() {
	describe( "when creating client", function() {
		var indexClient, client, newConfig, merged;
		before( function() {
			newConfig = {
					package: {
						owner: "derp",
						branch: "develop"
					}
				};
			merged = _.merge( {}, config, newConfig );
			indexClient = sinon.stub();
			var clientFn = proxyquire( "../src/indexClient.js", {
				"nonstop-index-client": indexClient
			} );
			client = clientFn( config );
			client.update( merged );
		} );

		it( "should pass the correct configuration to the index lib", function() {
			indexClient.getCall( 0 ).args.should.eql( [ { index: config.index, package: config.package } ] );
		} );

		it( "should pass the correct configuration to the index lib", function() {
			indexClient.getCall( 1 ).args.should.eql( [ { index: merged.index, package: merged.package } ] );
		} );

		it( "should set client config", function() {
			client.config.should.eql( merged );
		} );
	} );
} );


text:
package com.google.cloud.dataflow.sdk.transforms.windowing;

import static com.google.cloud.dataflow.sdk.testing.WindowFnTestUtils.runWindowFn;
import static com.google.cloud.dataflow.sdk.testing.WindowFnTestUtils.set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.joda.time.Duration;
import org.joda.time.Instant;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Tests for the SlidingWindows WindowFn.
 */
@RunWith(JUnit4.class)
public class SlidingWindowsTest {

  @Test
  public void testSimple() throws Exception {
    Map<IntervalWindow, Set<String>> expected = new HashMap<>();
    expected.put(new IntervalWindow(new Instant(-5), new Instant(5)), set(1, 2));
    expected.put(new IntervalWindow(new Instant(0), new Instant(10)), set(1, 2, 5, 9));
    expected.put(new IntervalWindow(new Instant(5), new Instant(15)), set(5, 9, 10, 11));
    expected.put(new IntervalWindow(new Instant(10), new Instant(20)), set(10, 11));
    assertEquals(
        expected,
        runWindowFn(
            SlidingWindows.of(new Duration(10)).every(new Duration(5)),
            Arrays.asList(1L, 2L, 5L, 9L, 10L, 11L)));
  }

  @Test
  public void testSlightlyOverlapping() throws Exception {
    Map<IntervalWindow, Set<String>> expected = new HashMap<>();
    expected.put(new IntervalWindow(new Instant(-5), new Instant(2)), set(1));
    expected.put(new IntervalWindow(new Instant(0), new Instant(7)), set(1, 2, 5));
    expected.put(new IntervalWindow(new Instant(5), new Instant(12)), set(5, 9, 10, 11));
    expected.put(new IntervalWindow(new Instant(10), new Instant(17)), set(10, 11));
    assertEquals(
        expected,
        runWindowFn(
            SlidingWindows.of(new Duration(7)).every(new Duration(5)),
            Arrays.asList(1L, 2L, 5L, 9L, 10L, 11L)));
  }

  @Test
  public void testElidings() throws Exception {
    Map<IntervalWindow, Set<String>> expected = new HashMap<>();
    expected.put(new IntervalWindow(new Instant(0), new Instant(3)), set(1, 2));
    expected.put(new IntervalWindow(new Instant(10), new Instant(13)), set(10, 11));
    expected.put(new IntervalWindow(new Instant(100), new Instant(103)), set(100));
    assertEquals(
        expected,
        runWindowFn(
            // Only look at the first 3 millisecs of every 10-millisec interval.
            SlidingWindows.of(new Duration(3)).every(new Duration(10)),
            Arrays.asList(1L, 2L, 3L, 5L, 9L, 10L, 11L, 100L)));
  }

  @Test
  public void testOffset() throws Exception {
    Map<IntervalWindow, Set<String>> expected = new HashMap<>();
    expected.put(new IntervalWindow(new Instant(-8), new Instant(2)), set(1));
    expected.put(new IntervalWindow(new Instant(-3), new Instant(7)), set(1, 2, 5));
    expected.put(new IntervalWindow(new Instant(2), new Instant(12)), set(2, 5, 9, 10, 11));
    expected.put(new IntervalWindow(new Instant(7), new Instant(17)), set(9, 10, 11));
    assertEquals(
        expected,
        runWindowFn(
            SlidingWindows.of(new Duration(10)).every(new Duration(5)).withOffset(new Duration(2)),
            Arrays.asList(1L, 2L, 5L, 9L, 10L, 11L)));
  }

  @Test
  public void testTimeUnit() throws Exception {
    Map<IntervalWindow, Set<String>> expected = new HashMap<>();
    expected.put(new IntervalWindow(new Instant(-5000), new Instant(5000)), set(1, 2, 1000));
    expected.put(new IntervalWindow(new Instant(0), new Instant(10000)),
        set(1, 2, 1000, 5000, 5001));
    expected.put(new IntervalWindow(new Instant(5000), new Instant(15000)), set(5000, 5001, 10000));
    expected.put(new IntervalWindow(new Instant(10000), new Instant(20000)), set(10000));
    assertEquals(
        expected,
        runWindowFn(
            SlidingWindows.of(Duration.standardSeconds(10)).every(Duration.standardSeconds(5)),
            Arrays.asList(1L, 2L, 1000L, 5000L, 5001L, 10000L)));
  }

  @Test
  public void testDefaultPeriods() throws Exception {
    assertEquals(Duration.standardHours(1),
        SlidingWindows.getDefaultPeriod(Duration.standardDays(1)));
    assertEquals(Duration.standardHours(1),
        SlidingWindows.getDefaultPeriod(Duration.standardHours(2)));
    assertEquals(Duration.standardMinutes(1),
        SlidingWindows.getDefaultPeriod(Duration.standardHours(1)));
    assertEquals(Duration.standardMinutes(1),
        SlidingWindows.getDefaultPeriod(Duration.standardMinutes(10)));
    assertEquals(Duration.standardSeconds(1),
        SlidingWindows.getDefaultPeriod(Duration.standardMinutes(1)));
    assertEquals(Duration.standardSeconds(1),
        SlidingWindows.getDefaultPeriod(Duration.standardSeconds(10)));
    assertEquals(Duration.millis(1),
        SlidingWindows.getDefaultPeriod(Duration.standardSeconds(1)));
    assertEquals(Duration.millis(1),
        SlidingWindows.getDefaultPeriod(Duration.millis(10)));
    assertEquals(Duration.millis(1),
        SlidingWindows.getDefaultPeriod(Duration.millis(1)));
  }

  @Test
  public void testEquality() {
    assertTrue(
        SlidingWindows.of(new Duration(10)).isCompatible(
            SlidingWindows.of(new Duration(10))));
    assertTrue(
        SlidingWindows.of(new Duration(10)).isCompatible(
            SlidingWindows.of(new Duration(10))));

    assertFalse(SlidingWindows.of(new Duration(10)).isCompatible(
        SlidingWindows.of(new Duration(20))));
    assertFalse(SlidingWindows.of(new Duration(10)).isCompatible(
        SlidingWindows.of(new Duration(20))));
  }
}


text:
import tmp from 'tmp';
import yargs = require('yargs');
import path = require('path');
import {copyCode, loadOwlBotYaml} from '../../copy-code';
import {OwlBotYaml} from '../../config-files';

interface Args {
  'source-repo': string;
  'source-repo-commit-hash': string;
  dest: string | undefined;
  'config-file': string[];
}

export const copyCodeCommand: yargs.CommandModule<{}, Args> = {
  command: 'copy-code',
  describe: 'copies code from source to repo into a local repo',
  builder(yargs) {
    return yargs
      .option('source-repo', {
        describe: 'The source repository.  Example: googleapis/googleapis-gen',
        type: 'string',
        demand: false,
        default: 'googleapis/googleapis-gen',
      })
      .option('source-repo-commit-hash', {
        describe:
          'The commit hash of the source repo from which to copy files.',
        type: 'string',
        demand: false,
        default: '',
      })
      .option('dest', {
        describe:
          'The directory containing a local repo.  Example: nodejs/vision.',
        type: 'string',
        demand: false,
      })
      .option('config-file', {
        describe: 'Path in the directory to the .OwlBot.yaml config.',
        type: 'array',
        default: ['.github/.OwlBot.yaml'],
      });
  },
  async handler(argv) {
    const destDir = argv.dest ?? process.cwd();
    const yamls: OwlBotYaml[] = [];
    for (const configFile of argv['config-file']) {
      yamls.push(await loadOwlBotYaml(path.join(destDir, configFile)));
    }
    await copyCode(
      argv['source-repo'],
      argv['source-repo-commit-hash'],
      destDir,
      tmp.dirSync().name,
      yamls
    );
  },
};


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Beih. Nova Hedwigia 50: 103 (1974)

#### Original name
Favolaschia roseogrisea Singer, 1974

### Remarks
null


text:
require 'simplecov'
require 'coveralls'
SimpleCov.formatters = [
  SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter
]

SimpleCov.start do
  add_filter '/spec/'
  add_filter '/vendor/'
  minimum_coverage(99.57)
end

require 'date'
require 'singleton'
require 'rest-client'
require 'faker'
require 'timekit'
require 'rspec'
require 'webmock/rspec'

WebMock.disable_net_connect!(allow: 'coveralls.io')

RSpec.configure do |config|
  config.before(:suite) do
    Timekit.configure(
      app: 'testapp',
      email: 'test@example.com',
      api_token: 'testapitoken'
    )
  end
end

def a_delete(path)
  a_request(:delete, Timekit::Request::BASE_URL + path)
end

def a_get(path)
  with_default_options(
    a_request(:get, Timekit::Request::BASE_URL + path)
  )
end

def a_post(path)
  a_request(:post, Timekit::Request::BASE_URL + path)
end

def a_put(path)
  a_request(:put, Timekit::Request::BASE_URL + path)
end

def stub_delete(path)
  stub_request(:delete, Timekit::Request::BASE_URL + path)
end

def stub_get(path)
  with_default_options(
    stub_request(:get, Timekit::Request::BASE_URL + path)
  )
end

def stub_post(path)
  stub_request(:post, Timekit::Request::BASE_URL + path)
end

def stub_put(path)
  stub_request(:put, Timekit::Request::BASE_URL + path)
end

def fixture_path
  File.expand_path('../fixtures', __FILE__)
end

def fixture(file)
  File.new(fixture_path + '/' + file)
end

def with_default_options(request)
  request.with(
    basic_auth: [
      Timekit.config[:credentials].email,
      Timekit.config[:credentials].api_token
    ],
    headers: {
      'Accept' => 'application/json',
      'Content-Type' => 'application/json',
      'Timekit-App' => Timekit.config[:app]
    }
  )
end

# class ActiveSupport::TestCase
#   # Setup all fixtures in test/fixtures/*.yml
#   # for all tests in alphabetical order.
#   fixtures :all
#
#   # Add more helper methods to be used by all tests here...
# end


text:
.class Landroid/support/v4/media/TransportMediatorJellybeanMR2$2;
.super Ljava/lang/Object;
.source "TransportMediatorJellybeanMR2.java"

# interfaces
.implements Landroid/view/ViewTreeObserver$OnWindowFocusChangeListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/media/TransportMediatorJellybeanMR2;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Landroid/support/v4/media/TransportMediatorJellybeanMR2;

# direct methods
.method constructor <init>(Landroid/support/v4/media/TransportMediatorJellybeanMR2;)V
    .registers 2

    .prologue
    .line 53
    iput-object p1, p0, Landroid/support/v4/media/TransportMediatorJellybeanMR2$2;->this$0:Landroid/support/v4/media/TransportMediatorJellybeanMR2;

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

    return-void
.end method

# virtual methods
.method public onWindowFocusChanged(Z)V
    .registers 3
    .param p1, "hasFocus"    # Z

    .prologue
    .line 56
    if-eqz p1, :cond_8

    iget-object v0, p0, Landroid/support/v4/media/TransportMediatorJellybeanMR2$2;->this$0:Landroid/support/v4/media/TransportMediatorJellybeanMR2;

    invoke-virtual {v0}, Landroid/support/v4/media/TransportMediatorJellybeanMR2;->gainFocus()V

    .line 58
    :goto_7
    return-void

    .line 57
    :cond_8
    iget-object v0, p0, Landroid/support/v4/media/TransportMediatorJellybeanMR2$2;->this$0:Landroid/support/v4/media/TransportMediatorJellybeanMR2;

    invoke-virtual {v0}, Landroid/support/v4/media/TransportMediatorJellybeanMR2;->loseFocus()V

    goto :goto_7
.end method


text:
package schedulev2

// DeleteScheduleRotationResponse is a response of get alert action.
type DeleteScheduleRotationResponse struct {
	ResponseMeta
}


text:
[![Latest Stable Version](https://img.shields.io/packagist/v/NoodlesNZ/double-metaphone.svg?style=flat-square)](https://packagist.org/packages/NoodlesNZ/double-metaphone)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)
[![Build Status](https://img.shields.io/travis/NoodlesNZ/double-metaphone/master.svg?style=flat-square)](https://travis-ci.org/NoodlesNZ/double-metaphone)

# double-metaphone

This class implements a "sounds like" algorithm developed by Lawrence Philips which he published in the June, 2000 issue of C/C++ Users Journal. Double Metaphone is an improved version of Philips' original Metaphone algorithm.

## Installation

To add this package as a local, per-project dependency to your project, simply add a dependency on `NoodlesNZ/double-metaphone` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on double-metaphone:

    {
        "require": {
            "NoodlesNZ/double-metaphone": "~1.0"
        }
    }

## Usage

```php
$d = new DoubleMetaphone('richard');

echo $d->primary . "\n";
echo $d->secondary . "\n";
```

The code above yields the output below:

    RXRT
    RKRT


text:
package co.aikar.commands;

public class JDAConditionContext extends ConditionContext<JDACommandEvent> {
    JDAConditionContext(JDACommandEvent issuer, String config) {
        super(issuer, config);
    }
}


text:
package org.apache.hadoop.raid;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Date;
import java.text.SimpleDateFormat;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.SequenceFileRecordReader;
import org.apache.hadoop.raid.RaidNode.Statistics;
import org.apache.hadoop.raid.protocol.PolicyInfo;
import org.apache.hadoop.util.StringUtils;

public class DistRaid {

  protected static final Log LOG = LogFactory.getLog(DistRaid.class);

  static final String NAME = "distRaid";
  static final String JOB_DIR_LABEL = NAME + ".job.dir";
  static final String OP_LIST_LABEL = NAME + ".op.list";
  static final String OP_COUNT_LABEL = NAME + ".op.count";
  static final int   OP_LIST_BLOCK_SIZE = 32 * 1024 * 1024; // block size of control file
  static final short OP_LIST_REPLICATION = 10; // replication factor of control file

  private static final long OP_PER_MAP = 100;
  private static final int MAX_MAPS_PER_NODE = 20;
  private static final int SYNC_FILE_MAX = 10;
  private static final SimpleDateFormat dateForm = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  private static String jobName = NAME;

  static enum Counter {
    FILES_SUCCEEDED, FILES_FAILED, PROCESSED_BLOCKS, PROCESSED_SIZE, META_BLOCKS, META_SIZE
  }

  protected JobConf jobconf;

  /** {@inheritDoc} */
  public void setConf(Configuration conf) {
    if (jobconf != conf) {
      jobconf = conf instanceof JobConf ? (JobConf) conf : new JobConf(conf);
    }
  }

  /** {@inheritDoc} */
  public JobConf getConf() {
    return jobconf;
  }

  public DistRaid(Configuration conf) {
    setConf(createJobConf(conf));
  }

  private static final Random RANDOM = new Random();

  protected static String getRandomId() {
    return Integer.toString(RANDOM.nextInt(Integer.MAX_VALUE), 36);
  }

  /**
   *
   * helper class which holds the policy and paths
   *
   */
  public static class RaidPolicyPathPair {
    public PolicyInfo policy;
    public List<FileStatus> srcPaths;

    RaidPolicyPathPair(PolicyInfo policy, List<FileStatus> srcPaths) {
      this.policy = policy;
      this.srcPaths = srcPaths;
    }
  }

  List<RaidPolicyPathPair> raidPolicyPathPairList = new ArrayList<RaidPolicyPathPair>();

  /** Responsible for generating splits of the src file list. */
  static class DistRaidInputFormat implements InputFormat<Text, PolicyInfo> {
    /** Do nothing. */
    public void validateInput(JobConf job) {
    }

    /**
     * Produce splits such that each is no greater than the quotient of the
     * total size and the number of splits requested.
     *
     * @param job
     *          The handle to the JobConf object
     * @param numSplits
     *          Number of splits requested
     */
    public InputSplit[] getSplits(JobConf job, int numSplits)
        throws IOException {
      final int srcCount = job.getInt(OP_COUNT_LABEL, -1);
      final int targetcount = srcCount / numSplits;
      String srclist = job.get(OP_LIST_LABEL, "");
      if (srcCount < 0 || "".equals(srclist)) {
        throw new RuntimeException("Invalid metadata: #files(" + srcCount
            + ") listuri(" + srclist + ")");
      }
      Path srcs = new Path(srclist);
      FileSystem fs = srcs.getFileSystem(job);

      List<FileSplit> splits = new ArrayList<FileSplit>(numSplits);

      Text key = new Text();
      PolicyInfo value = new PolicyInfo();
      SequenceFile.Reader in = null;
      long prev = 0L;
      int count = 0; // count src
      try {
        for (in = new SequenceFile.Reader(fs, srcs, job); in.next(key, value);) {
          long curr = in.getPosition();
          long delta = curr - prev;
          if (++count > targetcount) {
            count = 0;
            splits.add(new FileSplit(srcs, prev, delta, (String[]) null));
            prev = curr;
          }
        }
      } finally {
        in.close();
      }
      long remaining = fs.getFileStatus(srcs).getLen() - prev;
      if (remaining != 0) {
        splits.add(new FileSplit(srcs, prev, remaining, (String[]) null));
      }
      LOG.info("jobname= " + jobName + " numSplits=" + numSplits +
               ", splits.size()=" + splits.size());
      return splits.toArray(new FileSplit[splits.size()]);
    }

    /** {@inheritDoc} */
    public RecordReader<Text, PolicyInfo> getRecordReader(InputSplit split,
        JobConf job, Reporter reporter) throws IOException {
      return new SequenceFileRecordReader<Text, PolicyInfo>(job,
          (FileSplit) split);
    }
  }

  /** The mapper for raiding files. */
  static class DistRaidMapper implements
      Mapper<Text, PolicyInfo, WritableComparable, Text> {
    private JobConf jobconf;
    private boolean ignoreFailures;

    private int failcount = 0;
    private int succeedcount = 0;
    private Statistics st = null;

    private String getCountString() {
      return "Succeeded: " + succeedcount + " Failed: " + failcount;
    }

    /** {@inheritDoc} */
    public void configure(JobConf job) {
      this.jobconf = job;
      ignoreFailures = false;
      st = new Statistics();
    }

    /** Run a FileOperation */
    public void map(Text key, PolicyInfo policy,
        OutputCollector<WritableComparable, Text> out, Reporter reporter)
        throws IOException {
      try {
    	  LOG.info("************************************************");
        LOG.info("Raiding file=" + key.toString() + " policy=" + policy);
        Path p = new Path(key.toString());
        FileStatus fs = p.getFileSystem(jobconf).getFileStatus(p);
        st.clear();
        RaidNode.doRaid(jobconf, policy, fs, st, reporter);

        ++succeedcount;

        reporter.incrCounter(Counter.PROCESSED_BLOCKS, st.numProcessedBlocks);
        reporter.incrCounter(Counter.PROCESSED_SIZE, st.processedSize);
        reporter.incrCounter(Counter.META_BLOCKS, st.numMetaBlocks);
        reporter.incrCounter(Counter.META_SIZE, st.metaSize);

        reporter.incrCounter(Counter.FILES_SUCCEEDED, 1);
      } catch (IOException e) {
        ++failcount;
        reporter.incrCounter(Counter.FILES_FAILED, 1);

        String s = "FAIL: " + policy + ", " + key + " "
            + StringUtils.stringifyException(e);
        out.collect(null, new Text(s));
        LOG.info(s);
      } finally {
        reporter.setStatus(getCountString());
      }
    }

    /** {@inheritDoc} */
    public void close() throws IOException {
      if (failcount == 0 || ignoreFailures) {
        return;
      }
      throw new IOException(getCountString());
    }
  }

  /**
   * create new job conf based on configuration passed.
   *
   * @param conf
   * @return
   */
  private static JobConf createJobConf(Configuration conf) {
    JobConf jobconf = new JobConf(conf, DistRaid.class);
    jobName = NAME + " " + dateForm.format(new Date(RaidNode.now()));
    jobconf.setJobName(jobName);
    jobconf.setMapSpeculativeExecution(false);

    jobconf.setJarByClass(DistRaid.class);
    jobconf.setInputFormat(DistRaidInputFormat.class);
    jobconf.setOutputKeyClass(Text.class);
    jobconf.setOutputValueClass(Text.class);

    jobconf.setMapperClass(DistRaidMapper.class);
    jobconf.setNumReduceTasks(0);
    return jobconf;
  }

  /** Add paths to be raided */
  public void addRaidPaths(PolicyInfo info, List<FileStatus> paths) {
    raidPolicyPathPairList.add(new RaidPolicyPathPair(info, paths));
  }

  /** Calculate how many maps to run. */
  private static int getMapCount(int srcCount, int numNodes) {
    int numMaps = (int) (srcCount / OP_PER_MAP);
    numMaps = Math.min(numMaps, numNodes * MAX_MAPS_PER_NODE);
    return Math.max(numMaps, MAX_MAPS_PER_NODE);
  }

  /** invokes mapred job do parallel raiding */
  public void doDistRaid() throws IOException {
	if(LOGDISPLAY)  LOG.info("06.1------DistRaid.doDistRaid()-----");
    if (raidPolicyPathPairList.size() == 0) {
      LOG.info("DistRaid has no paths to raid.");
      return;
    }
    try {
      if (setup()) {
        JobClient.runJob(jobconf);
      }
    } finally {
      // delete job directory
      final String jobdir = jobconf.get(JOB_DIR_LABEL);
      if (jobdir != null) {
        final Path jobpath = new Path(jobdir);
        jobpath.getFileSystem(jobconf).delete(jobpath, true);
      }
    }
    raidPolicyPathPairList.clear();
    if(LOGDISPLAY)  LOG.info("06.1+++++DistRaid.doDistRaid()+++++");
  }

  /**
   * set up input file which has the list of input files.
   *
   * @return boolean
   * @throws IOException
   */
  private boolean setup() throws IOException {
	  if(LOGDISPLAY)  LOG.info("07.1------DistRaid.setup()-----");
    final String randomId = getRandomId();
    JobClient jClient = new JobClient(jobconf);
    Path jobdir = new Path(jClient.getSystemDir(), NAME + "_" + randomId);

    LOG.info(JOB_DIR_LABEL + "=" + jobdir);
    jobconf.set(JOB_DIR_LABEL, jobdir.toString());
    Path log = new Path(jobdir, "_logs");

    // The control file should have small size blocks. This helps
    // in spreading out the load from mappers that will be spawned.
    jobconf.setInt("dfs.blocks.size",  OP_LIST_BLOCK_SIZE);

    FileOutputFormat.setOutputPath(jobconf, log);
    LOG.info("log=" + log);

    // create operation list
    FileSystem fs = jobdir.getFileSystem(jobconf);
    Path opList = new Path(jobdir, "_" + OP_LIST_LABEL);
    jobconf.set(OP_LIST_LABEL, opList.toString());
    int opCount = 0, synCount = 0;
    SequenceFile.Writer opWriter = null;
    if(LOGDISPLAY1)  LOG.info("------DistRaid.setup()---11111--");
    try {
      opWriter = SequenceFile.createWriter(fs, jobconf, opList, Text.class,
          PolicyInfo.class, SequenceFile.CompressionType.NONE);
    if(LOGDISPLAY1)  LOG.info("------DistRaid.setup()---22222--");
      for (RaidPolicyPathPair p : raidPolicyPathPairList) {
        for (FileStatus st : p.srcPaths) {
          if(LOGDISPLAY1)  LOG.info("------DistRaid.setup()---33333--");
          if(LOGDISPLAY1)  LOG.info("------st.getPath().toString() == " + st.getPath().toString() + "-----");
          if(LOGDISPLAY2)  LOG.info("p.policy.toString() == "+p.policy.toString());

          opWriter.append(new Text(st.getPath().toString()), p.policy);
          if(LOGDISPLAY1)  LOG.info("------DistRaid.setup()---44444--");
          opCount++;
          if (++synCount > SYNC_FILE_MAX) {
            opWriter.sync();
            synCount = 0;
          }
        }
      }

    } finally {
      if (opWriter != null) {
        opWriter.close();
      }
      fs.setReplication(opList, OP_LIST_REPLICATION); // increase replication for control file
    }
    raidPolicyPathPairList.clear();

    jobconf.setInt(OP_COUNT_LABEL, opCount);
    LOG.info("Number of files=" + opCount);
    jobconf.setNumMapTasks(getMapCount(opCount, new JobClient(jobconf)
        .getClusterStatus().getTaskTrackers()));
    LOG.info("jobName= " + jobName + " numMapTasks=" + jobconf.getNumMapTasks());

    if(LOGDISPLAY)  LOG.info("07.1+++++DistRaid.setup()+++++");
    return opCount != 0;

  }
  public static  boolean LOGDISPLAY=false;
  public static  boolean LOGDISPLAY1=false;
  public static  boolean LOGDISPLAY2=false;
  public static  boolean LOGDISPLAY3=false;
  public static  boolean LOGDISPLAY4=false;
  public static  boolean LOGDISPLAY5=false;
  public static  boolean LOGDISPLAY6=false;
  public static  boolean LOGDISPLAY7=false;
  public static  boolean LOGDISPLAY8=false;
  public static  boolean LOGDISPLAY9=false;
  public static  boolean LOGDISPLAY10=false;
  public static  boolean LOGDISPLAY0=false;
  public static  boolean LOGDEBUG=false;
  static
  {
	   LOGDISPLAY=System.getProperty("LOGDISPLAY")!=null&&System.getProperty("LOGDISPLAY").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY1=System.getProperty("LOGDISPLAY1")!=null&&System.getProperty("LOGDISPLAY1").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY2=System.getProperty("LOGDISPLAY2")!=null&&System.getProperty("LOGDISPLAY2").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY3=System.getProperty("LOGDISPLAY3")!=null&&System.getProperty("LOGDISPLAY3").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY4=System.getProperty("LOGDISPLAY4")!=null&&System.getProperty("LOGDISPLAY4").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY5=System.getProperty("LOGDISPLAY5")!=null&&System.getProperty("LOGDISPLAY5").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY6=System.getProperty("LOGDISPLAY6")!=null&&System.getProperty("LOGDISPLAY6").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY7=System.getProperty("LOGDISPLAY7")!=null&&System.getProperty("LOGDISPLAY7").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY8=System.getProperty("LOGDISPLAY8")!=null&&System.getProperty("LOGDISPLAY8").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY9=System.getProperty("LOGDISPLAY9")!=null&&System.getProperty("LOGDISPLAY9").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY10=System.getProperty("LOGDISPLAY10")!=null&&System.getProperty("LOGDISPLAY10").equalsIgnoreCase("true")?true:false;
	   LOGDISPLAY0=System.getProperty("LOGDISPLAY0")!=null&&System.getProperty("LOGDISPLAY0").equalsIgnoreCase("true")?true:false;
	   LOGDEBUG=System.getProperty("LOGDEBUG")!=null&&System.getProperty("LOGDEBUG").equalsIgnoreCase("true")?true:false;
  }
}


text:
<?php
namespace PlaygroundGame\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\ORM\Mapping\PreUpdate;

/**
 * An entry represent a game session.
 * @ORM\Entity @HasLifecycleCallbacks
 * @ORM\Table(name="game_entry")
 */
class Entry implements \JsonSerializable
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer");
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="Game", cascade={"persist","remove"})
     * @ORM\JoinColumn(name="game_id", referencedColumnName="id", onDelete="CASCADE")
     **/
    protected $game;

    /**
     * @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE")
     **/
    protected $user;

    /**
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $active = true;

    /**
     * Has this entry been paid
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $paid = false;

    /**
     * The amount paid for this entry
     * @ORM\Column(name="paid_amount", type="integer", nullable=true)
     */
    protected $paidAmount = 0;

    /**
     * An entry marked as bonus means that it's not taken into account
     * in the limit calculation. It's offered, for example, when you share the game to a friend.
     *
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $bonus = 0;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $points;

    /**
     * Time spent during the entry in seconds
     * @ORM\Column(name="time_spent", type="integer", nullable=true)
     */
    protected $timeSpent;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $ip;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $geoloc;

    /**
     * @ORM\Column(name="anonymous_id", type="string", length=255, nullable=true)
     */
    protected $anonymousId;

    /**
     * This column hosts an id chosen by the admin in case of a game with "anonymous" participation :
     * This is a value chosen from the playerData (generally "email").
     *
     * @ORM\Column(name="anonymous_identifier", type="string", length=255, nullable=true)
     */
    protected $anonymousIdentifier;

    /**
     * @ORM\Column(name="player_data", type="text", nullable=true)
     */
    protected $playerData;

    /**
     * @ORM\Column(name="social_shares", type="text", nullable=true)
     */
    protected $socialShares;

    /**
     * Is this entry a winning one ?
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $winner = false;

    /**
     * Is there a termsOptin on this entry ?
     * @ORM\Column(name="terms_optin", type="boolean", nullable=true)
     */
    protected $termsOptin;

    /**
     * Is this entry eligible to draw ?
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $drawable = false;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $created_at;

    /**
     * The step in the play (in a quiz for example : the nth question)
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $step = 0;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $updated_at;

    public function __construct()
    {
    }

    /** @PrePersist */
    public function createChrono()
    {
        $this->created_at = new \DateTime("now");
        $this->updated_at = new \DateTime("now");
    }

    /** @PreUpdate */
    public function updateChrono()
    {
        $this->updated_at = new \DateTime("now");
        $this->timeSpent = $this->updated_at->getTimestamp() - $this->created_at->getTimestamp();
    }

    /**
     *
     * @return the $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     *
     * @param field_type $id
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * @return the $game
     */
    public function getGame()
    {
        return $this->game;
    }

    /**
     * @param field_type $game
     */
    public function setGame($game)
    {
        $this->game = $game;

        return $this;
    }

    /**
     * @return the $user
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * @param field_type $user
     */
    public function setUser($user)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * @return integer $points
     */
    public function getPoints()
    {
        return $this->points;
    }

    /**
     * @param integer $points
     */
    public function setPoints($points)
    {
        $this->points = $points;

        return $this;
    }

    /**
     * @return integer $timeSPent
     */
    public function getTimeSpent()
    {
        return $this->timeSPent;
    }

    /**
     * @param integer $timeSPent
     */
    public function setTimeSpent($timeSPent)
    {
        $this->timeSPent = $timeSPent;

        return $this;
    }

    /**
     * @return the $ip
     */
    public function getIp()
    {
        return $this->ip;
    }

    /**
     * @param field_type $ip
     */
    public function setIp($ip)
    {
        $this->ip = $ip;

        return $this;
    }

    /**
     * @return the $geoloc
     */
    public function getGeoloc()
    {
        return $this->geoloc;
    }

    /**
     * @param field_type $geoloc
     */
    public function setGeoloc($geoloc)
    {
        $this->geoloc = $geoloc;

        return $this;
    }

    /**
     * @return the $anonymousId
     */
    public function getAnonymousId()
    {
        return $this->anonymousId;
    }

    /**
     * @param field_type $anonymousId
     */
    public function setAnonymousId($anonymousId)
    {
        $this->anonymousId = $anonymousId;

        return $this;
    }

    /**
     * @return the $anonymousIdentifier
     */
    public function getAnonymousIdentifier()
    {
        return $this->anonymousIdentifier;
    }

    /**
     * @param field_type $anonymousIdentifier
     */
    public function setAnonymousIdentifier($anonymousIdentifier)
    {
        $this->anonymousIdentifier = $anonymousIdentifier;
    }

    /**
     * @return the $playerData
     */
    public function getPlayerData()
    {
        return $this->playerData;
    }

    /**
     * @param field_type $playerData
     */
    public function setPlayerData($playerData)
    {
        $this->playerData = $playerData;

        return $this;
    }

    /**
     * @return the $socialShares
     */
    public function getSocialShares()
    {
        return $this->socialShares;
    }

    /**
     * @param field_type $socialShares
     */
    public function setSocialShares($socialShares)
    {
        $this->socialShares = $socialShares;
    }

    /**
     * @return boolean active
     */
    public function getActive()
    {
        return $this->active ? 'true' : 'false';
    }

    /**
     * @param boolean $active
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * @return boolean paid
     */
    public function getPaid()
    {
        return $this->paid;
    }

    /**
     * @param boolean $paid
     */
    public function setPaid($paid)
    {
        $this->paid = $paid;

        return $this;
    }

    /**
     * @return integer paidAmount
     */
    public function getPaidAmount()
    {
        return $this->paidAmount;
    }

    /**
     * @param integer $paidAmount
     */
    public function setPaidAmount($paidAmount)
    {
        $this->paidAmount = $paidAmount;

        return $this;
    }

    /**
     * @return integer $step
     */
    public function getStep()
    {
        return $this->step;
    }

    /**
     * @param number $step
     */
    public function setStep($step)
    {
        $this->step = $step;
    }

    /**
     * @return integer bonus
     */
    public function getBonus()
    {
        return $this->bonus;
    }

    /**
     * @param integer $bonus
     */
    public function setBonus($bonus)
    {
        $this->bonus = $bonus;

        return $this;
    }

    /**
     * @return integer status
     */
    public function getWinner()
    {
        return $this->winner;
    }

    /**
     * @param integer $winner
     */
    public function setWinner($winner)
    {
        $this->winner = $winner;

        return $this;
    }

    /**
     * @return integer $drawable
     */
    public function getDrawable()
    {
        return $this->drawable;
    }

    /**
     * @param number $drawable
     */
    public function setDrawable($drawable)
    {
        $this->drawable = $drawable;

        return $this;
    }

    /**
     * @return the termsOptin
     */
    public function getTermsOptin()
    {
        return $this->termsOptin;
    }

    /**
     * @param field_type $termsOptin
     */
    public function setTermsOptin($termsOptin)
    {
        $this->termsOptin = $termsOptin;

        return $this;
    }

    /**
     * @return \DateTime $created_at
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * @param \DateTime $created_at
     */
    public function setCreatedAt($created_at)
    {
        $this->created_at = $created_at;

        return $this;
    }

    /**
     * @return \DateTime $updated_at
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

    /**
     * @param \DateTime $updated_at
     */
    public function setUpdatedAt($updated_at)
    {
        $this->updated_at = $updated_at;

        return $this;
    }

    /**
     * Convert the object to an array.
     *
     * @return array
     */
    public function getArrayCopy()
    {
        return get_object_vars($this);
    }

    /**
    * Convert the object to json.
    *
    * @return array
    */
    public function jsonSerialize(): mixed
    {
        return $this->getArrayCopy();
    }

    /**
     * Populate from an array.
     *
     * @param array $data
     */
    public function populate($data = array())
    {
    }
}


text:
<!--
Copyright 2018 Next Century Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- polymer style -->
<link rel="import" href="../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<custom-style>
  <style is="custom-style" include="iron-flex iron-flex-reverse iron-flex-alignment iron-flex-factors iron-positioning"></style>
</custom-style>

<!-- polymer iron elements -->
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../bower_components/iron-dropdown/iron-dropdown.html">
<link rel="import" href="../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../bower_components/iron-icons/av-icons.html">
<link rel="import" href="../bower_components/iron-icons/communication-icons.html">
<link rel="import" href="../bower_components/iron-icons/device-icons.html">
<link rel="import" href="../bower_components/iron-icons/editor-icons.html">
<link rel="import" href="../bower_components/iron-icons/hardware-icons.html">
<link rel="import" href="../bower_components/iron-icons/image-icons.html">
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/iron-icons/maps-icons.html">
<link rel="import" href="../bower_components/iron-icons/notification-icons.html">
<link rel="import" href="../bower_components/iron-icons/places-icons.html">
<link rel="import" href="../bower_components/iron-icons/social-icons.html">
<link rel="import" href="../bower_components/iron-iconset-svg/iron-iconset-svg.html">

<!--
<link rel="import" href="../bower_components/iron-icons/alert-icons.html">
<link rel="import" href="../bower_components/iron-icons/content-icons.html">
<link rel="import" href="../bower_components/iron-icons/file-icons.html">
<link rel="import" href="../bower_components/iron-icons/navigation-icons.html">
<link rel="import" href="../bower_components/iron-icons/toggle-icons.html">
-->

<!-- polymer paper elements -->
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="../bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="../bower_components/paper-header-panel/paper-header-panel.html">
<link rel="import" href="../bower_components/paper-item/paper-icon-item.html">
<link rel="import" href="../bower_components/paper-material/paper-material.html">
<link rel="import" href="../bower_components/paper-spinner/paper-spinner.html">
<link rel="import" href="../bower_components/paper-styles/color.html">
<link rel="import" href="../bower_components/paper-styles/shadow.html">
<link rel="import" href="../bower_components/paper-toolbar/paper-toolbar.html">

<!-- dig elements -->
<link rel="import" href="../bower_components/aggregation-query-and-display/aggregation-query-and-display.html">
<link rel="import" href="../bower_components/build-and-run-query/build-and-run-query.html">
<link rel="import" href="../bower_components/button-action/button-action.html">
<link rel="import" href="../bower_components/bulk-search/bulk-search.html">
<link rel="import" href="../bower_components/detail-view/detail-view.html">
<link rel="import" href="../bower_components/dig-logger/dig-logger.html">
<link rel="import" href="../bower_components/dropdown-menu/dropdown-menu.html">
<link rel="import" href="../bower_components/elastic-client/elastic-client.html">
<link rel="import" href="../bower_components/elastic-client-query-builder/elastic-client-query-builder.html">
<link rel="import" href="../bower_components/elastic-error/elastic-error.html">
<link rel="import" href="../bower_components/export-button/export-button.html">
<link rel="import" href="../bower_components/export-button/export-dialog.html">
<link rel="import" href="../bower_components/extraction-grid/extraction-grid.html">
<link rel="import" href="../bower_components/facet-panel/facet-panel.html">
<link rel="import" href="../bower_components/filters-builder/filters-builder.html">
<link rel="import" href="../bower_components/image-query-and-display/image-query-and-display.html">
<link rel="import" href="../bower_components/icon-button/icon-button.html">
<link rel="import" href="../bower_components/json-combine/json-combine.html">
<link rel="import" href="../bower_components/leaflet-wrapper/leaflet-wrapper.html">
<link rel="import" href="../bower_components/log-creator/log-creator.html">
<link rel="import" href="../bower_components/modal-icon/modal-icon.html">
<link rel="import" href="../bower_components/nested-list/nested-list.html">
<link rel="import" href="../bower_components/profile-manager/profile-manager.html">
<link rel="import" href="../bower_components/query-builder/query-builder.html">
<link rel="import" href="../bower_components/query-transformer/query-transformer.html">
<link rel="import" href="../bower_components/result-list/result-list.html">
<link rel="import" href="../bower_components/search-fields-dialog/search-fields-button.html">
<link rel="import" href="../bower_components/search-fields-dialog/search-fields-dialog.html">
<link rel="import" href="../bower_components/save-case-dialog/save-case-dialog.html">
<link rel="import" href="../bower_components/selected-facets-display/selected-facets-display.html">
<link rel="import" href="../bower_components/single-result/single-result.html">
<link rel="import" href="../bower_components/sparkline-list/sparkline-list.html">
<link rel="import" href="../bower_components/state-manager/state-manager.html">
<link rel="import" href="../bower_components/styled-dialog/styled-dialog.html">
<link rel="import" href="../bower_components/tag-entity-buttons/tag-entity-buttons.html">
<link rel="import" href="../bower_components/tag-extraction-buttons/tag-extraction-buttons.html">
<link rel="import" href="../bower_components/tag-manager/tag-manager.html">
<link rel="import" href="../bower_components/terms-transformer/terms-transformer.html">
<link rel="import" href="../bower_components/user-settings-dialog/user-settings-button.html">
<link rel="import" href="../bower_components/user-settings-dialog/user-settings-dialog.html">
<link rel="import" href="../bower_components/zoomable-bar-chart/zoomable-bar-chart.html">

<!-- other elements -->
<link rel="import" href="../bower_components/polymer-fontawesome-iconset/fa-all.html">
<link rel="import" href="../bower_components/moment-element/moment-with-locales-import.html">

<!-- dig-ui page behavior -->
<link rel="import" href="behaviors.html">

<!-- dig-ui page elements -->
<link rel="import" href="cached-page/cached-page.html">
<link rel="import" href="entity-page/entity-page.html">
<link rel="import" href="result-page/result-page.html">
<link rel="import" href="search-page/search-page.html">

<!-- dig-ui elements -->
<link rel="import" href="copy-button/copy-button.html">
<link rel="import" href="database-details/database-details.html">
<link rel="import" href="dual-column/dual-column.html">
<link rel="import" href="section-wrapper/section-wrapper.html">
<link rel="import" href="transform-functions/transform-functions.html">

<!-- search page elements -->
<link rel="import" href="../bower_components/dig-ui-search-box/editable-button.html">
<link rel="import" href="../bower_components/dig-ui-search-box/search-box.html">
<link rel="import" href="../bower_components/dig-ui-search-box/search-strategy.html">


text:
<?php
class Manage_depot_controller extends CI_Controller {

	public function __construct()
	{
		parent::__construct();

		//Loading all necessary models
		$this->load->model('myaccount_model');
		$this->load->model('sitesetting_model');
		$this->load->model('common_model');
		$this->load->library('ImageThumb');

		//if admin user logged out redirecting to login page
		if(!$this->session->userdata('is_logged_in')){
			redirect('control/login');
		}
	}

    /**
    * Load the main view with all the current model model's data.
    * @return void
    */
	public function index()
	{
		$user_id = $dealer_id = ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;

		$setting_data 					= $this->myaccount_model->get_account_data($user_id);
		$data['data']['setting_data'] 	= $setting_data;
		$data['data']['settings'] 		= $this->sitesetting_model->get_settings();
		$data['data']['dealer_id'] 		= $user_id;

		//settings data
		$data['myaccount_data'] 			= $this->myaccount_model->get_account_data($user_id);

		//$this->mongo_db->select(array('_id', 'form_type'));
		$this->mongo_db->select('*');
		$this->mongo_db->where(array('user_type' => 'broker'));
		$all_details 					= $this->mongo_db->get('site_users');
		//$all_details 	= $this->mongo_db->get('form_fields');

		//echo '
'; print_r($all_details); echo '
'; die;

		$data['data']['all_broker']		= $all_details;

		//$data['data']['all_forms']		= array();

		$data['view_link'] = 'admin/brokers/index';

		$this->load->view('includes/template', $data);
	}//index

	public function add_broker()
	{
		$user_id 			= $dealer_id = ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;
		//Get last user id
		$this->mongo_db->order_by(array('_id' => 'desc'));
		$this->mongo_db->limit(1);
		$get_last_id_arr 			= $this->mongo_db->get('site_users');
		$get_last_id 				= (isset($get_last_id_arr[0]['id'])) ? $get_last_id_arr[0]['id'] : 1;

		$reg_type 				= strval('broker');
		$data_to_store 			= array();

		$data_to_store['user_type']	= strval($reg_type);
		$data_to_store['id']		= strval($get_last_id + 1);
		//$data_to_store['linkedin_id']	= '';
		//$data_to_store['linkedin_location'] = '';

		$fixed_fields 				= $this->input->post('fixed_fields');

		$fixed_fields 				= ($fixed_fields) ? $fixed_fields : array();

		$extra_fields 				= $this->input->post('extra_fields');
		$extra_fields 				= ($extra_fields) ? $extra_fields : array();

		if(!empty($fixed_fields))
		{
			foreach($fixed_fields as $f => $field){
				if(!isset($data_to_store[$f]))
					if(!isset($data_to_store[$f]))
						$data_to_store[$f] 		= (is_array($field)) ? json_encode($field) :strval($field);
					else
						$data_to_store[$f.'_1'] = (is_array($field)) ? json_encode($field) :strval($field);
			}
		}

		//echo "
";
		//print_r($data_to_store);die;
		if(!empty($extra_fields))
		{
			$start_pos 	= count($data_to_store);
			foreach($extra_fields as $ef => $efield){
				if(!isset($data_to_store[$ef]))
					$data_to_store[$ef] 		= strval($efield);
				else
					$data_to_store[$ef.'_1']		= strval($efield);
			}
		}

		$data_to_store['added_on']		= strval(date('Y-m-d H:i:s'));
		$data_to_store['admin_status']	= strval(1);
		$data_to_store['status']			= strval(1);

		//echo '
'; print_r($_FILES); echo '
';
		//echo '
'; print_r($data_to_store); echo '
'; die;

		//check for email as it should be unique for each users and can not be same
		$do_have_email = (isset($fixed_fields['email'])) ? 1 : '0';
		$do_insert 	= 1;

		if($do_have_email)
		{
			$email_id = (isset($fixed_fields['email'])) ? $fixed_fields['email'] : '';
			if($email_id)
			{
				//check for similar email
				$this->mongo_db->where(array('email' => $email_id));
				$count = $this->mongo_db->count('site_users');

				if($count > 0)
				{
					$this->session->set_flashdata('flash_message', 'email_error');
					redirect('control/manage-brokers');
				}
			}
			else
			{
				$this->session->set_flashdata('flash_message', 'reg_error');
				redirect('control/manage-brokers');
			}
		}

		if($do_insert)
		{
			$insert 	= $this->mongo_db->insert('site_users', $data_to_store);

			if($insert)
			{
				$to_up_files = array();

				//upload extra field iles
				if(isset($_FILES['extra_fields']['name']) && !empty($_FILES['extra_fields']['name']))
				{
					foreach($_FILES['extra_fields']['name'] as $f => $file_name)
					{
						$to_up_files[$f]['name'] 	= $file_name;
						$to_up_files[$f]['type'] 	= $_FILES['extra_fields']['type'][$f];
						$to_up_files[$f]['tmp_name'] 	= $_FILES['extra_fields']['tmp_name'][$f];
						$to_up_files[$f]['error'] 	= $_FILES['extra_fields']['error'][$f];
						$to_up_files[$f]['size'] 	= $_FILES['extra_fields']['size'][$f];
					}
				}

				if(!empty($to_up_files))
				{
					$data_to_store_file = array();
					foreach($to_up_files as $ufld => $up_file)
					{
						$file_type 			= (isset($up_file['type'])) ? explode('/', $up_file['type']) : array();
						$file_type_det 		= (isset($file_type[0])) ? $file_type[0] : '';

						$filename 			= (isset($up_file['name'])) ? substr($up_file['name'],strripos($up_file['name'],'.')) : '';
						$s					= time().$filename;
						$file 				= $up_file['tmp_name'];

						if($file_type_det == 'image')
						{
							$DIR_IMG_NORMAL 		= FILEUPLOADPATH.'assets/uploads/user_images/';
							$fileNormal 			= $DIR_IMG_NORMAL.$s;
							$result 				= move_uploaded_file($file, $fileNormal);

							if($result)
							{
								$srcPath		= FILEUPLOADPATH.'assets/uploads/user_images/'.$s;
								$destPath1 	= FILEUPLOADPATH.'assets/uploads/user_images/thumb/'.$s;
								$destWidth1	= 500;
								$destHeight1	= 500;
								$this->imagethumb->resizeProportional($destPath1, $srcPath, $destWidth1, $destHeight1);
								$image_name	= $s;

								$data_to_store_file[$ufld] = $image_name;
							}
						}
						else
						{
							$DIR_IMG_NORMAL 	= FILEUPLOADPATH.'assets/uploads/user_files/';
							$fileNormal 		= $DIR_IMG_NORMAL.$s;
							$result 			= move_uploaded_file($file, $fileNormal);

							if($result) $data_to_store_file[$ufld] = $s;
						}
					}

					if(!empty($data_to_store_file))
					{
						$this->mongo_db->where(array('_id' => $insert));
						$this->mongo_db->set($data_to_store_file);
						$this->mongo_db->update('site_users');
					}
				}

				$this->session->set_flashdata('flash_message', 'reg_success');
				redirect('control/manage-brokers');
			}
		}
		else
		{
			$this->session->set_flashdata('flash_message', 'reg_error');
			redirect('control/manage-brokers');
		}

		redirect('control/manage-brokers');
	}

	public function add(){

		$user_id = $dealer_id = ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;

		$setting_data 					= $this->myaccount_model->get_account_data($user_id);
		$data['data']['setting_data'] 	= $setting_data;
		$data['data']['settings'] 		= $this->sitesetting_model->get_settings();
		$data['data']['dealer_id'] 		= $user_id;

		//settings data
		$data['myaccount_data'] 			= $this->myaccount_model->get_account_data($user_id);

		$all_existing_menus 			= array();
		$data['data']['all_existing_menus']= $all_existing_menus;

		//for is fixed 1 which means mandatory fields
		$this->mongo_db->select('*');
		$this->mongo_db->where(array('form_type' => 'broker'));
		$this->mongo_db->where(array('is_fixed' => '1'));
		$this->mongo_db->order_by(array('is_fixed' => 'desc', '_id' => 'asc'));
		$all_fixed_fields 					= $this->mongo_db->get('form_fields');
		$data['data']['all_fields_fixed']	=	$all_fixed_fields;

		//for other fields which is not mandatory fields
		$this->mongo_db->select('*');
		$this->mongo_db->where(array('form_type' => 'broker'));
		$this->mongo_db->where(array('is_fixed' => '0'));
		$this->mongo_db->order_by(array('is_fixed' => 'desc', '_id' => 'asc'));
		$all_nonfixed_fields 					= $this->mongo_db->get('form_fields');
		$data['data']['all_non_fixed']		= $all_nonfixed_fields;
		//echo "
";
		//print_r($all_nonfixed_fields);die;

		$data['view_link'] = 'admin/brokers/add_brokers';
		$this->load->view('includes/template', $data);

	}

	//Function to update existing form fields and add new ones if added
	public function updt()
	{
		$user_id = $dealer_id = ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;

		$setting_data 					= $this->myaccount_model->get_account_data($user_id);
		$data['data']['setting_data'] 	= $setting_data;
		$data['data']['settings'] 		= $this->sitesetting_model->get_settings();
		$data['data']['dealer_id'] 		= $user_id;

		//settings data
		$data['myaccount_data'] 			= $this->myaccount_model->get_account_data($user_id);

		$all_existing_menus 			= array();
		$data['data']['all_existing_menus']= $all_existing_menus;
		$broker_id 							= ($this->input->post('brokers_id') && $this->input->post('brokers_id')!='') ? strval($this->input->post('brokers_id')) :'';

		//for is fixed 1 which means mandatory fields
		$this->mongo_db->select('*');
		$this->mongo_db->where(array('form_type' => 'broker'));
		$this->mongo_db->where(array('is_fixed' => '1'));
		$this->mongo_db->order_by(array('is_fixed' => 'desc', '_id' => 'asc'));
		$all_fixed_fields 					= $this->mongo_db->get('form_fields');
		$data['data']['all_fields_fixed']	=	$all_fixed_fields;

		//for other fields which is not mandatory fields
		$this->mongo_db->select('*');
		$this->mongo_db->where(array('form_type' => 'broker'));
		$this->mongo_db->where(array('is_fixed' => '0'));
		$this->mongo_db->order_by(array('is_fixed' => 'desc', '_id' => 'asc'));
		$all_nonfixed_fields 					= $this->mongo_db->get('form_fields');
		$data['data']['all_non_fixed']		= $all_nonfixed_fields;

		//for customer details array
		if($broker_id !='')
		{
			$this->mongo_db->select('*');
			$this->mongo_db->where(array('_id' 	=> $broker_id));
			$this->mongo_db->order_by(array('is_fixed' => 'desc', '_id' => 'asc'));
			$broker_details 					= $this->mongo_db->get('site_users');
			$data['data']['broker_details']	=	$broker_details;
		}

		//print_r($all_fixed_fields);die;
		$data_to_store = $data_to_store_old = array();

		//if save button was clicked, get the data sent via post
		if ($this->input->server('REQUEST_METHOD') === 'POST' && $broker_id=='')
		{
			$broker_form_id 							= ($this->input->post('broker_unique_id') && $this->input->post('broker_unique_id')!='') ? strval($this->input->post('broker_unique_id')) :'';
			$this->mongo_db->order_by(array('_id' => 'desc'));
			$this->mongo_db->limit(1);
			$get_last_id_arr 			= $this->mongo_db->get('site_users');

			$data_to_store 			= array();

			//$data_to_store['linkedin_id']	= '';
			//$data_to_store['linkedin_location'] = '';

			$fixed_fields 				= $this->input->post('fixed_fields');

			$fixed_fields 				= ($fixed_fields) ? $fixed_fields : array();

			$extra_fields 				= $this->input->post('extra_fields');
			$extra_fields 				= ($extra_fields) ? $extra_fields : array();

			if(!empty($fixed_fields))
			{
				foreach($fixed_fields as $f => $field){
					if(!isset($data_to_store[$f]))
						if(!isset($data_to_store[$f]))
							$data_to_store[$f] 		= (is_array($field)) ? json_encode($field) :strval($field);
						else
							$data_to_store[$f.'_1'] 	= (is_array($field)) ? json_encode($field) :strval($field);
				}
			}

			//echo "
";
			//print_r($data_to_store);die;
			if(!empty($extra_fields))
			{
				$start_pos 	= count($data_to_store);
				foreach($extra_fields as $ef => $efield){
					if(!isset($data_to_store[$ef]))
						$data_to_store[$ef] 		= strval($efield);
					else
						$data_to_store[$ef.'_1']		= strval($efield);
				}
			}

			//echo '
'; print_r($_FILES); echo '
';
			//echo '
'; print_r($data_to_store); echo '
'; die;

			//check for email as it should be unique for each users and can not be same
			$do_have_email = (isset($fixed_fields['email'])) ? 1 : '0';
			$do_insert 	= 1;

			if($do_have_email)
			{
				$email_id = (isset($fixed_fields['email'])) ? $fixed_fields['email'] : '';
				if($email_id)
				{
					//echo $cust_form_id;
					//check for similar email
					$this->mongo_db->where(array('email' => $email_id));
					$all_email=$this->mongo_db->get('site_users');

					if(count($all_email) > 0)
					{
						foreach($all_email as $email)
						{
							if($email['_id']!=$broker_form_id)
							{
								$this->session->set_flashdata('flash_message', 'email_error');
								redirect('control/manage-brokers');
							}
						}

					}
				}
				else
				{
					$this->session->set_flashdata('flash_message', 'reg_error');
					redirect('control/manage-brokers');
				}
			}

			if($do_insert)
			{
				//$insert 	= $this->mongo_db->insert('site_users', $data_to_store);

				$this->mongo_db->where(array('_id' 	=> $broker_form_id));
				$this->mongo_db->set($data_to_store);
				$this->mongo_db->update('site_users');

				if(isset($insert))
				{
					$to_up_files = array();

					//upload extra field iles
					if(isset($_FILES['extra_fields']['name']) && !empty($_FILES['extra_fields']['name']))
					{
						foreach($_FILES['extra_fields']['name'] as $f => $file_name)
						{
							$to_up_files[$f]['name'] 	= $file_name;
							$to_up_files[$f]['type'] 	= $_FILES['extra_fields']['type'][$f];
							$to_up_files[$f]['tmp_name'] 	= $_FILES['extra_fields']['tmp_name'][$f];
							$to_up_files[$f]['error'] 	= $_FILES['extra_fields']['error'][$f];
							$to_up_files[$f]['size'] 	= $_FILES['extra_fields']['size'][$f];
						}
					}

					if(!empty($to_up_files))
					{
						$data_to_store_file = array();
						foreach($to_up_files as $ufld => $up_file)
						{
							$file_type 			= (isset($up_file['type'])) ? explode('/', $up_file['type']) : array();
							$file_type_det 		= (isset($file_type[0])) ? $file_type[0] : '';

							$filename 			= (isset($up_file['name'])) ? substr($up_file['name'],strripos($up_file['name'],'.')) : '';
							$s					= time().$filename;
							$file 				= $up_file['tmp_name'];

							if($file_type_det == 'image')
							{
								$DIR_IMG_NORMAL 		= FILEUPLOADPATH.'assets/uploads/user_images/';
								$fileNormal 			= $DIR_IMG_NORMAL.$s;
								$result 				= move_uploaded_file($file, $fileNormal);

								if($result)
								{
									$srcPath		= FILEUPLOADPATH.'assets/uploads/user_images/'.$s;
									$destPath1 	= FILEUPLOADPATH.'assets/uploads/user_images/thumb/'.$s;
									$destWidth1	= 500;
									$destHeight1	= 500;
									$this->imagethumb->resizeProportional($destPath1, $srcPath, $destWidth1, $destHeight1);
									$image_name	= $s;

									$data_to_store_file[$ufld] = $image_name;
								}
							}
							else
							{
								$DIR_IMG_NORMAL 	= FILEUPLOADPATH.'assets/uploads/user_files/';
								$fileNormal 		= $DIR_IMG_NORMAL.$s;
								$result 			= move_uploaded_file($file, $fileNormal);

								if($result) $data_to_store_file[$ufld] = $s;
							}
						}

						if(!empty($data_to_store_file))
						{
							$this->mongo_db->where(array('_id' => $insert));
							$this->mongo_db->set($data_to_store_file);
							$this->mongo_db->update('site_users');
						}
					}

				}

					$this->session->set_flashdata('flash_message', 'option_updated');
					redirect('control/manage-brokers');
			}
			else
			{
				$this->session->set_flashdata('flash_message', 'error_option_update');
				redirect('control/manage-brokers');
			}

			redirect('control/manage-brokers');
		}

		if(!isset($data['data']['broker_details']))
		{
			redirect('control/manage-brokers');
		}

		$data['view_link'] = 'admin/brokers/edit_brokers';
		$this->load->view('includes/template', $data);
	}

	//Function to delete all fields of a type
	public function remove_all_cat_field()
	{
		//Get logged in session admin id
		$user_id 						= ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;
		$setting_data 					= $this->myaccount_model->get_account_data($user_id);
		$data['data']['setting_data'] 	= $setting_data;
		$data['data']['settings'] 		= $this->sitesetting_model->get_settings();
		$data['data']['dealer_id'] 		= $user_id;

		//getting all admin data
		$data['myaccount_data'] 			= $this->myaccount_model->get_account_data($user_id);

		//Get requested form type from url segment position 3
		$field_id 					= $this->uri->segment(3);

		//deleting query
		$this->mongo_db->where(array('form_type' => $field_id));
		if($this->mongo_db->delete_all('form_fields'))
			$this->session->set_flashdata('flash_message', 'info_deleted');
		else
			$this->session->set_flashdata('flash_message', 'info_delete_failed');

		redirect('control/data-forms');
	}

	//Ajax function to - Remove existing form fields
	public function remove_form_field()
	{
		//Get logged in session admin id
		$user_id 						= ($this->session->userdata('user_id_hotcargo')) ?  $this->session->userdata('user_id_hotcargo') : 1;
		$setting_data 					= $this->myaccount_model->get_account_data($user_id);
		$data['data']['setting_data'] 	= $setting_data;
		$data['data']['settings'] 		= $this->sitesetting_model->get_settings();
		$data['data']['dealer_id'] 		= $user_id;

		//getting all admin data
		$data['myaccount_data'] 			= $this->myaccount_model->get_account_data($user_id);

		//Get requested id to remove
		$field_id 					= $this->input->get('form_id');

		//deleting query
		$this->mongo_db->where(array('field_name' => $field_id));
		if($this->mongo_db->delete('form_fields'))
			echo 1;
		else
			echo 0;
	}

}