text:
package io.dropwizard.jackson;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.sql.ClientInfoStatus;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

class FuzzyEnumModuleTest {
    private final ObjectMapper mapper = new ObjectMapper();

    private enum EnumWithLowercase {
        lower_case_enum,
        mixedCaseEnum
    }

    private enum EnumWithCreator {
        TEST;

        @JsonCreator
        public static EnumWithCreator fromString(String value) {
            return EnumWithCreator.TEST;
        }
    }

    private enum CurrencyCode {
        USD("United States dollar"),
        AUD("a_u_d"),
        CAD("c-a-d"),
        BLA("b.l.a"),
        EUR("Euro"),
        GBP("Pound sterling");

        private final String description;

        CurrencyCode(String name) {
            this.description = name;
        }

        @Override
        public String toString() {
            return description;
        }
    }

    enum EnumWithPropertyAnno {
        @JsonProperty("a a")
        A,

        // For this value, force use of anonymous sub-class, to ensure things still work
        @JsonProperty("b b")
        B {
            @Override
            public String toString() {
                return "bb";
            }
        },

        @JsonProperty("forgot password")
        FORGOT_PASSWORD,

        @JsonEnumDefaultValue
        DEFAULT
    }

    @BeforeEach
    void setUp() throws Exception {
        mapper.registerModule(new FuzzyEnumModule());
    }

    @Test
    void mapsUpperCaseEnums() throws Exception {
        assertThat(mapper.readValue("\"SECONDS\"", TimeUnit.class))
                .isEqualTo(TimeUnit.SECONDS);
    }

    @Test
    void mapsLowerCaseEnums() throws Exception {
        assertThat(mapper.readValue("\"milliseconds\"", TimeUnit.class))
                .isEqualTo(TimeUnit.MILLISECONDS);
    }

    @Test
    void mapsPaddedEnums() throws Exception {
        assertThat(mapper.readValue("\"   MINUTES \"", TimeUnit.class))
                .isEqualTo(TimeUnit.MINUTES);
    }

    @Test
    void mapsSpacedEnums() throws Exception {
        assertThat(mapper.readValue("\"   MILLI SECONDS \"", TimeUnit.class))
                .isEqualTo(TimeUnit.MILLISECONDS);
    }

    @Test
    void mapsDashedEnums() throws Exception {
        assertThat(mapper.readValue("\"REASON-UNKNOWN\"", ClientInfoStatus.class))
                .isEqualTo(ClientInfoStatus.REASON_UNKNOWN);
    }

    @Test
    void mapsDottedEnums() throws Exception {
        assertThat(mapper.readValue("\"REASON.UNKNOWN\"", ClientInfoStatus.class))
                .isEqualTo(ClientInfoStatus.REASON_UNKNOWN);
    }

    @Test
    void mapsWhenEnumHasCreator() throws Exception {
        assertThat(mapper.readValue("\"BLA\"", EnumWithCreator.class))
                .isEqualTo(EnumWithCreator.TEST);
    }

    @Test
    void failsOnIncorrectValue() {
        assertThatExceptionOfType(JsonMappingException.class)
            .isThrownBy(() -> mapper.readValue("\"wrong\"", TimeUnit.class))
            .satisfies(e -> assertThat(e.getOriginalMessage())
                .isEqualTo("Cannot deserialize value of type `java.util.concurrent.TimeUnit` from String \"wrong\": " +
                    "wrong was not one of [NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS]"));
    }

    @Test
    void mapsToLowerCaseEnums() throws Exception {
        assertThat(mapper.readValue("\"lower_case_enum\"", EnumWithLowercase.class))
                .isEqualTo(EnumWithLowercase.lower_case_enum);
    }

    @Test
    void mapsMixedCaseEnums() throws Exception {
        assertThat(mapper.readValue("\"mixedCaseEnum\"", EnumWithLowercase.class))
                .isEqualTo(EnumWithLowercase.mixedCaseEnum);
    }

    @Test
    void readsEnumsUsingToString() throws Exception {
        final ObjectMapper toStringEnumsMapper = mapper.copy()
                .configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
        assertThat(toStringEnumsMapper.readValue("\"Pound sterling\"", CurrencyCode.class)).isEqualTo(CurrencyCode.GBP);
    }

    @Test
    void readsUnknownEnumValuesAsNull() throws Exception {
        final ObjectMapper toStringEnumsMapper = mapper.copy()
            .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
        assertThat(toStringEnumsMapper.readValue("\"Pound sterling\"", CurrencyCode.class)).isNull();
    }

    @Test
    void readsUnknownEnumValuesUsingDefaultValue() throws Exception {
        final ObjectMapper toStringEnumsMapper = mapper.copy()
            .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true);
        assertThat(toStringEnumsMapper.readValue("\"Pound sterling\"", EnumWithPropertyAnno.class)).isEqualTo(EnumWithPropertyAnno.DEFAULT);
    }

    @Test
    void readsEnumsUsingToStringWithDeserializationFeatureOff() throws Exception {
        assertThat(mapper.readValue("\"Pound sterling\"", CurrencyCode.class)).isEqualTo(CurrencyCode.GBP);
        assertThat(mapper.readValue("\"a_u_d\"", CurrencyCode.class)).isEqualTo(CurrencyCode.AUD);
        assertThat(mapper.readValue("\"c-a-d\"", CurrencyCode.class)).isEqualTo(CurrencyCode.CAD);
        assertThat(mapper.readValue("\"b.l.a\"", CurrencyCode.class)).isEqualTo(CurrencyCode.BLA);
    }

    @Test
    void testEnumWithJsonPropertyRename() throws Exception {
        final String json = mapper.writeValueAsString(new EnumWithPropertyAnno[] {
            EnumWithPropertyAnno.B, EnumWithPropertyAnno.A, EnumWithPropertyAnno.FORGOT_PASSWORD
        });
        assertThat(json).isEqualTo("[\"b b\",\"a a\",\"forgot password\"]");

        final EnumWithPropertyAnno[] result = mapper.readValue(json, EnumWithPropertyAnno[].class);

        assertThat(result).isNotNull().hasSize(3);
        assertThat(result[0]).isEqualTo(EnumWithPropertyAnno.B);
        assertThat(result[1]).isEqualTo(EnumWithPropertyAnno.A);
        assertThat(result[2]).isEqualTo(EnumWithPropertyAnno.FORGOT_PASSWORD);
    }
}


text:
'use strict';

angular.module("TrackerApp.Issue.services", [])
    .factory("IssueService", function($http, BrowserService, PathService, PathResolver, NotificationService,
                                      NotificationTypes, RunApiService, DefaultStyles){
        return {
            createMeta: function(data){
                return $http.get(PathService.issue.createMeta(data))
                    .then(function(response){
                        return response.data;
                    });
            },

            load: function(data){
                return $http.get(PathService.issue.load(data))
                    .then(function(response){
                        return response.data;
                    });
            },

            move:function(data){
                return $http.post(PathService.issue.move(data.id), data)
                    .then(function(response){
                        NotificationService.notify({
                            objectType: NotificationTypes.objectType.issue,
                            operation:NotificationTypes.operation.update,
                            item:response.data
                        });
                        return response.data;
                    });
            },

            save: function(data){
                var baseFunc = data.id ? $http.put : $http.post;
                return baseFunc(PathService.issue.save(data), data)
                    .then(function(response){
                        NotificationService.notify({
                            objectType: NotificationTypes.objectType.issue,
                            operation:data.id ? NotificationTypes.operation.update : NotificationTypes.operation.add,
                            item:response.data
                        });
                        return response.data;
                    });
            },

            remove: function(id){
                return $http.delete(PathService.issue.remove(id))
                    .then(function(response){
                        NotificationService.notify({
                            objectType: NotificationTypes.objectType.issue,
                            operation:NotificationTypes.operation.delete,
                            item:response.data
                        });
                        return response.data;
                    });
            },

            assignToMe:function(data){
                return $http.post(PathService.issue.assignToMe(data))
                    .then(function(response){
                        NotificationService.notify({
                            objectType: NotificationTypes.objectType.issue,
                            operation:NotificationTypes.operation.update,
                            item:response.data
                        });
                        return response.data;
                    });
            },

            reporterIsMe:function(data){
                return $http.post(PathService.issue.reporterIsMe(data))
                    .then(function(response){
                        NotificationService.notify({
                            objectType: NotificationTypes.objectType.issue,
                            operation:NotificationTypes.operation.update,
                            item:response.data
                        });
                        return response.data;
                    });
            },

            grid: function(data){
                return $http.get(RunApiService.generateUrl(PathService.issue.grid, data))
                    .then(function(response){
                        return response.data;
                    });
            },

            gridConfig: function(data){
                data = data || {};
                var pars = {
                    customCss: DefaultStyles.css.defaultTableHoverCss,
                    columns: [
                        { name: "Key", field:"pkey" },
                        { name: "Project", field:"project" },
                        { name: "Parent", field:"parent" },
                        { name: "Name", field:"name" },
                        { name: "Assignee", field:"assignee" },
                        { name: "Reporter", field:"reporter" },
                        { name: "Priority", field:"priority" },
                        { name: "Status", field:"status" },
                        { name: "Due", field:"dueDate", filter:"timeAgo" }
                    ],
                    rowClick: function(row){
                        BrowserService.issue.edit(row.pkey);
                    }
                };
                return angular.extend(pars, data);
            },

            currentUserSubscribed:function(id){
                return $http.get(PathService.issue.currentUserSubscribed(id))
                    .then(function(response){
                        return response.data;
                    });
            },

            changeStatus: function(pkey, status){
                return $http.post(PathService.issue.changeStatus({pkey:pkey, status:status}))
                .then(function(response){
                    NotificationService.notify({
                        objectType: NotificationTypes.objectType.issue,
                        operation:NotificationTypes.operation.update,
                        item:response.data
                    });
                    return response.data;
                });
            },

            commentAdd:function(data){
                return $http.post(PathService.issue.commentAdd(data),data)
                    .then(function(response){
                        NotificationService.notify({
                            objectType:NotificationTypes.objectType.issueComment,
                            operation:NotificationTypes.operation.add,
                            item: response.data
                        });
                        return response.data;
                    });
            },

            commentUpdate:function(data){
                return $http.put(PathService.issue.commentUpdate(data),data)
                    .then(function(response){
                        NotificationService.notify({
                            objectType:NotificationTypes.objectType.issueComment,
                            operation:NotificationTypes.operation.update,
                            item: response.data
                        });
                        return response.data;
                    });
            },

            commentRemove:function(data){
                return $http.delete(PathService.issue.commentRemove(data))
                    .then(function(response){
                        NotificationService.notify({
                            objectType:NotificationTypes.objectType.issueComment,
                            operation:NotificationTypes.operation.delete,
                            item: response.data
                        });
                        return response.data;
                    });
            },

            commentList:function(data){
                return $http.get(PathService.issue.commentList(data))
                    .then(function(response){
                        return response.data;
                    });
            },

            subscriptionToggle:function(data){
                return $http.post(PathService.issue.subscriptionToggle(data))
                    .then(function(response){
                        return response.data;
                    });
            },

            subscriptionToggleAny:function(data){
                return $http.post(PathService.issue.subscriptionToggleAny,data)
                    .then(function(response){
                        return response.data;
                    });
            },

            subscribedSelected:function(id){
                return $http.get(PathService.issue.subscribedSelected(id))
                    .then(function(response){
                        return response.data;
                    });
            },

            mySubscriptionsGrid:function(data){
                return $http.get(RunApiService.generateUrl(PathService.issue.mySubscriptions,data))
                    .then(function(response){
                        return response.data;
                    });
            },

            attachments:function(data){
                return $http.get(PathService.issue.attachments(data))
                    .then(function (response) {
                        return response.data;
                    });
            },

            attachmentLoad:function(id){
                return $http.get(PathService.issue.attachmentLoad(id))
                    .then(function(response){
                        return response.data;
                    });
            },

            attachmentAdd:function(data){
                return $http.post(PathService.issue.attachmentAdd(data), data)
                    .then(function(response){
                        return response.data;
                    });
            },

            attachmentRemove:function(data){
                return $http.delete(PathService.issue.attachmentRemove(data))
                    .then(function(response){
                        return response.data;
                    });
            },

            getChildren:function(id){
                return $http.get(PathService.issue.getChildren(id))
                    .then(function(response){
                        return response.data;
                    });
            },

            getDocument:function(id){
                return $http.get(PathService.issue.getDocument(id))
                    .then(function(response){
                        return response.data;
                    });
            }
        }
    })

