text:
<?php

declare(strict_types=1);

return [
    'meta' => [
        'title' => 'Class static property call of a class imported with an aliased use statement in a namespace',
        // Default values. If not specified will be the one used
        'prefix' => 'Humbug',

        'expose-global-constants' => false,
        'expose-global-classes' => false,
        'expose-global-functions' => false,
        'expose-namespaces' => [],
        'expose-constants' => [],
        'expose-classes' => [],
        'expose-functions' => [],

        'exclude-namespaces' => [],
        'exclude-constants' => [],
        'exclude-classes' => [],
        'exclude-functions' => [],

        'expected-recorded-classes' => [],
        'expected-recorded-functions' => [],
    ],

    'Constant call on a aliased class which is imported via an aliased use statement and which belongs to the global namespace' => <<<'PHP'
    <?php

    namespace {
        class Foo {}
    }

    namespace A {
        use Foo as X;

        X::$mainStaticProp;
    }
    ----
    <?php

    namespace Humbug;

    class Foo
    {
    }
    namespace Humbug\A;

    use Humbug\Foo as X;
    X::$mainStaticProp;

    PHP,

    'FQ constant call on a aliased class which is imported via an aliased use statement and which belongs to the global namespace' => <<<'PHP'
    <?php

    namespace {
        class Foo {}
        class X {}
    }

    namespace A {
        use Foo as X;

        \X::$mainStaticProp;
    }
    ----
    <?php

    namespace Humbug;

    class Foo
    {
    }
    class X
    {
    }
    namespace Humbug\A;

    use Humbug\Foo as X;
    \Humbug\X::$mainStaticProp;

    PHP,

    'Constant call on an exposed class which is imported via an aliased use statement and which belongs to the global namespace' => <<<'PHP'
    <?php

    namespace A;

    use Reflector as X;

    X::$mainStaticProp;
    ----
    <?php

    namespace Humbug\A;

    use Reflector as X;
    X::$mainStaticProp;

    PHP,

    'FQ constant call on an internal class which is imported via an aliased use statement and which belongs to the global namespace' => <<<'PHP'
    <?php

    namespace {
        class X {}
    }

    namespace A {
        use Reflector as X;

        \X::$mainStaticProp;
    }
    ----
    <?php

    namespace Humbug;

    class X
    {
    }
    namespace Humbug\A;

    use Reflector as X;
    \Humbug\X::$mainStaticProp;

    PHP,

    'FQ constant call on an exposed class which is imported via an aliased use statement and which belongs to the global namespace' => [
        'expose-classes' => ['Foo'],
        'payload' => <<<'PHP'
        <?php

        namespace {
            class X {}
        }

        namespace A {
            use Foo as X;

            \Foo::$mainStaticProp;
        }
        ----
        <?php

        namespace Humbug;

        class X
        {
        }
        namespace Humbug\A;

        use Humbug\Foo as X;
        \Humbug\Foo::$mainStaticProp;

        PHP,
    ],
];


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>lib/api/user.js - arango</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="stylesheet" href="../assets/css/custom.css">
    <link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap.css">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            arango

                    API Docs for Version: 1.1.0

        <form class="navbar-form pull-right" style="line-height: 40px; height: 40px;">
            <input style="margin-top: 0;" type="text" class="search-query" placeholder="Search for classes/modules..." data-obj='["classes/action", "classes/admin", "classes/aqlfunction", "classes/batch", "classes/collection", "classes/cursor", "classes/database", "classes/document", "classes/edge", "classes/endpoint", "classes/graph", "classes/import", "classes/index", "classes/jobs", "classes/query", "classes/simple", "classes/transaction", "classes/traversal", "classes/users", "modules/action", "modules/admin", "modules/aqlfunction", "modules/arango", "modules/batch", "modules/collection", "modules/cursor", "modules/database", "modules/document", "modules/edge", "modules/endpoint", "modules/graph", "modules/import", "modules/index", "modules/jobs", "modules/query", "modules/simple", "modules/transaction", "modules/traversal", "modules/users"]'>
        </form>

APIs

Classes

Modules

            <input type="search" placeholder="Type to filter APIs">

action

admin

aqlfunction

batch

collection

cursor

database

document

edge

endpoint

graph

import

index

jobs

query

simple

transaction

traversal

users

action

admin

aqlfunction

arango

batch

collection

cursor

database

document

edge

endpoint

graph

import

index

jobs

query

simple

transaction

traversal

users

                <form id="options-form" class="form-inline pull-right">
        Show:

            <input type="checkbox" id="api-show-inherited" checked>
            Inherited

            <input type="checkbox" id="api-show-protected">
            Protected

            <input type="checkbox" id="api-show-private">
            Private

            <input type="checkbox" id="api-show-deprecated">
            Deprecated

    </form>

lib/api/user.js File

var Arango = require('../arango');
/**
 * The api module to maintain users in ArangoDB.
 *
 * @class users
 * @module arango
 * @submodule users
 **/
function UserAPI(db) {
    var path = "/_api/user/";

    return {

	/**
	 * Creates a user.
	 *
	 * @param {String} username  - the username.
	 * @param {String} password  - the password.
	 * @param {Boolean} [active=true] - true if is the user is active.
	 * @param {Object} [extra]   - additional userdata as JSONObject
	 * @method create
	 * @return{Promise}
	 */
	"create": function (username, password, active, extra) {
	    if (typeof active !== 'boolean') {
		extra = active;
		active = true;
	    }

	    var data = {
		username: username,
		password: password,
		active: active,
		extra: extra
	    };

	    return db.post(path, data);
	},
	/**
	 * Returns the requested user.
	 *
	 * @param {String} username  - the user to request data for.
	 * @method get
	 * @return{Promise}
	 */
	"get": function (username) {
	    return db.get(path + username);
	},
	/**
	 * Replaces entry for user
	 *
	 * @param {String} username  - the user to be replaced
	 * @param {String} password  - new password
	 * @param {Boolean} [active=true] is the user is active.
	 * @param {Object} [extra]   - additional userdata as JSONObject
	 * @method put
	 * @return{Promise}
	 */
	"put": function (username, password, active, extra) {
	    if (typeof active !== 'boolean') {
		extra = active;
		active = true;
	    }

	    var data = {
		password: password,
		active: active
	    };

	    if (extra) data.extra = extra;

	    return db.put(path + username, data);
	},
	/**
	 * updates entry for user
	 * @param {String} username  - the user to be replaced
	 * @param {String} password  - new password
	 * @param {Boolean} [active] - boolean is the user is active.
	 * @param {Object} [extra]  - additional userdata as JSONObject
	 * @method patch
	 * @return{Promise}
	 */
	"patch": function (username, password, active, extra) {
	    if (typeof active !== 'boolean') {
		extra = active;
		active = true;
	    }

	    var data = {
		password: password
	    };

	    if (extra) data.extra = extra;
	    if (active !== undefined) data.active = active;
	    if (extra !== undefined) data.extra = extra;

	    return db.patch(path + username, data);
	},
	/**
	 * deletes user
	 * @param {String} username  - the user to be deleted
	 * @method delete
	 * @return{Promise}
	 */
	"delete": function (username) {
	    return db.delete(path + username);
	}
    };
}

module.exports = Arango.api('user', UserAPI);

redpajama_set_name: RedPajamaGithub


text:
namespace XE {

	class EntityHolder
	{
	public:
		EntityHolder(entityx::Entity ent)
		{
			Entity = ent;
		}

		entityx::Entity Entity;
	};
} // ns XE

