text:
using testing::_;
using testing::Invoke;
using testing::Pointee;
using testing::Ref;
using testing::Return;

namespace device_signals {

namespace {

constexpr char kGaiaId[] = "gaia-id";

}  // namespace

class SignalsAggregatorImplTest : public testing::Test {
 protected:
  SignalsAggregatorImplTest() {
    auto av_signal_collector = GetFakeCollector(SignalName::kAntiVirus);
    av_signal_collector_ = av_signal_collector.get();

    auto hotfix_signal_collector = GetFakeCollector(SignalName::kHotfixes);
    hotfix_signal_collector_ = hotfix_signal_collector.get();

    std::vector<std::unique_ptr<SignalsCollector>> collectors;
    collectors.push_back(std::move(av_signal_collector));
    collectors.push_back(std::move(hotfix_signal_collector));
    aggregator_ = std::make_unique<SignalsAggregatorImpl>(
        &mock_permission_service_, std::move(collectors));
  }

  void GrantUserPermission() {
    EXPECT_CALL(mock_permission_service_, CanCollectSignals(user_context_, _))
        .WillOnce([](const UserContext&,
                     UserPermissionService::CanCollectCallback callback) {
          std::move(callback).Run(UserPermission::kGranted);
        });
  }

  SignalsAggregationRequest CreateRequest() {
    SignalsAggregationRequest request;
    request.user_context = user_context_;
    return request;
  }

  std::unique_ptr<MockSignalsCollector> GetFakeCollector(
      SignalName signal_name) {
    auto mock_collector = std::make_unique<MockSignalsCollector>();
    ON_CALL(*mock_collector.get(), IsSignalSupported(_))
        .WillByDefault(Return(false));
    ON_CALL(*mock_collector.get(), IsSignalSupported(signal_name))
        .WillByDefault(Return(true));

    ON_CALL(*mock_collector.get(), GetSupportedSignalNames())
        .WillByDefault(Return(std::unordered_set<SignalName>({signal_name})));

    ON_CALL(*mock_collector.get(), GetSignal(signal_name, _, _, _))
        .WillByDefault(Invoke([&](SignalName signal_name,
                                  const SignalsAggregationRequest& request,
                                  SignalsAggregationResponse& response,
                                  base::OnceClosure done_closure) {
          std::move(done_closure).Run();
        }));

    return mock_collector;
  }

  base::test::TaskEnvironment task_environment_;
  raw_ptr<MockSignalsCollector> av_signal_collector_;
  raw_ptr<MockSignalsCollector> hotfix_signal_collector_;
  testing::StrictMock<MockUserPermissionService> mock_permission_service_;
  UserContext user_context_{kGaiaId};
  std::unique_ptr<SignalsAggregatorImpl> aggregator_;
  base::HistogramTester histogram_tester_;
};

// Tests that the aggregator will return an empty value when given an empty
// parameter dictionary.
TEST_F(SignalsAggregatorImplTest, GetSignals_NoSignal) {
  base::test::TestFuture<SignalsAggregationResponse> future;
  aggregator_->GetSignals(std::move(CreateRequest()), future.GetCallback());

  SignalsAggregationResponse response = future.Get();
  ASSERT_TRUE(response.top_level_error.has_value());
  EXPECT_EQ(response.top_level_error.value(),
            SignalCollectionError::kUnsupported);
}

// Tests that the aggregator will return an empty value when given a request
// with multiple signal names.
TEST_F(SignalsAggregatorImplTest, GetSignals_MultipleSignals) {
  auto request = CreateRequest();
  request.signal_names.emplace(SignalName::kAntiVirus);
  request.signal_names.emplace(SignalName::kHotfixes);

  base::test::TestFuture<SignalsAggregationResponse> future;
  aggregator_->GetSignals(request, future.GetCallback());

  SignalsAggregationResponse response = future.Get();
  ASSERT_TRUE(response.top_level_error.has_value());
  EXPECT_EQ(response.top_level_error.value(),
            SignalCollectionError::kUnsupported);
}

// Tests how the aggregator behaves when given a parameter with a single signal
// which is supported by one of the collectors.
TEST_F(SignalsAggregatorImplTest, GetSignals_SingleSignal_Supported) {
  GrantUserPermission();

  auto expected_signal_name = SignalName::kAntiVirus;
  auto request = CreateRequest();
  request.signal_names.emplace(expected_signal_name);

  EXPECT_CALL(*av_signal_collector_, IsSignalSupported(expected_signal_name))
      .Times(1);
  EXPECT_CALL(*av_signal_collector_,
              GetSignal(SignalName::kAntiVirus, request, _, _))
      .Times(1);

  EXPECT_CALL(*hotfix_signal_collector_, GetSignal(_, _, _, _)).Times(0);

  base::test::TestFuture<SignalsAggregationResponse> future;
  aggregator_->GetSignals(std::move(request), future.GetCallback());

  SignalsAggregationResponse response = future.Get();
  EXPECT_FALSE(response.top_level_error.has_value());

  histogram_tester_.ExpectUniqueSample(
      "Enterprise.DeviceSignals.Collection.Request", expected_signal_name, 1);
  histogram_tester_.ExpectUniqueSample(
      "Enterprise.DeviceSignals.UserPermission", UserPermission::kGranted, 1);
}

// Tests how the aggregator behaves when given a parameter with a single signal
// that no collector supports.
TEST_F(SignalsAggregatorImplTest, GetSignals_SingleSignal_Unsupported) {
  GrantUserPermission();

  auto expected_signal_name = SignalName::kFileSystemInfo;
  auto request = CreateRequest();
  request.signal_names.emplace(expected_signal_name);

  base::test::TestFuture<SignalsAggregationResponse> future;
  aggregator_->GetSignals(std::move(request), future.GetCallback());

  SignalsAggregationResponse response = future.Get();
  ASSERT_TRUE(response.top_level_error.has_value());
  EXPECT_EQ(response.top_level_error.value(),
            SignalCollectionError::kUnsupported);

  histogram_tester_.ExpectUniqueSample(
      "Enterprise.DeviceSignals.Collection.Request", expected_signal_name, 1);
  histogram_tester_.ExpectUniqueSample(
      "Enterprise.DeviceSignals.UserPermission", UserPermission::kGranted, 1);
}

// Tests how the aggregator behaves when encountering user permission errors.
TEST_F(SignalsAggregatorImplTest, GetSignals_InvalidUserPermissions) {
  std::map<UserPermission, SignalCollectionError> permission_to_error_map;
  permission_to_error_map[UserPermission::kUnaffiliated] =
      SignalCollectionError::kUnaffiliatedUser;
  permission_to_error_map[UserPermission::kMissingConsent] =
      SignalCollectionError::kConsentRequired;
  permission_to_error_map[UserPermission::kConsumerUser] =
      SignalCollectionError::kInvalidUser;
  permission_to_error_map[UserPermission::kUnknownUser] =
      SignalCollectionError::kInvalidUser;
  permission_to_error_map[UserPermission::kMissingUser] =
      SignalCollectionError::kInvalidUser;

  uint16_t item_index = 0;
  for (const auto& test_case : permission_to_error_map) {
    EXPECT_CALL(mock_permission_service_, CanCollectSignals(user_context_, _))
        .WillOnce(
            [&test_case](const UserContext&,
                         UserPermissionService::CanCollectCallback callback) {
              std::move(callback).Run(test_case.first);
            });

    // This value is not important for these test cases.
    auto expected_signal_name = SignalName::kAntiVirus;
    auto request = CreateRequest();
    request.signal_names.emplace(expected_signal_name);

    base::test::TestFuture<SignalsAggregationResponse> future;
    aggregator_->GetSignals(std::move(request), future.GetCallback());
    SignalsAggregationResponse response = future.Get();
    ASSERT_TRUE(response.top_level_error.has_value());
    EXPECT_EQ(response.top_level_error.value(), test_case.second);

    histogram_tester_.ExpectUniqueSample(
        "Enterprise.DeviceSignals.Collection.Request", expected_signal_name,
        ++item_index);
    histogram_tester_.ExpectBucketCount(
        "Enterprise.DeviceSignals.UserPermission", test_case.first, 1);
  }
}

}  // namespace device_signals


text:
package hydrograph.engine.jaxb.commandtypes;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import hydrograph.engine.jaxb.commontypes.TypeCommandComponent;