redpajama_set_name: RedPajamaGithub


text:
<?PHP
require_once(dirname(dirname(__FILE__))."/config.php");
require_once("_session.php");
?>
<!DOCTYPE html>

	<title>Add New Post - Admin Megablogging</title>
    <?PHP require_once(dirname(__FILE__)."/inc/css.php"); ?>

    <div id="wrapper" <?PHP echo $c_sidebar_set; ?>>
		<?PHP require_once(dirname(__FILE__)."/inc/navbar.php"); ?>
        <?PHP require_once(dirname(__FILE__)."/inc/sidebar.php"); ?>

 Admin

Add New Post

        <?PHP require_once(dirname(__FILE__)."/inc/footer.php"); ?>

    <?PHP require_once(dirname(__FILE__)."/inc/js.php"); ?>


text:
package com.internetitem.reactorBuilder.config;

import com.internetitem.reactorBuilder.LogWrapper;
import com.internetitem.reactorBuilder.StringUtility;

import java.util.Collections;
import java.util.List;

public class Configuration {

	public static final String[] LIST_OPTION_NAMES = {"prependModules", "appendModules", "moduleSearchDirectories"};
	private String xmlns = "http://maven.apache.org/POM/4.0.0";

	private String templateFile;
	private String groupId;
	private String artifactId;
	private String version;
	private String packaging = "pom";

	private List<String> prependModules = Collections.emptyList();
	private List<String> appendModules = Collections.emptyList();

	private String relativeTo;
	private List<String> moduleSearchDirectories = Collections.emptyList();

	private String outputFile;

	private LogWrapper logWrapper;

	public Configuration(LogWrapper logWrapper) {
		this.logWrapper = logWrapper;
	}

	public Configuration(LogWrapper logWrapper, KeyedOptions options) {
		this.logWrapper = logWrapper;

		this.xmlns = getOption(options, "xmlns", xmlns);
		this.templateFile = getOption(options, "templateFile", templateFile);
		this.groupId = getOption(options, "groupId", groupId);
		this.artifactId = getOption(options, "artifactId", artifactId);
		this.version = getOption(options, "version", version);
		this.packaging = getOption(options, "packaging", packaging);
		this.prependModules = getOptionList(options, "prependModule");
		this.appendModules = getOptionList(options, "appendModule");
		this.relativeTo = getOption(options, "relativeTo", relativeTo);
		this.moduleSearchDirectories = getOptionList(options, "moduleSearchDirectory");
		this.outputFile = getOption(options, "outputFile", outputFile);
	}

	private List<String> getOptionList(KeyedOptions options, String key) {
		List<String> values = options.getValues(key);
		if (values == null) {
			return Collections.emptyList();
		}
		return values;
	}

	private String getOption(KeyedOptions options, String key, String defaultValue) {
		String value = options.getFirstValue(key);
		if (value == null) {
			return defaultValue;
		}
		return value;
	}

	public String getXmlns() {
		return xmlns;
	}

	public void setXmlns(String xmlns) {
		this.xmlns = xmlns;
	}

	public String getTemplateFile() {
		return templateFile;
	}

	public void setTemplateFile(String templateFile) {
		this.templateFile = templateFile;
	}

	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public String getArtifactId() {
		return artifactId;
	}

	public void setArtifactId(String artifactId) {
		this.artifactId = artifactId;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getPackaging() {
		return packaging;
	}

	public void setPackaging(String packaging) {
		this.packaging = packaging;
	}

	public List<String> getPrependModules() {
		return prependModules;
	}

	public void setPrependModules(List<String> prependModules) {
		this.prependModules = prependModules;
	}

	public List<String> getAppendModules() {
		return appendModules;
	}

	public void setAppendModules(List<String> appendModules) {
		this.appendModules = appendModules;
	}

	public List<String> getModuleSearchDirectories() {
		return moduleSearchDirectories;
	}

	public void setModuleSearchDirectories(List<String> moduleSearchDirectories) {
		this.moduleSearchDirectories = moduleSearchDirectories;
	}

	public String getRelativeTo() {
		return relativeTo;
	}

	public void setRelativeTo(String relativeTo) {
		this.relativeTo = relativeTo;
	}

	public String getOutputFile() {
		return outputFile;
	}

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

	public LogWrapper getLogWrapper() {
		return logWrapper;
	}

	public void summarizeConfiguration() {
		logWrapper.info("Reactor Builder Configuration Start");
		maybeOutput(xmlns, "xmlns");
		maybeOutput(templateFile, "templateFile");
		maybeOutput(groupId, "groupId");
		maybeOutput(artifactId, "artifactId");
		maybeOutput(version, "version");
		maybeOutput(packaging, "packaging");
		maybeOutput(prependModules, "prependModules");
		maybeOutput(appendModules, "appendModules");
		maybeOutput(relativeTo, "relativeTo");
		maybeOutput(moduleSearchDirectories, "moduleSearchDirectories");
		maybeOutput(outputFile, "outputFile");
		logWrapper.info("Reactor Builder Configuration Finish");
	}

	private void maybeOutput(String value, String name) {
		if (value == null) {
			return;
		}
		logWrapper.info(" " + name + " = " + value);
	}

	private void maybeOutput(List<String> values, String name) {
		if (values == null || values.isEmpty()) {
			return;
		}
		String valueString = StringUtility.joinValues(values, ", ");
		logWrapper.info(" " + name + " = " + valueString);
	}
}


text:
namespace Vq { namespace Logger {

class AbstractLogTarget;
class LogMessage;
VQ_INTERFACE ILogFilter;

VQ_INTERFACE ILogDispatcher
{
    virtual bool addTarget( std::unique_ptr< AbstractLogTarget > &&target ) = 0;

    virtual AbstractLogTarget * target( std::string targetId ) = 0;

    virtual bool setTargetEnabledState( const std::string &trgId, bool value ) = 0;

    virtual bool removeTarget( const std::string &trgId ) = 0;

    virtual bool installFilter( std::shared_ptr< ILogFilter > filter,
                                const std::string &trgId ) = 0;

    virtual bool uninstallFilter( const std::string &filterId,
                                  const std::string &trgId ) = 0;

    virtual void write( LogMessage *message ) = 0;

    virtual void flush() = 0;

    virtual void stopDispatch() = 0;

    inline virtual ~ILogDispatcher(){ }
};

} }


text:
<glade-catalog name="preferences_malstor_dialog" domain="glade-3"
               depends="gtk+" version="1.0">
  <glade-widget-classes>
    <glade-widget-class title="Malstor Preferences Dialog" name="PreferencesMalstorDialog"
                        generic-name="PreferenceMalstorDialog" parent="GtkDialog"
                        icon-name="widget-gtk-dialog"/>
  </glade-widget-classes>

</glade-catalog>


text:
package com.sean.service.entity;

import com.sean.service.enums.DataType;
import com.sean.service.enums.ParameterType;

/**
 * Parameter实体
 * @author sean
 *
 */
public class ParameterEntity
{
	private String name;
	private DataType dataType;
	private ParameterType type;
	private String regex;
	private int length;
	private String description;

	public ParameterEntity(String name, DataType dataType, ParameterType type, String regex, int length, String description)
	{
		this.name = name;
		this.dataType = dataType;
		this.type = type;
		this.regex = regex;
		this.length = length;
		this.description = description;
	}

	public String getName()
	{
		return name;
	}

	public DataType getDataType()
	{
		return dataType;
	}

	public ParameterType getType()
	{
		return type;
	}

	public String getRegex()
	{
		return regex;
	}

	public String getDescription()
	{
		return description;
	}

	public int getLength()
	{
		return length;
	}

}


text:
#include <osgUtil/Optimizer>
#include <osgUtil/SmoothingVisitor>

#include <ifcpp/geometry/Carve/IncludeCarveHeaders.h>

#include <ifcpp/model/BasicTypes.h>
#include <ifcpp/model/BuildingObject.h>
#include <ifcpp/model/BuildingException.h>
#include <ifcpp/model/BuildingGuid.h>
#include <ifcpp/reader/ReaderSTEP.h>

#include "IncludeGeometryHeaders.h"
#include "Command.h"
#include "IfcPlusPlusSystem.h"
#include "LoadIfcFileCommand.h"

LoadIfcFileCommand::LoadIfcFileCommand( IfcPlusPlusSystem* system ) : Command( system )
{
}

LoadIfcFileCommand::~LoadIfcFileCommand() {}

void LoadIfcFileCommand::setFilePath( std::wstring& path_in )
{
	m_file_path = path_in;
}

bool LoadIfcFileCommand::doCmd()
{
	if( m_file_path.length() == 0 )
	{
		return false;
	}

	// first remove previously loaded geometry from scenegraph
	osg::ref_ptr<osg::Switch> model_switch = m_system->getModelNode();
	SceneGraphUtils::clearAllChildNodes( model_switch );
	m_system->clearSelection();

	// reset the IFC model
	shared_ptr<GeometryConverter> geometry_converter = m_system->getGeometryConverter();
	geometry_converter->clearMessagesCallback();
	geometry_converter->resetModel();
	std::stringstream err;

	try
	{
		// load file to IFC model
		m_system->getModelReader()->loadModelFromFile( m_file_path, geometry_converter->getBuildingModel() );

		// convert IFC geometric representations into Carve geometry
		const double length_in_meter = geometry_converter->getBuildingModel()->getUnitConverter()->getLengthInMeterFactor();
		geometry_converter->setCsgEps(carve::CARVE_EPSILON*length_in_meter);
		geometry_converter->convertGeometry();

		// convert Carve geometry to OSG
		shared_ptr<ConverterOSG> converter_osg( new ConverterOSG( geometry_converter->getGeomSettings() ) );
		converter_osg->setMessageTarget( geometry_converter.get() );
		converter_osg->convertToOSG( geometry_converter->getShapeInputData(), model_switch );

		// in case there are IFC entities that are not in the spatial structure
		const std::map<std::string, shared_ptr<BuildingObject> >& objects_outside_spatial_structure = geometry_converter->getObjectsOutsideSpatialStructure();
		if( objects_outside_spatial_structure.size() > 0 )
		{
			osg::ref_ptr<osg::Switch> sw_objects_outside_spatial_structure = new osg::Switch();
			sw_objects_outside_spatial_structure->setName( "IfcProduct objects outside spatial structure" );

			converter_osg->addNodes( objects_outside_spatial_structure, sw_objects_outside_spatial_structure );
			if( sw_objects_outside_spatial_structure->getNumChildren() > 0 )
			{
				model_switch->addChild( sw_objects_outside_spatial_structure );
			}
		}
	}
	catch( OutOfMemoryException& e)
	{
		throw e;
	}
	catch( BuildingException& e )
	{
		err << e.what();
	}
	catch( std::exception& e )
	{
		err << e.what();
	}
	catch( ... )
	{
		err << "loadModelFromFile, createGeometryOSG failed" << std::endl;
	}

	try
	{
		if( model_switch )
		{
			bool optimize = true;
			if( optimize )
			{
				osgUtil::Optimizer opt;
				opt.optimize(model_switch);
			}

			// if model bounding sphere is far from origin, move to origin
			const osg::BoundingSphere& bsphere = model_switch->getBound();
			if( bsphere.center().length() > 10000 )
			{
				if( bsphere.center().length()/bsphere.radius() > 100 )
				{
					std::unordered_set<osg::Geode*> set_applied;
					SceneGraphUtils::translateGroup( model_switch, -bsphere.center(), set_applied );
				}
			}
		}
	}
	catch(std::exception& e)
	{
		err << e.what();
	}

	geometry_converter->clearInputCache();

	if( err.tellp() > 0 )
	{
		throw BuildingException( err.str().c_str() );
	}

	return true;
}

bool LoadIfcFileCommand::undo()
{
	return true;
}

bool LoadIfcFileCommand::redo()
{
	return true;
}


text:
using namespace FrameServices;

Rational::Rational()
{
    Numerator = 0;
    Denominator = 1;
}

Rational::Rational(int numerator, int denominator)
{
    Numerator = numerator;
    Denominator = denominator;
}


text:
using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(Caritas.Startup))]
namespace Caritas
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}