#endif // __NODE_HPP__


text:
import lighthouse from 'lighthouse/lighthouse-core';
import * as lhConfig from './config';

export const lighthouseReport = async (target) => {
  return JSON.parse((await lighthouse(target, lhConfig)).report);
};


text:
package com.planet_ink.coffee_mud.Items.BasicTech;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

import com.planet_ink.coffee_mud.Libraries.interfaces.*;

public class GenElecPanel extends StdElecPanel
{
	@Override
	public String ID()
	{
		return "GenElecPanel";
	}

	protected String	readableText	= "";

	public GenElecPanel()
	{
		super();
		setName("a generic electronics panel");
		basePhyStats.setWeight(2);
		setDisplayText("a generic electric panel is mounted here.");
		setDescription("");
		baseGoldValue=5;
		setCapacity(25000);
		basePhyStats().setLevel(1);
		recoverPhyStats();
		setMaterial(RawMaterial.RESOURCE_STEEL);
	}

	@Override
	public boolean isGeneric()
	{
		return true;
	}

	@Override
	public String text()
	{
		return CMLib.coffeeMaker().getPropertiesStr(this, false);
	}

	@Override
	public String readableText()
	{
		return readableText;
	}

	@Override
	public void setReadableText(String text)
	{
		readableText = text;
	}

	@Override
	public void setMiscText(String newText)
	{
		miscText="";
		CMLib.coffeeMaker().setPropertiesStr(this,newText,false);
		recoverPhyStats();
	}

	private final static String[] MYCODES={"HASLOCK","HASLID","CAPACITY", "CONTAINTYPES","RESETTIME","POWERCAP", "ACTIVATED","POWERREM","PANTYPE","DEFCLOSED","DEFLOCKED"};
	@Override
	public String getStat(String code)
	{
		if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
			return CMLib.coffeeMaker().getGenItemStat(this,code);
		switch(getCodeNum(code))
		{
		case 0:
			return "" + hasALock();
		case 1:
			return "" + hasADoor();
		case 2:
			return "" + capacity();
		case 3:
			return "" + containTypes();
		case 4:
			return "" + openDelayTicks();
		case 5:
			return "" + powerCapacity();
		case 6:
			return "" + activated();
		case 7:
			return "" + powerRemaining();
		case 8:
			return "" + panelType().name();
		case 9:
			return "" + defaultsClosed();
		case 10:
			return "" + defaultsLocked();
		default:
			return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code);
		}
	}

	@Override
	public void setStat(String code, String val)
	{
		if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
			CMLib.coffeeMaker().setGenItemStat(this,code,val);
		else
		switch(getCodeNum(code))
		{
		case 0:
			setDoorsNLocks(hasADoor(), isOpen(), defaultsClosed(), CMath.s_bool(val), false, CMath.s_bool(val) && defaultsLocked());
			break;
		case 1:
			setDoorsNLocks(CMath.s_bool(val), isOpen(), CMath.s_bool(val) && defaultsClosed(), hasALock(), isLocked(), defaultsLocked());
			break;
		case 2:
			setCapacity(CMath.s_parseIntExpression(val));
			break;
		case 3:
			setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
			break;
		case 4:
			setOpenDelayTicks(CMath.s_parseIntExpression(val));
			break;
		case 5:
			setPowerCapacity(CMath.s_parseLongExpression(val));
			break;
		case 6:
			activate(CMath.s_bool(val));
			break;
		case 7:
			setPowerRemaining(CMath.s_parseLongExpression(val));
			break;
		case 8:
		{
			try
			{
				setPanelType(TechType.valueOf(val.toUpperCase().trim()));
			}
			catch (final Exception e)
			{
			}
			break;
		}
		case 9:
			setDoorsNLocks(hasADoor(), isOpen(), CMath.s_bool(val), hasALock(), isLocked(), defaultsLocked());
			break;
		case 10:
			setDoorsNLocks(hasADoor(), isOpen(), defaultsClosed(), hasALock(), isLocked(), CMath.s_bool(val));
			break;
		default:
			CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
			break;
		}
	}

	@Override
	protected int getCodeNum(String code)
	{
		for(int i=0;i<MYCODES.length;i++)
		{
			if(code.equalsIgnoreCase(MYCODES[i]))
				return i;
		}
		return -1;
	}

	private static String[] codes=null;

	@Override
	public String[] getStatCodes()
	{
		if(codes!=null)
			return codes;
		final String[] MYCODES=CMProps.getStatCodesList(GenElecPanel.MYCODES,this);
		final String[] superCodes=CMParms.toStringArray(GenericBuilder.GenItemCode.values());
		codes=new String[superCodes.length+MYCODES.length];
		int i=0;
		for(;i<superCodes.length;i++)
			codes[i]=superCodes[i];
		for(int x=0;x<MYCODES.length;i++,x++)
			codes[i]=MYCODES[x];
		return codes;
	}

	@Override
	public boolean sameAs(Environmental E)
	{
		if(!(E instanceof GenElecPanel))
			return false;
		final String[] theCodes=getStatCodes();
		for(int i=0;i<theCodes.length;i++)
		{
			if(!E.getStat(theCodes[i]).equals(getStat(theCodes[i])))
				return false;
		}
		return true;
	}
}


text:
<?php
/**
 * Helper class for generating source code
 */
class CodeStringBuffer
{
    private $_buffer = array();
    private $_identLevel = 0;

    protected $identStr = '';
    protected $newLineStr = '';

    /**
     * Constructs new code buffer
     *
     * @param string $tabString     String used for identation
     * @param string $newLineString String used as new line
     */
    public function __construct($tabString = ' ', $newLineString = PHP_EOL)
    {
        $this->identStr = $tabString;
        $this->newLineStr = $newLineString;
    }

    /**
     * Adds new line to buffer
     *
     * @return CodeStringBuffer
     */
    public function newline()
    {
        $this->append('');
        return $this;
    }

    /**
     * Appends lines to buffer
     *
     * @param string $lines       Lines to append
     * @param bool   $newline     Add extra newline after lines
     * @param int    $identOffset Extra ident code
     *
     * @return CodeStringBuffer
     */
    public function append($lines, $newline = false, $identOffset = 0)
    {
        foreach (explode($this->newLineStr, $lines) as $line) {
            if (strlen($line) > 0) {
                $this->_buffer[] = $this->_getIdentationString($identOffset) . $line;
            } else {
                $this->_buffer[] = '';
            }
        }

        if ($newline) {
            $this->_buffer[] = $this->newLineStr;
        }

        return $this;
    }

    /**
     * Increases identation
     *
     * @return CodeStringBuffer
     */
    public function increaseIdentation()
    {
        $this->_identLevel++;

        return $this;
    }

    /**
     * Decreases identation
     *
     * @return CodeStringBuffer
     */
    public function decreaseIdentation()
    {
        $this->_identLevel = max(0, $this->_identLevel - 1);

        return $this;
    }

    /**
     * Returns identation string
     *
     * @param int $identOffset Offset
     *
     * @return string
     */
    private function _getIdentationString($identOffset = 0)
    {
        return str_repeat($this->identStr, $this->_identLevel + $identOffset);
    }

    /**
     * Returns buffer as string
     *
     * @return string
     */
    public function __toString()
    {
        return implode($this->newLineStr, $this->_buffer);
    }
}


text:
<?php

// Define a super global constant for the log file (this will be in scope for all functions)
define("LOG_FILE", "./php.log");
require_once 'vendor/autoload.php';