/**
 *
Java class for runSQL complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="runSQL">
 *   <complexContent>
 *     <extension base="{hydrograph/engine/jaxb/commontypes}type-command-component">
 *       <sequence>
 *         <element name="database_Connection_Name">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="databaseConnectionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="server_Name">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="ip_address" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="port_Number">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="portNumber" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="database_Name">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="databaseName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="db_User_Name">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="userName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="db_Password">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="password" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="queryCommand">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="query" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "runSQL", namespace = "hydrograph/engine/jaxb/commandtypes", propOrder = {
    "databaseConnectionName",
    "serverName",
    "portNumber",
    "databaseName",
    "dbUserName",
    "dbPassword",
    "queryCommand"
})
public class RunSQL
    extends TypeCommandComponent
{

    @XmlElement(name = "database_Connection_Name", required = true)
    protected RunSQL.DatabaseConnectionName databaseConnectionName;
    @XmlElement(name = "server_Name", required = true)
    protected RunSQL.ServerName serverName;
    @XmlElement(name = "port_Number", required = true)
    protected RunSQL.PortNumber portNumber;
    @XmlElement(name = "database_Name", required = true)
    protected RunSQL.DatabaseName databaseName;
    @XmlElement(name = "db_User_Name", required = true)
    protected RunSQL.DbUserName dbUserName;
    @XmlElement(name = "db_Password", required = true)
    protected RunSQL.DbPassword dbPassword;
    @XmlElement(required = true)
    protected RunSQL.QueryCommand queryCommand;

    /**
     * Gets the value of the databaseConnectionName property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.DatabaseConnectionName }
     *
     */
    public RunSQL.DatabaseConnectionName getDatabaseConnectionName() {
        return databaseConnectionName;
    }

    /**
     * Sets the value of the databaseConnectionName property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.DatabaseConnectionName }
     *
     */
    public void setDatabaseConnectionName(RunSQL.DatabaseConnectionName value) {
        this.databaseConnectionName = value;
    }

    /**
     * Gets the value of the serverName property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.ServerName }
     *
     */
    public RunSQL.ServerName getServerName() {
        return serverName;
    }

    /**
     * Sets the value of the serverName property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.ServerName }
     *
     */
    public void setServerName(RunSQL.ServerName value) {
        this.serverName = value;
    }

    /**
     * Gets the value of the portNumber property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.PortNumber }
     *
     */
    public RunSQL.PortNumber getPortNumber() {
        return portNumber;
    }

    /**
     * Sets the value of the portNumber property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.PortNumber }
     *
     */
    public void setPortNumber(RunSQL.PortNumber value) {
        this.portNumber = value;
    }

    /**
     * Gets the value of the databaseName property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.DatabaseName }
     *
     */
    public RunSQL.DatabaseName getDatabaseName() {
        return databaseName;
    }

    /**
     * Sets the value of the databaseName property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.DatabaseName }
     *
     */
    public void setDatabaseName(RunSQL.DatabaseName value) {
        this.databaseName = value;
    }

    /**
     * Gets the value of the dbUserName property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.DbUserName }
     *
     */
    public RunSQL.DbUserName getDbUserName() {
        return dbUserName;
    }

    /**
     * Sets the value of the dbUserName property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.DbUserName }
     *
     */
    public void setDbUserName(RunSQL.DbUserName value) {
        this.dbUserName = value;
    }

    /**
     * Gets the value of the dbPassword property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.DbPassword }
     *
     */
    public RunSQL.DbPassword getDbPassword() {
        return dbPassword;
    }

    /**
     * Sets the value of the dbPassword property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.DbPassword }
     *
     */
    public void setDbPassword(RunSQL.DbPassword value) {
        this.dbPassword = value;
    }

    /**
     * Gets the value of the queryCommand property.
     *
     * @return
     *     possible object is
     *     {@link RunSQL.QueryCommand }
     *
     */
    public RunSQL.QueryCommand getQueryCommand() {
        return queryCommand;
    }

    /**
     * Sets the value of the queryCommand property.
     *
     * @param value
     *     allowed object is
     *     {@link RunSQL.QueryCommand }
     *
     */
    public void setQueryCommand(RunSQL.QueryCommand value) {
        this.queryCommand = value;
    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="databaseConnectionName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class DatabaseConnectionName {

        @XmlAttribute(name = "databaseConnectionName", required = true)
        protected String databaseConnectionName;

        /**
         * Gets the value of the databaseConnectionName property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getDatabaseConnectionName() {
            return databaseConnectionName;
        }

        /**
         * Sets the value of the databaseConnectionName property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setDatabaseConnectionName(String value) {
            this.databaseConnectionName = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="databaseName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class DatabaseName {

        @XmlAttribute(name = "databaseName", required = true)
        protected String databaseName;

        /**
         * Gets the value of the databaseName property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getDatabaseName() {
            return databaseName;
        }

        /**
         * Sets the value of the databaseName property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setDatabaseName(String value) {
            this.databaseName = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="password" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class DbPassword {

        @XmlAttribute(name = "password", required = true)
        protected String password;

        /**
         * Gets the value of the password property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getPassword() {
            return password;
        }

        /**
         * Sets the value of the password property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setPassword(String value) {
            this.password = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="userName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class DbUserName {

        @XmlAttribute(name = "userName", required = true)
        protected String userName;

        /**
         * Gets the value of the userName property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getUserName() {
            return userName;
        }

        /**
         * Sets the value of the userName property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setUserName(String value) {
            this.userName = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="portNumber" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class PortNumber {

        @XmlAttribute(name = "portNumber")
        protected String portNumber;

        /**
         * Gets the value of the portNumber property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getPortNumber() {
            return portNumber;
        }

        /**
         * Sets the value of the portNumber property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setPortNumber(String value) {
            this.portNumber = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="query" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class QueryCommand {

        @XmlAttribute(name = "query", required = true)
        protected String query;

        /**
         * Gets the value of the query property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getQuery() {
            return query;
        }

        /**
         * Sets the value of the query property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setQuery(String value) {
            this.query = value;
        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="ip_address" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class ServerName {

        @XmlAttribute(name = "ip_address", required = true)
        protected String ipAddress;

        /**
         * Gets the value of the ipAddress property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getIpAddress() {
            return ipAddress;
        }

        /**
         * Sets the value of the ipAddress property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setIpAddress(String value) {
            this.ipAddress = value;
        }

    }

}

redpajama_set_name: RedPajamaGithub


text:
package certgen

import (
	"crypto/rand"
	"crypto/rsa"
	"fmt"

	"github.com/off-sync/platform-proxy/app/interfaces"
	"github.com/off-sync/platform-proxy/common/logging"
	"github.com/off-sync/platform-proxy/domain/acme"
	"github.com/off-sync/platform-proxy/domain/certs"
	lego "github.com/xenolf/lego/acme"
	"github.com/xenolf/lego/providers/dns/route53"
)

const (
	// LetsEncryptStagingEndpoint holds the URL of the Let's Encrypt staging endpoint.
	LetsEncryptStagingEndpoint = "https://acme-staging.api.letsencrypt.org/directory"

	// LetsEncryptProductionEndpoint holds the URL of the Let's Encrypt production endpoint.
	LetsEncryptProductionEndpoint = "https://acme-v01.api.letsencrypt.org/directory"
)

// LegoACMECertGen implements the CertGen interface using the
// lego ACME library.
type LegoACMECertGen struct {
	user    *acme.Account
	client  *lego.Client
	keyBits int
}

// SetLegoLogger sets the logger used by the lego library.
func SetLegoLogger(log interfaces.Logger) error {
	if log == nil {
		return fmt.Errorf("missing logger")
	}

	lego.Logger = logging.NewStdLogAdapter(log)

	return nil
}

// NewLegoACMECertGen creates a new ACME certificate generator for the provided account.
func NewLegoACMECertGen(account *acme.Account, log interfaces.Logger) (*LegoACMECertGen, error) {
	if account == nil {
		return nil, fmt.Errorf("missing account")
	}

	if log != nil {
		SetLegoLogger(log)
	}

	acmeClient, err := lego.NewClient(account.Endpoint, account, lego.RSA4096)
	if err != nil {
		return nil, err
	}

	provider, err := route53.NewDNSProvider()
	if err != nil {
		return nil, err
	}

	acmeClient.SetChallengeProvider(lego.DNS01, provider)
	acmeClient.ExcludeChallenges([]lego.Challenge{lego.TLSSNI01, lego.HTTP01})

	return &LegoACMECertGen{
		user:    account,
		client:  acmeClient,
		keyBits: 4096,
	}, nil
}

// GenCert generates a certificate using the provided ACME endpoint.
func (g *LegoACMECertGen) GenCert(domains []string) (*certs.Certificate, error) {
	key, err := rsa.GenerateKey(rand.Reader, g.keyBits)
	if err != nil {
		return nil, fmt.Errorf("generating RSA private key: %s", err)
	}

	crt, failures := g.client.ObtainCertificate(domains, true, key, false)
	if len(failures) > 0 {
		return nil, fmt.Errorf("obtaining certificates: %v", failures)
	}

	return &certs.Certificate{
		Certificate: crt.Certificate,
		PrivateKey:  crt.PrivateKey,
	}, nil
}


text:
@interface DSPTNetworkViewController : UITableViewController

@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using eZustellSendPOC.ViewModels;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using eZustellSendPOCTests;
using Microsoft.Practices.Unity;
using eZustellSendPOC.RCService;
using LogService;

namespace eZustellSendPOC.ViewModels.Tests
{
    [TestClass()]
    public class SendPOCControllerTests : TestBase
    {
        [TestMethod()]
        public void SendPOCControllerTest()
        {
            Assert.Fail();
        }

        [TestMethod()]
        public void OnCertificateLoadedEventTest()
        {
            SendPOCController ctrl = uc.Resolve<SendPOCController>();
            Assert.Fail();
        }

        [TestMethod]
        public void SendPOCCreateDeliveryRequestTest()
        {
            var vm = uc.Resolve<SendPOCViewmodel>();
            vm.SelectedReceiver = new ReceiverViewModel()
            {
                edID = "Testedid"
            };
            vm.MessageText = "Testnachricht" + Environment.NewLine + "noch eine Zeile";
            vm.selectedDeliveryQuality = vm.DeliverQualityList[1];
            vm.SelectedDocumentClass = vm.DocClasses[1];
            vm.Subject = "Betrifft den Test";
            vm.Reference = "Aktenzeichen XY";
            string fn = @"C:\Users\jbogad\Documents\Adventkonzert_2015_Einladung.pdf";
            vm.AttachmentFileName = fn;
            vm.LockDeliveryUntil = true;
            vm.LockedUtilTime = new DateTime(1, 1, 1, 12, 00, 00);
            vm.LockedUntilDateTime = DateTime.Today.AddDays(30);
            SendDeliveryRequestType requ = vm;

            Assert.IsNotNull(requ);
        }

    }
}


text:
<?php

class A_NextGen_Pro_Masonry_Forms extends Mixin
{
    function initialize()
    {
        $this->add_form(NEXTGEN_DISPLAY_SETTINGS_SLUG, NEXTGEN_GALLERY_NEXTGEN_PRO_MASONRY);
    }
}


text:
describe :strscan_matched_size, shared: true do
  before :each do
    @s = StringScanner.new("This is a test")
  end

 it "returns the size of the most recent match" do
    @s.check(/This/)
    @s.send(@method).should == 4
    @s.send(@method).should == 4
    @s.scan(//)
    @s.send(@method).should == 0
  end

  it "returns nil if there was no recent match" do
    @s.send(@method).should == nil
    @s.check(/\d+/)
    @s.send(@method).should == nil
    @s.terminate
    @s.send(@method).should == nil
  end
end


text:
#include <iostream>

#include "abstractoperationnode.h"

using namespace std;

namespace Model
{
namespace Node
{
namespace Operation
{

class XorOperationNode: public AbstractOperationNode
{
public:
    XorOperationNode();
    int getType();
    void debugOutput(int nestingLevel);
    string debugExpression();

    XorOperationNode *clone();
};

}
}
}

#endif // MODEL_NODE_OPERATION_XOROPERATIONNODE_H


text:
<?php
namespace Gamegos\Util\Collection\Exception;

/* Imports from PHP core */
use InvalidArgumentException;

/**
 * Invalid Collectable Exception
 * Thrown when expected and actual collectable classes do not match.
 * @author Safak Ozpinar <safak@gamegos.com>
 */
class InvalidCollectableException extends InvalidArgumentException
{

}


text:
class CreateQqwryIps < ActiveRecord::Migration
  def change
    create_table :qqwry_ips do |t|
      t.string :start_long
      t.string :end_long
      t.string :country
      t.string :location
      t.string :start_ip
      t.string :end_ip

      t.timestamps
    end

    add_index :qqwry_ips, :start_long
    add_index :qqwry_ips, :end_long
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Country List</title>
<select name="country">
    <option value="UZ">Ўзбекистон</option>
</select>


text:
var argscheck = require('cordova/argscheck');

var MenuItem = function (id, name, handler) {
    this.id = id;
    this.name = name;
    this.handler = handler;
    this.enabled = true;
    this.visibility = true;
}

MenuItem.prototype.setEnabled = function (enable) {
    argscheck.checkArgs('O', 'MenuItem.setEnabled', arguments);
    this.enabled = enable;
    return this;
}

MenuItem.prototype.setVisibility = function (visible) {
    argscheck.checkArgs('O', 'MenuItem.setVisibility', arguments);
    this.visibility = visible;
    return this;
}

module.exports = MenuItem;


text:
using System;
namespace Visitor
{
    public abstract class Visitor
    {
        public abstract void VisitConcreteElementA(ElementA elementA);
        public abstract void VisitConcreteElementB(ElementB elementB);
    }
}


text:
namespace nodelt {
  class TorrentHandleWrap: public node::ObjectWrap {
    public:
      static void Initialize(v8::Handle<v8::Object> target);
      static v8::Local<v8::Object> New(const libtorrent::torrent_handle& th);
      static libtorrent::torrent_handle* Unwrap(const v8::Local<v8::Object>& obj) {
        return node::ObjectWrap::Unwrap<TorrentHandleWrap>(obj)->obj_;
      };

    private:
      libtorrent::torrent_handle* obj_;
      TorrentHandleWrap();
      ~TorrentHandleWrap();
      static v8::Persistent<v8::Function> constructor;
      static v8::Handle<v8::Value> NewInstance(const v8::Arguments& args);

      static v8::Handle<v8::Value> get_peer_info(const v8::Arguments& args);
      static v8::Handle<v8::Value> status(const v8::Arguments& args);
      static v8::Handle<v8::Value> get_download_queue(const v8::Arguments& args);
      static v8::Handle<v8::Value> file_progress(const v8::Arguments& args);
      static v8::Handle<v8::Value> trackers(const v8::Arguments& args);
      static v8::Handle<v8::Value> replace_trackers(const v8::Arguments& args);
      static v8::Handle<v8::Value> add_tracker(const v8::Arguments& args);
      static v8::Handle<v8::Value> add_url_seed(const v8::Arguments& args);
      static v8::Handle<v8::Value> remove_url_seed(const v8::Arguments& args);
      static v8::Handle<v8::Value> url_seeds(const v8::Arguments& args);
      static v8::Handle<v8::Value> add_http_seed(const v8::Arguments& args);
      static v8::Handle<v8::Value> remove_http_seed(const v8::Arguments& args);
      static v8::Handle<v8::Value> http_seeds(const v8::Arguments& args);
      static v8::Handle<v8::Value> get_torrent_info(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_metadata(const v8::Arguments& args);
      static v8::Handle<v8::Value> is_valid(const v8::Arguments& args);
      static v8::Handle<v8::Value> pause(const v8::Arguments& args);
      static v8::Handle<v8::Value> resume(const v8::Arguments& args);
      static v8::Handle<v8::Value> clear_error(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_priority(const v8::Arguments& args);
      static v8::Handle<v8::Value> super_seeding(const v8::Arguments& args);

      static v8::Handle<v8::Value> auto_managed(const v8::Arguments& args);
      static v8::Handle<v8::Value> queue_position(const v8::Arguments& args);
      static v8::Handle<v8::Value> queue_position_up(const v8::Arguments& args);
      static v8::Handle<v8::Value> queue_position_down(const v8::Arguments& args);
      static v8::Handle<v8::Value> queue_position_top(const v8::Arguments& args);
      static v8::Handle<v8::Value> queue_position_bottom(const v8::Arguments& args);

#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
      static v8::Handle<v8::Value> resolve_countries(const v8::Arguments& args);
#endif

      static v8::Handle<v8::Value> add_piece(const v8::Arguments& args);
      static v8::Handle<v8::Value> read_piece(const v8::Arguments& args);
      static v8::Handle<v8::Value> have_piece(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_piece_deadline(const v8::Arguments& args);
      static v8::Handle<v8::Value> reset_piece_deadline(const v8::Arguments& args);
      static v8::Handle<v8::Value> piece_availability(const v8::Arguments& args);
      static v8::Handle<v8::Value> piece_priority(const v8::Arguments& args);
      static v8::Handle<v8::Value> prioritize_pieces(const v8::Arguments& args);
      static v8::Handle<v8::Value> piece_priorities(const v8::Arguments& args);
      static v8::Handle<v8::Value> prioritize_files(const v8::Arguments& args);
      static v8::Handle<v8::Value> file_priorities(const v8::Arguments& args);
      static v8::Handle<v8::Value> file_priority(const v8::Arguments& args);
      static v8::Handle<v8::Value> use_interface(const v8::Arguments& args);
      static v8::Handle<v8::Value> save_resume_data(const v8::Arguments& args);
      static v8::Handle<v8::Value> need_save_resume_data(const v8::Arguments& args);
      static v8::Handle<v8::Value> force_reannounce(const v8::Arguments& args);
#ifndef TORRENT_DISABLE_DHT
      static v8::Handle<v8::Value> force_dht_announce(const v8::Arguments& args);
#endif
      static v8::Handle<v8::Value> scrape_tracker(const v8::Arguments& args);
      static v8::Handle<v8::Value> name(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_upload_mode(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_share_mode(const v8::Arguments& args);
      static v8::Handle<v8::Value> flush_cache(const v8::Arguments& args);
      static v8::Handle<v8::Value> apply_ip_filter(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_upload_limit(const v8::Arguments& args);
      static v8::Handle<v8::Value> upload_limit(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_download_limit(const v8::Arguments& args);
      static v8::Handle<v8::Value> download_limit(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_sequential_download(const v8::Arguments& args);
      static v8::Handle<v8::Value> connect_peer(const v8::Arguments& args);
      static v8::Handle<v8::Value> save_path(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_max_uploads(const v8::Arguments& args);
      static v8::Handle<v8::Value> max_uploads(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_max_connections(const v8::Arguments& args);
      static v8::Handle<v8::Value> max_connections(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_tracker_login(const v8::Arguments& args);
      static v8::Handle<v8::Value> move_storage(const v8::Arguments& args);
      static v8::Handle<v8::Value> info_hash(const v8::Arguments& args);
      static v8::Handle<v8::Value> force_recheck(const v8::Arguments& args);
      static v8::Handle<v8::Value> rename_file(const v8::Arguments& args);
      static v8::Handle<v8::Value> set_ssl_certificate(const v8::Arguments& args);
  };
};

#endif // NODE_LIBTORRENT_TORRENT_HANDLE_HPP_INCLUDED


text:
class Task < ActiveRecord::Base
  belongs_to :list

  attr_accessible :name, :finished, :due_on

  validates :name, :presence => true, :uniqueness => {:scope => :list_id}
end


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

<title>org.hibernate.boot.model.process.internal (Hibernate JavaDocs)</title>
<meta name="date" content="2017-01-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

org.hibernate.boot.model.process.internal

Classes

ManagedResourcesImpl

ScanningCoordinator


text:
"""
Django settings for mysite project.

Generated by 'django-admin startproject' using Django 1.9.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_DIR = (os.path.join(BASE_DIR, 'templates'),)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'bgpfo3kv)zt6^2^q1yc$2mqpr8hm_!l+bld4jyn5!6qjo%dpfj'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

LOGIN_REDIRECT_URL = "/index/"

LOGIN_URL = "/accounts/login/"

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'charge',
]

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'mysite.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mysite.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'charge',
        'USER' : 'TaaD',
        'PASSWORD' : 'farnwang',
        'HOST' : '140.112.42.140',
        'PORT' : '',
    }
}

# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Taipei'

USE_I18N = True

USE_L10N = True

USE_TZ = False

# Session settings
#SESSION_EXPIRE_AT_BROWSER_CLOSE = True

#SESSION_COOKIE_AGE = 1800     #30 mins

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)


text:
from __future__ import unicode_literals

from django.db import migrations, models
import django_pgjson.fields

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Page',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('_data', django_pgjson.fields.JsonField(default={})),
                ('url', models.CharField(max_length=255, unique=True)),
                ('title', models.CharField(max_length=255)),
                ('content', django_pgjson.fields.JsonField(default={'blockLists': [[], []], 'blocks': []})),
            ],
            options={
                'abstract': False,
            },
        ),
    ]


text:
module ActiveMerchant #:nodoc:
  module Shipping

    class RateResponse < Response

      attr_reader :rates
      attr_reader :xml

      def initialize(success, message, params = {}, options = {})
        @rates = Array(options[:estimates] || options[:rates] || options[:rate_estimates])
        @xml = options[:xml]
        unless success
          msg = "Error in getting rates response [XML RESPONSE IS]: #{options[:xml]}"
          if defined? Rails.logger
            Rails.logger.error msg
          else
            $stderr.puts msg
          end
        end

        super
      end

      alias_method :estimates, :rates
      alias_method :rate_estimates, :rates
    end
  end
end


text:
/* eslint-disable no-console */

const express = require('express');
const webpack = require('webpack');
const webpackDevServer = require('webpack-dev-server');
const config = require('./webpack.config');
const randomString = require('randomstring');

const compiler = webpack(config);
const FIXTURES = `${__dirname}/__tests__/fixtures`;

const server = new webpackDevServer(compiler, {
  publicPath: config.output.publicPath,
  stats: {
    colors: true
  }
  /* Enable this to use a QuotaService instance directly for development.
  proxy: {
    '/api': 'http://localhost:8080'
  }
  */
});

server.app.get('/api/capabilities', (req, res) =>
  res.sendFile(`${FIXTURES}/capabilities.json`)
);

server.app.get('/api/configs', (req, res) =>
  res.sendFile(`${FIXTURES}/configs.json`)
);

server.app.get('/api/stats/:namespace', (req, res) => {
  function generate() {
    const results = new Array(Math.round(Math.random() * 5) + 5);

    for (let i = 0; i < results.length; i++) {
      results[i] = {
        bucket: randomString.generate(),
        value: Math.round(Math.random() * 1000) + 1000
      };
    }
    return results;
  }

  res.send({
    namespace: req.params.namespace,
    topHits: generate(),
    topMisses: generate(),
  });
});

server.app.use(express.static(__dirname));

server.listen(3000, 'localhost', err => {
  if (err) {
    console.log(err);
  }

  console.log('👉 Running at http://localhost:3000');
  console.log('✋ configs & capabilities are served from ./__tests__/fixtures/');
});


text:
<?php

namespace Google\AdsApi\AdWords\v201705\cm;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class ReportDefinitionErrorReason
{
    const INVALID_DATE_RANGE_FOR_REPORT = 'INVALID_DATE_RANGE_FOR_REPORT';
    const INVALID_FIELD_NAME_FOR_REPORT = 'INVALID_FIELD_NAME_FOR_REPORT';
    const UNABLE_TO_FIND_MAPPING_FOR_THIS_REPORT = 'UNABLE_TO_FIND_MAPPING_FOR_THIS_REPORT';
    const INVALID_COLUMN_NAME_FOR_REPORT = 'INVALID_COLUMN_NAME_FOR_REPORT';
    const INVALID_REPORT_DEFINITION_ID = 'INVALID_REPORT_DEFINITION_ID';
    const REPORT_SELECTOR_CANNOT_BE_NULL = 'REPORT_SELECTOR_CANNOT_BE_NULL';
    const NO_ENUMS_FOR_THIS_COLUMN_NAME = 'NO_ENUMS_FOR_THIS_COLUMN_NAME';
    const INVALID_VIEW = 'INVALID_VIEW';
    const SORTING_NOT_SUPPORTED = 'SORTING_NOT_SUPPORTED';
    const PAGING_NOT_SUPPORTED = 'PAGING_NOT_SUPPORTED';
    const CUSTOMER_SERVING_TYPE_REPORT_MISMATCH = 'CUSTOMER_SERVING_TYPE_REPORT_MISMATCH';
    const CLIENT_SELECTOR_NO_CUSTOMER_IDENTIFIER = 'CLIENT_SELECTOR_NO_CUSTOMER_IDENTIFIER';
    const CLIENT_SELECTOR_INVALID_CUSTOMER_ID = 'CLIENT_SELECTOR_INVALID_CUSTOMER_ID';
    const REPORT_DEFINITION_ERROR = 'REPORT_DEFINITION_ERROR';

}


text:
ACCEPTED

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

#### Published in
null

#### Original name
Calycothrix asperula Schauer

### Remarks
null


text:
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";

const Hook = require("./Hook");
const HookCodeFactory = require("./HookCodeFactory");

class SyncWaterfallHookCodeFactory extends HookCodeFactory {
	content({ onError, onResult, onDone, rethrowIfPossible }) {
		return this.callTapsSeries({
			onError: (i, err) => onError(err),
			onResult: (i, result, next) => {
				let code = "";
				code += `if(${result} !== undefined) {\n`;
				code += `${this._args[0]} = ${result};\n`;
				code += `}\n`;
				code += next();
				return code;
			},
			onDone: () => onResult(this._args[0]),
			rethrowIfPossible
		});
	}
}

const factory = new SyncWaterfallHookCodeFactory();

class SyncWaterfallHook extends Hook {
	constructor(args) {
		super(args);
		if(args.length < 1) throw new Error("Waterfall hooks must have at least one argument");
	}

	tapAsync() {
		throw new Error("tapAsync is not supported on a SyncWaterfallHook");
	}

	tapPromise() {
		throw new Error("tapPromise is not supported on a SyncWaterfallHook");
	}

	compile(options) {
		factory.setup(this, options);
		return factory.create(options);
	}
}

module.exports = SyncWaterfallHook;


text:
<?php if (!defined('ABSPATH')) die(); ?>

<!--[if lte IE 7]>
  <script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/json3.min.js"></script>
<![endif]-->

<!--[if lt IE 9]>
  <script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/html5-shiv.min.js"></script>
  <script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/respond.min.js"></script>
<![endif]-->

<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/base.js?<?php echo add_checksum_param('js/base.js')?>"></script>

<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/moment.min.js"></script>

<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/main.js?<?php echo add_checksum_param('js/main.js')?>"></script>

<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/assets/js/jquery.magnific-popup.js?<?php echo add_checksum_param('js/jquery.magnific-popup.js')?>"></script>


text:
package util;

public final class objNameFormat {

  //
  // toDotSeparator
  //
  // This function is passed a String for an object name in internal
  // form, with slash separators and returns a String for the object
  // name with dot separators.
  //
  // Some objects names may be terminated by a semicolon.  I have not
  // seen this explicitly discussed in the JVM Specification, but an
  // example is shown in section 4.3.2.  In any case, the semicolon
  // is skipped in the code below.
  //
  public static String toDotSeparator( String slashName ) {
    String newName = null;

    if (slashName != null) {
      int len;
      char ch;

      StringBuffer strBuf = new StringBuffer();

      len = slashName.length();
      for (int i = 0; i < len; i++) {
	ch = slashName.charAt( i );
	if (ch == '/') {
	  strBuf.append( '.' );
	}
	else if (ch != ';') {
	  strBuf.append( ch );
	}
      } // for
      newName = strBuf.toString();
    } // if
    return newName;
  } // toDotSeparator

  /**
    Return the last name (the leaf) in a "dot" name
    sequence.  For example, in the name
    java.lang.Character, Character is the leaf name.
   */
  String leafName( String name ) {
    String leaf = null;

    if (name != null) {
      int ix;

      ix = name.lastIndexOf( '.' );
      if (ix >= 0) {
	leaf = name.substring( ix );
      }
    }
    return leaf;
  }  // leafName

} // objNameFormat


text:
#include <freetype/internal/ftmemory.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/ftgzip.h>
#include FT_CONFIG_STANDARD_LIBRARY_H

#include <freetype/ftmoderr.h>

#undef FTERRORS_H_

#undef  FT_ERR_PREFIX
#define FT_ERR_PREFIX  Gzip_Err_
#define FT_ERR_BASE    FT_Mod_Err_Gzip

#include <freetype/fterrors.h>

#ifdef FT_CONFIG_OPTION_USE_ZLIB

#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB

#include <zlib.h>

#else /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */

  /* In this case, we include our own modified sources of the ZLib  */
  /* within the `gzip' component.  The modifications were necessary */
  /* to #include all files without conflicts, as well as preventing */
  /* the definition of `extern' functions that may cause linking    */
  /* conflicts when a program is linked with both FreeType and the  */
  /* original ZLib.                                                 */

#ifndef USE_ZLIB_ZCALLOC
#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutil.c */
#endif

  /* Note that our `zlib.h' includes `ftzconf.h' instead of `zconf.h'; */
  /* the main reason is that even a global `zlib.h' includes `zconf.h' */
  /* with                                                              */
  /*                                                                   */
  /*   #include "zconf.h"                                              */
  /*                                                                   */
  /* instead of the expected                                           */
  /*                                                                   */
  /*   #include <zconf.h>                                              */
  /*                                                                   */
  /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might   */
  /* include the wrong `zconf.h' file, leading to errors.              */
#include "zlib.h"

#undef  SLOW
#define SLOW  1  /* we can't use asm-optimized sources here! */

#if defined( _MSC_VER )      /* Visual C++ (and Intel C++)   */
  /* We disable the warning `conversion from XXX to YYY,     */
  /* possible loss of data' in order to compile cleanly with */
  /* the maximum level of warnings: zlib is non-FreeType     */
  /* code.                                                   */
#pragma warning( push )
#pragma warning( disable : 4244 )
#endif /* _MSC_VER */

  /* Urgh.  `inflate_mask' must not be declared twice -- C++ doesn't like
     this.  We temporarily disable it and load all necessary header files. */
#define NO_INFLATE_MASK
#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#undef  NO_INFLATE_MASK

  /* infutil.c must be included before infcodes.c */
#include "zutil.c"
#include "inftrees.c"
#include "infutil.c"
#include "infcodes.c"
#include "infblock.c"
#include "inflate.c"
#include "adler32.c"

#if defined( _MSC_VER )
#pragma warning( pop )
#endif

#endif /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */

/***************************************************************************/
/***************************************************************************/
/*****                                                                 *****/
/*****            Z L I B   M E M O R Y   M A N A G E M E N T          *****/
/*****                                                                 *****/
/***************************************************************************/
/***************************************************************************/

  /* it is better to use FreeType memory routines instead of raw
     'malloc/free' */

  static voidpf
  ft_gzip_alloc( voidpf  opaque,
                 uInt    items,
                 uInt    size )
  {
    FT_Memory   memory = (FT_Memory)opaque;
    FT_ULong    sz     = (FT_ULong)size * items;
    FT_Error    error;
    FT_Pointer  p      = NULL;

    /* allocate and zero out */
    FT_MEM_ALLOC( p, sz );
    return p;
  }

  static void
  ft_gzip_free( voidpf  opaque,
                voidpf  address )
  {
    FT_Memory  memory = (FT_Memory)opaque;

    FT_MEM_FREE( address );
  }

#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )

  local voidpf
  zcalloc ( voidpf    opaque,
            unsigned  items,
            unsigned  size )
  {
    return ft_gzip_alloc( opaque, items, size );
  }

  local void
  zcfree( voidpf  opaque,
          voidpf  ptr )
  {
    ft_gzip_free( opaque, ptr );
  }

#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */

/***************************************************************************/
/***************************************************************************/
/*****                                                                 *****/
/*****               Z L I B   F I L E   D E S C R I P T O R           *****/
/*****                                                                 *****/
/***************************************************************************/
/***************************************************************************/

#define FT_GZIP_BUFFER_SIZE  4096

  typedef struct  FT_GZipFileRec_
  {
    FT_Stream  source;         /* parent/source stream        */
    FT_Stream  stream;         /* embedding stream            */
    FT_Memory  memory;         /* memory allocator            */
    z_stream   zstream;        /* zlib input stream           */

    FT_ULong   start;          /* starting position, after .gz header */
    FT_Byte    input[FT_GZIP_BUFFER_SIZE];   /* input read buffer  */

    FT_Byte    buffer[FT_GZIP_BUFFER_SIZE];  /* output buffer      */
    FT_ULong   pos;                          /* position in output */
    FT_Byte*   cursor;
    FT_Byte*   limit;

  } FT_GZipFileRec, *FT_GZipFile;

  /* gzip flag byte */
#define FT_GZIP_ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
#define FT_GZIP_HEAD_CRC     0x02 /* bit 1 set: header CRC present */
#define FT_GZIP_EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
#define FT_GZIP_ORIG_NAME    0x08 /* bit 3 set: original file name present */
#define FT_GZIP_COMMENT      0x10 /* bit 4 set: file comment present */
#define FT_GZIP_RESERVED     0xE0 /* bits 5..7: reserved */

  /* check and skip .gz header - we don't support `transparent' compression */
  static FT_Error
  ft_gzip_check_header( FT_Stream  stream )
  {
    FT_Error  error;
    FT_Byte   head[4];

    if ( FT_STREAM_SEEK( 0 )       ||
         FT_STREAM_READ( head, 4 ) )
      goto Exit;

    /* head[0] && head[1] are the magic numbers;    */
    /* head[2] is the method, and head[3] the flags */
    if ( head[0] != 0x1F              ||
         head[1] != 0x8B              ||
         head[2] != Z_DEFLATED        ||
        (head[3] & FT_GZIP_RESERVED)  )
    {
      error = FT_THROW( Invalid_File_Format );
      goto Exit;
    }

    /* skip time, xflags and os code */
    (void)FT_STREAM_SKIP( 6 );

    /* skip the extra field */
    if ( head[3] & FT_GZIP_EXTRA_FIELD )
    {
      FT_UInt  len;

      if ( FT_READ_USHORT_LE( len ) ||
           FT_STREAM_SKIP( len )    )
        goto Exit;
    }

    /* skip original file name */
    if ( head[3] & FT_GZIP_ORIG_NAME )
      for (;;)
      {
        FT_UInt  c;

        if ( FT_READ_BYTE( c ) )
          goto Exit;

        if ( c == 0 )
          break;
      }

    /* skip .gz comment */
    if ( head[3] & FT_GZIP_COMMENT )
      for (;;)
      {
        FT_UInt  c;

        if ( FT_READ_BYTE( c ) )
          goto Exit;

        if ( c == 0 )
          break;
      }

    /* skip CRC */
    if ( head[3] & FT_GZIP_HEAD_CRC )
      if ( FT_STREAM_SKIP( 2 ) )
        goto Exit;

  Exit:
    return error;
  }

  static FT_Error
  ft_gzip_file_init( FT_GZipFile  zip,
                     FT_Stream    stream,
                     FT_Stream    source )
  {
    z_stream*  zstream = &zip->zstream;
    FT_Error   error   = FT_Err_Ok;

    zip->stream = stream;
    zip->source = source;
    zip->memory = stream->memory;

    zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
    zip->cursor = zip->limit;
    zip->pos    = 0;

    /* check and skip .gz header */
    {
      stream = source;

      error = ft_gzip_check_header( stream );
      if ( error )
        goto Exit;

      zip->start = FT_STREAM_POS();
    }

    /* initialize zlib -- there is no zlib header in the compressed stream */
    zstream->zalloc = ft_gzip_alloc;
    zstream->zfree  = ft_gzip_free;
    zstream->opaque = stream->memory;

    zstream->avail_in = 0;
    zstream->next_in  = zip->buffer;

    if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
         !zstream->next_in                           )
      error = FT_THROW( Invalid_File_Format );

  Exit:
    return error;
  }

  static void
  ft_gzip_file_done( FT_GZipFile  zip )
  {
    z_stream*  zstream = &zip->zstream;

    inflateEnd( zstream );

    /* clear the rest */
    zstream->zalloc    = NULL;
    zstream->zfree     = NULL;
    zstream->opaque    = NULL;
    zstream->next_in   = NULL;
    zstream->next_out  = NULL;
    zstream->avail_in  = 0;
    zstream->avail_out = 0;

    zip->memory = NULL;
    zip->source = NULL;
    zip->stream = NULL;
  }

  static FT_Error
  ft_gzip_file_reset( FT_GZipFile  zip )
  {
    FT_Stream  stream = zip->source;
    FT_Error   error;

    if ( !FT_STREAM_SEEK( zip->start ) )
    {
      z_stream*  zstream = &zip->zstream;

      inflateReset( zstream );

      zstream->avail_in  = 0;
      zstream->next_in   = zip->input;
      zstream->avail_out = 0;
      zstream->next_out  = zip->buffer;

      zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
      zip->cursor = zip->limit;
      zip->pos    = 0;
    }

    return error;
  }

  static FT_Error
  ft_gzip_file_fill_input( FT_GZipFile  zip )
  {
    z_stream*  zstream = &zip->zstream;
    FT_Stream  stream  = zip->source;
    FT_ULong   size;

    if ( stream->read )
    {
      size = stream->read( stream, stream->pos, zip->input,
                           FT_GZIP_BUFFER_SIZE );
      if ( size == 0 )
      {
        zip->limit = zip->cursor;
        return FT_THROW( Invalid_Stream_Operation );
      }
    }
    else
    {
      size = stream->size - stream->pos;
      if ( size > FT_GZIP_BUFFER_SIZE )
        size = FT_GZIP_BUFFER_SIZE;

      if ( size == 0 )
      {
        zip->limit = zip->cursor;
        return FT_THROW( Invalid_Stream_Operation );
      }

      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
    }
    stream->pos += size;

    zstream->next_in  = zip->input;
    zstream->avail_in = size;

    return FT_Err_Ok;
  }

  static FT_Error
  ft_gzip_file_fill_output( FT_GZipFile  zip )
  {
    z_stream*  zstream = &zip->zstream;
    FT_Error   error   = FT_Err_Ok;

    zip->cursor        = zip->buffer;
    zstream->next_out  = zip->cursor;
    zstream->avail_out = FT_GZIP_BUFFER_SIZE;

    while ( zstream->avail_out > 0 )
    {
      int  err;

      if ( zstream->avail_in == 0 )
      {
        error = ft_gzip_file_fill_input( zip );
        if ( error )
          break;
      }

      err = inflate( zstream, Z_NO_FLUSH );

      if ( err == Z_STREAM_END )
      {
        zip->limit = zstream->next_out;
        if ( zip->limit == zip->cursor )
          error = FT_THROW( Invalid_Stream_Operation );
        break;
      }
      else if ( err != Z_OK )
      {
        zip->limit = zip->cursor;
        error      = FT_THROW( Invalid_Stream_Operation );
        break;
      }
    }

    return error;
  }

  /* fill output buffer; `count' must be <= FT_GZIP_BUFFER_SIZE */
  static FT_Error
  ft_gzip_file_skip_output( FT_GZipFile  zip,
                            FT_ULong     count )
  {
    FT_Error  error = FT_Err_Ok;

    for (;;)
    {
      FT_ULong  delta = (FT_ULong)( zip->limit - zip->cursor );

      if ( delta >= count )
        delta = count;

      zip->cursor += delta;
      zip->pos    += delta;

      count -= delta;
      if ( count == 0 )
        break;

      error = ft_gzip_file_fill_output( zip );
      if ( error )
        break;
    }

    return error;
  }

  static FT_ULong
  ft_gzip_file_io( FT_GZipFile  zip,
                   FT_ULong     pos,
                   FT_Byte*     buffer,
                   FT_ULong     count )
  {
    FT_ULong  result = 0;
    FT_Error  error;

    /* Reset inflate stream if we're seeking backwards.        */
    /* Yes, that is not too efficient, but it saves memory :-) */
    if ( pos < zip->pos )
    {
      error = ft_gzip_file_reset( zip );
      if ( error )
        goto Exit;
    }

    /* skip unwanted bytes */
    if ( pos > zip->pos )
    {
      error = ft_gzip_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );
      if ( error )
        goto Exit;
    }

    if ( count == 0 )
      goto Exit;

    /* now read the data */
    for (;;)
    {
      FT_ULong  delta;

      delta = (FT_ULong)( zip->limit - zip->cursor );
      if ( delta >= count )
        delta = count;

      FT_MEM_COPY( buffer, zip->cursor, delta );
      buffer      += delta;
      result      += delta;
      zip->cursor += delta;
      zip->pos    += delta;

      count -= delta;
      if ( count == 0 )
        break;

      error = ft_gzip_file_fill_output( zip );
      if ( error )
        break;
    }

  Exit:
    return result;
  }

/***************************************************************************/
/***************************************************************************/
/*****                                                                 *****/
/*****               G Z   E M B E D D I N G   S T R E A M             *****/
/*****                                                                 *****/
/***************************************************************************/
/***************************************************************************/

  static void
  ft_gzip_stream_close( FT_Stream  stream )
  {
    FT_GZipFile  zip    = (FT_GZipFile)stream->descriptor.pointer;
    FT_Memory    memory = stream->memory;

    if ( zip )
    {
      /* finalize gzip file descriptor */
      ft_gzip_file_done( zip );

      FT_FREE( zip );

      stream->descriptor.pointer = NULL;
    }

    if ( !stream->read )
      FT_FREE( stream->base );
  }

  static unsigned long
  ft_gzip_stream_io( FT_Stream       stream,
                     unsigned long   offset,
                     unsigned char*  buffer,
                     unsigned long   count )
  {
    FT_GZipFile  zip = (FT_GZipFile)stream->descriptor.pointer;

    return ft_gzip_file_io( zip, offset, buffer, count );
  }

  static FT_ULong
  ft_gzip_get_uncompressed_size( FT_Stream  stream )
  {
    FT_Error  error;
    FT_ULong  old_pos;
    FT_ULong  result = 0;

    old_pos = stream->pos;
    if ( !FT_Stream_Seek( stream, stream->size - 4 ) )
    {
      result = FT_Stream_ReadULongLE( stream, &error );
      if ( error )
        result = 0;

      (void)FT_Stream_Seek( stream, old_pos );
    }

    return result;
  }

  /* documentation is in ftgzip.h */

  FT_EXPORT_DEF( FT_Error )
  FT_Stream_OpenGzip( FT_Stream  stream,
                      FT_Stream  source )
  {
    FT_Error     error;
    FT_Memory    memory;
    FT_GZipFile  zip = NULL;

    if ( !stream || !source )
    {
      error = FT_THROW( Invalid_Stream_Handle );
      goto Exit;
    }

    memory = source->memory;

    /*
     * check the header right now; this prevents allocating un-necessary
     * objects when we don't need them
     */
    error = ft_gzip_check_header( source );
    if ( error )
      goto Exit;

    FT_ZERO( stream );
    stream->memory = memory;

    if ( !FT_QNEW( zip ) )
    {
      error = ft_gzip_file_init( zip, stream, source );
      if ( error )
      {
        FT_FREE( zip );
        goto Exit;
      }

      stream->descriptor.pointer = zip;
    }

    /*
     * We use the following trick to try to dramatically improve the
     * performance while dealing with small files.  If the original stream
     * size is less than a certain threshold, we try to load the whole font
     * file into memory.  This saves us from using the 32KB buffer needed
     * to inflate the file, plus the two 4KB intermediate input/output
     * buffers used in the `FT_GZipFile' structure.
     */
    {
      FT_ULong  zip_size = ft_gzip_get_uncompressed_size( source );

      if ( zip_size != 0 && zip_size < 40 * 1024 )
      {
        FT_Byte*  zip_buff = NULL;

        if ( !FT_QALLOC( zip_buff, zip_size ) )
        {
          FT_ULong  count;

          count = ft_gzip_file_io( zip, 0, zip_buff, zip_size );
          if ( count == zip_size )
          {
            ft_gzip_file_done( zip );
            FT_FREE( zip );

            stream->descriptor.pointer = NULL;

            stream->size  = zip_size;
            stream->pos   = 0;
            stream->base  = zip_buff;
            stream->read  = NULL;
            stream->close = ft_gzip_stream_close;

            goto Exit;
          }

          ft_gzip_file_io( zip, 0, NULL, 0 );
          FT_FREE( zip_buff );
        }
        error = FT_Err_Ok;
      }

      if ( zip_size )
        stream->size = zip_size;
      else
        stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */
    }

    stream->pos   = 0;
    stream->base  = NULL;
    stream->read  = ft_gzip_stream_io;
    stream->close = ft_gzip_stream_close;

  Exit:
    return error;
  }

  /* documentation is in ftgzip.h */

  FT_EXPORT_DEF( FT_Error )
  FT_Gzip_Uncompress( FT_Memory       memory,
                      FT_Byte*        output,
                      FT_ULong*       output_len,
                      const FT_Byte*  input,
                      FT_ULong        input_len )
  {
    z_stream  stream;
    int       err;

    /* check for `input' delayed to `inflate' */

    if ( !memory || !output_len || !output )
      return FT_THROW( Invalid_Argument );

    /* this function is modeled after zlib's `uncompress' function */

    stream.next_in  = (Bytef*)input;
    stream.avail_in = (uInt)input_len;

    stream.next_out  = output;
    stream.avail_out = (uInt)*output_len;

    stream.zalloc = ft_gzip_alloc;
    stream.zfree  = ft_gzip_free;
    stream.opaque = memory;

    /* This is a temporary fix and will be removed once the internal
     * copy of zlib is updated to the newest version. The `|32' flag
     * is only supported in the new versions of zlib to enable gzip
     * encoded header.
     */
#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
    err = inflateInit2( &stream, MAX_WBITS|32 );
#else
    err = inflateInit2( &stream, MAX_WBITS );
#endif

    if ( err != Z_OK )
      return FT_THROW( Invalid_Argument );

    err = inflate( &stream, Z_FINISH );
    if ( err != Z_STREAM_END )
    {
      inflateEnd( &stream );
      if ( err == Z_OK )
        err = Z_BUF_ERROR;
    }
    else
    {
      *output_len = stream.total_out;

      err = inflateEnd( &stream );
    }

    if ( err == Z_MEM_ERROR )
      return FT_THROW( Out_Of_Memory );

    if ( err == Z_BUF_ERROR )
      return FT_THROW( Array_Too_Large );

    if ( err == Z_DATA_ERROR )
      return FT_THROW( Invalid_Table );

    return FT_Err_Ok;
  }

#else /* !FT_CONFIG_OPTION_USE_ZLIB */

  FT_EXPORT_DEF( FT_Error )
  FT_Stream_OpenGzip( FT_Stream  stream,
                      FT_Stream  source )
  {
    FT_UNUSED( stream );
    FT_UNUSED( source );

    return FT_THROW( Unimplemented_Feature );
  }

  FT_EXPORT_DEF( FT_Error )
  FT_Gzip_Uncompress( FT_Memory       memory,
                      FT_Byte*        output,
                      FT_ULong*       output_len,
                      const FT_Byte*  input,
                      FT_ULong        input_len )
  {
    FT_UNUSED( memory );
    FT_UNUSED( output );
    FT_UNUSED( output_len );
    FT_UNUSED( input );
    FT_UNUSED( input_len );

    return FT_THROW( Unimplemented_Feature );
  }

#endif /* !FT_CONFIG_OPTION_USE_ZLIB */

/* END */


text:
using DotNetNuke.Entities.Users;
using DotNetNuke.Services.Tokens;
using System.Globalization;
using System.Web;
using System.Xml;

namespace DotNetNuke.Modules.UserDefinedTable.Components
{
    public class TokenReplace : Services.Tokens.TokenReplace
    {
        readonly bool _escapeApostrophe;

        public TokenReplace() : this(false)
        {
        }

        public TokenReplace(bool escapeApostrophe)
        {
            _escapeApostrophe = escapeApostrophe;
            if (HttpContext.Current != null)
            {
                var request = HttpContext.Current.Request;
                PropertySource["querystring"] = new FilteredNameValueCollectionPropertyAccess(request.QueryString);
                PropertySource["form"] = new FilteredNameValueCollectionPropertyAccess(request.Form);
                PropertySource["server"] = new FilteredNameValueCollectionPropertyAccess(request.ServerVariables);
            }
        }

        protected override string replacedTokenValue(string objectName, string propertyName, string formatString)
        {
            var returnvalue = base.replacedTokenValue(objectName, propertyName, formatString);
            if (_escapeApostrophe)
            {
                returnvalue = returnvalue.Replace("\'", "\'\'");
            }
            return returnvalue;
        }
    }

    public class TokenReplaceForForms : Services.Tokens.BaseCustomTokenReplace
    {
        class PlaceHolderForControl_PropertyAccess : IPropertyAccess
        {
            readonly string _idprefix;
            public PlaceHolderForControl_PropertyAccess(string idprefix)
            {
                _idprefix = idprefix;
            }

            public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
            {
                return $"  <asp:PlaceHolder runat=\"server\" ID=\"{_idprefix}_{propertyName.SafeId()}\"/>";
            }

            public CacheLevel Cacheability
            {
                get { return CacheLevel.fullyCacheable; }
            }
        }
        public TokenReplaceForForms()
        {
            PropertySource["label-for"] = new PlaceHolderForControl_PropertyAccess("label_for");
            PropertySource["editor-for"] = new PlaceHolderForControl_PropertyAccess("editor_for");
        }
        public string GetControlTemplate(string input)
        {
            return this.ReplaceTokens(input);
        }
    }
}


text:
    import "github.com/facebookgo/stack"

Package stack provides utilities to capture and pass around stack traces.

This is useful for building errors that know where they originated from, to
track where a certain log event occured and so on.

The package provides stack.Multi which represents a sequence of stack traces.
Since in Go we return errors they don't necessarily end up with a single useful
stack trace. For example an error may be going thru a channel across goroutines,
in which case we may want to capture a stack trace in both (or many) goroutines.
stack.Multi in turn is made up of stack.Stack, which is a set of stack.Frames.
Each stack.Frame contains the File/Line/Name (function name). All these types
implement a pretty human readable String() function.

The GOPATH is stripped from the File location. Look at the StripGOPATH function
on instructions for how to embed to GOPATH into the binary for when deploying to
production and the GOPATH environment variable may not be set. The package name
is stripped from the Name of the function since it included in the File
location.

## Usage

#### func  StripGOPATH

```go
func StripGOPATH(f string) string
```
StripGOPATH strips the GOPATH prefix from the file path f. In development, this
will be done using the GOPATH environment variable. For production builds, where
the GOPATH environment will not be set, the GOPATH can be included in the binary
by passing ldflags, for example:

    GO_LDFLAGS="$GO_LDFLAGS -X github.com/facebookgo/stack.gopath $GOPATH"
    go install "-ldflags=$GO_LDFLAGS" my/pkg

#### func  StripPackage

```go
func StripPackage(n string) string
```
StripPackage strips the package name from the given Func.Name.

#### type Frame

```go
type Frame struct {
	File string
	Line int
	Name string
}
```

Frame identifies a file, line & function name in the stack.

#### func  Caller

```go
func Caller(skip int) Frame
```
Caller returns a single Frame for the caller. The argument skip is the number of
stack frames to ascend, with 0 identifying the caller of Callers.

#### func (Frame) String

```go
func (f Frame) String() string
```
String provides the standard file:line representation.

#### type Multi

```go
type Multi struct {
}
```

Multi represents a number of Stacks. This is useful to allow tracking a value as
it travels thru code.

#### func  CallersMulti

```go
func CallersMulti(skip int) *Multi
```
CallersMulti returns a Multi which includes one Stack for the current callers.
The argument skip is the number of stack frames to ascend, with 0 identifying
the caller of CallersMulti.

#### func (*Multi) Add

```go
func (m *Multi) Add(s Stack)
```
Add the given Stack to this Multi.

#### func (*Multi) AddCallers

```go
func (m *Multi) AddCallers(skip int)
```
AddCallers adds the Callers Stack to this Multi. The argument skip is the number
of stack frames to ascend, with 0 identifying the caller of Callers.

#### func (*Multi) Stacks

```go
func (m *Multi) Stacks() []Stack
```
Stacks returns the tracked Stacks.

#### func (*Multi) String

```go
func (m *Multi) String() string
```
String provides a human readable multi-line stack trace.

#### type Stack

```go
type Stack []Frame
```

Stack represents an ordered set of Frames.

#### func  Callers

```go
func Callers(skip int) Stack
```
Callers returns a Stack of Frames for the callers. The argument skip is the
number of stack frames to ascend, with 0 identifying the caller of Callers.

#### func (Stack) String

```go
func (s Stack) String() string
```
String provides the standard multi-line stack trace.


text:
from south.db import db
from django.db import models
from transifex.txcommon.models import *
from userprofile.countries import CountryField

class Migration:

    depends_on = (
        ("languages", "0001_initial"),
    )

    def forwards(self, orm):

        # Adding model 'Profile'
        db.create_table('txcommon_profile', (
            ('looking_for_work', models.BooleanField(_('Looking for work?'), default=False)),
            ('about', models.TextField(_('About yourself'), max_length=140, blank=True)),
            ('surname', models.CharField(_('Surname'), max_length=255, blank=True)),
            ('firstname', models.CharField(_('First name'), max_length=255, blank=True)),
            ('country', CountryField(null=True, blank=True)),
            ('twitter', models.URLField(_('Twitter'), blank=True)),
            ('native_language', models.ForeignKey(orm['languages.Language'], null=True, verbose_name=_('Native Language'), blank=True)),
            ('longitude', models.DecimalField(null=True, max_digits=10, decimal_places=6, blank=True)),
            ('creation_date', models.DateTimeField(default=datetime.datetime(2009, 7, 30, 13, 13, 50, 217271))),
            ('blog', models.URLField(_('Blog'), blank=True)),
            ('user', models.ForeignKey(orm['auth.User'], unique=True)),
            ('latitude', models.DecimalField(null=True, max_digits=10, decimal_places=6, blank=True)),
            ('linked_in', models.URLField(_('LinkedIn'), blank=True)),
            ('id', models.AutoField(primary_key=True)),
            ('location', models.CharField(max_length=255, blank=True)),
        ))
        db.send_create_signal('txcommon', ['Profile'])

    def backwards(self, orm):

        # Deleting model 'Profile'
        db.delete_table('txcommon_profile')

    models = {
        'auth.user': {
            '_stub': True,
            'id': ('models.AutoField', [], {'primary_key': 'True'})
        },
        'languages.language': {
            'Meta': {'ordering': "('name',)", 'db_table': "'translations_language'"},
            '_stub': True,
            'id': ('models.AutoField', [], {'primary_key': 'True'})
        },
        'txcommon.profile': {
            'about': ('models.TextField', ["_('About yourself')"], {'max_length': '140', 'blank': 'True'}),
            'blog': ('models.URLField', ["_('Blog')"], {'blank': 'True'}),
            'country': ('CountryField', [], {'null': 'True', 'blank': 'True'}),
            'creation_date': ('models.DateTimeField', [], {'default': 'datetime.datetime(2009, 7, 30, 13, 13, 50, 293400)'}),
            'firstname': ('models.CharField', ["_('First name')"], {'max_length': '255', 'blank': 'True'}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'latitude': ('models.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '6', 'blank': 'True'}),
            'linked_in': ('models.URLField', ["_('LinkedIn')"], {'blank': 'True'}),
            'location': ('models.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'longitude': ('models.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '6', 'blank': 'True'}),
            'looking_for_work': ('models.BooleanField', ["_('Looking for work?')"], {'default': 'False'}),
            'native_language': ('models.ForeignKey', ['Language'], {'null': 'True', 'verbose_name': "_('Native Language')", 'blank': 'True'}),
            'surname': ('models.CharField', ["_('Surname')"], {'max_length': '255', 'blank': 'True'}),
            'twitter': ('models.URLField', ["_('Twitter')"], {'blank': 'True'}),
            'user': ('models.ForeignKey', ['User'], {'unique': 'True'})
        }
    }

    complete_apps = ['txcommon']


text:
#include "maestro_cmd_ctxt.h"

maestro_cmd_ctxt_t *maestro_cmd_ctxt_new(const gru_uri_t *uri, gru_status_t *status) {
	maestro_cmd_ctxt_t *ret = gru_alloc(sizeof(maestro_cmd_ctxt_t), status);
	gru_alloc_check(ret, NULL);

	ret->vmsl = vmsl_init();

	if (!vmsl_assign_by_url(uri, &ret->vmsl)) {
		return NULL;
	}

	ret->handlers = vmslh_new(status);

	ret->queue = create_forward_queue(status);
	if (ret->queue < 0) {
		gru_status_set(status, GRU_FAILURE, "Unable to initialize forward queue: %s\n",
			status->message);

		gru_dealloc((void **) &ret);

		return NULL;
	}

	return ret;
}

void maestro_cmd_ctxt_destroy(maestro_cmd_ctxt_t **ptr) {
	logger_t  logger = gru_logger_get();
	maestro_cmd_ctxt_t *ctxt = *ptr;

	logger(GRU_DEBUG, "Destroying context");
	if (!ctxt) {
		return;
	}

	if (ctxt->msg_ctxt) {
		msg_conn_info_cleanup(&ctxt->msg_ctxt->msg_opts.conn_info);

		gru_status_t tmp = gru_status_new();

		ctxt->vmsl.stop(ctxt->msg_ctxt, &tmp);
		ctxt->vmsl.destroy(ctxt->msg_ctxt, &tmp);
	}

	vmslh_cleanup(&ctxt->handlers);

	gru_dealloc((void **) ptr);
}

bool maestro_cmd_ctxt_start(maestro_cmd_ctxt_t *cmd_ctxt, msg_opt_t opt, gru_status_t *status) {
	logger_t  logger = gru_logger_get();

	cmd_ctxt->msg_ctxt = cmd_ctxt->vmsl.init(opt, &cmd_ctxt->handlers, status);

	if (!cmd_ctxt->msg_ctxt) {
		logger(GRU_ERROR, "Failed to initialize maestro connection: %s", status->message);
		return false;
	}

	vmsl_stat_t sstat = cmd_ctxt->vmsl.start(cmd_ctxt->msg_ctxt, status);
	if (vmsl_stat_error(sstat)) {
		return false;
	}

	return true;
}

void maestro_cmd_ctxt_stop(maestro_cmd_ctxt_t *cmd_ctxt, gru_status_t *status) {
	logger_t  logger = gru_logger_get();

	logger(GRU_DEBUG, "Stopping context");
	cmd_ctxt->vmsl.stop(cmd_ctxt->msg_ctxt, status);

	gru_uri_cleanup(&cmd_ctxt->msg_ctxt->msg_opts.uri);
	msg_conn_info_cleanup(&cmd_ctxt->msg_ctxt->msg_opts.conn_info);

	cmd_ctxt->vmsl.destroy(cmd_ctxt->msg_ctxt, status);
	cmd_ctxt->msg_ctxt = NULL;
}

bool maestro_cmd_ctxt_forwarder(maestro_cmd_ctxt_t *cmd_ctxt, vmsl_mtopic_spec_t *mtopic,
								gru_status_t *status) {
	logger_t  logger = gru_logger_get();

	logger(GRU_DEBUG, "Subscribing to the Maestro topic for command forwarding");
	vmsl_stat_t rstat = cmd_ctxt->vmsl.subscribe(cmd_ctxt->msg_ctxt, mtopic, status);
	if (vmsl_stat_error(rstat)) {
		gru_status_set(status, GRU_FAILURE, "Unable to subscribe to maestro broker");

		maestro_cmd_ctxt_destroy(&cmd_ctxt);
		return false;
	}

	return true;
}

bool maestro_cmd_ctxt_send(maestro_cmd_ctxt_t *cmd_ctxt, msg_content_data_t *cmd, gru_status_t *status) {
	vmsl_stat_t rstat = cmd_ctxt->vmsl.send(cmd_ctxt->msg_ctxt, cmd, status);

	if (rstat != VMSL_SUCCESS) {
		return false;
	}

	return true;
}


text:
from django.apps import AppConfig

class ContactConfig(AppConfig):
    name = 'pdc.apps.contact'

    def ready(self):
        from pdc.apps.utils.utils import connect_app_models_pre_save_signal
        connect_app_models_pre_save_signal(self)
        from . import signals   # noqa


text:
package com.sunpeng.foundation.modules.app.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.sunpeng.foundation.common.config.Global;
import com.sunpeng.foundation.common.persistence.Page;
import com.sunpeng.foundation.common.web.BaseController;
import com.sunpeng.foundation.common.utils.StringUtils;
import com.sunpeng.foundation.modules.app.entity.AppType;
import com.sunpeng.foundation.modules.app.service.AppTypeService;

/**
 * 应用城市管理Controller
 * @author sunp
 * @version 2016-02-11
 */
@Controller
@RequestMapping(value = "${adminPath}/app/appType")
public class AppTypeController extends BaseController {

	@Autowired
	private AppTypeService appTypeService;

	@ModelAttribute
	public AppType get(@RequestParam(required=false) String id) {
		AppType entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = appTypeService.get(id);
		}
		if (entity == null){
			entity = new AppType();
		}
		return entity;
	}

	@RequiresPermissions("app:appType:view")
	@RequestMapping(value = {"list", ""})
	public String list(AppType appType, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<AppType> page = appTypeService.findPage(new Page<AppType>(request, response), appType);
		model.addAttribute("page", page);
		return "modules/app/appTypeList";
	}

	@RequiresPermissions("app:appType:view")
	@RequestMapping(value = "form")
	public String form(AppType appType, Model model) {
		model.addAttribute("appType", appType);
		return "modules/app/appTypeForm";
	}

	@RequiresPermissions("app:appType:edit")
	@RequestMapping(value = "save")
	public String save(AppType appType, Model model, RedirectAttributes redirectAttributes) {
		if (!beanValidator(model, appType)){
			return form(appType, model);
		}
		appTypeService.save(appType);
		addMessage(redirectAttributes, "保存类别成功");
		return "redirect:"+Global.getAdminPath()+"/app/appType/?repage";
	}

	@RequiresPermissions("app:appType:edit")
	@RequestMapping(value = "delete")
	public String delete(AppType appType, RedirectAttributes redirectAttributes) {
		appTypeService.delete(appType);
		addMessage(redirectAttributes, "删除类别成功");
		return "redirect:"+Global.getAdminPath()+"/app/appType/?repage";
	}

}


text:
<ion-view view-title="" name="login-view">
    <ion-content>

                	<input type="text" placeholder="Username" ng-model="data.username">

                	<input type="password" placeholder="Password" ng-model="data.pwd">

        	<button class="button button-block button-balanced" ng-click="login(data)">Login</button>

    </ion-content>
  </ion-view>


text:
<?php

namespace Phue\Transport;

/**
 * Transport Interface
 */
interface TransportInterface
{
    /**
     * Get method
     */
    const METHOD_GET = 'GET';

    /**
     * Post method
     */
    const METHOD_POST = 'POST';

    /**
     * Put method
     */
    const METHOD_PUT = 'PUT';

    /**
     * Delete method
     */
    const METHOD_DELETE = 'DELETE';

    /**
     * Send request
     *
     * @param string    $path    API path
     * @param string    $method  Request method
     * @param \stdClass $data    Body data
     *
     * @return mixed Command result
     */
    public function sendRequest($path, $method = self::METHOD_GET, \stdClass $data = null);
}


text:
.hdr-container {
    position: relative;
    margin: 0 auto;
    height: 370px;
    width: 900px;
    padding: 0;
    overflow: hidden;
}
.old-browser-hdr {
    background-image: url("/glos/img/flatHeader.png");
    background-repeat: no-repeat;
    background-position: center top;
    display: block;
    /*position:absolute;*/
    /*top:0px;*/
    width: 900px;
    height: 200px;
    z-index:1;
}
.supported-browser {
    display: none;
}
/* parallax */
@media screen and (min-width: 40em) {
    @supports ((perspective: 1px) and (not (-webkit-overflow-scrolling: touch))) {
        .old-browser-hdr {
            display: none;
        }
        .supported-browser {
            display: block;
        }
    }
}

@media screen and (min-width: 40em) {
    @supports ((perspective: 1px) and (not (-webkit-overflow-scrolling: touch))) {
        .parallax {
            scroll-behavior: smooth;
        }
        .parallax-0 {
            display: block;
            width: 100%;
            height: 90px;
            position:absolute;
            top:15px;
            transition-timing-function: ease-out;
            transition-property: all;
            transition-property: transform;
            transition-duration: 0.2s;
            background-image: url("/glos/img/img-hdr-para-layer0_p.png");
            background-repeat: no-repeat;
            background-position: center top;
            z-index:1;
        }
        .parallax-1 {
            display: block;
            width: 100%;
            height: 100px;
            position:absolute;
            top:10px;
            transition-property: all;
            transition-timing-function: ease-out;
            transition-property: transform;
            transition-duration: 0.2s;
            background-image: url("/glos/img/img-hdr-para-layer1_p.png");
            background-repeat: no-repeat;
            background-position: center top;
            z-index:2;
        }
        .parallax-2 {
            display: block;
            width: 100%;
            height: 200px;
            position:absolute;
            top:40px;
            transition-property: all;
            transition-timing-function: ease-out;
            transition-property: transform;
            transition-duration: 0.2s;
            background-image: url("/glos/img/img-hdr-para-layer2_p.png");
            background-size: 100%;
            background-repeat: no-repeat;
            background-position: center top;
            z-index:3;
        }
    }
}

.bird {
    z-index: 4;
}


text:
package io.fabric8.git.internal;

import io.fabric8.api.RuntimeProperties;
import io.fabric8.api.jcip.ThreadSafe;
import io.fabric8.api.scr.AbstractComponent;
import io.fabric8.api.scr.ValidatingReference;
import io.fabric8.api.visibility.VisibleForTesting;
import io.fabric8.git.GitListener;
import io.fabric8.git.GitService;
import io.fabric8.zookeeper.bootstrap.BootstrapConfiguration;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.RepositoryCache;

@ThreadSafe
@Component(name = "io.fabric8.git.service", label = "Fabric8 Git Service", immediate = true, metatype = false)
@Service(GitService.class)
public final class FabricGitServiceImpl extends AbstractComponent implements GitService {

    public static final String DEFAULT_GIT_PATH = "git" + File.separator + "local" + File.separator + "fabric";

    @Reference(referenceInterface = RuntimeProperties.class)
    private final ValidatingReference<RuntimeProperties> runtimeProperties = new ValidatingReference<RuntimeProperties>();
    @Reference(referenceInterface = BootstrapConfiguration.class)
    private final ValidatingReference<BootstrapConfiguration> bootstrapConfiguration = new ValidatingReference<BootstrapConfiguration>();

    private final List<GitListener> listeners = new CopyOnWriteArrayList<GitListener>();
    private File localRepo;
    private volatile String remoteUrl;
    private volatile Git git;

    @Activate
    @VisibleForTesting
    public void activate() throws IOException {
        RuntimeProperties sysprops = runtimeProperties.get();
        localRepo = sysprops.getDataPath().resolve(DEFAULT_GIT_PATH).toFile();
        if (!localRepo.exists() && !localRepo.mkdirs()) {
            throw new IOException("Failed to create local repository at:" + localRepo.getAbsolutePath());
        }

        git = openOrInit(localRepo);

        activateComponent();
    }

    @Deactivate
    void deactivate() {
        deactivateComponent();
        RepositoryCache.clear();
    }

    private Git openOrInit(File localRepo) throws IOException {
        try {
            return Git.open(localRepo);
        } catch (RepositoryNotFoundException e) {
            try {
                return Git.init().setDirectory(localRepo).call();
            } catch (GitAPIException ex) {
                throw new IOException(ex);
            }
        }
    }

    @Override
    public Git getGit() {
        assertValid();
        return git;
    }

    @Override
    public String getRemoteUrl() {
        assertValid();
        return remoteUrl;
    }

    @Override
    public void notifyRemoteChanged(String remoteUrl) {
        this.remoteUrl = remoteUrl;
        for (GitListener listener : listeners) {
            listener.onRemoteUrlChanged(remoteUrl);
        }
    }

    @Override
    public void notifyReceivePacket() {
        for (GitListener listener : listeners) {
            listener.onReceivePack();
        }
    }

    @Override
    public void addGitListener(GitListener listener) {
        listeners.add(listener);
    }

    @Override
    public void removeGitListener(GitListener listener) {
        listeners.remove(listener);
    }

    @VisibleForTesting
    public void setGitForTesting(Git git) {
        this.git = git;
    }

    @VisibleForTesting
    public void bindRuntimeProperties(RuntimeProperties service) {
        this.runtimeProperties.bind(service);
    }

    void unbindRuntimeProperties(RuntimeProperties service) {
        this.runtimeProperties.unbind(service);
    }

    void bindBootstrapConfiguration(BootstrapConfiguration service) {
        this.bootstrapConfiguration.bind(service);
    }

    void unbindBootstrapConfiguration(BootstrapConfiguration service) {
        this.bootstrapConfiguration.unbind(service);
    }
}