text:
//
//  SXD_AddressModel.h
//  SXD_Project
//
//  Created by Bruce Chin on 2017/8/17.
//  Copyright © 2017年 Bruce Chin. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SXD_AddressModel : NSObject

/**"code": "130100",*/
@property (nonatomic,copy)NSString * code;

/**"name": "石家庄市",*/
@property (nonatomic,copy)NSString * name;

/**"parent_code": "130000"*/
@property (nonatomic,copy)NSString * parent_code;

@end


text:
#include <geode/Cache.hpp>
#include <Utils.hpp>
#include <geode/DataOutput.hpp>
#include <string>
#include <cstdlib>
#include <geode/GeodeTypeIds.hpp>
#include <CacheXmlParser.hpp>
#include <ace/DLL.h>
#include <ace/OS.h>
#include <geode/DataInput.hpp>
#include <geode/Properties.hpp>

using namespace apache::geode::client;
RegionAttributes::RegionAttributes()
    : Serializable(),
      m_regionTimeToLiveExpirationAction(ExpirationAction::INVALIDATE),
      m_regionIdleTimeoutExpirationAction(ExpirationAction::INVALIDATE),
      m_entryTimeToLiveExpirationAction(ExpirationAction::INVALIDATE),
      m_entryIdleTimeoutExpirationAction(ExpirationAction::INVALIDATE),
      m_lruEvictionAction(ExpirationAction::LOCAL_DESTROY),
      m_cacheWriter(NULLPTR),
      m_cacheLoader(NULLPTR),
      m_cacheListener(NULLPTR),
      m_partitionResolver(NULLPTR),
      m_lruEntriesLimit(0),
      m_caching(true),
      m_maxValueDistLimit(100 * 1024),
      m_entryIdleTimeout(0),
      m_entryTimeToLive(0),
      m_regionIdleTimeout(0),
      m_regionTimeToLive(0),
      m_initialCapacity(10000),
      m_loadFactor(0.75),
      m_concurrencyLevel(16),
      m_cacheLoaderLibrary(NULL),
      m_cacheWriterLibrary(NULL),
      m_cacheListenerLibrary(NULL),
      m_partitionResolverLibrary(NULL),
      m_cacheLoaderFactory(NULL),
      m_cacheWriterFactory(NULL),
      m_cacheListenerFactory(NULL),
      m_partitionResolverFactory(NULL),
      m_diskPolicy(DiskPolicyType::NONE),
      m_endpoints(NULL),
      m_clientNotificationEnabled(false),
      m_persistenceLibrary(NULL),
      m_persistenceFactory(NULL),
      m_persistenceProperties(NULLPTR),
      m_persistenceManager(NULLPTR),
      m_poolName(NULL),
      m_isClonable(false),
      m_isConcurrencyChecksEnabled(true) {}

RegionAttributes::RegionAttributes(const RegionAttributes& rhs)
    : m_regionTimeToLiveExpirationAction(
          rhs.m_regionTimeToLiveExpirationAction),
      m_regionIdleTimeoutExpirationAction(
          rhs.m_regionIdleTimeoutExpirationAction),
      m_entryTimeToLiveExpirationAction(rhs.m_entryTimeToLiveExpirationAction),
      m_entryIdleTimeoutExpirationAction(
          rhs.m_entryIdleTimeoutExpirationAction),
      m_lruEvictionAction(rhs.m_lruEvictionAction),
      m_cacheWriter(rhs.m_cacheWriter),
      m_cacheLoader(rhs.m_cacheLoader),
      m_cacheListener(rhs.m_cacheListener),
      m_partitionResolver(rhs.m_partitionResolver),
      m_lruEntriesLimit(rhs.m_lruEntriesLimit),
      m_caching(rhs.m_caching),
      m_maxValueDistLimit(rhs.m_maxValueDistLimit),
      m_entryIdleTimeout(rhs.m_entryIdleTimeout),
      m_entryTimeToLive(rhs.m_entryTimeToLive),
      m_regionIdleTimeout(rhs.m_regionIdleTimeout),
      m_regionTimeToLive(rhs.m_regionTimeToLive),
      m_initialCapacity(rhs.m_initialCapacity),
      m_loadFactor(rhs.m_loadFactor),
      m_concurrencyLevel(rhs.m_concurrencyLevel),
      m_diskPolicy(rhs.m_diskPolicy),
      m_clientNotificationEnabled(rhs.m_clientNotificationEnabled),
      m_persistenceProperties(rhs.m_persistenceProperties),
      m_persistenceManager(rhs.m_persistenceManager),
      m_isClonable(rhs.m_isClonable),
      m_isConcurrencyChecksEnabled(rhs.m_isConcurrencyChecksEnabled) {
  if (rhs.m_cacheLoaderLibrary != NULL) {
    size_t len = strlen(rhs.m_cacheLoaderLibrary) + 1;
    m_cacheLoaderLibrary = new char[len];
    ACE_OS::strncpy(m_cacheLoaderLibrary, rhs.m_cacheLoaderLibrary, len);
  } else {
    m_cacheLoaderLibrary = NULL;
  }
  if (rhs.m_cacheWriterLibrary != NULL) {
    size_t len = strlen(rhs.m_cacheWriterLibrary) + 1;
    m_cacheWriterLibrary = new char[len];
    ACE_OS::strncpy(m_cacheWriterLibrary, rhs.m_cacheWriterLibrary, len);
  } else {
    m_cacheWriterLibrary = NULL;
  }
  if (rhs.m_cacheListenerLibrary != NULL) {
    size_t len = strlen(rhs.m_cacheListenerLibrary) + 1;
    m_cacheListenerLibrary = new char[len];
    ACE_OS::strncpy(m_cacheListenerLibrary, rhs.m_cacheListenerLibrary, len);
  } else {
    m_cacheListenerLibrary = NULL;
  }
  if (rhs.m_partitionResolverLibrary != NULL) {
    size_t len = strlen(rhs.m_partitionResolverLibrary) + 1;
    m_partitionResolverLibrary = new char[len];
    ACE_OS::strncpy(m_partitionResolverLibrary, rhs.m_partitionResolverLibrary,
                    len);
  } else {
    m_partitionResolverLibrary = NULL;
  }
  if (rhs.m_cacheLoaderFactory != NULL) {
    size_t len = strlen(rhs.m_cacheLoaderFactory) + 1;
    m_cacheLoaderFactory = new char[len];
    ACE_OS::strncpy(m_cacheLoaderFactory, rhs.m_cacheLoaderFactory, len);
  } else {
    m_cacheLoaderFactory = NULL;
  }
  if (rhs.m_cacheWriterFactory != NULL) {
    size_t len = strlen(rhs.m_cacheWriterFactory) + 1;
    m_cacheWriterFactory = new char[len];
    ACE_OS::strncpy(m_cacheWriterFactory, rhs.m_cacheWriterFactory, len);
  } else {
    m_cacheWriterFactory = NULL;
  }
  if (rhs.m_cacheListenerFactory != NULL) {
    size_t len = strlen(rhs.m_cacheListenerFactory) + 1;
    m_cacheListenerFactory = new char[len];
    ACE_OS::strncpy(m_cacheListenerFactory, rhs.m_cacheListenerFactory, len);
  } else {
    m_cacheListenerFactory = NULL;
  }
  if (rhs.m_partitionResolverFactory != NULL) {
    size_t len = strlen(rhs.m_partitionResolverFactory) + 1;
    m_partitionResolverFactory = new char[len];
    ACE_OS::strncpy(m_partitionResolverFactory, rhs.m_partitionResolverFactory,
                    len);
  } else {
    m_partitionResolverFactory = NULL;
  }
  if (rhs.m_endpoints != NULL) {
    size_t len = strlen(rhs.m_endpoints) + 1;
    m_endpoints = new char[len];
    ACE_OS::strncpy(m_endpoints, rhs.m_endpoints, len);
  } else {
    m_endpoints = NULL;
  }
  if (rhs.m_poolName != NULL) {
    size_t len = strlen(rhs.m_poolName) + 1;
    m_poolName = new char[len];
    ACE_OS::strncpy(m_poolName, rhs.m_poolName, len);
  } else {
    m_poolName = NULL;
  }
  if (rhs.m_persistenceLibrary != NULL) {
    size_t len = strlen(rhs.m_persistenceLibrary) + 1;
    m_persistenceLibrary = new char[len];
    ACE_OS::strncpy(m_persistenceLibrary, rhs.m_persistenceLibrary, len);
  } else {
    m_persistenceLibrary = NULL;
  }
  if (rhs.m_persistenceFactory != NULL) {
    size_t len = strlen(rhs.m_persistenceFactory) + 1;
    m_persistenceFactory = new char[len];
    ACE_OS::strncpy(m_persistenceFactory, rhs.m_persistenceFactory, len);
  } else {
    m_persistenceFactory = NULL;
  }
}

#define RA_DELSTRING(x) \
  if (x != NULL) {      \
    delete[] x;         \
  }                     \
  x = NULL

RegionAttributes::~RegionAttributes() {
  RA_DELSTRING(m_cacheLoaderLibrary);
  RA_DELSTRING(m_cacheWriterLibrary);
  RA_DELSTRING(m_cacheListenerLibrary);
  RA_DELSTRING(m_partitionResolverLibrary);
  RA_DELSTRING(m_cacheLoaderFactory);
  RA_DELSTRING(m_cacheWriterFactory);
  RA_DELSTRING(m_cacheListenerFactory);
  RA_DELSTRING(m_partitionResolverFactory);
  RA_DELSTRING(m_endpoints);
  RA_DELSTRING(m_persistenceLibrary);
  RA_DELSTRING(m_persistenceFactory);
  RA_DELSTRING(m_poolName);
}