// Figure out how many levels up to get to the "public_html" root folder
$webRootDirOffset = substr_count(strstr(dirname(__FILE__),"public_html"),DIRECTORY_SEPARATOR) + 1;
// Get settings and credentials from a file in a directory outside of public_html
// (assume a settings file in the "external_includes" folder one level up from "public_html")
$extIncludePath = dirname(__FILE__, $webRootDirOffset+1).DIRECTORY_SEPARATOR.'external_includes'.DIRECTORY_SEPARATOR;
require_once $extIncludePath.'hoadbSecrets.php';
// Common functions
require_once 'php_secure/commonUtil.php';
// Common database functions and table record classes
require_once 'php_secure/hoaDbCommon.php';

	// If they are set, get input parameters from the REQUEST
	$parcelId = getParamVal("parcelId");
	$lotNo = getParamVal("lotNo");
	$address = getParamVal("address");

	// Default SQL
	$sql = "SELECT * FROM hoa_properties p, hoa_owners o WHERE p.Parcel_ID = o.Parcel_ID AND o.CurrentOwner = 1 AND UPPER(p.Parcel_ID) ";
	$paramStr = " ";

	if (!empty($parcelId)) {
		$sql = "SELECT * FROM hoa_properties p, hoa_owners o WHERE p.Parcel_ID = o.Parcel_ID AND o.CurrentOwner = 1 AND UPPER(p.Parcel_ID) ";
		$paramStr = wildCardStrFromTokens($parcelId);
	} elseif (!empty($lotNo)) {
		$sql = "SELECT * FROM hoa_properties p, hoa_owners o WHERE p.Parcel_ID = o.Parcel_ID AND o.CurrentOwner = 1 AND p.LotNo ";
		$paramStr = wildCardStrFromTokens($lotNo);
	} elseif (!empty($address)) {
		$sql = "SELECT * FROM hoa_properties p, hoa_owners o WHERE p.Parcel_ID = o.Parcel_ID AND o.CurrentOwner = 1 AND UPPER(p.Parcel_Location) ";
		$paramStr = wildCardStrFromTokens($address);
	} else {
		$sql = "SELECT * FROM hoa_properties p, hoa_owners o WHERE p.Parcel_ID = o.Parcel_ID AND o.CurrentOwner = 1 AND UPPER(p.Parcel_ID) ";
		// Hardcode the default to find all parcels
		$paramStr = '%r%';
	}

	$sql = $sql . "LIKE UPPER(?) ORDER BY p.Parcel_ID; ";
	//error_log('$sql = ' . $sql);

	$conn = getConn($host, $dbadmin, $password, $dbname);
	$stmt = $conn->prepare($sql);
	$stmt->bind_param("s", $paramStr);
	$stmt->execute();
	$result = $stmt->get_result();

	$outputArray = array();
	if ($result->num_rows > 0) {
		while($row = $result->fetch_assoc()) {
			$hoaPropertyRec = new HoaPropertyRec();

			$hoaPropertyRec->parcelId = $row["Parcel_ID"];
			$hoaPropertyRec->lotNo = $row["LotNo"];
			$hoaPropertyRec->subDivParcel = $row["SubDivParcel"];
			$hoaPropertyRec->parcelLocation = $row["Parcel_Location"];

			array_push($outputArray,$hoaPropertyRec);
		}
	} else {
		// If no records found on the initial search try cutting off the last word
		$stmt->close();

		if (!empty($parcelId)) {
			$paramStr = wildCardStrFromTokens($parcelId);
		} elseif (!empty($lotNo)) {
			$paramStr = wildCardStrFromTokens($lotNo);
		} elseif (!empty($address)) {
			//$paramStr = wildCardStrFromTokens($address);
			// Just use the first word
			$token = strtok($address, " ");
			$paramStr = '%' . $token . '%';
		}

		$stmt = $conn->prepare($sql);
		$stmt->bind_param("s", $paramStr);
		$stmt->execute();
		$result = $stmt->get_result();
		if ($result->num_rows > 0) {
			while($row = $result->fetch_assoc()) {
				$hoaPropertyRec = new HoaPropertyRec();

				$hoaPropertyRec->parcelId = $row["Parcel_ID"];
				$hoaPropertyRec->lotNo = $row["LotNo"];
				$hoaPropertyRec->subDivParcel = $row["SubDivParcel"];
				$hoaPropertyRec->parcelLocation = $row["Parcel_Location"];

				array_push($outputArray,$hoaPropertyRec);
			}
		}
	}

	$stmt->close();
	$conn->close();

	echo json_encode($outputArray);

?>


text:
Ti=Footnote 48

sec=The voluntary basis for actions to be taken by emergency workers is usually covered in emergency arrangements.

=[Z/f/ol/0]


text: declare module 'mongodb';


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StackExchange.Redis;
using StackRedis.L1.MemoryCache;
using System.Threading.Tasks;

namespace StackRedis.L1.Test
{
    [TestClass]
    public class Keyspace_del : UnitTestBase
    {
        [TestMethod]
        public async Task Keyspace_del_KeyRemoved()
        {
            //Create a key
            _redisDirectDb.StringSet("key1", "value1");
            Assert.AreEqual("value1", (string)_memDb.StringGet("key1"));

            //Delete it in Redis
            _otherClientDb.KeyDelete("key1");

            //Wait 100ms for it to take effect
            await Task.Delay(100);

            //Ensure it's gone from the memory db
            Assert.IsFalse(_memDb.KeyExists("key1"));
        }
    }
}


text:
title: About
permalink: /about/
---

To be done.


text:
package org.interonet.ldm.SwitchManager;

import org.interonet.ldm.ConfigurationCenter.IConfigurationCenter;
import org.interonet.ldm.Core.LDMCore;

import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.logging.Logger;

public class SwitchManager implements ISwitchManager {
    private NFSManager nfsManager;
    private BootImageManager bootImageManager;
    private FPGAManager fpgaManager;
    private IConfigurationCenter configurationCenter;
    private Logger logger;

    public SwitchManager(LDMCore ldmCore) {
        logger = Logger.getLogger(SwitchManager.class.getName());
        configurationCenter = ldmCore.getConfigurationCenter();
        nfsManager = new NFSManager();
        bootImageManager = new BootImageManager();
        fpgaManager = new FPGAManager();
        initNFSDirectory();
    }

