text:
namespace xenon
{
	namespace lib
	{

		// XNet------------------------------------------------------------------

		X_STATUS Xbox_NetDll_XNetCleanup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetConnect()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetCreateKey()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetDnsLookup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetDnsRelease()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetBroadcastVersionStatus()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetConnectStatus()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetDebugXnAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetEthernetLinkStatus()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetOpt()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetSystemLinkPort()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetTitleXnAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetGetXnAddrPlatform()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetInAddrToServer()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetInAddrToString()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetInAddrToXnAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetQosGetListenStats()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetQosListen()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetQosLookup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetQosRelease()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetQosServiceLookup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetRandom()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetRegisterKey()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetReplaceKey()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetServerToInAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetSetSystemLinkPort()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetStartup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetUnregisterInAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetUnregisterKey()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetXnAddrToInAddr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XNetXnAddrToMachineId()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XOnlineGetNatType()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// Winsock---------------------------------------------------------------

		X_STATUS Xbox_NetDll_accept()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_bind()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_closesocket()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_connect()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_getpeername()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_getsockname()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_getsockopt()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_htonl()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_htons()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_inet_addr()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_ioctlsocket()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_listen()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_ntohl()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_ntohs()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_recv()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_recvfrom()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_select()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_send()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_sendto()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_setsockopt()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_shutdown()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_socket()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSACancelOverlappedIO()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSACleanup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSACloseEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSACreateEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAEventSelect()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll___WSAFDIsSet()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAGetLastError()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAGetOverlappedResult()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSARecv()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSARecvFrom()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAResetEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSASend()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSASendTo()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSASetEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSASetLastError()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAStartup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_WSAWaitForMultipleEvents()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// XRNM ---------------------------------------------------------------------------

		X_STATUS Xbox_NetDll_XrnmAllowInboundLinkRequests()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCancelSends()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCloseHandle()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCreateEndpoint()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCreateInboundLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCreateOutboundLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmCreateSendChannel()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmDenyInboundLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmFlushSends()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetAlertSettings()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetAllChannels()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetAllLinks()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetChannelUserData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetDefaultChannelComponents()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetEndpointFromLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetHandleStatus()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetHandleUserData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetLocalAddressForEndpoint()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetOpt()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmGetRemoteAddressForLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmQueryInfo()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmReturnEvent()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmSend()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmSetAlertSettings()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmSetChannelUserData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmSetHandleUserData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmSetOpt()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmTerminateLink()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XrnmTerminateSendChannel()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// QNet ---------------------------------------------------------------------------

		X_STATUS Xbox_NetDll_QNetCreateUsingXAudio2()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// XHttp --------------------------------------------------------------------------

		X_STATUS Xbox_NetDll_XHttpCloseHandle()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpConnect()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpCrackUrl()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpCreateUrl()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpDoWork()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpOpen()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpOpenRequest()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpQueryHeaders()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpQueryOption()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpReadData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpReceiveResponse()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpSendRequest()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpSetOption()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpSetStatusCallback()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpShutdown()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpStartup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XHttpWriteData()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// XAuth --------------------------------------------------------------------------

		X_STATUS Xbox_NetDll_XAuthFreeToken()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XAuthGetRelyingPartyId()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XAuthGetToken()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XAuthInsecureSocketsAllowed()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XAuthShutdown()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XAuthStartup()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// XJSON --------------------------------------------------------------------------

		X_STATUS Xbox_NetDll_XJSONDestroy()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XJSONGetTokenValue()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XJSONInitialize()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XJSONReadToken()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		X_STATUS Xbox_NetDll_XJSONSetBuffer()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		// Endpoint discovery--------------------------------------------------------------

		X_STATUS Xbox_NetDll_XGetServiceEndpoint()
		{
			return X_STATUS_NOT_IMPLEMENTED;
		}

		//---------------------------------------------------------------------------------

		void RegisterXboxNetworking(runtime::Symbols& symbols)
		{
			// XNet --
			REGISTER(NetDll_XNetCleanup);
			REGISTER(NetDll_XNetConnect);
			REGISTER(NetDll_XNetCreateKey);
			REGISTER(NetDll_XNetDnsLookup);
			REGISTER(NetDll_XNetDnsRelease);
			REGISTER(NetDll_XNetGetBroadcastVersionStatus);
			REGISTER(NetDll_XNetGetConnectStatus);
			REGISTER(NetDll_XNetGetDebugXnAddr);
			REGISTER(NetDll_XNetGetEthernetLinkStatus);
			REGISTER(NetDll_XNetGetOpt);
			REGISTER(NetDll_XNetGetSystemLinkPort);
			REGISTER(NetDll_XNetGetTitleXnAddr);
			REGISTER(NetDll_XNetGetXnAddrPlatform);
			REGISTER(NetDll_XNetInAddrToServer);
			REGISTER(NetDll_XNetInAddrToString);
			REGISTER(NetDll_XNetInAddrToXnAddr);
			REGISTER(NetDll_XNetQosGetListenStats);
			REGISTER(NetDll_XNetQosListen);
			REGISTER(NetDll_XNetQosLookup);
			REGISTER(NetDll_XNetQosRelease);
			REGISTER(NetDll_XNetQosServiceLookup);
			REGISTER(NetDll_XNetRandom);
			REGISTER(NetDll_XNetRegisterKey);
			REGISTER(NetDll_XNetReplaceKey);
			REGISTER(NetDll_XNetServerToInAddr);
			REGISTER(NetDll_XNetSetSystemLinkPort);
			REGISTER(NetDll_XNetStartup);
			REGISTER(NetDll_XNetUnregisterInAddr);
			REGISTER(NetDll_XNetUnregisterKey);
			REGISTER(NetDll_XNetXnAddrToInAddr);
			REGISTER(NetDll_XNetXnAddrToMachineId);
			REGISTER(NetDll_XOnlineGetNatType);
			// Winsock --
			REGISTER(NetDll_accept);
			REGISTER(NetDll_bind);
			REGISTER(NetDll_closesocket);
			REGISTER(NetDll_connect);
			REGISTER(NetDll_getpeername);
			REGISTER(NetDll_getsockname);
			REGISTER(NetDll_getsockopt);
			REGISTER(NetDll_htonl);
			REGISTER(NetDll_htons);
			REGISTER(NetDll_inet_addr);
			REGISTER(NetDll_ioctlsocket);
			REGISTER(NetDll_listen);
			REGISTER(NetDll_ntohl);
			REGISTER(NetDll_ntohs);
			REGISTER(NetDll_recv);
			REGISTER(NetDll_recvfrom);
			REGISTER(NetDll_select);
			REGISTER(NetDll_send);
			REGISTER(NetDll_sendto);
			REGISTER(NetDll_setsockopt);
			REGISTER(NetDll_shutdown);
			REGISTER(NetDll_socket);
			REGISTER(NetDll_WSACancelOverlappedIO);
			REGISTER(NetDll_WSACleanup);
			REGISTER(NetDll_WSACloseEvent);
			REGISTER(NetDll_WSACreateEvent);
			REGISTER(NetDll_WSAEventSelect);
			REGISTER(NetDll___WSAFDIsSet);
			REGISTER(NetDll_WSAGetLastError);
			REGISTER(NetDll_WSAGetOverlappedResult);
			REGISTER(NetDll_WSARecv);
			REGISTER(NetDll_WSARecvFrom);
			REGISTER(NetDll_WSAResetEvent);
			REGISTER(NetDll_WSASend);
			REGISTER(NetDll_WSASendTo);
			REGISTER(NetDll_WSASetEvent);
			REGISTER(NetDll_WSASetLastError);
			REGISTER(NetDll_WSAStartup);
			REGISTER(NetDll_WSAWaitForMultipleEvents);
			// XRNM --
			REGISTER(NetDll_XrnmAllowInboundLinkRequests);
			REGISTER(NetDll_XrnmCancelSends);
			REGISTER(NetDll_XrnmCloseHandle);
			REGISTER(NetDll_XrnmCreateEndpoint);
			REGISTER(NetDll_XrnmCreateInboundLink);
			REGISTER(NetDll_XrnmCreateOutboundLink);
			REGISTER(NetDll_XrnmCreateSendChannel);
			REGISTER(NetDll_XrnmDenyInboundLink);
			REGISTER(NetDll_XrnmFlushSends);
			REGISTER(NetDll_XrnmGetAlertSettings);
			REGISTER(NetDll_XrnmGetAllChannels);
			REGISTER(NetDll_XrnmGetAllLinks);
			REGISTER(NetDll_XrnmGetChannelUserData);
			REGISTER(NetDll_XrnmGetDefaultChannelComponents);
			REGISTER(NetDll_XrnmGetEndpointFromLink);
			REGISTER(NetDll_XrnmGetEvent);
			REGISTER(NetDll_XrnmGetHandleStatus);
			REGISTER(NetDll_XrnmGetHandleUserData);
			REGISTER(NetDll_XrnmGetLocalAddressForEndpoint);
			REGISTER(NetDll_XrnmGetOpt);
			REGISTER(NetDll_XrnmGetRemoteAddressForLink);
			REGISTER(NetDll_XrnmQueryInfo);
			REGISTER(NetDll_XrnmReturnEvent);
			REGISTER(NetDll_XrnmSend);
			REGISTER(NetDll_XrnmSetAlertSettings);
			REGISTER(NetDll_XrnmSetChannelUserData);
			REGISTER(NetDll_XrnmSetHandleUserData);
			REGISTER(NetDll_XrnmSetOpt);
			REGISTER(NetDll_XrnmTerminateLink);
			REGISTER(NetDll_XrnmTerminateSendChannel);
			// QNet --
			REGISTER(NetDll_QNetCreateUsingXAudio2);
			// XHttp --
			REGISTER(NetDll_XHttpCloseHandle);
			REGISTER(NetDll_XHttpConnect);
			REGISTER(NetDll_XHttpCrackUrl);
			REGISTER(NetDll_XHttpCreateUrl);
			REGISTER(NetDll_XHttpDoWork);
			REGISTER(NetDll_XHttpOpen);
			REGISTER(NetDll_XHttpOpenRequest);
			REGISTER(NetDll_XHttpQueryHeaders);
			REGISTER(NetDll_XHttpQueryOption);
			REGISTER(NetDll_XHttpReadData);
			REGISTER(NetDll_XHttpReceiveResponse);
			REGISTER(NetDll_XHttpSendRequest);
			REGISTER(NetDll_XHttpSetOption);
			REGISTER(NetDll_XHttpSetStatusCallback);
			REGISTER(NetDll_XHttpShutdown);
			REGISTER(NetDll_XHttpStartup);
			REGISTER(NetDll_XHttpWriteData);
			// XAuth --
			REGISTER(NetDll_XAuthFreeToken);
			REGISTER(NetDll_XAuthGetRelyingPartyId);
			REGISTER(NetDll_XAuthGetToken);
			REGISTER(NetDll_XAuthInsecureSocketsAllowed);
			REGISTER(NetDll_XAuthShutdown);
			REGISTER(NetDll_XAuthStartup);
			// XJSON --
			REGISTER(NetDll_XJSONDestroy);
			REGISTER(NetDll_XJSONGetTokenValue);
			REGISTER(NetDll_XJSONInitialize);
			REGISTER(NetDll_XJSONReadToken);
			REGISTER(NetDll_XJSONSetBuffer);
			// Endpoint Discovery --
			REGISTER(NetDll_XGetServiceEndpoint);
		}