namespace apache {
namespace geode {
namespace client {
namespace impl {

/**
 * lib should be in the form required by ACE_DLL, typically just like specifying
 * a
 * lib in java System.loadLibrary( "x" ); Where x is a component of the name
 * lib<x>.so on unix, or <x>.dll on windows.
 */
void* getFactoryFunc(const char* lib, const char* funcName) {
  ACE_DLL dll;
  if (dll.open(lib, ACE_DEFAULT_SHLIB_MODE, 0) == -1) {
    // error...
    char msg[1000];
    ACE_OS::snprintf(msg, 1000, "cannot open library: %s", lib);
    throw IllegalArgumentException(msg);
  }
  void* func = dll.symbol(funcName);
  if (func == NULL) {
    char msg[1000];
    ACE_OS::snprintf(msg, 1000, "cannot find factory function %s in library %s",
                     funcName, lib);
    throw IllegalArgumentException(msg);
  }
  return func;
}
}  // namespace impl
}  // namespace client
}  // namespace geode
}  // namespace apache

CacheLoaderPtr RegionAttributes::getCacheLoader() {
  if ((m_cacheLoader == NULLPTR) && (m_cacheLoaderLibrary != NULL)) {
    if (CacheXmlParser::managedCacheLoaderFn != NULL &&
        strchr(m_cacheLoaderFactory, '.') != NULL) {
      // this is a managed library
      m_cacheLoader = (*CacheXmlParser::managedCacheLoaderFn)(
          m_cacheLoaderLibrary, m_cacheLoaderFactory);
    } else {
      CacheLoader* (*funcptr)();
      funcptr = reinterpret_cast<CacheLoader* (*)()>(
          apache::geode::client::impl::getFactoryFunc(m_cacheLoaderLibrary,
                                                      m_cacheLoaderFactory));
      m_cacheLoader = funcptr();
    }
  }
  return m_cacheLoader;
}

CacheWriterPtr RegionAttributes::getCacheWriter() {
  if ((m_cacheWriter == NULLPTR) && (m_cacheWriterLibrary != NULL)) {
    if (CacheXmlParser::managedCacheWriterFn != NULL &&
        strchr(m_cacheWriterFactory, '.') != NULL) {
      // this is a managed library
      m_cacheWriter = (*CacheXmlParser::managedCacheWriterFn)(
          m_cacheWriterLibrary, m_cacheWriterFactory);
    } else {
      CacheWriter* (*funcptr)();
      funcptr = reinterpret_cast<CacheWriter* (*)()>(
          apache::geode::client::impl::getFactoryFunc(m_cacheWriterLibrary,
                                                      m_cacheWriterFactory));
      m_cacheWriter = funcptr();
    }
  }
  return m_cacheWriter;
}

CacheListenerPtr RegionAttributes::getCacheListener() {
  if ((m_cacheListener == NULLPTR) && (m_cacheListenerLibrary != NULL)) {
    if (CacheXmlParser::managedCacheListenerFn != NULL &&
        strchr(m_cacheListenerFactory, '.') != NULL) {
      // LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
      // instance from managed library." );
      // this is a managed library
      m_cacheListener = (*CacheXmlParser::managedCacheListenerFn)(
          m_cacheListenerLibrary, m_cacheListenerFactory);
    } else {
      CacheListener* (*funcptr)();
      funcptr = reinterpret_cast<CacheListener* (*)()>(
          apache::geode::client::impl::getFactoryFunc(m_cacheListenerLibrary,
                                                      m_cacheListenerFactory));
      m_cacheListener = funcptr();
    }
  }
  return m_cacheListener;
}

PartitionResolverPtr RegionAttributes::getPartitionResolver() {
  if ((m_partitionResolver == NULLPTR) &&
      (m_partitionResolverLibrary != NULL)) {
    if (CacheXmlParser::managedPartitionResolverFn != NULL &&
        strchr(m_partitionResolverFactory, '.') != NULL) {
      // LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
      // instance from managed library." );
      // this is a managed library
      m_partitionResolver = (*CacheXmlParser::managedPartitionResolverFn)(
          m_partitionResolverLibrary, m_partitionResolverFactory);
    } else {
      PartitionResolver* (*funcptr)();
      funcptr = reinterpret_cast<PartitionResolver* (*)()>(
          apache::geode::client::impl::getFactoryFunc(
              m_partitionResolverLibrary, m_partitionResolverFactory));
      m_partitionResolver = funcptr();
    }
  }
  return m_partitionResolver;
}

PersistenceManagerPtr RegionAttributes::getPersistenceManager() {
  if ((m_persistenceManager == NULLPTR) && (m_persistenceLibrary != NULL)) {
    if (CacheXmlParser::managedPartitionResolverFn != NULL &&
        strchr(m_persistenceFactory, '.') != NULL) {
      LOGDEBUG(
          "RegionAttributes::getPersistenceManager: Trying to create instance "
          "from managed library.");
      // this is a managed library
      m_persistenceManager = (*CacheXmlParser::managedPersistenceManagerFn)(
          m_persistenceLibrary, m_persistenceFactory);
    } else {
      PersistenceManager* (*funcptr)();
      funcptr = reinterpret_cast<PersistenceManager* (*)()>(
          apache::geode::client::impl::getFactoryFunc(m_persistenceLibrary,
                                                      m_persistenceFactory));
      m_persistenceManager = funcptr();
    }
  }
  return m_persistenceManager;
}
const char* RegionAttributes::getCacheLoaderFactory() {
  return m_cacheLoaderFactory;
}

const char* RegionAttributes::getCacheWriterFactory() {
  return m_cacheWriterFactory;
}

const char* RegionAttributes::getCacheListenerFactory() {
  return m_cacheListenerFactory;
}

const char* RegionAttributes::getPartitionResolverFactory() {
  return m_partitionResolverFactory;
}

const char* RegionAttributes::getPersistenceFactory() {
  return m_persistenceFactory;
}
const char* RegionAttributes::getCacheLoaderLibrary() {
  return m_cacheLoaderLibrary;
}

const char* RegionAttributes::getCacheWriterLibrary() {
  return m_cacheWriterLibrary;
}

const char* RegionAttributes::getCacheListenerLibrary() {
  return m_cacheListenerLibrary;
}

const char* RegionAttributes::getPartitionResolverLibrary() {
  return m_partitionResolverLibrary;
}

const char* RegionAttributes::getEndpoints() { return m_endpoints; }
bool RegionAttributes::getClientNotificationEnabled() const {
  return m_clientNotificationEnabled;
}
const char* RegionAttributes::getPersistenceLibrary() {
  return m_persistenceLibrary;
}

PropertiesPtr RegionAttributes::getPersistenceProperties() {
  return m_persistenceProperties;
}

int RegionAttributes::getRegionTimeToLive() { return m_regionTimeToLive; }

ExpirationAction::Action RegionAttributes::getRegionTimeToLiveAction() {
  return m_regionTimeToLiveExpirationAction;
}

int RegionAttributes::getRegionIdleTimeout() { return m_regionIdleTimeout; }

ExpirationAction::Action RegionAttributes::getRegionIdleTimeoutAction() {
  return m_regionIdleTimeoutExpirationAction;
}

int RegionAttributes::getEntryTimeToLive() { return m_entryTimeToLive; }

ExpirationAction::Action RegionAttributes::getEntryTimeToLiveAction() {
  return m_entryTimeToLiveExpirationAction;
}

int RegionAttributes::getEntryIdleTimeout() { return m_entryIdleTimeout; }

ExpirationAction::Action RegionAttributes::getEntryIdleTimeoutAction() {
  return m_entryIdleTimeoutExpirationAction;
}

int RegionAttributes::getInitialCapacity() const { return m_initialCapacity; }

float RegionAttributes::getLoadFactor() const { return m_loadFactor; }

uint8_t RegionAttributes::getConcurrencyLevel() const {
  return m_concurrencyLevel;
}

const ExpirationAction::Action RegionAttributes::getLruEvictionAction() const {
  return m_lruEvictionAction;
}

uint32_t RegionAttributes::getLruEntriesLimit() const {
  return m_lruEntriesLimit;
}

DiskPolicyType::PolicyType RegionAttributes::getDiskPolicy() const {
  return m_diskPolicy;
}
const char* RegionAttributes::getPoolName() const { return m_poolName; }
Serializable* RegionAttributes::createDeserializable() {
  return new RegionAttributes();
}

int32_t RegionAttributes::classId() const { return 0; }

int8_t RegionAttributes::typeId() const {
  return GeodeTypeIds::RegionAttributes;
}

namespace apache {
namespace geode {
namespace client {
namespace impl {

void writeBool(DataOutput& out, bool field) {
  out.write(static_cast<int8_t>(field ? 1 : 0));
}

void readBool(DataInput& in, bool* field) {
  int8_t v = 0;
  in.read(&v);
  *field = v ? true : false;
}

void writeCharStar(DataOutput& out, const char* field) {
  if (field == NULL) {
    out.writeBytes(reinterpret_cast<const int8_t*>(""),
                   static_cast<uint32_t>(0));
  } else {
    out.writeBytes((int8_t*)field, static_cast<uint32_t>(strlen(field)) + 1);
  }
}

/** this one allocates the memory and modifies field to point to it. */
void readCharStar(DataInput& in, char** field) {
  GF_D_ASSERT(*field == NULL);
  int32_t memlen = 0;
  in.readArrayLen(&memlen);
  if (memlen != 0) {
    *field = new char[memlen];
    in.readBytesOnly(reinterpret_cast<int8_t*>(*field), memlen);
  }
}

}  // namespace impl
}  // namespace client
}  // namespace geode
}  // namespace apache

void RegionAttributes::toData(DataOutput& out) const {
  out.writeInt(static_cast<int32_t>(m_regionTimeToLive));
  out.writeInt(static_cast<int32_t>(m_regionTimeToLiveExpirationAction));
  out.writeInt(static_cast<int32_t>(m_regionIdleTimeout));
  out.writeInt(static_cast<int32_t>(m_regionIdleTimeoutExpirationAction));
  out.writeInt(static_cast<int32_t>(m_entryTimeToLive));
  out.writeInt(static_cast<int32_t>(m_entryTimeToLiveExpirationAction));
  out.writeInt(static_cast<int32_t>(m_entryIdleTimeout));
  out.writeInt(static_cast<int32_t>(m_entryIdleTimeoutExpirationAction));
  out.writeInt(static_cast<int32_t>(m_initialCapacity));
  out.writeFloat(m_loadFactor);
  out.writeInt(static_cast<int32_t>(m_maxValueDistLimit));
  out.writeInt(static_cast<int32_t>(m_concurrencyLevel));
  out.writeInt(static_cast<int32_t>(m_lruEntriesLimit));
  out.writeInt(static_cast<int32_t>(m_lruEvictionAction));

  apache::geode::client::impl::writeBool(out, m_caching);
  apache::geode::client::impl::writeBool(out, m_clientNotificationEnabled);

  apache::geode::client::impl::writeCharStar(out, m_cacheLoaderLibrary);
  apache::geode::client::impl::writeCharStar(out, m_cacheLoaderFactory);
  apache::geode::client::impl::writeCharStar(out, m_cacheWriterLibrary);
  apache::geode::client::impl::writeCharStar(out, m_cacheWriterFactory);
  apache::geode::client::impl::writeCharStar(out, m_cacheListenerLibrary);
  apache::geode::client::impl::writeCharStar(out, m_cacheListenerFactory);
  apache::geode::client::impl::writeCharStar(out, m_partitionResolverLibrary);
  apache::geode::client::impl::writeCharStar(out, m_partitionResolverFactory);
  out.writeInt(static_cast<int32_t>(m_diskPolicy));
  apache::geode::client::impl::writeCharStar(out, m_endpoints);
  apache::geode::client::impl::writeCharStar(out, m_persistenceLibrary);
  apache::geode::client::impl::writeCharStar(out, m_persistenceFactory);
  out.writeObject(m_persistenceProperties);
  apache::geode::client::impl::writeCharStar(out, m_poolName);
  apache::geode::client::impl::writeBool(out, m_isConcurrencyChecksEnabled);
}