    private void initNFSDirectory() {
        Collection<Process> processes = new HashSet<>();
        Map<String, String> nfsMapping = configurationCenter.getSwitchId2NFSRootDirectoryMapping();
        for (Map.Entry<String, String> entry : nfsMapping.entrySet()) {
            try {
                Process p = Runtime.getRuntime().exec("rm -rf " + entry.getValue());
                logger.info("rm -rf " + entry.getValue());
                processes.add(p);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        for (Process process : processes) {
            try {
                process.waitFor();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        logger.info("Initiate the NFS Directory Successfully.");
    }

    /*
    *   customSwitchConf should be like this.
    *
    *  {
    *     "root-fs": "http://202.117.15.79/ons_bak/1449315538610-backup.tar.xz",
    *     "boot-bin": "http://202.117.15.79/ons_bak/1449315538611-system.bit",
    *     "uImage": "http://202.117.15.79/ons_bak/1449315538612-uImage",
    *     "device-tree": "http://202.117.15.79/ons_bak/1449315538613-devicetree.dtb"
    *  }
    *
    * */
    @Override
    public void changeSwitchConf(Map<String, String> customSwitchConfGDM, Integer switchId, String controllerIP, int controllerPort) throws Exception {
        //Parameter Parsing.
        String rootFsUrl = customSwitchConfGDM.get("root-fs");
        String bootBinUrl = customSwitchConfGDM.get("boot-bin");
        String uImageUrl = customSwitchConfGDM.get("uImage");
        String deviceTreeUrl = customSwitchConfGDM.get("device-tree");

        //Url Validation.
        String urlRegex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
        if (!rootFsUrl.matches(urlRegex) ||
                !bootBinUrl.matches(urlRegex) ||
                !uImageUrl.matches(uImageUrl) ||
                !deviceTreeUrl.matches(urlRegex)) {
            logger.severe("rootFsUrl = " + rootFsUrl);
            logger.severe("bootBinUrl = " + bootBinUrl);
            logger.severe("uImageUrl = " + uImageUrl);
            logger.severe("deviceTreeUrl = " + deviceTreeUrl);
            throw new Exception("Wrong URL");
        }

        //root-fs Processing
        // 1. Download the root-fs.tar.xz from URL
        // 2. Create a directory for every switch.
        // 3. Uncompress the tar.xz file into this directory.
        // 4. change the mode bit for every file.
        try {
            nfsManager.copyCustomRootFsFileToDir(rootFsUrl, switchId);
            nfsManager.createSwitchDirectory(switchId);
            nfsManager.unCompressXZFile(switchId);
            nfsManager.changeFilePermission(switchId);
        } catch (Exception e) {
            throw e;
        }

        //uImage and devicetree.dtb Processing
        // 1. Copy the url file to the /tftpboot/0/ directory.
        try {
            bootImageManager.changeUImage(switchId, uImageUrl);
            bootImageManager.changeDeviceTree(switchId, deviceTreeUrl);
        } catch (Exception e) {
            throw e;
        }

        //boot.bin Processing.
        // 1. scp the boot.bin into every switch's /mnt/ directory.
        try {
            String username = "root";
            String hostIp = configurationCenter.getSwitchId2AddressMapping().get(switchId.toString());
            String password = "root";
            String knownHostFile = "/home/samuel/.ssh/known_hosts";
            String fileDestination = "/mnt/boot.bin";
            bootImageManager.changeBootBin(bootBinUrl, hostIp, username, password, knownHostFile, fileDestination);
        } catch (Exception e) {
            throw e;
        }
    }

    @Override
    public void changeSwitchConf(String type, Integer switchId, String controllerIp, int controllerPort) throws InterruptedException, IOException {

        switch (type) {
            case "OF1.3":
                Map<String, String> nfsMapping = configurationCenter.getSwitchId2NFSRootDirectoryMapping();
                String nfsRootPath = nfsMapping.get(switchId.toString());
                nfsManager.copyDefaultRootFsFileToDir("OF1.3", switchId, nfsRootPath, controllerIp, new Integer(controllerPort));
                break;
            case "OF1.0":
                //TODO
                logger.severe("Someone want a OF1.0 switch, but it is not available now");
                break;
            default:
                logger.severe("error: type = [" + type + "], not supported.");
                break;
        }
    }

    @Override
    public void resetSwitchConf(Integer switchID) throws InterruptedException, IOException {
        //TODO move to nfsManager
        Process process2Remove = Runtime.getRuntime().exec("rm -rf /export/" + switchID.toString());
        process2Remove.waitFor();
        logger.info("rm -rf /export/" + switchID.toString());

        Process process2RemoveTarBall = Runtime.getRuntime().exec("rm -rf /export/" + switchID.toString() + ".tar.xz");
        process2RemoveTarBall.waitFor();
        logger.info("rm -rf /export/" + switchID.toString() + ".tar.xz");
    }
}


text:
package com.amazonaws.services.route53.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * (Private hosted zones only) A complex type that contains information about an Amazon VPC.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class VPC implements Serializable, Cloneable {

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     */
    private String vPCRegion;

    private String vPCId;

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     *
     * @param vPCRegion
     *        (Private hosted zones only) The region that an Amazon VPC was created in.
     * @see VPCRegion
     */

    public void setVPCRegion(String vPCRegion) {
        this.vPCRegion = vPCRegion;
    }

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     *
     * @return (Private hosted zones only) The region that an Amazon VPC was created in.
     * @see VPCRegion
     */

    public String getVPCRegion() {
        return this.vPCRegion;
    }

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     *
     * @param vPCRegion
     *        (Private hosted zones only) The region that an Amazon VPC was created in.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VPCRegion
     */

    public VPC withVPCRegion(String vPCRegion) {
        setVPCRegion(vPCRegion);
        return this;
    }

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     *
     * @param vPCRegion
     *        (Private hosted zones only) The region that an Amazon VPC was created in.
     * @see VPCRegion
     */

    public void setVPCRegion(VPCRegion vPCRegion) {
        withVPCRegion(vPCRegion);
    }

    /**
     *

     * (Private hosted zones only) The region that an Amazon VPC was created in.
     *

     *
     * @param vPCRegion
     *        (Private hosted zones only) The region that an Amazon VPC was created in.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see VPCRegion
     */

    public VPC withVPCRegion(VPCRegion vPCRegion) {
        this.vPCRegion = vPCRegion.toString();
        return this;
    }

    /**
     * @param vPCId
     */

    public void setVPCId(String vPCId) {
        this.vPCId = vPCId;
    }

    /**
     * @return
     */

    public String getVPCId() {
        return this.vPCId;
    }

    /**
     * @param vPCId
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public VPC withVPCId(String vPCId) {
        setVPCId(vPCId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getVPCRegion() != null)
            sb.append("VPCRegion: ").append(getVPCRegion()).append(",");
        if (getVPCId() != null)
            sb.append("VPCId: ").append(getVPCId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof VPC == false)
            return false;
        VPC other = (VPC) obj;
        if (other.getVPCRegion() == null ^ this.getVPCRegion() == null)
            return false;
        if (other.getVPCRegion() != null && other.getVPCRegion().equals(this.getVPCRegion()) == false)
            return false;
        if (other.getVPCId() == null ^ this.getVPCId() == null)
            return false;
        if (other.getVPCId() != null && other.getVPCId().equals(this.getVPCId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getVPCRegion() == null) ? 0 : getVPCRegion().hashCode());
        hashCode = prime * hashCode + ((getVPCId() == null) ? 0 : getVPCId().hashCode());
        return hashCode;
    }

    @Override
    public VPC clone() {
        try {
            return (VPC) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
using Fpm.ProfileData.Entities.Core;
using Fpm.ProfileData.Entities.LookUps;
using NHibernate;
using NHibernate.Transform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fpm.ProfileData.Repositories
{
    public class CoreDataRepository : RepositoryBase, ICoreDataRepository
    {
        const string SqlColumns = " [IndicatorID] ,[Year] ,[YearRange] ,[Quarter] ,[Month] ,[AgeID] ,[SexID] ,[AreaCode] " +
                                  ",[Count] ,[Value] ,[LowerCI95] ,[UpperCI95], [LowerCI99_8] ,[UpperCI99_8] ,[Denominator] ,[Denominator_2] ,[ValueNoteId] " +
                                  ",[uploadbatchid] ,[CategoryTypeID] ,[CategoryID]";

        public CoreDataRepository()
            : this(NHibernateSessionFactory.GetSession())
        {
        }

        public CoreDataRepository(ISessionFactory sessionFactory)
            : base(sessionFactory)
        {
        }

        public IEnumerable<CoreDataSetArchive> GetCoreDataArchives(string areaCode)
        {
            var query = CurrentSession.CreateQuery("from CoreDataSetArchive cds where cds.AreaCode = :areaCode");
            query.SetParameterList("areaCode", areaCode);
            return query.List<CoreDataSetArchive>();
        }

        public void DeleteCoreDataArchive(Guid uploadBatchId)
        {
            try
            {
                transaction = CurrentSession.BeginTransaction();

                CurrentSession.CreateQuery("delete CoreDataSetArchive ca  where ca.UploadBatchId = :uploadBatchId")
                    .SetParameter("uploadBatchId", uploadBatchId)
                    .ExecuteUpdate();

                transaction.Commit();

            }
            catch (Exception exception)
            {

                HandleException(exception);
                throw;
            }
        }

        public void DeleteCoreDataSet(Guid uploadBatchId)
        {
            try
            {
                transaction = CurrentSession.BeginTransaction();

                CurrentSession.CreateQuery("delete CoreDataSet c where c.UploadBatchId = :uploadBatchId")
                    .SetParameter("uploadBatchId", uploadBatchId)
                    .ExecuteUpdate();

                transaction.Commit();

            }
            catch (Exception exception)
            {

                HandleException(exception);
                throw;
            }
        }

        public Area GetAreaDetail(string areaCode)
        {
            var q = CurrentSession.CreateQuery("from Area a where a.AreaCode = :areaCode");
            q.SetParameter("areaCode", areaCode);
            var area = q.UniqueResult<Area>();
            return area;
        }

        public void UpdateAreaDetail(Area newAreaDetail, string originalAreaCode, string loggedInUser)
        {
            try
            {
                var areaDetail = GetAreaDetail(originalAreaCode);

                areaDetail.AreaCode = newAreaDetail.AreaCode;
                areaDetail.AreaShortName = newAreaDetail.AreaShortName;
                areaDetail.AreaName = newAreaDetail.AreaName;
                areaDetail.AddressLine1 = newAreaDetail.AddressLine1;
                areaDetail.AddressLine2 = newAreaDetail.AddressLine2;
                areaDetail.AddressLine3 = newAreaDetail.AddressLine3;
                areaDetail.AddressLine4 = newAreaDetail.AddressLine4;
                areaDetail.IsCurrent = newAreaDetail.IsCurrent;
                areaDetail.Postcode = newAreaDetail.Postcode;

                transaction = CurrentSession.BeginTransaction();

                CurrentSession.Save(areaDetail);

                if (areaDetail.AreaCode != originalAreaCode)
                {
                    // Update other tables with new areacode

                    /* Columns that are updated automatically by foreign key cascade updates:
                     *  L_AreaLinks.areacode
                     *  GIS_Postcodes.areacode
                     *  L_AreaMapping.ChildLevelGeographyCode
                     *  CoreDataSet.AreaCode
                     */

                    foreach (var coreDataSetArchive in GetCoreDataArchives(originalAreaCode))
                    {
                        coreDataSetArchive.AreaCode = areaDetail.AreaCode;
                        CurrentSession.Save(coreDataSetArchive);
                    }

                    CurrentSession.GetNamedQuery("Update_AreaMapping")
                        .SetParameter("AreaCode", areaDetail.AreaCode)
                        .SetParameter("OriginalAreaCode", originalAreaCode)
                        .ExecuteUpdate();

                    // Insert Audit
                    CurrentSession.GetNamedQuery("Insert_FPMAreaAudit")
                          .SetParameter("AreaCode", areaDetail.AreaCode)
                          .SetParameter("AreaName", areaDetail.AreaName)
                          .SetParameter("AreaShortName", areaDetail.AreaShortName)
                          .SetParameter("AreaTypeId", areaDetail.AreaTypeId)
                          .SetParameter("AddressLine1", areaDetail.AddressLine1)
                          .SetParameter("AddressLine2", areaDetail.AddressLine2)
                          .SetParameter("AddressLine3", areaDetail.AddressLine3)
                          .SetParameter("AddressLine4", areaDetail.AddressLine4)
                          .SetParameter("IsCurrent", areaDetail.IsCurrent)
                          .SetParameter("Postcode", areaDetail.Postcode)

                          .SetParameter("ChangedAreaCode",
                              areaDetail.AreaCode == originalAreaCode ? (object)DBNull.Value : areaDetail.AreaCode)
                          .SetParameter("UserName", loggedInUser)
                          .SetParameter("Timestamp", DateTime.Now)
                          .ExecuteUpdate();
                }

                transaction.Commit();
            }
            catch (Exception exception)
            {
                HandleException(exception);
            }
        }

        public virtual IEnumerable<CategoryType> GetCategoryTypes(int indicatorId)
        {
            var categoryTypes = CurrentSession.GetNamedQuery("GetDistinctCategoryTypesByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .SetResultTransformer(Transformers.AliasToBean<CategoryType>())
               .List<CategoryType>()
               .OrderBy(x => x.Id);
            return categoryTypes;
        }

        public virtual IEnumerable<AreaType> GetAreaTypes(int indicatorId)
        {
            var areaTypes = CurrentSession.GetNamedQuery("GetDistinctAreaTypesByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .SetResultTransformer(Transformers.AliasToBean<AreaType>())
               .List<AreaType>();
            return areaTypes;
        }

        public virtual IEnumerable<Sex> GetSexes(int indicatorId)
        {
            var sexes = CurrentSession.GetNamedQuery("GetDistinctSexesByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .SetResultTransformer(Transformers.AliasToBean<Sex>())
               .List<Sex>();
            return sexes;
        }

        public virtual IEnumerable<Age> GetAges(int indicatorId)
        {
            var ages = CurrentSession.GetNamedQuery("GetDistinctAgesByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .SetResultTransformer(Transformers.AliasToBean<Age>())
               .List<Age>();

            return ages;
        }

        public virtual IEnumerable<int> GetYearRanges(int indicatorId)
        {
            return CurrentSession.GetNamedQuery("GetDistinctYearRangeByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .List<int>();
        }

        public virtual IEnumerable<int> GetYears(int indicatorId)
        {
            return CurrentSession.GetNamedQuery("GetDistinctYearsByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .List<int>();
        }

        public virtual IEnumerable<int> GetMonths(int indicatorId)
        {
            return CurrentSession.GetNamedQuery("GetDistinctMonthsByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .List<int>();
        }

        public virtual IEnumerable<int> GetQuarters(int indicatorId)
        {
            return CurrentSession.GetNamedQuery("GetDistinctQuartersByIndicator")
               .SetParameter("indicatorId", indicatorId)
               .List<int>();
        }

        public IEnumerable<CoreDataSet> GetCoreDataSet(int indicatorId, out int totalRows)
        {
            return GetCoreDataSet(indicatorId, null, out totalRows);
        }

        public IEnumerable<CoreDataSet> GetCoreDataSet(int indicatorId,
            Dictionary<string, object> filters, out int totalRows)
        {
            // Dynamic Query
            const string sqlSelectColumns = "SELECT Top 500 Uid, IndicatorId,Year,YearRange,Quarter,Month," +
                                            "AgeId,SexId,AreaCode,Count,Value,LowerCI95,UpperCI95,LowerCI99_8,UpperCI99_8,Denominator,Denominator_2," +
                                            "ValueNoteId,UploadBatchId,CategoryTypeId, CategoryId " +
                                            "FROM Coredataset cds ";

            const string sqlSelectCount = "SELECT count(*) totalRows FROM Coredataset cds ";

            var sqlWhere = "WHERE indicatorId = " + indicatorId;

            var sqlFilters = filters != null ? GetSqlFromFilters(filters) : string.Empty;

            totalRows = CurrentSession.CreateSQLQuery(sqlSelectCount + sqlWhere + sqlFilters)
                 .UniqueResult<int>();

            var result = CurrentSession.CreateSQLQuery(sqlSelectColumns + sqlWhere + sqlFilters)
                .SetResultTransformer(Transformers.AliasToBean<CoreDataSet>())
                .List<CoreDataSet>();

            return result;
        }

        public int DeleteCoreDataSet(int indicatorId, Dictionary<string, object> filters, string userName)
        {

            var deleteBatchId = Guid.NewGuid();

            var sqlWhere = " WHERE indicatorId = " + indicatorId + GetSqlFromFilters(filters);

            var sqlInsertArchive = "INSERT INTO Coredataset_Archive(" + SqlColumns + ", DeleteBatchId) " +
                                   "SELECT " + SqlColumns + ", '" + deleteBatchId + "' FROM Coredataset " +
                                   sqlWhere;

            var sqlDeleteCoreData = "DELETE FROM Coredataset " + sqlWhere;

            try
            {
                transaction = CurrentSession.BeginTransaction();

                // Delete all values calculated by Fingertips as they may need to be recalculated
                CurrentSession.CreateSQLQuery(string.Format("DELETE FROM CoreDataSet WHERE ValueNoteId = {0} AND IndicatorId = {1}",
                    ValueNoteIds.AggregatedFromAllKnownLowerGeographyValuesByFingertips, indicatorId))
                    .ExecuteUpdate();

                CurrentSession.CreateSQLQuery(sqlInsertArchive)
                    .ExecuteUpdate();

                var rowsDeleted = CurrentSession.CreateSQLQuery(sqlDeleteCoreData)
                    .ExecuteUpdate();

                CurrentSession.GetNamedQuery("Insert_CoreData_DeleteAudit")
                    .SetParameter("indicatorId", indicatorId)
                    .SetParameter("whereClause", sqlWhere)
                    .SetParameter("rowsDeleted", rowsDeleted)
                    .SetParameter("userName", userName)
                    .SetParameter("deleteBatchId", deleteBatchId)
                    .ExecuteUpdate();

                transaction.Commit();
                return rowsDeleted;
            }
            catch (Exception exception)
            {
                HandleException(exception);

            }
            return -1;
        }

        public void DeleteCoreDataSet(int indicatorId, int valueNoteId)
        {
            try
            {
                transaction = CurrentSession.BeginTransaction();

                var deleteBatchId = Guid.NewGuid();

                var sqlInsertArchive = string.Format(
                    "INSERT INTO Coredataset_Archive(" + SqlColumns + ", DeleteBatchId) SELECT " + SqlColumns + ", '" +
                    deleteBatchId + "' FROM Coredataset WHERE IndicatorId = {0} AND ValueNoteId = {1}", indicatorId,
                    valueNoteId);

                CurrentSession.CreateSQLQuery(sqlInsertArchive).ExecuteUpdate();

                var sql = string.Format("DELETE FROM CoreDataSet WHERE IndicatorId = {0} AND ValueNoteId = {1}",
                    indicatorId, valueNoteId);

                CurrentSession.CreateSQLQuery(sql).ExecuteUpdate();

                transaction.Commit();
            }
            catch (Exception exception)
            {
                HandleException(exception);
            }
        }

        private string GetSqlFromFilters(Dictionary<string, object> filters)
        {
            if (filters == null) return string.Empty;

            var sqlBuilder = new StringBuilder();

            foreach (var key in filters.Keys)
            {
                if (key == CoreDataFilters.AreaTypeId)
                {
                    sqlBuilder.Append(" AND AreaCode IN (SELECT areacode FROM l_areas where areatypeId = " + filters[key] + ")");
                }
                else if (key == CoreDataFilters.AreaCode)
                {
                    sqlBuilder.Append(" AND AreaCode like '%" + filters[key] + "%'");
                }
                else
                {
                    sqlBuilder.Append(" AND " + key + " = " + filters[key]);
                }
            }
            return sqlBuilder.ToString();
        }

        public bool CanDeleteDataSet(int indicatorId, string userName)
        {
            var result = CurrentSession.GetNamedQuery("CheckIfAuthorisedUser")
                .SetParameter("indicatorId", indicatorId)
                .SetParameter("userName", userName)
                .UniqueResult<int>();

            return result > 0;
        }
    }
}


text:
function mySave(flag) {
	var quota = $("input[name='applyQuota']").val();
	var productId = $("#productId").val();
	var customerBusinessType = $("input[name='customerBusinessType']:checked").val();
	if(customerBusinessType=="Type01"){
		var customerBusinessAptitude = null;
		$("input[name='customerBusinessAptitude']:checked").each(function() {
			customerBusinessAptitude = $(this).val();
		});

		if (customerBusinessAptitude==null){
			Dialog.message("客户商业类型为散件时候请选择对应的散件类型!");
		}
		/*判断当前用户能选择客户类型*/
		$("input[name='customerBusinessAptitude']:checked").each(function() {
			var value = $(this).val();
			$.ajax({
				dataType : 'json',
				type : "post",
				url : contextPath+"/intopieces/intopiecesquery/checkValue.json",
				data:{"value":value,"applyQuota":quota,"productId":productId},
				success : function(data) {
					if (!data.success) {
						Dialog.confirm(data.message, "是否移交进件对话框", function(){
							save("save",true);
							return false;
						},function(){
							/*save(flag,false);*/
							return false;
						});
					} else {
						save(flag,false);
						return false;
					}
				},
				error : function(data) {
					Dialog.closeLoad();
					Dialog.message("无法验证客户商业类型!");
					return false;
				}
			});
		});
	}else{
		checkApplyQuota(flag);
	}
}

function checkApplyQuota(flag){
	var quota = $("input[name='applyQuota']").val();
	var productId = $("#productId").val();
	/*检查授信额度*/
	$.ajax({
		dataType : 'json',
		type : "post",
		url : contextPath+"/intopieces/intopiecesquery/checkApplyQuota.json",
		data:{"applyQuota":quota,"productId":productId},
		success : function(data) {
			if (!data.success) {
				Dialog.confirm(data.message, "是否移交进件对话框", function(){
					save("save",true);
					return false;
				},function(){
					/*save(flag,false);*/
					return false;
				});
			} else {
				save(flag,false);
				return false;
			}
		},
		error : function(data) {
			Dialog.closeLoad();
			Dialog.message("授信额度检查失败!");
			return false;
		}
	});
}

function save(flag,checkFlag){
	$('#allInfoForm').ajaxSubmit({
		dataType : 'json',
		type : "post",
		data:{"operationFlag":flag,"checkFlag":checkFlag},
		success : function(data) {
			if (data.success) {
				Dialog.message(data.message,"提示", function() {
				 self.location.href=contextPath+"/intopieces/intopiecesquery/browse.page";
				 });
			} else {
				Dialog.message(data.message);
				return false;
			}
		},
		error : function(data) {
			Dialog.closeLoad();
			Dialog.message("操作失败");
			return false;
		}
	});
}

function saveCard(reloadUrl) {
	$('#allInfoForm').ajaxSubmit({
		dataType : 'json',
		type : "post",
		success : function(data) {
			if (data.success) {
				Dialog.message(data.message,"提示", function() {
				 self.location.href=reloadUrl;
				 });
			} else {
				Dialog.message(data.message);
				return false;
			}
		},
		error : function(data) {
			Dialog.closeLoad();
			Dialog.message("操作失败");
			return false;
		}
	});
}

function issuedCard(url,reloadUrl,flag){
	var id = null;
	var operationflag = true;
	if(flag){
		$("input[name='checkbox']:checked").each(function() {
			id = $(this).val();
			$(this).parent().parent().find("td").each(function(i){
				if(i==4){
					if($.trim($(this).html())=='未下发'){
						Dialog.message("未下发到机构的卡片不可以下发到客户!");
						operationflag = false;
						return false;
					}
				}
			});
		});
	}
	if(!operationflag){
		return false;
	 }

	$("input[name='checkbox']:checked").each(function() {
		id = $(this).val();
		return false;
	});
	if(id!=null){
		$.ajax({
			dataType : 'json',
			type : "post",
			url : url,
			data:{"id":id},
			success : function(data) {
				if (data.success) {
					Dialog.message(data.message,"提示", function() {
						self.location.href = reloadUrl;
					 });
				} else {
					Dialog.message(data.message);
					return false;
				}
			},
			error : function(data) {
				Dialog.closeLoad();
				Dialog.message("操作失败");
				return false;
			}
		});
	}else{
		Dialog.message("请选择要下发的卡片!");
		return;
	}
}

function viewCard(url){
	var id = null;
	$("input[name='checkbox']:checked").each(function() {
		id = $(this).val();
		return false;
	});
	if(id!=null){
		self.location.href = url+"?id="+id;
	}else{
		Dialog.message("请选择要查看的卡片!");
		return;
	}

}

function reset(){
	$('#allInfoForm')[0].reset();
}

function chooseCustomer(flag){
	if(flag){
		self.location.href = contextPath+"/intopieces/intopiecesquery/input.page?customerCardId="+$("#cardId").val();
		return;
	}else{
		var id = null;
		$("input[name='checkbox']:checked").each(function() {
			id = $(this).val();
		});
		if(id!=null){
			self.location.href = contextPath+"/intopieces/intopiecesquery/input.page?customerId="+id;
			return;
		}else{
			Dialog.message("请选择一个客户!");
			return;
		}
	}
}

function dynamicAdd(tableId){
	var list = $("#allInfoForm").find("table[id^="+tableId+"Add]");
	var cloneTable = $("#"+tableId).clone(true);
	var radioName = $(cloneTable).find("input[type='radio']").attr("name");
	if(list !=null && list.size()>0){
		cloneTable.attr("id",tableId+"Add"+(list.size()+1));
		if(radioName!=null){
			$(cloneTable).find("input[type='radio']").attr("name",radioName).attr("name",radioName+(list.size()));
		}
		cloneTable.find("input").each(function(){
			 $(this).val("");
		});
		cloneTable.insertAfter("#"+tableId+"Add"+list.size());
	}else{
		if(radioName!=null){
			$(cloneTable).find("input[type='radio']").attr("name",radioName).attr("name",radioName+"0");
		}
		cloneTable.attr("id",tableId+"Add"+1);
		cloneTable.find("input").each(function(){
			 $(this).val("");
		});
		cloneTable.insertAfter("#"+tableId);
	}
}

function dynamicDelete(tableId){
	 var list = $("#allInfoForm").find("table[id^="+tableId+"Add]");
	 if(list!=null && list.size()>0){
		var obj = $("#"+tableId+"Add"+(list.size()));
		var  name = obj.find("tr:first").find("input[type='hidden']").attr("name");
		var value = obj.find("tr:first").find("input[type='hidden']").val();
		Dialog.confirm("你确认要删除吗?", "删除对话框", function(){
			$.ajax({
				dataType : 'json',
				type : "post",
				url : contextPath+"/intopieces/intopiecesquery/delete.json",
				data:{"name":name,"value":value},
				success : function(data) {
					if (data.success) {
						Dialog.message(data.message,"提示", function() {
							$("table").remove("#"+tableId+"Add"+(list.size()));
						 });
					} else {
						Dialog.message(data.message);
						return false;
					}
				},
				error : function(data) {
					Dialog.closeLoad();
					Dialog.message("删除失败");
					return false;
				}
			});
		});
     }
	 else{
	   /*至少留一个table*/
	  /*$("table").remove("#"+tableId);*/
  }
}

$(function() {
	 $("#chineseName").autocomplete(contextPath+"/intopieces/intopiecesquery/chooseCustomerName.json", {
			minChars: 0,
			max: 12,
			autoFill: true,
			//mustMatch: true,
			matchContains: false,
			scrollHeight: 220,
			width:250,
			dataType:'json',
			parse:function(data){
				var parsed = [];
				for(var i = 0; i < data.length; i++){
					parsed[i] = {
						data : data[i] ,
						value : data[i].chineseName,
						result: data[i].chineseName// 返回的结果显示内容
					};
				}
				return parsed;
			},
			formatItem: function(item) {// 显示下拉列表的内容
				return "
 " + item.chineseName + "

" + item.telephone + "
";
			}
		});

	$("#cardId").autocomplete(contextPath+"/intopieces/intopiecesquery/selectByLike.json", {
		minChars: 0,
		max: 12,
		autoFill: true,
		matchContains: false,
		scrollHeight: 220,
		width:250,
		dataType:'json',
		parse:function(data){
			var parsed = [];
			for(var i = 0; i < data.length; i++){
				parsed[i] = {
					data : data[i] ,
					value : data[i].cardId,
					result: data[i].cardId
				};
			}
			return parsed;
		},
		formatItem: function(item) {// 显示下拉列表的内容
			return "
 " + item.cardId + "

" + item.chineseName + "
";
		}
	});

	/*第一次进来时候处理*/
	$("input[name='creditCard']:checked").each(function() {
		var value = $(this).val();
		if (value == '3') {
			$("input[name='howManyCard']").attr("readonly", false);
			$("input[name='maximumAmount']").attr("readonly", false);
			return false;
		} else {
			$("input[name='howManyCard']").val("");
			$("input[name='maximumAmount']").val("");
			$("input[name='howManyCard']").attr("readonly", "readonly");
			$("input[name='maximumAmount']").attr("readonly", "readonly");
			return false;
		}
	});
     /*值改变时候处理*/
	$("input[name='creditCard']").change(function() {
		$("input[name='creditCard']:checked").each(function() {
			var value = $(this).val();
			if (value == '3') {
				$("input[name='howManyCard']").attr("readonly", false);
				$("input[name='maximumAmount']").attr("readonly", false);
				return false;
			} else {
				$("input[name='howManyCard']").val("");
				$("input[name='maximumAmount']").val("");
				$("input[name='howManyCard']").attr("readonly", "readonly");
				$("input[name='maximumAmount']").attr("readonly", "readonly");
				return false;
			}
		});
	});

	$("#lastTr").hide();
	/*第一次进来时候处理*/
	$("input[name='customerBusinessType']:checked").each(function() {
		var value = $(this).val();
		if (value == 'Type01') {
			$("#lastTr").show();
			return false;
		}else{
			$("input[name='customerBusinessAptitude']").val("");
			$("#lastTr").hide();
		}
	});
    /*值改变时候处理*/
	$("input[name='customerBusinessType']").change(function() {
		$("input[name='customerBusinessType']:checked").each(function() {
			var value = $(this).val();
			if (value == 'Type01') {
				$("#lastTr").show();
				return false;
			}else{
				$("input[name='customerBusinessAptitude']").val("");
				$("#lastTr").hide();
			}
		});
	});

	/*第一次进来时候*/
	$("#payTypeTr").hide();
	$("input[name='isAutoPay']:checked").each(function(){
		var value = $(this).val();
		if(value=='1'){
			$("#payTypeTr").show();
		}else{
			$("#payTypeTr").hide();
			$("debitWay").val("");
			$("repaymentCardNumber").val("");
		}
	});

	/*值改变的时候*/
	$("input[name='isAutoPay']").change(function(){
		var value = $("input[name='isAutoPay']:checked").val();
		if(value=='1'){
			$("#payTypeTr").show();
		}else{
			$("#payTypeTr").hide();
			$("debitWay").val();
			$("repaymentCardNumber").val();
		}
	});

});

function selectCustomerChange(url,productId,applicationId){
	$.ajax({
		dataType : 'json',
		type : "post",
		url:url,
		data:{'productId':productId,'applicationId':applicationId},
		success : function(data) {
			if (data.success) {
					var addString = null;
					var list = $("#allInfoForm").find("table[id^=appendix]");
					if(list!=null && list.size()>0){
						list.each(function(){
							$(this).remove();
						});
						if(data.resultList1.length>0){
							addString = "

产品附件
<colgroup><col width='10%'><col width='40%'><col width='10%'><col width='40%'></colgroup>";
							$.each(data.resultList1,function(){
								var parent = this;
								addString += "
文件名称	<input type='text' name='productAccessoryName' readonly='readonly' style='width: 260px;' value='"+parent.typeName+"'>";
								$.each(data.resultList2,function(){
									if(parent.typeCode==this.appendixTypeCode){
										addString +="已上传资料<input type='hidden' name='addressAccessoriesId' value='"+this.id+"'>";
										return false;
									}
								});
								addString +="	 产品附件	<input type='file' name='file_"+parent.typeCode+"'><input type='hidden' name='appendixTypeCode' value='"+parent.typeCode+"'>
";
							});
							addString +="
";
							$("#allForm").append(addString);
						}
					}else{
						if(data.resultList1.length>0){
							addString = "

产品附件
<colgroup><col width='10%'><col width='40%'><col width='10%'><col width='40%'></colgroup>";
							$.each(data.resultList1,function(){
								var parent = this;
								addString += "
文件名称	<input type='text' name='productAccessoryName' readonly='readonly' style='width: 260px;' value='"+parent.typeName+"'>";
								$.each(data.resultList2,function(){
									if(parent.typeCode==this.appendixTypeCode){
										addString +="已上传资料<input type='hidden' name='addressAccessoriesId' value='"+this.id+"'>";
									    return false;
									}
								});
								addString +="	 产品附件	<input type='file' name='file_"+parent.typeCode+"'><input type='hidden' name='appendixTypeCode' value='"+parent.typeCode+"'>
";
							});
							addString +="
";
							$("#allForm").append(addString);
						}
					}
			} else {
				Dialog.message(data.message);
				return false;
			}
		},
		error : function(data) {
			Dialog.closeLoad();
			Dialog.message("操作失败");
			return false;
		}
	});
}

function updateIntoPices(){
	var id = null;
	var flag = true;
	$("input[name='checkbox']:checked").each(function() {
		id = $(this).val();
		$(this).parent().parent().find("td").each(function(i){
			if(i==5){
				if($.trim($(this).html())!='暂存'&&$.trim($(this).html())!='申请未通过'){
					Dialog.message("当前状态的进件不可以修改!");
					flag = false;
					return false;
				}
			}
		});
	});
	if(id!=null&&flag){
		self.location.href=contextPath+"/intopieces/intopiecesquery/input.page?intoPicesidAndCustorId="+id;
		return;
	}else{
		Dialog.message("请选择要被修改的进件!");
		return;
	}
}

function viewIntoPices(flag){
	var id = null;
	$("input[name='checkbox']:checked").each(function() {
		id = $(this).val();
	});
	if(id!=null&&flag){
		self.location.href=contextPath+"/intopieces/intopiecesquery/display.page?intoPicesidAndCustorId="+id+"&viewFlag="+flag;
		return;
	}else{
		Dialog.message("请选择要被查看的进件!");
		return;
	}
}

function linkImport(url){
	self.location.href = url;
}

function importData(url) {
	var id = null;
	var flag = true;
	$("input[name='checkbox']:checked").each(function() {
		id = $(this).val();
		$(this).parent().parent().find("td").each(function(i) {
			if (i == 6) {
				if ($.trim($(this).html()) != '审批结束') {
					Dialog.message("只有审批结束的数据才可以导出数据!");
					flag = false;
					return false;
				}
			}
		});
	});
	if(id==null){
		Dialog.message("请选择要导出的数据!");
		return false;
	}
	if (flag) {
		$.ajax({
			dataType : 'json',
			url : url + "?intoPicesidAndCustorId=" + id,
			success : function(data) {
				Dialog.message(data.message);
				return false;
			},
			error : function(data) {
				Dialog.closeLoad();
				Dialog.message("操作失败");
				return false;
			}
		});
	}
}

function importCustomer(reloadUrl){
	if($("#file").val()==""){
		Dialog.message("请选择导入文件");
		return;
	}
	var uploadTip = document.getElementById("uploadTip");
	var uploadButton = document.getElementById("uploadButton");
	uploadTip.style.display='inline';
	uploadButton.disabled='true';
	$("#excelForm").ajaxSubmit({
		dataType : 'json',
		type : "post",
		success : function(data) {
			if (data.success) {
				Dialog.message(data.message,"提示", function() {
				 self.location.href = reloadUrl;
				 });
			} else {
				Dialog.message(data.message);
				return false;
			}
		},
		error : function(data) {
			Dialog.closeLoad();
			Dialog.message("导入失败");
			return false;
		}
	});
}


text:
using System;
using System.Collections.Generic;
using NUnit.Framework;

namespace OrigoDB.Core.Test
{

    [Serializable]
    public class MyModel<T> : Model
    {
        internal List<T> Items = new List<T>();

        public void Add(T item)
        {
            Items.Add(item);
        }

        public T ItemAt(int index)
        {
            return Items[index];
        }
    }

    [Serializable]
    public class MyQuery<T> : Command<MyModel<T>,int>
    {

        public override int Execute(MyModel<T> model)
        {
            return model.Items.Count;
        }
    }

    [TestFixture]
    public class GenericModelTest
    {
        [Test]
        public void Test()
        {
            var config = new EngineConfiguration().ForIsolatedTest();
            var engine = Engine.For<MyModel<String>>(config);
            var db = engine.GetProxy();
            db.Add("Fish");
            db.Add("Dog");
            var actual = db.ItemAt(1);
            Assert.AreEqual(actual, "Dog");
            int count = engine.Execute(new MyQuery<string>());
            Assert.AreEqual(2,count);
        }
    }
}


text:
using MetaDslx.VisualStudio.Intellisense;
using MetaDslx.VisualStudio.Utilities;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MetaDslx.VisualStudio.Editor
{
    [Export(typeof(IIntellisenseControllerProvider))]
    [Name("MetaDslx Intellisence")]
    [ContentType(MetaDslxDefinition.ContentType)]
    [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]
    [TextViewRole(PredefinedTextViewRoles.EmbeddedPeekTextView)]
    public class MetaDslxIntellisenseControllerProvider : IIntellisenseControllerProvider
    {
        [Import]
        private MetaDslxMefServices _mefServices = null;

        [Import]
        internal IAsyncQuickInfoBroker QuickInfoBroker { get; set; }

        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers)
        {
            return IntellisenseController.GetOrCreate(_mefServices, (IWpfTextView)textView, subjectBuffers, this);
        }
    }
}