		//---------------------------------------------------------------------------

	} // lib
} // xenon


text:
package com.jedou.framework.mini.web.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 不支持事务
 * @author tiankai
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface NotSupported{
}

redpajama_set_name: RedPajamaGithub


text:
package org.sagebionetworks.repo.model.principal;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * This maps the alias types and the regular expression used to validate each.
 * NOTE:  These must match the names in AliasType.json
 *
 * @author John
 *
 */
public enum AliasEnum {

	USER_NAME("^[a-z0-9._-]{3,}", "User names can only contain letters, numbers, dot (.), dash (-) and underscore (_) and must be at least 3 characters long.", true),
	TEAM_NAME("^[a-z0-9 ._-]{3,}", "Team names can only contain letters, numbers, spaces, dot (.), dash (-), underscore (_) and must be at least 3 characters long.", true),
	USER_EMAIL("[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}", "User emails must be a valid email address", false),
	USER_OPEN_ID("^(https?)://[-a-z0-9+&@#/%?=~_|!:,.;]*[-a-z0-9+&@#/%=~_|]","User OpenIDs must be a valid URL.", false),
	// http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
	USER_ORCID("^https://orcid.org/(([0-9]{4})-){3}([0-9]){3}[0-9xX]$","An ORCID is a URI of the form URI: https://orcid.org/xxxx-xxxx-xxxx-xxxx.", true);

	private AliasEnum(String regEx, String description, boolean isOnePerPrincipal){
		this.description = description;
		this.regEx = regEx;
		this.pattern = Pattern.compile(regEx);
		this.isOnePerPrincpal = isOnePerPrincipal;
	}

	private String description;
	private Pattern pattern;
	private String regEx;
	private boolean isOnePerPrincpal;

	public Pattern getPattern() {
		return pattern;
	}
	public String getRegEx() {
		return regEx;
	}
	public String getDescription() {
		return description;
	}

	/**
	 * True if only one alias of this type is allowed per principal
	 * @return
	 */
	public boolean isOnePerPrincpal(){
		return isOnePerPrincpal;
	}

	/**
	 * Validate an alias against types regular expression.
	 *
	 * @param toValidate
	 */
	public void validateAlias(String toValidate){
		if(toValidate == null) throw new IllegalArgumentException("Alias cannot be null");
		// validate the lower case version of the string.
		String lower = toValidate.toLowerCase();
		Matcher m = pattern.matcher(lower);
		if (!m.matches()) {
			throw new IllegalArgumentException(this.description+" Value="+toValidate);
		}
	}

}


text:
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

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

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