Serializable* RegionAttributes::fromData(DataInput& in) {
  in.readInt(reinterpret_cast<int32_t*>(&m_regionTimeToLive));
  in.readInt(reinterpret_cast<int32_t*>(&m_regionTimeToLiveExpirationAction));
  in.readInt(reinterpret_cast<int32_t*>(&m_regionIdleTimeout));
  in.readInt(reinterpret_cast<int32_t*>(&m_regionIdleTimeoutExpirationAction));
  in.readInt(reinterpret_cast<int32_t*>(&m_entryTimeToLive));
  in.readInt(reinterpret_cast<int32_t*>(&m_entryTimeToLiveExpirationAction));
  in.readInt(reinterpret_cast<int32_t*>(&m_entryIdleTimeout));
  in.readInt(reinterpret_cast<int32_t*>(&m_entryIdleTimeoutExpirationAction));
  in.readInt(reinterpret_cast<int32_t*>(&m_initialCapacity));
  in.readFloat(&m_loadFactor);
  in.readInt(reinterpret_cast<int32_t*>(&m_maxValueDistLimit));
  in.readInt(reinterpret_cast<int32_t*>(&m_concurrencyLevel));
  in.readInt(reinterpret_cast<int32_t*>(&m_lruEntriesLimit));
  in.readInt(reinterpret_cast<int32_t*>(&m_lruEvictionAction));

  apache::geode::client::impl::readBool(in, &m_caching);
  apache::geode::client::impl::readBool(in, &m_clientNotificationEnabled);

  apache::geode::client::impl::readCharStar(in, &m_cacheLoaderLibrary);
  apache::geode::client::impl::readCharStar(in, &m_cacheLoaderFactory);
  apache::geode::client::impl::readCharStar(in, &m_cacheWriterLibrary);
  apache::geode::client::impl::readCharStar(in, &m_cacheWriterFactory);
  apache::geode::client::impl::readCharStar(in, &m_cacheListenerLibrary);
  apache::geode::client::impl::readCharStar(in, &m_cacheListenerFactory);
  apache::geode::client::impl::readCharStar(in, &m_partitionResolverLibrary);
  apache::geode::client::impl::readCharStar(in, &m_partitionResolverFactory);
  in.readInt(reinterpret_cast<int32_t*>(&m_diskPolicy));
  apache::geode::client::impl::readCharStar(in, &m_endpoints);
  apache::geode::client::impl::readCharStar(in, &m_persistenceLibrary);
  apache::geode::client::impl::readCharStar(in, &m_persistenceFactory);
  in.readObject(m_persistenceProperties, true);
  apache::geode::client::impl::readCharStar(in, &m_poolName);
  apache::geode::client::impl::readBool(in, &m_isConcurrencyChecksEnabled);

  return this;
}

/** Return true if all the attributes are equal to those of other. */
bool RegionAttributes::operator==(const RegionAttributes& other) const {
  if (m_regionTimeToLive != other.m_regionTimeToLive) return false;
  if (m_regionTimeToLiveExpirationAction !=
      other.m_regionTimeToLiveExpirationAction) {
    return false;
  }
  if (m_regionIdleTimeout != other.m_regionIdleTimeout) return false;
  if (m_regionIdleTimeoutExpirationAction !=
      other.m_regionIdleTimeoutExpirationAction) {
    return false;
  }
  if (m_entryTimeToLive != other.m_entryTimeToLive) return false;
  if (m_entryTimeToLiveExpirationAction !=
      other.m_entryTimeToLiveExpirationAction) {
    return false;
  }
  if (m_entryIdleTimeout != other.m_entryIdleTimeout) return false;
  if (m_entryIdleTimeoutExpirationAction !=
      other.m_entryIdleTimeoutExpirationAction) {
    return false;
  }
  if (m_initialCapacity != other.m_initialCapacity) return false;
  if (m_loadFactor != other.m_loadFactor) return false;
  if (m_maxValueDistLimit != other.m_maxValueDistLimit) return false;
  if (m_concurrencyLevel != other.m_concurrencyLevel) return false;
  if (m_lruEntriesLimit != other.m_lruEntriesLimit) return false;
  if (m_lruEvictionAction != other.m_lruEvictionAction) return false;
  if (m_caching != other.m_caching) return false;
  if (m_clientNotificationEnabled != other.m_clientNotificationEnabled) {
    return false;
  }

  if (0 != compareStringAttribute(m_cacheLoaderLibrary,
                                  other.m_cacheLoaderLibrary)) {
    return false;
  }
  if (0 != compareStringAttribute(m_cacheLoaderFactory,
                                  other.m_cacheLoaderFactory)) {
    return false;
  }
  if (0 != compareStringAttribute(m_cacheWriterLibrary,
                                  other.m_cacheWriterLibrary)) {
    return false;
  }
  if (0 != compareStringAttribute(m_cacheWriterFactory,
                                  other.m_cacheWriterFactory)) {
    return false;
  }
  if (0 != compareStringAttribute(m_cacheListenerLibrary,
                                  other.m_cacheListenerLibrary)) {
    return false;
  }
  if (0 != compareStringAttribute(m_cacheListenerFactory,
                                  other.m_cacheListenerFactory)) {
    return false;
  }
  if (0 != compareStringAttribute(m_partitionResolverLibrary,
                                  other.m_partitionResolverLibrary)) {
    return false;
  }
  if (0 != compareStringAttribute(m_partitionResolverFactory,
                                  other.m_partitionResolverFactory)) {
    return false;
  }
  if (m_diskPolicy != other.m_diskPolicy) return false;
  if (0 != compareStringAttribute(m_endpoints, other.m_endpoints)) return false;
  if (0 != compareStringAttribute(m_persistenceLibrary,
                                  other.m_persistenceLibrary)) {
    return false;
  }
  if (0 != compareStringAttribute(m_persistenceFactory,
                                  other.m_persistenceFactory)) {
    return false;
  }
  if (m_isConcurrencyChecksEnabled != other.m_isConcurrencyChecksEnabled) {
    return false;
  }

  return true;
}

int32_t RegionAttributes::compareStringAttribute(char* attributeA,
                                                 char* attributeB) {
  if (attributeA == NULL && attributeB == NULL) {
    return 0;
  } else if (attributeA == NULL && attributeB != NULL) {
    return -1;
  } else if (attributeA != NULL && attributeB == NULL) {
    return -1;
  }
  return (strcmp(attributeA, attributeB));
}

/** Return true if any of the attributes are not equal to those of other. */
bool RegionAttributes::operator!=(const RegionAttributes& other) const {
  return !(*this == other);
}

/* Throws IllegalStateException when attributes targetted for use on a server do
 * not meet requirements. */
void RegionAttributes::validateSerializableAttributes() {
  if (m_cacheLoader != NULLPTR) {
    throw IllegalStateException(
        "CacheLoader must be set with setCacheLoader(library, factory) in "
        "members of type SERVER");
  }
  if (m_cacheWriter != NULLPTR) {
    throw IllegalStateException(
        "CacheWriter must be set with setCacheWriter(library, factory) in "
        "members of type SERVER");
  }
  if (m_cacheListener != NULLPTR) {
    throw IllegalStateException(
        "CacheListener must be set with setCacheListener(library, factory) in "
        "members of type SERVER");
  }
  if (m_partitionResolver != NULLPTR) {
    throw IllegalStateException(
        "PartitionResolver must be set with setPartitionResolver(library, "
        "factory) in members of type SERVER");
  }
  if (m_persistenceManager != NULLPTR) {
    throw IllegalStateException(
        "persistenceManager must be set with setPersistenceManager(library, "
        "factory,config) in members of type SERVER");
  }
}

void RegionAttributes::setCacheListener(const char* lib, const char* func) {
  GF_R_ASSERT(lib != NULL);
  GF_R_ASSERT(func != NULL);
  copyStringAttribute(m_cacheListenerLibrary, lib);
  copyStringAttribute(m_cacheListenerFactory, func);
}

void RegionAttributes::setPartitionResolver(const char* lib, const char* func) {
  GF_R_ASSERT(lib != NULL);
  GF_R_ASSERT(func != NULL);
  copyStringAttribute(m_partitionResolverLibrary, lib);
  copyStringAttribute(m_partitionResolverFactory, func);
}

void RegionAttributes::setCacheLoader(const char* lib, const char* func) {
  GF_R_ASSERT(lib != NULL);
  GF_R_ASSERT(func != NULL);
  copyStringAttribute(m_cacheLoaderLibrary, lib);
  copyStringAttribute(m_cacheLoaderFactory, func);
}

void RegionAttributes::setCacheWriter(const char* lib, const char* func) {
  GF_R_ASSERT(lib != NULL);
  GF_R_ASSERT(func != NULL);
  copyStringAttribute(m_cacheWriterLibrary, lib);
  copyStringAttribute(m_cacheWriterFactory, func);
}

void RegionAttributes::setPersistenceManager(const char* lib, const char* func,
                                             const PropertiesPtr& config) {
  GF_R_ASSERT(lib != NULL);
  GF_R_ASSERT(func != NULL);
  copyStringAttribute(m_persistenceLibrary, lib);
  copyStringAttribute(m_persistenceFactory, func);
  m_persistenceProperties = config;
}

void RegionAttributes::setEndpoints(const char* endpoints) {
  copyStringAttribute(m_endpoints, endpoints);
}

void RegionAttributes::setPoolName(const char* poolName) {
  copyStringAttribute(m_poolName, poolName);
}

void RegionAttributes::setCachingEnabled(bool enable) { m_caching = enable; }

void RegionAttributes::setLruEntriesLimit(int limit) {
  m_lruEntriesLimit = limit;
}
void RegionAttributes::setDiskPolicy(DiskPolicyType::PolicyType diskPolicy) {
  m_diskPolicy = diskPolicy;
}

void RegionAttributes::copyStringAttribute(char*& lhs, const char* rhs) {
  if (lhs != NULL) {
    delete[] lhs;
  }
  lhs = Utils::copyString(rhs);
}

void RegionAttributes::setCloningEnabled(bool isClonable) {
  m_isClonable = isClonable;
}

void RegionAttributes::setConcurrencyChecksEnabled(bool enable) {
  m_isConcurrencyChecksEnabled = enable;
}


text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2013 The Paris developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "db.h"
#include "walletdb.h"
#include "bitcoinrpc.h"
#include "net.h"
#include "init.h"
#include "util.h"
#include "ui_interface.h"
#include "checkpoints.h"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/interprocess/sync/file_lock.hpp>

#ifndef WIN32
#include <signal.h>
#endif

using namespace std;
using namespace boost;

CWallet* pwalletMain;

//////////////////////////////////////////////////////////////////////////////
//
// Shutdown
//

void ExitTimeout(void* parg)
{
#ifdef WIN32
    Sleep(5000);
    ExitProcess(0);
#endif
}