"""

from resource_management.core import shell
from resource_management.core.resources.system import Execute
from resource_management.libraries.script import Script
from resource_management.core.logger import Logger
from elastic_commands import service_check
from elastic_commands import configure_master

class Elasticsearch(Script):

    def install(self, env):
        import params
        env.set_params(params)
        Logger.info('Install Elasticsearch master node')
        self.install_packages(env)

    def configure(self, env, upgrade_type=None, config_dir=None):
        import params
        env.set_params(params)
        Logger.info('Configure Elasticsearch master node')
        configure_master()

    def stop(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        Logger.info('Stop Elasticsearch master node')
        Execute("service elasticsearch stop")

    def start(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        Logger.info('Start Elasticsearch master node')
        self.configure(env)
        Execute("service elasticsearch start")

    def status(self, env):
        import params
        env.set_params(params)
        Logger.info('Status check Elasticsearch master node')
        service_check(
          cmd="service elasticsearch status",
          user=params.elastic_status_check_user,
          label="Elasticsearch Master")

    def restart(self, env):
        import params
        env.set_params(params)
        Logger.info('Restart Elasticsearch master node')
        self.configure(env)
        Execute("service elasticsearch restart")

if __name__ == "__main__":
    Elasticsearch().execute()


text:
package executors

import (
	pb "beam.apache.org/playground/backend/internal/api/v1"
	"beam.apache.org/playground/backend/internal/preparers"
	"beam.apache.org/playground/backend/internal/validators"
	"context"
	"os/exec"
	"reflect"
	"sync"
	"testing"
)

const pipelineOptions = "--output t.txt"

func TestExecutor_Compile(t *testing.T) {
	type fields struct {
		compileArgs CmdConfiguration
		runArgs     CmdConfiguration
		validators  []validators.Validator
	}
	tests := []struct {
		name   string
		fields fields
		want   *exec.Cmd
	}{
		{
			name: "TestCompile",
			fields: fields{
				compileArgs: CmdConfiguration{
					fileName:        "filePath",
					workingDir:      "./",
					commandName:     "testCommand",
					commandArgs:     []string{"-d", "bin", "-classpath", "/opt/apache/beam/jars/beam-sdks-java-harness.jar"},
					pipelineOptions: []string{""},
				},
			},
			want: &exec.Cmd{
				Path:         "testCommand",
				Args:         []string{"javac", "-d", "bin", "-classpath", "/opt/apache/beam/jars/beam-sdks-java-harness.jar", "filePath"},
				Env:          nil,
				Dir:          "",
				Stdin:        nil,
				Stdout:       nil,
				Stderr:       nil,
				ExtraFiles:   nil,
				SysProcAttr:  nil,
				Process:      nil,
				ProcessState: nil,
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ex := &Executor{
				compileArgs: tt.fields.compileArgs,
				runArgs:     tt.fields.runArgs,
				validators:  tt.fields.validators,
			}
			if got := ex.Compile(context.Background()); !reflect.DeepEqual(got.String(), tt.want.String()) {
				t.Errorf("WithCompiler() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestExecutor_Run(t *testing.T) {
	type fields struct {
		compileArgs CmdConfiguration
		runArgs     CmdConfiguration
		testArgs    CmdConfiguration
		validators  []validators.Validator
		preparers   []preparers.Preparer
	}
	tests := []struct {
		name   string
		fields fields
		want   *exec.Cmd
	}{
		{
			name: "TestRun",
			fields: fields{
				runArgs: CmdConfiguration{
					fileName:    "HelloWorld",
					workingDir:  "./",
					commandName: "runCommand",
					commandArgs: []string{"-cp", "bin:/opt/apache/beam/jars/beam-sdks-java-harness.jar:" +
						"/opt/apache/beam/jars/beam-runners-direct.jar:/opt/apache/beam/jars/slf4j-jdk14.jar"},
					pipelineOptions: []string{""},
				},
			},
			want: &exec.Cmd{
				Path: "runCommand",
				Args: []string{"java", "-cp", "bin:/opt/apache/beam/jars/beam-sdks-java-harness.jar:" +
					"/opt/apache/beam/jars/beam-runners-direct.jar:/opt/apache/beam/jars/slf4j-jdk14.jar", "HelloWorld"},
				Env:          nil,
				Dir:          "",
				Stdin:        nil,
				Stdout:       nil,
				Stderr:       nil,
				ExtraFiles:   nil,
				SysProcAttr:  nil,
				Process:      nil,
				ProcessState: nil,
			},
		},
		{
			name: "TestRun with pipelineOptions",
			fields: fields{
				runArgs: CmdConfiguration{
					fileName:    "HelloWorld",
					workingDir:  "./",
					commandName: "runCommand",
					commandArgs: []string{"-cp", "bin:/opt/apache/beam/jars/beam-sdks-java-harness.jar:" +
						"/opt/apache/beam/jars/beam-runners-direct.jar:/opt/apache/beam/jars/slf4j-jdk14.jar"},
					pipelineOptions: []string{pipelineOptions},
				},
			},
			want: &exec.Cmd{
				Path: "runCommand",
				Args: []string{"java", "-cp", "bin:/opt/apache/beam/jars/beam-sdks-java-harness.jar:" +
					"/opt/apache/beam/jars/beam-runners-direct.jar:/opt/apache/beam/jars/slf4j-jdk14.jar", "HelloWorld", pipelineOptions},
				Env:          nil,
				Dir:          "",
				Stdin:        nil,
				Stdout:       nil,
				Stderr:       nil,
				ExtraFiles:   nil,
				SysProcAttr:  nil,
				Process:      nil,
				ProcessState: nil,
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ex := &Executor{
				compileArgs: tt.fields.compileArgs,
				runArgs:     tt.fields.runArgs,
				testArgs:    tt.fields.testArgs,
				validators:  tt.fields.validators,
				preparers:   tt.fields.preparers,
			}
			if got := ex.Run(context.Background()); !reflect.DeepEqual(got.String(), tt.want.String()) {
				t.Errorf("WithRunner() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestExecutor_RunTest(t *testing.T) {
	type fields struct {
		compileArgs CmdConfiguration
		runArgs     CmdConfiguration
		testArgs    CmdConfiguration
		validators  []validators.Validator
		preparers   []preparers.Preparer
	}
	type args struct {
		ctx context.Context
	}
	tests := []struct {
		name   string
		fields fields
		args   args
		want   *exec.Cmd
	}{
		{
			name: "TestRunTest",
			fields: fields{
				testArgs: CmdConfiguration{
					fileName:        "HelloWorld",
					workingDir:      "./",
					commandName:     "testCommand",
					commandArgs:     []string{"-cp", "option1:option2"},
					pipelineOptions: []string{""},
				},
			},
			args: args{context.Background()},
			want: &exec.Cmd{
				Path:         "testCommand",
				Args:         []string{"java", "-cp", "option1:option2", "HelloWorld"},
				Env:          nil,
				Dir:          "./",
				Stdin:        nil,
				Stdout:       nil,
				Stderr:       nil,
				ExtraFiles:   nil,
				SysProcAttr:  nil,
				Process:      nil,
				ProcessState: nil,
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ex := &Executor{
				compileArgs: tt.fields.compileArgs,
				runArgs:     tt.fields.runArgs,
				testArgs:    tt.fields.testArgs,
				validators:  tt.fields.validators,
				preparers:   tt.fields.preparers,
			}
			if got := ex.RunTest(tt.args.ctx); !reflect.DeepEqual(got.String(), tt.want.String()) {
				t.Errorf("RunTest() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestExecutor_Prepare(t *testing.T) {
	valResult := &sync.Map{}
	valResult.Store(validators.UnitTestValidatorName, false)
	valResult.Store(validators.KatasValidatorName, false)
	preparersArray, err := preparers.GetPreparers(pb.Sdk_SDK_JAVA, "./", valResult)
	if err != nil {
		panic(err)
	}
	type fields struct {
		compileArgs CmdConfiguration
		runArgs     CmdConfiguration
		testArgs    CmdConfiguration
		validators  []validators.Validator
		preparers   []preparers.Preparer
		boolChan    chan bool
		errorChan   chan error
		valResult   *sync.Map
	}
	tests := []struct {
		name    string
		fields  fields
		want    bool
		wantErr bool
	}{
		{
			name: "Test Prepare method with prepared preparers",
			fields: fields{
				preparers: *preparersArray,
				boolChan:  make(chan bool),
				errorChan: make(chan error),
				valResult: valResult,
			},
			want:    false,
			wantErr: true,
		},
		{
			name: "Test Prepare method without preparers",
			fields: fields{
				preparers: nil,
				boolChan:  make(chan bool),
				errorChan: make(chan error),
				valResult: valResult,
			},
			want:    true,
			wantErr: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ex := &Executor{
				compileArgs: tt.fields.compileArgs,
				runArgs:     tt.fields.runArgs,
				testArgs:    tt.fields.testArgs,
				validators:  tt.fields.validators,
				preparers:   tt.fields.preparers,
			}
			prepareFunc := ex.Prepare()
			go prepareFunc(tt.fields.boolChan, tt.fields.errorChan, tt.fields.valResult)
			if tt.wantErr {
				err := <-tt.fields.errorChan
				if (err != nil) != tt.wantErr {
					t.Errorf("Prepare() error = %v, wantErr %v", err, tt.wantErr)
				}
			}
			got := <-tt.fields.boolChan
			if got != tt.want {
				t.Errorf("Prepare() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestExecutor_Validate(t *testing.T) {
	valResult := &sync.Map{}
	validatorsArray, err := validators.GetValidators(pb.Sdk_SDK_JAVA, "./")
	if err != nil {
		panic(err)
	}
	type fields struct {
		compileArgs CmdConfiguration
		runArgs     CmdConfiguration
		testArgs    CmdConfiguration
		validators  []validators.Validator
		preparers   []preparers.Preparer
		boolChan    chan bool
		errorChan   chan error
		valResult   *sync.Map
	}
	tests := []struct {
		name    string
		fields  fields
		want    bool
		wantErr bool
	}{
		{
			name: "Test Validate method with prepared validators",
			fields: fields{
				validators: *validatorsArray,
				boolChan:   make(chan bool),
				errorChan:  make(chan error),
				valResult:  valResult,
			},
			want:    false,
			wantErr: true,
		},
		{
			name: "Test Validate method without validators",
			fields: fields{
				validators: nil,
				boolChan:   make(chan bool),
				errorChan:  make(chan error),
				valResult:  valResult,
			},
			want:    true,
			wantErr: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ex := &Executor{
				compileArgs: tt.fields.compileArgs,
				runArgs:     tt.fields.runArgs,
				testArgs:    tt.fields.testArgs,
				validators:  tt.fields.validators,
				preparers:   tt.fields.preparers,
			}
			valFunc := ex.Validate()
			go valFunc(tt.fields.boolChan, tt.fields.errorChan, tt.fields.valResult)
			if tt.wantErr {
				err := <-tt.fields.errorChan
				if (err != nil) != tt.wantErr {
					t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr)
				}
			}
			got := <-tt.fields.boolChan
			if got != tt.want {
				t.Errorf("Validate() = %v, want %v", got, tt.want)
			}
		})
	}
}


text:
layout: post
title: "安卓开发学习笔记5-Android应用四大组件之Activity"
description: ""
category:
tags: [Android]
---

#### Activity组件是Android应用程序中直接同用户进行可视化交互的组件。一个Android应用可以包含一个或者一组Activity,其中有一个Activity是用户通过点击应用Icon首次启动应用时呈现出的用户界面。每个Activity都被分配一个窗口来绘制自己的界面,一般情况下这个窗口会充满整个屏幕,开发者也可以控制该窗口在屏幕上以小窗体的形式显示或者浮动在其他窗体上面。

#### 一个Activity可以启动其他的Activity,这时,该Activity会被存入Activity栈中(通过点击"Back"按钮可以回到原来的Activity),然后新创建的Activity也会被放入该栈中,处于栈顶的位置并在屏幕顶层显示。这里的栈代表着Task的概念。

### 创建Activity
1. 通过在Java代码中定义一个Activity类型的子类就可以创建一个Activity,这个Activity的子类可以通过override Activity类型的回调方法来实现Activity在自己生命周期中状态变化时执行的操作。其中最重要的两个回调函数为:
	* __onCreate()__ - 这个方法必须被实现,因为在创建Activity实例时,Android系统会调用这个方法来初始化Activity的基础元素,方法体中,setContentView方法必须被调用从而使为该Activity设置的用户界面以定义好的layout呈现在屏幕上。
	* __onPause()__ - Android系统在用户离开当前Activity实例(该Activity实例被其他Activity实例完全覆盖不可见或者有其他Activity实例float在其上或者用户退出了该Activity实例)或者销毁其进程之前会调用该方法。在该方法中,我们应该做状态和数据的保存,因为用户可能不会再回到该Activity实例或者之后该Activity实例或被Android系统销毁。
	* 其他重要的回调函数在后面关于Activity生命周期的讨论中会继续讨论。
2. Activity的用户界面是由一系列继承自View类型的View对象呈现,用来响应用户操作以及展示信息,接受用户输入等。
3. 程序设计中,将界面和逻辑分离是被证明很有价值的做法,在之前的blog文章中已经介绍了独立定义Activity的布局对Android应用程序支持localization和compatibility方面的方式和意义。

### 声明Activity
* 为了让Android系统能够访问到我们创建的Activity,必须将其在Android应用的manifest文件中声明,[格式][1]如下:

{% highlight xml %}
<manifest ... >
  <application ... >
      <activity android:name=".ExampleActivity" />
      ...
  </application ... >
  ...
</manifest >
{% endhighlight %}

* 在声明Activity的时候,我们可以设置很多该Activity的属性,比如label,icon,theme等,下面是一个实际中的例子:

{% highlight xml %}
<activity android:name=".ExampleActivity" android:icon="@drawable/app_icon">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
{% endhighlight %}

* 在上面的实例中,可以看到__intent_filter__,该属性声明了其他应用组件如何激活该Activity。上面例子中的action元素声明了这个Activity是包含它的Android应用程序的主要(main)入口,首次点击应用图标启动应用时激活的Activity;category元素声明了该Activity应该被放入Android系统的应用启动器中,以允许用户通过点击应用图标进行启动。
* 当Android应用不允许其他应用程序激活自己的某个Activity时,可以不声明任何intent-filter,否则可以声明包含action,category以及data(后两者非必需)元素的intent-filter,像下面的例子一样:

{% highlight xml %}
<activity android:name="ShareActivity">
    <intent-filter>
        <action android:name="android.intent.action.SEND"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:mimeType="text/plain"/>
    </intent-filter>
</activity>
{% endhighlight %}

### 启动Activity
* 通过调用startActivity()方法传递一个Intent类型对象参数来启动一个Activity,这里的Intent类型对象或者指定了要启动的Activity的名称,或者声明了要启动的Activity的action元素类型。对于后者,Android系统会选择一个符合条件的Activity来启动,如果有多个符合条件的,Android系统会列出来让用户选择。这里的Intent类型对象也可以携带少量的数据用来传递。下面有[两个官网的例子][2],分别实例了这里所说的两种情况:

{% highlight java %}
Intent intent = new Intent(this, SignInActivity.class);
startActivity(intent);
{% endhighlight %}

{% highlight java %}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, recipientArray);
startActivity(intent);
{% endhighlight %}

* 通过调用startActivityForResult()方法传递一个Intent类型对象参数来启动一个Activity并处理其返回的结果。这种场景下,onActivityResult()方法应该被override,以便处理被启动的Activity放入Intent类型对象中的数据,[官网的例子][3]如下:

{% highlight java %}
private void pickContact() {
    // Create an intent to "pick" a contact, as defined by the content provider URI
    Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
    startActivityForResult(intent, PICK_CONTACT_REQUEST);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // If the request went well (OK) and the request was PICK_CONTACT_REQUEST
    if (resultCode == Activity.RESULT_OK && requestCode == PICK_CONTACT_REQUEST) {
        // Perform a query to the contact's content provider for the contact's name
        Cursor cursor = getContentResolver().query(data.getData(),
        new String[] {Contacts.DISPLAY_NAME}, null, null, null);
        if (cursor.moveToFirst()) { // True if the cursor is not empty
            int columnIndex = cursor.getColumnIndex(Contacts.DISPLAY_NAME);
            String name = cursor.getString(columnIndex);
            // Do something with the selected contact's name...
        }
    }
}
{% endhighlight %}

### 关闭Activity
1. 通过调用finish()方法可以关闭Activity自身。
2. 通过调用finishActivity()方法可以关闭自己启动的其他Activity

### Activity生命周期

#### 通过合理得override Activity类型中的回调函数可以控制Android应用中的Activity来提供优异的用户体验。文本前面提到过onCreate()和onPause()方法,下面我们结合Activity组件生命周期的不同状态继续讨论。

#### Activity的状态主要有下面三个:
1. Resumed - 也就是Running状态,表示该Activity正处于屏幕顶端,被用户使用。
2. Paused - 该Activity被其他Activity部分覆盖,它已不再有焦点,但是仍能被用户看到。这种状态下,该Activity的所有成员都存在于内存中,并还和Window manager保持联系。系统资源紧张的时候该Activity会被系统自动销毁。
3. Stopped - 该Activity处于后台,不再能被用户看到。这时该Activity的成员也还存在于内存中,但已经不再和Window manager保持联系。系统资源紧张的时候该Activity会被系统自动销毁。

##### 系统在销毁一个Activity实例的时候,会尝试要求该Activity调用自己的finish方法,也可能会直接kill进程,之后该Activity被重新启动时,需要从头开始初始化。

#### Activity生命周期示意图(来自[官网][4]):
![][activitylifecycle]

#### 下面是包含基本生命周期方法的Activity的例子:

{% highlight java %}
public class ExampleActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // The activity is being created.
    }
    @Override
    protected void onStart() {
        super.onStart();
        // The activity is about to become visible.
    }
    @Override
    protected void onResume() {
        super.onResume();
        // The activity has become visible (it is now "resumed").
    }
    @Override
    protected void onPause() {
        super.onPause();
        // Another activity is taking focus (this activity is about to be "paused").
    }
    @Override
    protected void onStop() {
        super.onStop();
        // The activity is no longer visible (it is now "stopped")
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        // The activity is about to be destroyed.
    }
}
{% endhighlight %}

#### Activity生命周期中体现了下面三个重要的阶段:
1. 完整生命周期 - 从onCreate初始化到onDestroyed销毁。
2. 可见阶段 - 从onStart启动到onStop停止转入后台。
3. 前台阶段 - 从onResume运行到onPause暂停。

### 保存Activity状态

#### 当Activity处于非Resumed状态并且系统资源紧张时,Android系统可能会销毁该Activity实例,这时有必要保存该Activity实例的数据以便用户重新回到该Activity的时候能继续操作。另一种情况是当设备由竖屏变为横屏的时候,如果定义了不同的layout,Activity会被销毁然后根据定义的layout初始化,这时也需要保存和还原之前的状态数据。看一张官网的示意图:
![][save]

#### 通过调用onSaveInstanceState()方法和onSaveInstanceState()方法可以保存和还原Activity的状态。这里需要注意的是,Android系统不保证onSaveInstanceState()方法一定会在被销毁前调用,所以对于一些重要的数据,最好在onPause方法中保存。

#### [官网提供了一个非常好的Demo以及对其的说明][5]来帮助我们学习和理解Activity的生命周期,可以下载编译后运行看看。

[1]: http://developer.android.com/guide/components/activities.html
[2]: http://developer.android.com/guide/components/activities.html
[3]: http://developer.android.com/guide/components/activities.html
[4]: http://developer.android.com/guide/components/activities.html
[5]: http://developer.android.com/training/basics/activity-lifecycle/index.html
[activitylifecycle]: /images/activity_lifecycle.png
[save]: /images/restore_instance.png

{% include JB/setup %}


text:
/*
 * celix_errorcodes.c
 *
 *  \date       Aug 30, 2011
 *  \author    	Apache Celix Project Team
 *  \copyright	Apache License, Version 2.0
 */
#include <string.h>

#include "celix_errno.h"

static char *celix_error_string(celix_status_t statcode) {
	switch (statcode) {
	case CELIX_BUNDLE_EXCEPTION:
		return "Bundle exception";
	case CELIX_INVALID_BUNDLE_CONTEXT:
		return "Invalid bundle context";
	case CELIX_ILLEGAL_ARGUMENT:
		return "Illegal argument";
	case CELIX_INVALID_SYNTAX:
		return "Invalid syntax";
	case CELIX_FRAMEWORK_SHUTDOWN:
		return "Framework shutdown";
	case CELIX_ILLEGAL_STATE:
		return "Illegal state";
	case CELIX_FRAMEWORK_EXCEPTION:
		return "Framework exception";
	case CELIX_FILE_IO_EXCEPTION:
		return "File I/O exception";
	case CELIX_SERVICE_EXCEPTION:
        return "Service exception";
	}
	return "Unkown code";
}

char *celix_strerror(celix_status_t errorcode, char *buffer, size_t bufferSize) {
    if (errorcode < CELIX_START_ERROR) {
    	return strerror(errorcode);
    } else {
    	char * str = celix_error_string(errorcode);
    	strncpy(buffer, str, bufferSize);
        return buffer;
    }
}


text:
#ifndef _BASICLAYERTYPES_H_
#define _BASICLAYERTYPES_H_

#include <iostream>
#include <string>
#include "functions.h"
#include "LayerRegistry.h"

namespace NPP2 {

#ifdef __APPLE__
#pragma mark Basic defintions
#endif

  enum LayerType { INPUT_LAYER, HIDDEN_LAYER, OUTPUT_LAYER }; ///< used to mark the type of the layers

  class Net;

  /** Data about the general layout of a specific layer. In NPP2 layers may be
   * organized two-dimensionally in rows and columns. This is a feature that was
   * added to facilitate processing of two-dimensional image data. */
  class LayerTopology {
  public:
    int numUnits;   ///< total number of units (equals numRows * numCols)
    int numRows;    ///< number of rows in the layer (height)
    int numCols;    ///< number of columns in the layer (width)

    /** Constructor that practically puts all units in to a single, large row. */
    LayerTopology(int numUnits)
      : numUnits(numUnits), numRows(1), numCols(numUnits) {}
    /** Constructor to organize the neurons in rows and columns. */
    LayerTopology(int cols, int rows)
      : numUnits(cols*rows), numRows(rows), numCols(cols) {}
    /** Constructor for an empty (zero-initialized) layer. */
    LayerTopology()
      : numUnits(0), numRows(0), numCols(0) {}
  };

 /** Class for collecting all the parameters that needed to be specified
  * during the construction of a layer of a specific type. Each layer type
  * must offer its own corresponding Argument-Class that is derived from
  * LayerArguments. With the help of these classes its possible to construct
  * layers in an "abstract" way (using a factory, without knowing the type
  * of the constructed layer) and nevertheless passing the right arguments. */
 class LayerArguments {
 public:
   std::string identifer;         ///< string identifying the type of the layer

   /** This constructor should never be called directly, as it just produces
    * an argument object corresponding to an undefined layer type. */
   LayerArguments(const std::string& identifer="Undefined") : identifer(identifer) {}
   /** Cleans up all the argumantes. */
   virtual ~LayerArguments() {}
 };

#ifdef __APPLE__
#pragma mark -
#pragma mark Basic Layer Type  (abstract base class)
#endif

  /** Abstract base class for all implementations of layer types. Defines all the
   * neurons together with basic facilities each layer must have (topological data,
   * activation function, update function, etc.) but does not define the connection
   * structure (which is implementation dependent).
   *
   * General Conventions used in NPP2:
   * - unit 0 in each layer is a bias unit and always on
   * - the normal units start at position 1 in the vector
   * - each layer has numUnits normal units
   * - in each vector storing values for the units (neurons), the first numUnits+1
   *   entries are for the 'real' unit. Afterwards there are numCopies copies of
   *   the values used for parallel processing.
   * - there are copies for activations and derivatives, but never for the weights,
   *   as these are the same in each thread and are not touched (changed) by the
   *   threads but only after joining partial results from the different threads.
   */
  struct BasicLayerType {

    /** Correspoding class holding the arguments, every layer does expect
     * during construction: this are the number of units in columns and rows */
    class BasicLayerArguments : public LayerArguments {
    public:
      int numCols;          ///< number of units per column
      int numRows;          ///< number of units per row

      /** Constructs an argument object with the two necessary parameters. */
      BasicLayerArguments(int numCols, int numRows);
    };

    std::string identifer;  ///< string identifying the layer's type

    Net* net;               ///< points to the net, this layer is part-of

#ifdef __APPLE__
#pragma mark Layer-related properties
#endif
    int layerId;            ///< unique id of the layer, usually starts with 0
    int firstUnitId;        ///< number of the first unit in the layer; this is one larger than the previous' layers last neuron.
    int numUnits;           ///< total number of units in the layer
    int numRows;            ///< number of units per row
    int numCols;            ///< number of units per column
    int numCopies;          ///< number of copies of this layer (used during parallel processing)
    int numWeights;         ///< total number of weights (connections) TO this layer.

#ifdef __APPLE__
#pragma mark Unit-related properties
#endif
    FTYPE* dEdo;            ///< vector holding the partial derivatives for the output of each of the neurons.
    FTYPE* dEdnet;          ///< vector holdign the partial derivatives for the net input of each neuron.
    FTYPE* out;             ///< activation (output) of each neuron.
    FTYPE* netin;           ///< net input to each neuron.
    int actId;              ///< identifies which activation function (linear, logistic) to use for all the units in this layer.

    FTYPE (*act_f)(FTYPE); ///< activation function
    FTYPE (*deriv_f)(FTYPE, FTYPE); ///< derivative of the activation function

    UpdateFunction* updateFunction; ///< update function (learning rule, e.g. RProp)

#ifdef __APPLE__
#pragma mark Accessing individual neurons
#endif
    /** calculates the index into the arrays given the index of the unit and the
     * number of the copy to access */
    inline int calcIdFromIndex(int index, int copy=0) const;
    /** calculates the index into the arrays given the id of the unit and the
     * number of the copy to access */
    inline int calcIndexFromId(int unitId, int copy=0) const;

    /** given the index, calculates the x,y-coordinates of the unit and the
     * number of the copy, which this unit is in. */
    inline void calcXYFromIndex(int index, int *x, int *y, int *copy=0) const;
    /** given x,y-coordinates and the number of the copy to use, calculates
     * the index into the vectors. */
    inline int calcIndexFromXY(int x, int y, int copy=0) const;

#ifdef __APPLE__
#pragma mark Propagating, back-propagating and updating (learning)
#endif
    /** propagates the given input through the layer, using the specified
     * copy. The net's propagation method will call this method with the
     * output of the previous layer. */
    virtual void forwardPass(FTYPE *input, int copy=0)=0;
    /** back-propagates the given "input" through the layer, using the specified
     * copy. The net's backpropagation method will call this method with dedout
     * "received" from the subsequent layer */
    virtual void backwardPass(FTYPE *dedout, int copy=0)=0;
    /** updates the weights according to the caclulated error terms using an
     * appropriate learning method (e.g. backpropagation or RProp). */
    virtual void updateWeights(int numCopies=0)=0;

#ifdef __APPLE__
#pragma mark Initializing and handling the connection structure
#endif
    /** connects this layer in an implementation-dependent way to the
     * previous layer. */
    virtual void connectLayer(const BasicLayerType* previousLayer)=0;

    /** initializes the weights of the connections.
     * \param mode  presently, must be 0 (uniform random-initialization)
     * \param range values will be from -range to range */
    virtual void initWeights(int mode, FTYPE range)=0;

    /** sets the update (learning) rule that is applied during the weight
     * update. */
    virtual void setUpdateFunction(const UpdateFunction* updateFunction)=0;
    /** sets the activation function that is used by all of this layer's neurons.
     * \param actId either NPP_LINEAR or NPP_LOGISTIC . */
    virtual void setActivationFunction(int actId);

    /** serializes this layer to the given output stream. */
    virtual void writeToStream(std::ostream& out) const;
    /** de-serializes the layer from the given input stream. */
    virtual void readFromStream(std::istream& in);

    /** this method copies the weights from another layer of the same type
     * and identical structure. This is used during the "pre-training" of
     * deep autoencoders, where layers are trained individually in another
     * (shallow) autoencoder network. */
    virtual void copyWeights(const BasicLayerType* layer)=0;
    /** returns the type of this layer (INPUT_LAYER, OUTPUT_LAYER or
     * HIDDEN_LAYER) */
    int getLayerType() const;

    /** returns the arguments that have been used to construct this layer. */
    virtual LayerArguments* getArguments() const=0; // describe itself by returning arguments creating this layer.

    /** Base constructor using the Arguments-Objekt. */
    BasicLayerType(Net* net, int layerId, const LayerArguments*);
    /** Base constructor where the arguments are specified directly. */
    BasicLayerType(Net* net, int layerId, int firstUnitId, int unitsPerRow, int numRows=1, int numCopies=0);
    /** virtual destructor cleaning up all data structures connected to this
     * layer. */
    virtual ~BasicLayerType();

  protected:
    virtual void initLayer(); ///< internal helper function that actually sets up all data structures. To be extended by derived classes.
  };

  inline std::ostream& operator<<(std::ostream& out, const BasicLayerType& lt) { lt.writeToStream(out); return out; }
  inline std::istream& operator>>(std::istream& in, BasicLayerType& lt) { lt.readFromStream(in); return in; }

  // /////// inlines ////////////////////////////////////////

  inline int BasicLayerType::calcIdFromIndex(int index, int copy) const
  {
    index -= copy * (numUnits+1);
    return index == 0 ? 0 : (index-1) + firstUnitId;
  }
  inline int BasicLayerType::calcIndexFromId(int unitId, int copy) const
  {
    return unitId == 0 ? numUnits * copy : (unitId - firstUnitId+1) + copy * (numUnits+1);
  }

  inline void BasicLayerType::calcXYFromIndex(int index, int *x, int *y, int *copy) const
  {
    if (copy) {
      *copy = index / (numUnits+1);
    }
    index = index % (numUnits+1);
    if (index == 0) {
      *x = -1;
      *y =  0;
    }
    else {
      *x = (index-1) % numCols;
      *y = (index-1) / numCols;
    }
  }

  inline int BasicLayerType::calcIndexFromXY(int x, int y, int copy) const
  {
    return (x < 0 && y <= 0) ? copy * (numUnits+1) : x+y*numCols+1 + copy * (numUnits+1);
  }

}

#endif


text:
layout: default
title: "About"
excerpt: "Everything about me related to the tech-industry, as well as a couple of hints about this site and how it was built."
tags:
  - Nicolas Brugneaux
  - about
---

# About me

I am a French developer based in Berlin. I'm currently a lead software engineer at [Passbase](https://passbase.com).

You can ask me anything on [Twitter](https://twitter.com/nbrugneaux).
If you wish for a more private way of contacting me, you can reach <br>
me via [hello@nicolasbrugneaux.me](mailto:hello@nicolasbrugneaux.me).

## About this site

This site is made with [Jekyll](http://jekyllrb.com) and hosted on [Github Pages](https://pages.github.com/) under the [nicolasbrugneaux/nicolasbrugneaux.github.io](https://github.com/nicolasbrugneaux/nicolasbrugneaux.github.io) repository.


text:
using System;

namespace Microsoft.DotNet.ProjectModel.Graph
{
    [Flags]
    public enum LibraryDependencyTypeFlag
    {
        None = 0,
        MainReference = 1 << 0,
        MainSource = 1 << 1,
        MainExport = 1 << 2,
        PreprocessReference = 1 << 3,
        RuntimeComponent = 1 << 4,
        DevComponent = 1 << 5,
        PreprocessComponent = 1 << 6,
        BecomesNupkgDependency = 1 << 7,
    }
}


text:
namespace iv {
namespace lv5 {

class JSStringBuilder : public core::BasicStringBuilder<char16_t> {
 public:
  JSString* Build(Context* ctx, bool is_8bit, Error* e) const {
    return JSString::New(ctx,
                         container_type::begin(),
                         container_type::end(),
                         is_8bit, e);
  }

  // override Append is failed...
  void AppendJSString(const JSString& str) {
    const size_t current_size = container_type::size();
    container_type::resize(current_size + str.size());
    const JSFlatString* flat = str.Flatten();
    std::copy(flat->begin(), flat->end(),
              container_type::begin() + current_size);
  }

  void AppendJSString(const JSString& str,
                      size_t from,
                      size_t to) {
    const size_t current_size = container_type::size();
    container_type::resize(current_size + (to - from));
    const JSFlatString* flat = str.Flatten();
    std::copy(flat->begin() + from, flat->begin() + to,
              container_type::begin() + current_size);
  }
};

} }  // namespace iv::lv5
#endif  // IV_LV5_JSSTRING_BUILDER_H_


text:
package internal

import (
	"github.com/name5566/leaf/module"
	"server/base"
	"github.com/name5566/leaf/gate"
)

var (
	skeleton = base.NewSkeleton()
	ChanRPC  = skeleton.ChanRPCServer
)

type Module struct {
	*module.Skeleton
}

func (m *Module) OnInit() {
	m.Skeleton = skeleton
	UserAgent=make(map[string]gate.Agent)
}

func (m *Module) OnDestroy() {

}


text:
package org.apache.pulsar.functions.worker.rest.api.v2;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.pulsar.common.io.ConnectorDefinition;
import org.apache.pulsar.functions.worker.rest.FunctionApiResource;
import org.apache.pulsar.functions.worker.rest.api.FunctionsImpl;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@Path("/source")
public class SourceApiV2Resource extends FunctionApiResource {

    @POST
    @Path("/{tenant}/{namespace}/{sourceName}")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response registerSource(final @PathParam("tenant") String tenant,
                                   final @PathParam("namespace") String namespace,
                                   final @PathParam("sourceName") String sourceName,
                                   final @FormDataParam("data") InputStream uploadedInputStream,
                                   final @FormDataParam("data") FormDataContentDisposition fileDetail,
                                   final @FormDataParam("url") String functionPkgUrl,
                                   final @FormDataParam("sourceConfig") String sourceConfigJson) {

        return functions.registerFunction(tenant, namespace, sourceName, uploadedInputStream, fileDetail,
                functionPkgUrl, null, sourceConfigJson, FunctionsImpl.SOURCE, clientAppId());

    }

    @PUT
    @Path("/{tenant}/{namespace}/{sourceName}")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response updateSource(final @PathParam("tenant") String tenant,
                                 final @PathParam("namespace") String namespace,
                                 final @PathParam("sourceName") String sourceName,
                                 final @FormDataParam("data") InputStream uploadedInputStream,
                                 final @FormDataParam("data") FormDataContentDisposition fileDetail,
                                 final @FormDataParam("url") String functionPkgUrl,
                                 final @FormDataParam("sourceConfig") String sourceConfigJson) {

        return functions.updateFunction(tenant, namespace, sourceName, uploadedInputStream, fileDetail,
                functionPkgUrl, null, sourceConfigJson, FunctionsImpl.SOURCE, clientAppId());

    }

    @DELETE
    @Path("/{tenant}/{namespace}/{sourceName}")
    public Response deregisterSource(final @PathParam("tenant") String tenant,
            final @PathParam("namespace") String namespace, final @PathParam("sourceName") String sourceName) {
        return functions.deregisterFunction(tenant, namespace, sourceName, FunctionsImpl.SOURCE, clientAppId());
    }

    @GET
    @Path("/{tenant}/{namespace}/{sourceName}")
    public Response getSourceInfo(final @PathParam("tenant") String tenant,
                                  final @PathParam("namespace") String namespace,
                                  final @PathParam("sourceName") String sourceName)
            throws IOException {
        return functions.getFunctionInfo(tenant, namespace, sourceName, FunctionsImpl.SOURCE);
    }

    @GET
    @Path("/{tenant}/{namespace}/{sourceName}/{instanceId}/status")
    public Response getSourceInstanceStatus(final @PathParam("tenant") String tenant,
                                            final @PathParam("namespace") String namespace,
                                            final @PathParam("sourceName") String sourceName,
                                            final @PathParam("instanceId") String instanceId) throws IOException {
        return functions.getFunctionInstanceStatus(
            tenant, namespace, sourceName, FunctionsImpl.SOURCE, instanceId, uri.getRequestUri());
    }

    @GET
    @Path("/{tenant}/{namespace}/{sourceName}/status")
    public Response getSourceStatus(final @PathParam("tenant") String tenant,
                                    final @PathParam("namespace") String namespace,
                                    final @PathParam("sourceName") String sourceName) throws IOException {
        return functions.getFunctionStatus(tenant, namespace, sourceName, FunctionsImpl.SOURCE, uri.getRequestUri());
    }

    @GET
    @Path("/{tenant}/{namespace}")
    public Response listSources(final @PathParam("tenant") String tenant,
                                final @PathParam("namespace") String namespace) {
        return functions.listFunctions(tenant, namespace, FunctionsImpl.SOURCE);

    }

    @POST
    @ApiOperation(value = "Restart source instance", response = Void.class)
    @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"),
            @ApiResponse(code = 404, message = "The function does not exist"),
            @ApiResponse(code = 500, message = "Internal server error") })
    @Path("/{tenant}/{namespace}/{sourceName}/{instanceId}/restart")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response restartSource(final @PathParam("tenant") String tenant,
            final @PathParam("namespace") String namespace, final @PathParam("sourceName") String sourceName,
            final @PathParam("instanceId") String instanceId) {
        return functions.restartFunctionInstance(tenant, namespace, sourceName, FunctionsImpl.SOURCE, instanceId, this.uri.getRequestUri());
    }

    @POST
    @ApiOperation(value = "Restart all source instances", response = Void.class)
    @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"),
            @ApiResponse(code = 404, message = "The function does not exist"),
            @ApiResponse(code = 500, message = "Internal server error") })
    @Path("/{tenant}/{namespace}/{sourceName}/restart")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response restartSource(final @PathParam("tenant") String tenant,
            final @PathParam("namespace") String namespace, final @PathParam("sourceName") String sourceName) {
        return functions.restartFunctionInstances(tenant, namespace, sourceName, FunctionsImpl.SOURCE);
    }

    @POST
    @ApiOperation(value = "Stop source instance", response = Void.class)
    @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"),
            @ApiResponse(code = 404, message = "The function does not exist"),
            @ApiResponse(code = 500, message = "Internal server error") })
    @Path("/{tenant}/{namespace}/{sourceName}/{instanceId}/stop")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response stopSource(final @PathParam("tenant") String tenant,
            final @PathParam("namespace") String namespace, final @PathParam("sourceName") String sourceName,
            final @PathParam("instanceId") String instanceId) {
        return functions.stopFunctionInstance(tenant, namespace, sourceName, FunctionsImpl.SOURCE, instanceId, this.uri.getRequestUri());
    }

    @POST
    @ApiOperation(value = "Stop all source instances", response = Void.class)
    @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"),
            @ApiResponse(code = 404, message = "The function does not exist"),
            @ApiResponse(code = 500, message = "Internal server error") })
    @Path("/{tenant}/{namespace}/{sourceName}/stop")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response stopSource(final @PathParam("tenant") String tenant,
            final @PathParam("namespace") String namespace, final @PathParam("sourceName") String sourceName) {
        return functions.stopFunctionInstances(tenant, namespace, sourceName, FunctionsImpl.SOURCE);
    }

    @GET
    @Path("/builtinsources")
    public List<ConnectorDefinition> getSourceList() {
        List<ConnectorDefinition> connectorDefinitions = functions.getListOfConnectors();
        List<ConnectorDefinition> retval = new ArrayList<>();
        for (ConnectorDefinition connectorDefinition : connectorDefinitions) {
            if (!StringUtils.isEmpty(connectorDefinition.getSourceClass())) {
                retval.add(connectorDefinition);
            }
        }
        return retval;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
The MIT License (MIT)

Copyright (c) 2015 FetLife-OSS Contributors
https://bitbucket.org/malachid/fetlife-oss/src/default/Contributors.md?at=default

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity">

    <item android:id="@+id/nav_feed"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_feed" />

    <item android:id="@+id/nav_groups"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_groups" />

    <item android:id="@+id/nav_events"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_events" />

    <item android:id="@+id/nav_knp"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_knp" />

    <item android:id="@+id/nav_places"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_places"/>

    <item android:id="@+id/nav_writing"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_writing"/>

    <item android:id="@+id/nav_fetishes"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_fetishes"/>

    <item android:id="@+id/nav_videos"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_videos"/>

    <item android:id="@+id/nav_inbox"
        android:icon="@drawable/new_messages"
        android:title="@string/nav_inbox"/>

    <item android:id="@+id/nav_requests"
        android:icon="@drawable/new_friendrequests"
        android:title="@string/nav_requests"/>

    <item android:id="@+id/nav_ats"
        android:icon="@drawable/new_ats"
        android:title="@string/nav_ats"/>

    <item android:id="@+id/nav_profile"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_profile"/>

    <item android:id="@+id/nav_friends"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_friends"/>

    <item android:id="@+id/nav_upload"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_upload"/>

    <item android:id="@+id/nav_write"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_write"/>

    <item android:id="@+id/nav_editprofile"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_editprofile"/>

    <item android:id="@+id/nav_settings"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_settings"/>

    <item android:id="@+id/nav_share"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_share"/>

    <item android:id="@+id/nav_help"
        android:icon="@android:drawable/ic_menu_help"
        android:title="@string/nav_help"/>
</menu>


text:
<?php

require_once 'vendor/autoload.php';

$server = array(
    'HTTP_CONTENT_LENGTH' => '2830',
    'HTTP_CONTENT_TYPE' => 'application/json',
    'HTTP_X_REQUEST_UUID' => '07606ab4-601c-4ca4-8c93-b979d3c7b3a1',
    'HTTP_X_ATTEMPT_NUMBER' => '1',
    'HTTP_X_EVENT_KEY' => 'repo:push',
    'REMOTE_ADDR' => '131.103.20.165',
//    'REMOTE_ADDR' => '8.8.8.8',
);

$calls = array(
    'issue' => array(
        'comment_created' => array('actor', 'repository', 'issue', 'comment'),
        'created' => array('actor', 'repository', 'issue'),
        'updated' => array('actor', 'repository', 'issue', 'comment', 'changes'),
    ),
    'pullrequest' => array(
        'comment_created' => array('actor', 'repository', 'pullrequest', 'comment'),
        'comment_deleted' => array('actor', 'repository', 'pullrequest', 'comment'),
        'comment_updated' => array('actor', 'repository', 'pullrequest', 'comment'),
        'created' => array('actor', 'repository', 'pullrequest'),
        'updated' => array('actor', 'repository', 'pullrequest'),
        'approved' => array('actor', 'repository', 'pullrequest', 'approval'),
        'unapproved' => array('actor', 'repository', 'pullrequest', 'approval'),
        'fulfilled' => array('actor', 'repository', 'pullrequest'),
        'rejected' => array('actor', 'repository', 'pullrequest'),
    ),
    'repo' => array(
        'commit_comment_created' => array('actor', 'repository', 'comment', 'commit'),
        'commit_status_created' => array('actor', 'repository', 'commit_status'),
        'commit_status_updated' => array('actor', 'repository', 'commit_status'),
        'fork' => array('actor', 'repository', 'fork'),
        'push' => array('actor', 'repository', 'push'),
    ),
);

$webhook = new \Smalot\Bitbucket\Webhook\Webhook();
$map = $webhook->getEventMap();

foreach ($calls as $group => $types) {
    foreach ($types as $type => $properties) {
        echo 'check ' . $group . ':' . $type . "\n";

        $server['HTTP_X_EVENT_KEY'] = $group . ':' . $type;
        $content = file_get_contents('./test/payloads/' . $group . '/' . $type . '.json');

        $request = new \Symfony\Component\HttpFoundation\Request(
            array(), array(), array(), array(), array(), $server, $content
        );

        try {
            $event = $webhook->parseRequest($request);
            $classname = get_class($event);

            echo "  check event class name\n";

            if ($classname != trim($map[$group . ':' . $type], '\\')) {
                var_dump($classname, $map[$group . ':' . $type]);
                throw new \Exception('Invalid class used');
            }

            $model = $event->getModel();

            echo "  check model class name\n";

            if (get_class($model) != trim(preg_replace('/Event/', 'Model', $map[$group . ':' . $type]), '\\')) {
                var_dump(get_class($model), trim(preg_replace('/Event/', 'Model', $map[$group . ':' . $type]), '\\'));
                throw new \Exception('Invalid class used');
            }

            echo "  check actions\n";

            foreach ($properties as $property) {
                $action = 'get' . str_replace(' ', '', ucfirst(str_replace('_', ' ', $property)));

                echo '    ' . $action . "\n";

                if (!method_exists($model, $action)) {
                    var_dump(get_class($model), $action);
                    throw new \Exception('Missing method');
                }

                if (!is_array($model->$action())) {
                    var_dump($model, $action);
                    throw new \Exception('Json not mapped');
                }
            }

        } catch (Exception $e) {
            var_dump($e->getMessage());
            die("error\n");
        }
    }
}

die("done with success\n");


text:
/*----------------------------------------------------------------------------
 *      RL-ARM - USB
 *----------------------------------------------------------------------------
 *      Name:    usbreg.h
 *      Purpose: Hardware Layer Definitions for ST STM32F10x
 *---------------------------------------------------------------------------*/

#ifndef __USBREG_H
#define __USBREG_H

#define REG(x)  (*((volatile unsigned int *)(x)))

#define USB_BASE_ADDR   0x40005C00  /* USB Registers Base Address */
#define USB_PMA_ADDR    0x40006000  /* USB Packet Memory Area Address */

/* Common Registers */
#define CNTR    REG(USB_BASE_ADDR + 0x40)   /* Control Register */
#define ISTR    REG(USB_BASE_ADDR + 0x44)   /* Interrupt Status Register */
#define FNR     REG(USB_BASE_ADDR + 0x48)   /* Frame Number Register */
#define DADDR   REG(USB_BASE_ADDR + 0x4C)   /* Device Address Register */
#define BTABLE  REG(USB_BASE_ADDR + 0x50)   /* Buffer Table Address Register */

/* CNTR: Control Register Bit Definitions */
#define CNTR_CTRM       0x8000      /* Correct Transfer Interrupt Mask */
#define CNTR_PMAOVRM    0x4000      /* Packet Memory Aerea Over/underrun Interrupt Mask */
#define CNTR_ERRM       0x2000      /* Error Interrupt Mask */
#define CNTR_WKUPM      0x1000      /* Wake-up Interrupt Mask */
#define CNTR_SUSPM      0x0800      /* Suspend Mode Interrupt Mask  */
#define CNTR_RESETM     0x0400      /* USB Reset Interrupt Mask   */
#define CNTR_SOFM       0x0200      /* Start of Frame Interrupt Mask */
#define CNTR_ESOFM      0x0100      /* Expected Start of Frame Interrupt Mask */
#define CNTR_RESUME     0x0010      /* Resume Request */
#define CNTR_FSUSP      0x0008      /* Force Suspend */
#define CNTR_LPMODE     0x0004      /* Low-power Mode */
#define CNTR_PDWN       0x0002      /* Power Down */
#define CNTR_FRES       0x0001      /* Force USB Reset */

/* ISTR: Interrupt Status Register Bit Definitions */
#define ISTR_CTR        0x8000      /* Correct Transfer */
#define ISTR_PMAOVR     0x4000      /* Packet Memory Aerea Over/underrun */
#define ISTR_ERR        0x2000      /* Error */
#define ISTR_WKUP       0x1000      /* Wake-up */
#define ISTR_SUSP       0x0800      /* Suspend Mode */
#define ISTR_RESET      0x0400      /* USB Reset */
#define ISTR_SOF        0x0200      /* Start of Frame */
#define ISTR_ESOF       0x0100      /* Expected Start of Frame */
#define ISTR_DIR        0x0010      /* Direction of Transaction */
#define ISTR_EP_ID      0x000F      /* EndPoint Identifier */

/* FNR: Frame Number Register Bit Definitions */
#define FNR_RXDP        0x8000      /* D+ Data Line Status */
#define FNR_RXDM        0x4000      /* D- Data Line Status */
#define FNR_LCK         0x2000      /* Locked */
#define FNR_LSOF        0x1800      /* Lost SOF */
#define FNR_FN          0x07FF      /* Frame Number */

/* DADDR: Device Address Register Bit Definitions */
#define DADDR_EF        0x0080      /* Enable Function */
#define DADDR_ADD       0x007F      /* Device Address */

/* EndPoint Registers */
#define EPxREG(x)       REG(USB_BASE_ADDR + 4*(x))

/* EPxREG: EndPoint Registers Bit Definitions */
#define EP_CTR_RX       0x8000      /* Correct RX Transfer */
#define EP_DTOG_RX      0x4000      /* RX Data Toggle */
#define EP_STAT_RX      0x3000      /* RX Status */
#define EP_SETUP        0x0800      /* EndPoint Setup */
#define EP_TYPE         0x0600      /* EndPoint Type */
#define EP_KIND         0x0100      /* EndPoint Kind */
#define EP_CTR_TX       0x0080      /* Correct TX Transfer */
#define EP_DTOG_TX      0x0040      /* TX Data Toggle */
#define EP_STAT_TX      0x0030      /* TX Status */
#define EP_EA           0x000F      /* EndPoint Address */

/* EndPoint Register Mask (No Toggle Fields) */
#define EP_MASK         (EP_CTR_RX|EP_SETUP|EP_TYPE|EP_KIND|EP_CTR_TX|EP_EA)
/* EndPoint Register Mask (Write zero to clear) */
#define EP_MASK_RC_W0   (EP_CTR_RX|EP_CTR_TX)
/* Mask off all toggle bits and set write zero to clear bits to 1.          */
/* This creates a value that can be written back to the EndPoint register   */
/* which does not change any status bits.                                   */
#define EP_VAL_UNCHANGED(val)       (((val) & EP_MASK) | EP_MASK_RC_W0)

/* EP_TYPE: EndPoint Types */
#define EP_BULK         0x0000      /* BULK EndPoint */
#define EP_CONTROL      0x0200      /* CONTROL EndPoint */
#define EP_ISOCHRONOUS  0x0400      /* ISOCHRONOUS EndPoint */
#define EP_INTERRUPT    0x0600      /* INTERRUPT EndPoint */

/* EP_KIND: EndPoint Kind */
#define EP_DBL_BUF      EP_KIND     /* Double Buffer for Bulk Endpoint */
#define EP_STATUS_OUT   EP_KIND     /* Status Out for Control Endpoint */

/* EP_STAT_TX: TX Status */
#define EP_TX_DIS       0x0000      /* Disabled */
#define EP_TX_STALL     0x0010      /* Stalled */
#define EP_TX_NAK       0x0020      /* NAKed */
#define EP_TX_VALID     0x0030      /* Valid */

/* EP_STAT_RX: RX Status */
#define EP_RX_DIS       0x0000      /* Disabled */
#define EP_RX_STALL     0x1000      /* Stalled */
#define EP_RX_NAK       0x2000      /* NAKed */
#define EP_RX_VALID     0x3000      /* Valid */

/* Endpoint Buffer Descriptor */
typedef struct _EP_BUF_DSCR {
    U32 ADDR_TX;
    U32 COUNT_TX;
    U32 ADDR_RX;
    U32 COUNT_RX;
} EP_BUF_DSCR;

#define EP_ADDR_MASK    0xFFFE      /* Address Mask */
#define EP_COUNT_MASK   0x03FF      /* Count Mask */

#endif  /* __USBREG_H */


text:
{%extends "base.html"%} {% block content %}
<div>
  <form method="post" action="{% url 'instructor_student_edit' student.pk %}"> {% csrf_token %} {{ form.as_p }} {{ formset.as_p }}

    <input class="btn btn-default" type="submit" value="Done"> </form>
</div>
{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>

		<item value="false" key="isRegEx"/>
		<item value="getPatientsByPID" key="selection"/>
		<item value="false" key="casesensitive"/>
		<item value="false" key="incremental"/>
		<item value="true" key="wrap"/>
		<item value="false" key="wholeword"/>
		<list key="findhistory">
			<item value="getPatientsByPID"/>
			<item value="getRequestsByPatientID"/>
			<item value="getReq"/>
			<item value="ispat"/>
			<item value="uni"/>
			<item value="getDrugDetailsByDrugName"/>
			<item value="getDrugDetailsByDName/"/>
			<item value="getDrugNamesByCategory"/>
		</list>
		<list key="replacehistory">
			<item value=""/>
		</list>

		<item value="257" key="DIALOG_WIDTH"/>
		<item value="1|Segoe UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Segoe UI" key="DIALOG_FONT_NAME"/>
		<item value="380" key="DIALOG_HEIGHT"/>
		<item value="127" key="DIALOG_X_ORIGIN"/>
		<item value="163" key="DIALOG_Y_ORIGIN"/>


text:
NSString * const WTNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
NSString * const WTNetworkingReachabilityNotificationStatusItem = @"WTNetworkingReachabilityNotificationStatusItem";

typedef void (^WTNetworkReachabilityStatusBlock)(WTNetworkReachabilityStatus status);

typedef NS_ENUM(NSUInteger, WTNetworkReachabilityAssociation) {
    WTNetworkReachabilityForAddress = 1,
    WTNetworkReachabilityForAddressPair = 2,
    WTNetworkReachabilityForName = 3,
};

NSString * WTStringFromNetworkReachabilityStatus(WTNetworkReachabilityStatus status) {
    switch (status) {
        case WTNetworkReachabilityStatusNotReachable:
            return NSLocalizedStringFromTable(@"Not Reachable", @"WTNetworking", nil);
        case WTNetworkReachabilityStatusReachableViaWWAN:
            return NSLocalizedStringFromTable(@"Reachable via WWAN", @"WTNetworking", nil);
        case WTNetworkReachabilityStatusReachableViaWiFi:
            return NSLocalizedStringFromTable(@"Reachable via WiFi", @"WTNetworking", nil);
        case WTNetworkReachabilityStatusUnknown:
        default:
            return NSLocalizedStringFromTable(@"Unknown", @"WTNetworking", nil);
    }
}

static WTNetworkReachabilityStatus WTNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) {
    BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
    BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
    BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));
    BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0);
    BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction));

    WTNetworkReachabilityStatus status = WTNetworkReachabilityStatusUnknown;
    if (isNetworkReachable == NO) {
        status = WTNetworkReachabilityStatusNotReachable;
    }
#if	TARGET_OS_IPHONE
    else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
        status = WTNetworkReachabilityStatusReachableViaWWAN;
    }
#endif
    else {
        status = WTNetworkReachabilityStatusReachableViaWiFi;
    }

    return status;
}

static void WTNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
    WTNetworkReachabilityStatus status = WTNetworkReachabilityStatusForFlags(flags);
    WTNetworkReachabilityStatusBlock block = (__bridge WTNetworkReachabilityStatusBlock)info;
    if (block) {
        block(status);
    }

    dispatch_async(dispatch_get_main_queue(), ^{
        NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
        NSDictionary *userInfo = @{ WTNetworkingReachabilityNotificationStatusItem: @(status) };
        [notificationCenter postNotificationName:WTNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
    });

}

static const void * WTNetworkReachabilityRetainCallback(const void *info) {
    return Block_copy(info);
}

static void WTNetworkReachabilityReleaseCallback(const void *info) {
    if (info) {
        Block_release(info);
    }
}

@interface WTNetworkReachabilityManager ()
@property (readwrite, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
@property (readwrite, nonatomic, assign) WTNetworkReachabilityAssociation networkReachabilityAssociation;
@property (readwrite, nonatomic, assign) WTNetworkReachabilityStatus networkReachabilityStatus;
@property (readwrite, nonatomic, copy) WTNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
@end

@implementation WTNetworkReachabilityManager

+ (instancetype)sharedManager {
    static WTNetworkReachabilityManager *_sharedManager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        struct sockaddr_in address;
        bzero(&address, sizeof(address));
        address.sin_len = sizeof(address);
        address.sin_family = AF_INET;

        _sharedManager = [self managerForAddress:&address];
    });

    return _sharedManager;
}

+ (instancetype)managerForDomain:(NSString *)domain {
    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);

    WTNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
    manager.networkReachabilityAssociation = WTNetworkReachabilityForName;

    return manager;
}

+ (instancetype)managerForAddress:(const void *)address {
    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);

    WTNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
    manager.networkReachabilityAssociation = WTNetworkReachabilityForAddress;

    return manager;
}

- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {
    self = [super init];
    if (!self) {
        return nil;
    }

    self.networkReachability = reachability;
    self.networkReachabilityStatus = WTNetworkReachabilityStatusUnknown;

    return self;
}

- (void)dealloc {
    [self stopMonitoring];

    if (_networkReachability) {
        CFRelease(_networkReachability);
        _networkReachability = NULL;
    }
}

#pragma mark -

- (BOOL)isReachable {
    return [self isReachableViaWWAN] || [self isReachableViaWiFi];
}

- (BOOL)isReachableViaWWAN {
    return self.networkReachabilityStatus == WTNetworkReachabilityStatusReachableViaWWAN;
}

- (BOOL)isReachableViaWiFi {
    return self.networkReachabilityStatus == WTNetworkReachabilityStatusReachableViaWiFi;
}

#pragma mark -

- (void)startMonitoring {
    [self stopMonitoring];

    if (!self.networkReachability) {
        return;
    }

    __weak __typeof(self)weakSelf = self;
    WTNetworkReachabilityStatusBlock callback = ^(WTNetworkReachabilityStatus status) {
        __strong __typeof(weakSelf)strongSelf = weakSelf;

        strongSelf.networkReachabilityStatus = status;
        if (strongSelf.networkReachabilityStatusBlock) {
            strongSelf.networkReachabilityStatusBlock(status);
        }

    };

    SCNetworkReachabilityContext context = {0, (__bridge void *)callback, WTNetworkReachabilityRetainCallback, WTNetworkReachabilityReleaseCallback, NULL};
    SCNetworkReachabilitySetCallback(self.networkReachability, WTNetworkReachabilityCallback, &context);
    SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);

    switch (self.networkReachabilityAssociation) {
        case WTNetworkReachabilityForName:
            break;
        case WTNetworkReachabilityForAddress:
        case WTNetworkReachabilityForAddressPair:
        default: {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
                SCNetworkReachabilityFlags flags;
                SCNetworkReachabilityGetFlags(self.networkReachability, &flags);
                WTNetworkReachabilityStatus status = WTNetworkReachabilityStatusForFlags(flags);
                dispatch_async(dispatch_get_main_queue(), ^{
                    callback(status);

                    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
                    [notificationCenter postNotificationName:WTNetworkingReachabilityDidChangeNotification object:nil userInfo:@{ WTNetworkingReachabilityNotificationStatusItem: @(status) }];

                });
            });
        }
            break;
    }
}

- (void)stopMonitoring {
    if (!self.networkReachability) {
        return;
    }

    SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
}

#pragma mark -

- (NSString *)localizedNetworkReachabilityStatusString {
    return WTStringFromNetworkReachabilityStatus(self.networkReachabilityStatus);
}

#pragma mark -

- (void)setReachabilityStatusChangeBlock:(void (^)(WTNetworkReachabilityStatus status))block {
    self.networkReachabilityStatusBlock = block;
}

#pragma mark - NSKeyValueObserving

+ (NSSet *)keyPathsForValuesWTfectingValueForKey:(NSString *)key {
    if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) {
        return [NSSet setWithObject:@"networkReachabilityStatus"];
    }

    return [super keyPathsForValuesAffectingValueForKey:key];
}

@end


text:
(function(isBrowser) {
  if (isBrowser) {
    window.Happner = window.Happner || {};
    window.Happner.Promisify = Promisify;
  } else {
    module.exports = Promisify;
  }

  function Promisify(originalFunction, opts) {
    return function() {
      var args = Array.prototype.slice.call(arguments);
      var _this = this;

      if (opts && opts.unshift) args.unshift(opts.unshift);
      // No promisify if last passed arg is function (ie callback)

      if (typeof args[args.length - 1] === 'function') {
        return originalFunction.apply(this, args);
      }

      return new Promise(function(resolve, reject) {
        // push false callback into arguments
        args.push(function(error, result, more) {
          if (error) return reject(error);
          if (more) {
            var args = Array.prototype.slice.call(arguments);
            args.shift(); // toss undefined error
            return resolve(args); // resolve array of args passed to callback
          }
          return resolve(result);
        });
        try {
          return originalFunction.apply(_this, args);
        } catch (error) {
          return reject(error);
        }
      });
    };
  }
})(typeof module !== 'undefined' && typeof module.exports !== 'undefined' ? false : true);


text:
package mx.emite.sdk.ret10.comp.operacionesconderivados;

import java.math.BigDecimal;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import mx.emite.sdk.enums.sat.adaptadores.ImporteAdapter;
import mx.emite.sdk.ret10.comp.ComplementoInterface;

@XmlRootElement(name="Operacionesconderivados",namespace="http://www.sat.gob.mx/esquemas/retencionpago/1/operacionesconderivados")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Operacionesconderivados")
@Data
@Builder
@NoArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper=false)
public class Operacionesconderivados extends ComplementoInterface{

	/**
	 *  version Atributo requerido con valor prefijado que indica la versión del complemento de las operaciones financieras derivadas de capital.
	 */
	@XmlAttribute(name="Version")
	@NotNull @Pattern(regexp="(1\\.0)",message="Version debe de ser 1.0")
	private String version="1.0";

	/**
	 *  montGanAcum Atributo requerido para expresar el monto de la ganancia acumulable.
	 */
	@XmlAttribute(required = false,name="MontGanAcum")
	@XmlJavaTypeAdapter(ImporteAdapter.class)
	@NotNull
	protected BigDecimal montGanAcum;

	/**
	 *  montPerdDed Atributo requerido para expresar el monto de la pérdida deducible.
	 */
	@XmlAttribute(required = false,name="MontPerdDed")
	@XmlJavaTypeAdapter(ImporteAdapter.class)
	@NotNull
	protected BigDecimal montPerdDed;

	@Override
	public String getEsquemaLocation() {
		return "http://www.sat.gob.mx/esquemas/retencionpago/1/operacionesconderivados http://www.sat.gob.mx/esquemas/retencionpago/1/operacionesconderivados/operacionesconderivados.xsd";
	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Auxiliary;
using QuantConnect.Interfaces;
using QuantConnect.Logging;

namespace QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories
{
    /// <summary>
    /// Helper class used to create the corporate event providers
    /// <see cref="MappingEventProvider"/>, <see cref="SplitEventProvider"/>,
    /// <see cref="DividendEventProvider"/>, <see cref="DelistingEventProvider"/>
    /// </summary>
    public static class CorporateEventEnumeratorFactory
    {
        /// <summary>
        /// Creates a new <see cref="AuxiliaryDataEnumerator"/> that will hold the
        /// corporate event providers
        /// </summary>
        /// <param name="rawDataEnumerator">The underlying raw data enumerator</param>
        /// <param name="config">The <see cref="SubscriptionDataConfig"/></param>
        /// <param name="factorFileProvider">Used for getting factor files</param>
        /// <param name="tradableDayNotifier">Tradable dates provider</param>
        /// <param name="mapFileResolver">Used for resolving the correct map files</param>
        /// <param name="includeAuxiliaryData">True to emit auxiliary data</param>
        /// <returns>The new auxiliary data enumerator</returns>
        public static IEnumerator<BaseData> CreateEnumerators(
            IEnumerator<BaseData> rawDataEnumerator,
            SubscriptionDataConfig config,
            IFactorFileProvider factorFileProvider,
            ITradableDatesNotifier tradableDayNotifier,
            MapFileResolver mapFileResolver,
            bool includeAuxiliaryData)
        {
            var mapFileToUse = GetMapFileToUse(config, mapFileResolver);
            var factorFile = GetFactorFileToUse(config, factorFileProvider);

            var enumerator = new AuxiliaryDataEnumerator(
                config,
                factorFile,
                mapFileToUse,
                new ITradableDateEventProvider[]
                {
                    new MappingEventProvider(),
                    new SplitEventProvider(),
                    new DividendEventProvider(),
                    new DelistingEventProvider()
                },
                tradableDayNotifier,
                includeAuxiliaryData);

            var priceScaleFactorEnumerator = new PriceScaleFactorEnumerator(
                rawDataEnumerator,
                config,
                factorFile);

            return new SynchronizingEnumerator(priceScaleFactorEnumerator, enumerator);
        }

        private static MapFile GetMapFileToUse(
            SubscriptionDataConfig config,
            MapFileResolver mapFileResolver)
        {
            var mapFileToUse = new MapFile(config.Symbol.Value, new List<MapFileRow>());

            // load up the map and factor files for equities
            if (!config.IsCustomData && config.SecurityType == SecurityType.Equity)
            {
                try
                {
                    var mapFile = mapFileResolver.ResolveMapFile(
                        config.Symbol.ID.Symbol,
                        config.Symbol.ID.Date);

                    // only take the resolved map file if it has data, otherwise we'll use the empty one we defined above
                    if (mapFile.Any()) mapFileToUse = mapFile;
                }
                catch (Exception err)
                {
                    Log.Error(err, "CorporateEventEnumeratorFactory.GetMapFileToUse():" +
                        " Map File: " + config.Symbol.ID + ": ");
                }
            }

            // load up the map and factor files for underlying of equity option
            if (!config.IsCustomData && config.SecurityType == SecurityType.Option)
            {
                try
                {
                    var mapFile = mapFileResolver.ResolveMapFile(
                        config.Symbol.Underlying.ID.Symbol,
                        config.Symbol.Underlying.ID.Date);

                    // only take the resolved map file if it has data, otherwise we'll use the empty one we defined above
                    if (mapFile.Any()) mapFileToUse = mapFile;
                }
                catch (Exception err)
                {
                    Log.Error(err, "CorporateEventEnumeratorFactory.GetMapFileToUse():" +
                        " Map File: " + config.Symbol.ID + ": ");
                }
            }

            return mapFileToUse;
        }

        private static FactorFile GetFactorFileToUse(
            SubscriptionDataConfig config,
            IFactorFileProvider factorFileProvider)
        {
            var factorFileToUse = new FactorFile(config.Symbol.Value, new List<FactorFileRow>());

            if (!config.IsCustomData
                && config.SecurityType == SecurityType.Equity)
            {
                try
                {
                    var factorFile = factorFileProvider.Get(config.Symbol);
                    if (factorFile != null)
                    {
                        factorFileToUse = factorFile;
                    }
                }
                catch (Exception err)
                {
                    Log.Error(err, "CorporateEventEnumeratorFactory.GetFactorFileToUse(): Factors File: "
                        + config.Symbol.ID + ": ");
                }
            }

            return factorFileToUse;
        }
    }
}


text:
const mongoose = require('mongoose');
const crypto = require('crypto');
const Schema = mongoose.Schema;

const UserSchema = new Schema({
	username: String,
	password: String,
	salt: String
})

UserSchema.pre('save', function(next) {
	if(this.password) {
		this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
		this.password = this.hashPassword( this.password );
	}
	next();
});

UserSchema.methods.hashPassword = function (password) {
	return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
}

UserSchema.methods.authenticate = function(password) {
	return this.password === this.hashPassword(password);
}

UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
	var possibleUsername = username + (suffix || '');
	this.findOne({
		username: possibleUsername
	}, (err, user) => {
		if (!err) {
			if (!user) {
				callback(possibleUsername);
			}
			else {
				return this.findUniqueUsername(username, (suffix || 0) + 1, callback);
			}
		}
		else {
			callback(null);
		}
	});
};

mongoose.model('User', UserSchema);


text:
var assert = require('assert');

module.exports = {
  desiredCapabilities : {
    name : 'test-Name'
  },
  demoTest : function (client) {
    assert.equal(client.options.desiredCapabilities.name, 'test-Name');

    client.url('http://localhost')
      .assert.elementPresent('#weblogin');

  },

  after : function(client) {
    client.end(function() {

    });
  }
};


text:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var deepPopulate = require('mongoose-deep-populate')(mongoose);

var upvoteSchema = mongoose.Schema({
    user: { type: Schema.ObjectId, ref: 'User' },
    for: {type: String, default: "blogpost"},
    blogpost: { type: Schema.ObjectId, ref: 'blogpost' },
    currentaffair: { type: Schema.ObjectId, ref: 'currentaffair' },
    bookmark: { type: Boolean, default: false },
    _created: { type: Date, default: Date.now },
});
upvoteSchema.plugin(deepPopulate);
module.exports = mongoose.model('upvote', upvoteSchema);