void StartShutdown()
{
#ifdef QT_GUI
    // ensure we leave the Qt main loop for a clean GUI exit (Shutdown() is called in bitcoin.cpp afterwards)
    QueueShutdown();
#else
    // Without UI, Shutdown() can simply be started in a new thread
    CreateThread(Shutdown, NULL);
#endif
}

void Shutdown(void* parg)
{
    static CCriticalSection cs_Shutdown;
    static bool fTaken;
    bool fFirstThread = false;
    {
        TRY_LOCK(cs_Shutdown, lockShutdown);
        if (lockShutdown)
        {
            fFirstThread = !fTaken;
            fTaken = true;
        }
    }
    static bool fExit;
    if (fFirstThread)
    {
        fShutdown = true;
        nTransactionsUpdated++;
        DBFlush(false);
        StopNode();
        DBFlush(true);
        boost::filesystem::remove(GetPidFile());
        UnregisterWallet(pwalletMain);
        delete pwalletMain;
        CreateThread(ExitTimeout, NULL);
        Sleep(50);
        printf("Paris exiting\n\n");
        fExit = true;
#ifndef QT_GUI
        // ensure non UI client get's exited here, but let Bitcoin-Qt reach return 0; in bitcoin.cpp
        exit(0);
#endif
    }
    else
    {
        while (!fExit)
            Sleep(500);
        Sleep(100);
        ExitThread(0);
    }
}

void HandleSIGTERM(int)
{
    fRequestShutdown = true;
}

//////////////////////////////////////////////////////////////////////////////
//
// Start
//
#if !defined(QT_GUI)
int main(int argc, char* argv[])
{
    bool fRet = false;
    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        return 0;

    return 1;
}
#endif

bool AppInit(int argc, char* argv[])
{
    bool fRet = false;
    try
    {
        fRet = AppInit2(argc, argv);
    }
    catch (std::exception& e) {
        PrintException(&e, "AppInit()");
    } catch (...) {
        PrintException(NULL, "AppInit()");
    }
    if (!fRet)
        Shutdown(NULL);
    return fRet;
}

bool static Bind(const CService &addr) {
    if (IsLimited(addr))
        return false;
    std::string strError;
    if (!BindListenPort(addr, strError))
    {
        ThreadSafeMessageBox(strError, _("Paris"), wxOK | wxMODAL);
        return false;
    }
    return true;
}

bool AppInit2(int argc, char* argv[])
{
#ifdef _MSC_VER
    // Turn off microsoft heap dump noise
    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
    _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
#endif
#if _MSC_VER >= 1400
    // Disable confusing "helpful" text message on abort, ctrl-c
    _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#ifndef WIN32
    umask(077);
#endif
#ifndef WIN32
    // Clean shutdown on SIGTERM
    struct sigaction sa;
    sa.sa_handler = HandleSIGTERM;
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = 0;
    sigaction(SIGTERM, &sa, NULL);
    sigaction(SIGINT, &sa, NULL);
    sigaction(SIGHUP, &sa, NULL);
#endif

    //
    // Parameters
    //
    // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
#if !defined(QT_GUI)
    ParseParameters(argc, argv);
    if (!boost::filesystem::is_directory(GetDataDir(false)))
    {
        fprintf(stderr, "Error: Specified directory does not exist\n");
        Shutdown(NULL);
    }
    ReadConfigFile(mapArgs, mapMultiArgs);
#endif

    if (mapArgs.count("-?") || mapArgs.count("--help"))
    {
        string strUsage = string() +
          _("Paris version") + " " + FormatFullVersion() + "\n\n" +
          _("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
            "  Parisd [options]                   \t  " + "\n" +
            "  Parisd [options] <command> [params]\t  " + _("Send command to -server or Parisd") + "\n" +
            "  Parisd [options] help              \t\t  " + _("List commands") + "\n" +
            "  Parisd [options] help <command>    \t\t  " + _("Get help for a command") + "\n" +
          _("Options:") + "\n" +
            "  -conf=<file>     \t\t  " + _("Specify configuration file (default: Paris.conf)") + "\n" +
            "  -pid=<file>      \t\t  " + _("Specify pid file (default: Parisd.pid)") + "\n" +
            "  -gen             \t\t  " + _("Generate coins") + "\n" +
            "  -gen=0           \t\t  " + _("Don't generate coins") + "\n" +
            "  -min             \t\t  " + _("Start minimized") + "\n" +
            "  -splash          \t\t  " + _("Show splash screen on startup (default: 1)") + "\n" +
            "  -datadir=<dir>   \t\t  " + _("Specify data directory") + "\n" +
            "  -dbcache=<n>     \t\t  " + _("Set database cache size in megabytes (default: 25)") + "\n" +
            "  -dblogsize=<n>   \t\t  " + _("Set database disk log size in megabytes (default: 100)") + "\n" +
            "  -timeout=<n>     \t  "   + _("Specify connection timeout (in milliseconds)") + "\n" +
            "  -proxy=<ip:port> \t  "   + _("Connect through socks proxy") + "\n" +
            "  -socks=<n>       \t  "   + _("Select the version of socks proxy to use (4 or 5, 5 is default)") + "\n" +
            "  -noproxy=<net>   \t  "   + _("Do not use proxy for connections to network net (ipv4 or ipv6)") + "\n" +
            "  -dns             \t  "   + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" +
            "  -proxydns        \t  "   + _("Pass DNS requests to (SOCKS5) proxy") + "\n" +
            "  -port=<port>     \t\t  " + _("Listen for connections on <port> (default: 6901 or testnet: 9903)") + "\n" +
            "  -maxconnections=<n>\t  " + _("Maintain at most <n> connections to peers (default: 125)") + "\n" +
            "  -addnode=<ip>    \t  "   + _("Add a node to connect to and attempt to keep the connection open") + "\n" +
            "  -connect=<ip>    \t\t  " + _("Connect only to the specified node") + "\n" +
            "  -seednode=<ip>   \t\t  " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
            "  -externalip=<ip> \t  "   + _("Specify your own public address") + "\n" +
            "  -onlynet=<net>   \t  "   + _("Only connect to nodes in network <net> (IPv4 or IPv6)") + "\n" +
            "  -discover        \t  "   + _("Try to discover public IP address (default: 1)") + "\n" +
            "  -listen          \t  "   + _("Accept connections from outside (default: 1)") + "\n" +
            "  -bind=<addr>     \t  "   + _("Bind to given address. Use [host]:port notation for IPv6") + "\n" +
#ifdef QT_GUI
            "  -lang=<lang>     \t\t  " + _("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
#endif
            "  -dnsseed         \t  "   + _("Find peers using DNS lookup (default: 1)") + "\n" +
            "  -banscore=<n>    \t  "   + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
            "  -bantime=<n>     \t  "   + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +
            "  -maxreceivebuffer=<n>\t  " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000)") + "\n" +
            "  -maxsendbuffer=<n>\t  "   + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 10000)") + "\n" +
#ifdef USE_UPNP
#if USE_UPNP
            "  -upnp            \t  "   + _("Use Universal Plug and Play to map the listening port (default: 1)") + "\n" +
#else
            "  -upnp            \t  "   + _("Use Universal Plug and Play to map the listening port (default: 0)") + "\n" +
#endif
            "  -detachdb        \t  "   + _("Detach block and address databases. Increases shutdown time (default: 0)") + "\n" +
#endif
            "  -paytxfee=<amt>  \t  "   + _("Fee per KB to add to transactions you send") + "\n" +
#ifdef QT_GUI
            "  -server          \t\t  " + _("Accept command line and JSON-RPC commands") + "\n" +
#endif
#if !defined(WIN32) && !defined(QT_GUI)
            "  -daemon          \t\t  " + _("Run in the background as a daemon and accept commands") + "\n" +
#endif
            "  -testnet         \t\t  " + _("Use the test network") + "\n" +
            "  -debug           \t\t  " + _("Output extra debugging information") + "\n" +
            "  -logtimestamps   \t  "   + _("Prepend debug output with timestamp") + "\n" +
            "  -printtoconsole  \t  "   + _("Send trace/debug info to console instead of debug.log file") + "\n" +
#ifdef WIN32
            "  -printtodebugger \t  "   + _("Send trace/debug info to debugger") + "\n" +
#endif
            "  -rpcuser=<user>  \t  "   + _("Username for JSON-RPC connections") + "\n" +
            "  -rpcpassword=<pw>\t  "   + _("Password for JSON-RPC connections") + "\n" +
            "  -rpcport=<port>  \t\t  " + _("Listen for JSON-RPC connections on <port> (default: 6902)") + "\n" +
            "  -rpcallowip=<ip> \t\t  " + _("Allow JSON-RPC connections from specified IP address") + "\n" +
            "  -rpcconnect=<ip> \t  "   + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n" +
            "  -blocknotify=<cmd> "     + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
            "  -walletnotify=<cmd> "    + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" +
            "  -upgradewallet   \t  "   + _("Upgrade wallet to latest format") + "\n" +
            "  -keypool=<n>     \t  "   + _("Set key pool size to <n> (default: 100)") + "\n" +
            "  -rescan          \t  "   + _("Rescan the block chain for missing wallet transactions") + "\n" +
            "  -checkblocks=<n> \t\t  " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" +
            "  -checklevel=<n>  \t\t  " + _("How thorough the block verification is (0-6, default: 1)") + "\n";

        strUsage += string() +
            _("\nSSL options: (see the Paris Wiki for SSL setup instructions)") + "\n" +
            "  -rpcssl                                \t  " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" +
            "  -rpcsslcertificatechainfile=<file.cert>\t  " + _("Server certificate file (default: server.cert)") + "\n" +
            "  -rpcsslprivatekeyfile=<file.pem>       \t  " + _("Server private key (default: server.pem)") + "\n" +
            "  -rpcsslciphers=<ciphers>               \t  " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") + "\n";

        strUsage += string() +
            "  -?               \t\t  " + _("This help message") + "\n";

        // Remove tabs
        strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
#if defined(QT_GUI) && defined(WIN32)
        // On windows, show a message box, as there is no stderr
        ThreadSafeMessageBox(strUsage, _("Usage"), wxOK | wxMODAL);
#else
        fprintf(stderr, "%s", strUsage.c_str());
#endif
        return false;
    }

    fTestNet = GetBoolArg("-testnet");
    if (fTestNet)
    {
        SoftSetBoolArg("-irc", true);
    }

    fDebug = GetBoolArg("-debug");
    fDetachDB = GetBoolArg("-detachdb", false);

#if !defined(WIN32) && !defined(QT_GUI)
    fDaemon = GetBoolArg("-daemon");
#else
    fDaemon = false;
#endif

    if (fDaemon)
        fServer = true;
    else
        fServer = GetBoolArg("-server");

    /* force fServer when running without GUI */
#if !defined(QT_GUI)
    fServer = true;
#endif
    fPrintToConsole = GetBoolArg("-printtoconsole");
    fPrintToDebugger = GetBoolArg("-printtodebugger");
    fLogTimestamps = GetBoolArg("-logtimestamps");

#ifndef QT_GUI
    for (int i = 1; i < argc; i++)
        if (!IsSwitchChar(argv[i][0]) && !(strlen(argv[i]) >= 7 && strncasecmp(argv[i], "Paris:", 7) == 0))
            fCommandLine = true;

    if (fCommandLine)
    {
        int ret = CommandLineRPC(argc, argv);
        exit(ret);
    }
#endif

#if !defined(WIN32) && !defined(QT_GUI)
    if (fDaemon)
    {
        // Daemonize
        pid_t pid = fork();
        if (pid < 0)
        {
            fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
            return false;
        }
        if (pid > 0)
        {
            CreatePidFile(GetPidFile(), pid);
            return true;
        }

        pid_t sid = setsid();
        if (sid < 0)
            fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
    }
#endif

    if (!fDebug)
        ShrinkDebugFile();
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    printf("Paris version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str());
    printf("Default data directory %s\n", GetDefaultDataDir().string().c_str());

    if (GetBoolArg("-loadblockindextest"))
    {
        CTxDB txdb("r");
        txdb.LoadBlockIndex();
        PrintBlockTree();
        return false;
    }

    // Make sure only a single bitcoin process is using the data directory.
    boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
    FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
    if (file) fclose(file);
    static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
    if (!lock.try_lock())
    {
        ThreadSafeMessageBox(strprintf(_("Cannot obtain a lock on data directory %s.  Paris is probably already running."), GetDataDir().string().c_str()), _("Paris"), wxOK|wxMODAL);
        return false;
    }

    std::ostringstream strErrors;
    //
    // Load data files
    //
    if (fDaemon)
        fprintf(stdout, "Paris server starting\n");
    int64 nStart;

    InitMessage(_("Loading addresses..."));
    printf("Loading addresses...\n");
    nStart = GetTimeMillis();
    if (!LoadAddresses())
        strErrors << _("Error loading addr.dat") << "\n";
    printf(" addresses   %15"PRI64d"ms\n", GetTimeMillis() - nStart);

    InitMessage(_("Loading block index..."));
    printf("Loading block index...\n");
    nStart = GetTimeMillis();
    if (!LoadBlockIndex())
        strErrors << _("Error loading blkindex.dat") << "\n";

    // as LoadBlockIndex can take several minutes, it's possible the user
    // requested to kill bitcoin-qt during the last operation. If so, exit.
    // As the program has not fully started yet, Shutdown() is possibly overkill.
    if (fRequestShutdown)
    {
        printf("Shutdown requested. Exiting.\n");
        return false;
    }
    printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);

    InitMessage(_("Loading wallet..."));
    printf("Loading wallet...\n");
    nStart = GetTimeMillis();
    bool fFirstRun;
    pwalletMain = new CWallet("wallet.dat");
    int nLoadWalletRet = pwalletMain->LoadWallet(fFirstRun);
    if (nLoadWalletRet != DB_LOAD_OK)
    {
        if (nLoadWalletRet == DB_CORRUPT)
            strErrors << _("Error loading wallet.dat: Wallet corrupted") << "\n";
        else if (nLoadWalletRet == DB_TOO_NEW)
            strErrors << _("Error loading wallet.dat: Wallet requires newer version of Paris") << "\n";
        else if (nLoadWalletRet == DB_NEED_REWRITE)
        {
            strErrors << _("Wallet needed to be rewritten: restart Paris to complete") << "\n";
            printf("%s", strErrors.str().c_str());
            ThreadSafeMessageBox(strErrors.str(), _("Paris"), wxOK | wxICON_ERROR | wxMODAL);
            return false;
        }
        else
            strErrors << _("Error loading wallet.dat") << "\n";
    }

    if (GetBoolArg("-upgradewallet", fFirstRun))
    {
        int nMaxVersion = GetArg("-upgradewallet", 0);
        if (nMaxVersion == 0) // the -walletupgrade without argument case
        {
            printf("Performing wallet upgrade to %i\n", FEATURE_LATEST);
            nMaxVersion = CLIENT_VERSION;
            pwalletMain->SetMinVersion(FEATURE_LATEST); // permanently upgrade the wallet immediately
        }
        else
            printf("Allowing wallet upgrade up to %i\n", nMaxVersion);
        if (nMaxVersion < pwalletMain->GetVersion())
            strErrors << _("Cannot downgrade wallet") << "\n";
        pwalletMain->SetMaxVersion(nMaxVersion);
    }

    if (fFirstRun)
    {
        // Create new keyUser and set as default key
        RandAddSeedPerfmon();

        CPubKey newDefaultKey;
        if (!pwalletMain->GetKeyFromPool(newDefaultKey, false))
            strErrors << _("Cannot initialize keypool") << "\n";
        pwalletMain->SetDefaultKey(newDefaultKey);
        if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), ""))
            strErrors << _("Cannot write default address") << "\n";
    }

    printf("%s", strErrors.str().c_str());
    printf(" wallet      %15"PRI64d"ms\n", GetTimeMillis() - nStart);

    RegisterWallet(pwalletMain);

    CBlockIndex *pindexRescan = pindexBest;
    if (GetBoolArg("-rescan"))
        pindexRescan = pindexGenesisBlock;
    else
    {
        CWalletDB walletdb("wallet.dat");
        CBlockLocator locator;
        if (walletdb.ReadBestBlock(locator))
            pindexRescan = locator.GetBlockIndex();
    }
    if (pindexBest != pindexRescan && pindexBest && pindexRescan && pindexBest->nHeight > pindexRescan->nHeight)
    {
        InitMessage(_("Rescanning..."));
        printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
        nStart = GetTimeMillis();
        pwalletMain->ScanForWalletTransactions(pindexRescan, true);
        printf(" rescan      %15"PRI64d"ms\n", GetTimeMillis() - nStart);
    }

    InitMessage(_("Done loading"));
    printf("Done loading\n");

    //// debug print
    printf("mapBlockIndex.size() = %d\n",   mapBlockIndex.size());
    printf("nBestHeight = %d\n",            nBestHeight);
    printf("setKeyPool.size() = %d\n",      pwalletMain->setKeyPool.size());
    printf("mapWallet.size() = %d\n",       pwalletMain->mapWallet.size());
    printf("mapAddressBook.size() = %d\n",  pwalletMain->mapAddressBook.size());

    if (!strErrors.str().empty())
    {
        ThreadSafeMessageBox(strErrors.str(), _("Paris"), wxOK | wxICON_ERROR | wxMODAL);
        return false;
    }

    // Add wallet transactions that aren't already in a block to mapTransactions
    pwalletMain->ReacceptWalletTransactions();

    // Note: Bitcoin-QT stores several settings in the wallet, so we want
    // to load the wallet BEFORE parsing command-line arguments, so
    // the command-line/bitcoin.conf settings override GUI setting.

    //
    // Parameters
    //
    if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
    {
        PrintBlockTree();
        return false;
    }

    if (mapArgs.count("-timeout"))
    {
        int nNewTimeout = GetArg("-timeout", 5000);
        if (nNewTimeout > 0 && nNewTimeout < 600000)
            nConnectTimeout = nNewTimeout;
    }

    if (mapArgs.count("-printblock"))
    {
        string strMatch = mapArgs["-printblock"];
        int nFound = 0;
        for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
        {
            uint256 hash = (*mi).first;
            if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
            {
                CBlockIndex* pindex = (*mi).second;
                CBlock block;
                block.ReadFromDisk(pindex);
                block.BuildMerkleTree();
                block.print();
                printf("\n");
                nFound++;
            }
        }
        if (nFound == 0)
            printf("No blocks matching %s were found\n", strMatch.c_str());
        return false;
    }

    if (mapArgs.count("-proxy"))
    {
        fUseProxy = true;
        addrProxy = CService(mapArgs["-proxy"], 9050);
        if (!addrProxy.IsValid())
        {
            ThreadSafeMessageBox(_("Invalid -proxy address"), _("Paris"), wxOK | wxMODAL);
            return false;
        }
    }

    if (mapArgs.count("-noproxy"))
    {
        BOOST_FOREACH(std::string snet, mapMultiArgs["-noproxy"]) {
            enum Network net = ParseNetwork(snet);
            if (net == NET_UNROUTABLE) {
                ThreadSafeMessageBox(_("Unknown network specified in -noproxy"), _("Paris"), wxOK | wxMODAL);
                return false;
            }
            SetNoProxy(net);
        }
    }

    if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
        SoftSetBoolArg("-dnsseed", false);
        SoftSetBoolArg("-listen", false);
    }

    // even in Tor mode, if -bind is specified, you really want -listen
    if (mapArgs.count("-bind"))
        SoftSetBoolArg("-listen", true);

    bool fTor = (fUseProxy && addrProxy.GetPort() == 9050);
    if (fTor)
    {
        // Use SoftSetBoolArg here so user can override any of these if they wish.
        // Note: the GetBoolArg() calls for all of these must happen later.
        SoftSetBoolArg("-listen", false);
        SoftSetBoolArg("-irc", false);
        SoftSetBoolArg("-proxydns", true);
        SoftSetBoolArg("-upnp", false);
        SoftSetBoolArg("-discover", false);
    }

    if (mapArgs.count("-onlynet")) {
        std::set<enum Network> nets;
        BOOST_FOREACH(std::string snet, mapMultiArgs["-onlynet"]) {
            enum Network net = ParseNetwork(snet);
            if (net == NET_UNROUTABLE) {
                ThreadSafeMessageBox(_("Unknown network specified in -onlynet"), _("Paris"), wxOK | wxMODAL);
                return false;
            }
            nets.insert(net);
        }
        for (int n = 0; n < NET_MAX; n++) {
            enum Network net = (enum Network)n;
            if (!nets.count(net))
                SetLimited(net);
        }
    }

    fNameLookup = GetBoolArg("-dns");
    fProxyNameLookup = GetBoolArg("-proxydns");
    if (fProxyNameLookup)
        fNameLookup = true;
    fNoListen = !GetBoolArg("-listen", true);
    nSocksVersion = GetArg("-socks", 5);

    BOOST_FOREACH(string strDest, mapMultiArgs["-seednode"])
        AddOneShot(strDest);

    // Continue to put "/P2SH/" in the coinbase to monitor
    // BIP16 support.
    // This can be removed eventually...
    const char* pszP2SH = "/P2SH/";
    COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));

    bool fBound = false;
    if (!fNoListen)
    {
        std::string strError;
        if (mapArgs.count("-bind")) {
            BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
                fBound |= Bind(CService(strBind, GetDefaultPort(), false));
            }
        } else {
            struct in_addr inaddr_any;
            inaddr_any.s_addr = INADDR_ANY;
            fBound |= Bind(CService(inaddr_any, GetDefaultPort()));
#ifdef USE_IPV6
            fBound |= Bind(CService(in6addr_any, GetDefaultPort()));
#endif
        }
        if (!fBound)
            return false;
    }

    if (mapArgs.count("-externalip"))
    {
        BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"])
            AddLocal(CNetAddr(strAddr, fNameLookup), LOCAL_MANUAL);
    }

    if (mapArgs.count("-paytxfee"))
    {
        if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee) || nTransactionFee < MIN_TX_FEE)
        {
            ThreadSafeMessageBox(_("Invalid amount for -paytxfee=<amount>"), _("Paris"), wxOK | wxMODAL);
            return false;
        }
        if (nTransactionFee > 0.25 * COIN)
            ThreadSafeMessageBox(_("Warning: -paytxfee is set very high.  This is the transaction fee you will pay if you send a transaction."), _("Paris"), wxOK | wxICON_EXCLAMATION | wxMODAL);
    }

    if (mapArgs.count("-reservebalance")) // Paris: reserve balance amount
    {
        int64 nReserveBalance = 0;
        if (!ParseMoney(mapArgs["-reservebalance"], nReserveBalance))
        {
            ThreadSafeMessageBox(_("Invalid amount for -reservebalance=<amount>"), _("Paris"), wxOK | wxMODAL);
            return false;
        }
    }

    if (mapArgs.count("-checkpointkey")) // Paris: checkpoint master priv key
    {
        if (!Checkpoints::SetCheckpointPrivKey(GetArg("-checkpointkey", "")))
            ThreadSafeMessageBox(_("Unable to sign checkpoint, wrong checkpointkey?\n"), _("Paris"), wxOK | wxMODAL);
    }

    //
    // Start the node
    //
    if (!CheckDiskSpace())
        return false;

    RandAddSeedPerfmon();

    if (!CreateThread(StartNode, NULL))
        ThreadSafeMessageBox(_("Error: CreateThread(StartNode) failed"), _("Paris"), wxOK | wxMODAL);

    if (fServer)
        CreateThread(ThreadRPCServer, NULL);

#ifdef QT_GUI
    if (GetStartOnSystemStartup())
        SetStartOnSystemStartup(true); // Remove startup links
#endif

#if !defined(QT_GUI)
    while (1)
        Sleep(5000);
#endif

    return true;
}


text:
require_relative '../lib/rubyjobbuilderdsl'

builder = JenkinsJob::Builder.new

builder.freestyle 'hello_mars' do
  shell 'echo hello mars > hello_mars-1.0.$BUILD_NUMBER.txt && gzip hello_mars-1.0.$BUILD_NUMBER.txt'
end

builder.view 'test' do
  job 'test-.*'
end

JenkinsJob::Deployer.new(builder).run do
  disable_job 'hello_mars'
  wipeout_workspace 'hello_mars'
  delete_job 'hello_mars'
  delete_view 'test'

  each do |name, xml, type|
    upload_view(name, xml) if type == :view
    upload_job(name, xml) if type == :job
  end

  groovysh 'println "hello world"'
  enable_job 'hello_mars'
  trigger_job 'hello_mars'
end


text:
package org.firstinspires.ftc.robotcontroller.external.samples;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;

/**
 * This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
 * the autonomous or the teleop period of an FTC match. The names of OpModes appear on the menu
 * of the FTC Driver Station. When an selection is made from the menu, the corresponding OpMode
 * class is instantiated on the Robot Controller and executed.
 *
 * This particular OpMode just executes a basic Tank Drive Teleop for a two wheeled robot
 * It includes all the skeletal structure that all linear OpModes contain.
 *
 * Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
 * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
 */

@TeleOp(name="Basic: Linear OpMode", group="Linear Opmode")
@Disabled
public class BasicOpMode_Linear extends LinearOpMode {

    // Declare OpMode members.
    private ElapsedTime runtime = new ElapsedTime();
    private DcMotor leftDrive = null;
    private DcMotor rightDrive = null;

    @Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();

        // Initialize the hardware variables. Note that the strings used here as parameters
        // to 'get' must correspond to the names assigned during the robot configuration
        // step (using the FTC Robot Controller app on the phone).
        leftDrive  = hardwareMap.get(DcMotor.class, "left_drive");
        rightDrive = hardwareMap.get(DcMotor.class, "right_drive");

        // Most robots need the motor on one side to be reversed to drive forward
        // Reverse the motor that runs backwards when connected directly to the battery
        leftDrive.setDirection(DcMotor.Direction.FORWARD);
        rightDrive.setDirection(DcMotor.Direction.REVERSE);

        // Wait for the game to start (driver presses PLAY)
        waitForStart();
        runtime.reset();

        // run until the end of the match (driver presses STOP)
        while (opModeIsActive()) {

            // Setup a variable for each drive wheel to save power level for telemetry
            double leftPower;
            double rightPower;

            // Choose to drive using either Tank Mode, or POV Mode
            // Comment out the method that's not used.  The default below is POV.

            // POV Mode uses left stick to go forward, and right stick to turn.
            // - This uses basic math to combine motions and is easier to drive straight.
            double drive = -gamepad1.left_stick_y;
            double turn  =  gamepad1.right_stick_x;
            leftPower    = Range.clip(drive + turn, -1.0, 1.0) ;
            rightPower   = Range.clip(drive - turn, -1.0, 1.0) ;

            // Tank Mode uses one stick to control each wheel.
            // - This requires no math, but it is hard to drive forward slowly and keep straight.
            // leftPower  = -gamepad1.left_stick_y ;
            // rightPower = -gamepad1.right_stick_y ;

            // Send calculated power to wheels
            leftDrive.setPower(leftPower);
            rightDrive.setPower(rightPower);

            // Show the elapsed game time and wheel power.
            telemetry.addData("Status", "Run Time: " + runtime.toString());
            telemetry.addData("Motors", "left (%.2f), right (%.2f)", leftPower, rightPower);
            telemetry.update();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>NameCheap | Rajeev Sharma</title>
    <link>/tags/namecheap/</link>
      <atom:link href="/tags/namecheap/index.xml" rel="self" type="application/rss+xml" />
    <description>NameCheap</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>© 2020 Rajeev Sharma</copyright><lastBuildDate>Fri, 06 Jan 2017 00:00:00 +0000</lastBuildDate>
    <image>
      <url>/img/rajeevkannav.jpeg</url>
      <title>NameCheap</title>
      <link>/tags/namecheap/</link>
    </image>

    <item>
      <title>namecheap ssl cert authority invalid fix</title>
      <link>/post/2017-01-06-ssl-cert-authority-invalid-fix/</link>
      <pubDate>Fri, 06 Jan 2017 00:00:00 +0000</pubDate>
      <guid>/post/2017-01-06-ssl-cert-authority-invalid-fix/</guid>
      <description>
Happy New Year

Last year we deployed our rails application over nginx with ssl certificates
obtained from namecheap. everything ewas working fine but over Android moblie
we found a bug as in image below

Solution

We got two files from NameCheap for example:

youdomainname.crt

youdomainname.ca-bundle

What we missed to combine the certificates(thought ca-bundle is already combination).
We&rsquo;re wrong and our application stopped working on android phone&rsquo;s browser.

It is mandatory to combine the certificates in case of PositiveSSL. It will look like:

   $ cat *yourdomainname*.crt COMODO_DV_SHA-256_bundle.crt &gt;&gt; cert_chain.crt
   or
   $ cat *yourdomainname*.crt *yourdomainname*.ca-bundle &gt;&gt; cert_chain.crt

Sample nginx configuration

    ssl on;
    # ssl_certificate should be pointed to the file with combined certificates (file you created in step 2)
    ssl_certificate /etc/ssl/cert_chain.crt;
    # ssl_certificate_key should be pointed to the Private Key that has been generated with the CSR code that you have used for activation of the certificate.
    ssl_certificate_key /etc/ssl/*your_private_key*.key;

And if you get stuck…
Ask Here

 email me
rajeevsharma86@gmail.com

</description>
    </item>

    <item>
      <title>SSl csr-certificate post-processing for Web-Server usage</title>
      <link>/post/2015-05-23-ssl-csr-certificate-postprocessing/</link>
      <pubDate>Tue, 26 May 2015 00:00:00 +0000</pubDate>
      <guid>/post/2015-05-23-ssl-csr-certificate-postprocessing/</guid>
      <description>
For those of you who may refer my early written post
Openssl CSR SHA-2..
Here is Part 2.

Install the Certificate (CRT)

After giving your CSR to SSL Provider, you need to wait for their response. They&rsquo;ll validate your CSR and give you some
certificates and file as in package. We&rsquo;re using NameCheap as SSL Provider so this blog will follow according to their
response. NameCheap sends you an zipped folder which will have :

AddTrustExternalCARoot.crt

COMODORSAAddTrustCA.crt

COMODORSADomainValidationSecureServerCA.crt

STAR_xxxxx_com.crt

And you already have

xxxxx.key

xxxxx.csr

Now you&rsquo;ll need to have one pass phrase protected key and one combined ssl certificate in right order. You need to remove
the pass phrase. To do that have that key and run following command

openssl rsa -in xxxxx.key -out xxxxx.nopass.key

Enter the private key pass phrase when asked. And Get set Go! Use this new key to your
Elastic Load Balancer/nginx/Apache. For combined SSL certificate :&ndash;

cat STAR_xxxxx_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt &gt; SSL.crt

Use SSL.crt and xxxxx.nopass.key to your Web Server configuration.

Test your installed Certificate

Visit your web Application after configuring certificates and key at web server and see Browser console.
There should not any waring or error related to SSL. for e.g.

This site makes use of a SHA-1 Certificate; it's recommended you use certificates
with signature algorithms that use hash functions stronger than SHA-1.

And if you get stuck…
Ask Here

 email me
rajeevsharma86@gmail.com

</description>
    </item>

  </channel>
</rss>


text:
package net.openhft.chronicle.core.util;

import net.openhft.chronicle.core.time.SystemTimeProvider;
import net.openhft.chronicle.core.time.UniqueMicroTimeProvider;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * A timer for timeouts which is resilient to pauses in the JVM, tickTime can only increase if the JVM hasn't been paused.
 * <p>
 * For this to work, currentTimeMillis (or one of the methods that calls it) must be called more frequently than
 * every millisecond; the EventLoop implementations in chronicle-threads do this.
 * </p>
 */
public final class Time {
    private Time() {
    }

    public static String uniqueId() {
        long l;
        try {
            l = UniqueMicroTimeProvider.INSTANCE.currentTimeMicros();
        } catch (IllegalStateException e) {
            l = SystemTimeProvider.INSTANCE.currentTimeMicros();
        }
        return Long.toString(l, 36);
    }

    public static void parkNanos(long nanos) {
        LockSupport.parkNanos(nanos);
    }

    /**
     * Sleeps in such a way that any long pause of the JVM, e.g. GC, will make it wait much longer to prevent timeouts being busted.
     *
     * @param time     to pause for at least.
     * @param timeUnit the time unit
     */
    public static void sleep(long time, TimeUnit timeUnit) {
        int millis = (int) timeUnit.convert(time, TimeUnit.MILLISECONDS);
        for (int i = 0; i < millis; i++) {
            System.currentTimeMillis();
            LockSupport.parkNanos(1_000_000);
        }
    }
}


text:
category: breaking
---
The signature of `allowImplicitRead` on `DataFlow::Configuration` and `TaintTracking::Configuration` has changed from `allowImplicitRead(DataFlow::Node node, DataFlow::Content c)` to `allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c)`.


text:
layout: post
title:  Note-on-Git
description: some notes on git
categories: blog
---

### Note
1. 如何开一个新的空分支 git checkout --orphan branch_name 然后 git reset --hard 或者 rm -rf \* (注意这里要小心)
2. 生成一个tag git tag -a tag_name -m "message"
3. 推送到远程分支 git push --tags
4. 删除本地tag git tag -D tag_name
5. 删除remote tag git push --delete origin tag_name
6. clone 特定的branch git clone -b <branch_name> <remote_repo>
7. clone 特定的tag  git clone --branch tag_name remote_repo


text:
using Abp.Configuration.Startup;

namespace Abp.Zero.Ldap.Configuration
{
    /// <summary>
    /// Extension methods for module zero configurations.
    /// </summary>
    public static class ModuleZeroLdapConfigurationExtensions
    {
        /// <summary>
        /// Configures ABP Zero LDAP module.
        /// </summary>
        /// <returns></returns>
        public static IAbpZeroLdapModuleConfig ZeroLdap(this IModuleConfigurations moduleConfigurations)
        {
            return moduleConfigurations.AbpConfiguration.Get<IAbpZeroLdapModuleConfig>();
        }
    }
}


text: @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-page-indicator{display:flex}