text:
#import "TMBNOAA.h"
#import "TMBChoreographyExecution.h"
#import "TMBTembooSession.h"
#import "TMBTembooUri.h"

/*!
 * Input object with appropriate setters for specifying arguments to the ListCoordinatesForZipcode Choreo.
 */
@implementation TMBNOAA_ListCoordinatesForZipcode_Inputs

	/*!
	 * Set the value of the ListZipCodeList input for this Choreo.
	*(integer) Enter the zipcode for which latitude and longitude coordinates will be retrieved.
	 */
	-(void)setListZipCodeList:(NSString*)ListZipCodeList {
		[super setInput:@"ListZipCodeList" toValue:ListZipCodeList];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the ListCoordinatesForZipcode Choreo.
 */
@implementation TMBNOAA_ListCoordinatesForZipcode_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (XML) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve latitude and longitude data for a specified zipcode (in 50 U.S. States and Puerto Rico).
 */
@implementation TMBNOAA_ListCoordinatesForZipcode

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_ListCoordinatesForZipcode Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/ListCoordinatesForZipcode"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_ListCoordinatesForZipcode_ResultSet *results = [[[TMBNOAA_ListCoordinatesForZipcode_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the ListCoordinatesForZipcode Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_ListCoordinatesForZipcode_Inputs*)newInputSet {
		return [[[TMBNOAA_ListCoordinatesForZipcode_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherByCitiesUnsummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCitiesUnsummarized_Inputs

	/*!
	 * Set the value of the CitiesLevel input for this Choreo.
	*(required, integer) Enter a city grouping number. For example: enter 1, to obtain weather information for primary U.S. cities. See documentation for additional numbers.
	 */
	-(void)setCitiesLevel:(NSString*)CitiesLevel {
		[super setInput:@"CitiesLevel" toValue:CitiesLevel];
	}

	/*!
	 * Set the value of the EndDate input for this Choreo.
	*(required, date) Enter the end time for retrieval of NDWD information in UTC format. Time must be today's date, or a future date.  Format: 2004-04-27T12:00.
	 */
	-(void)setEndDate:(NSString*)EndDate {
		[super setInput:@"EndDate" toValue:EndDate];
	}

	/*!
	 * Set the value of the NDFDParameterName input for this Choreo.
	*(optional, string) Enter an additional weather parameter in the following format: phail=phail. Use only if Product is set to: glance.
	 */
	-(void)setNDFDParameterName:(NSString*)NDFDParameterName {
		[super setInput:@"NDFDParameterName" toValue:NDFDParameterName];
	}

	/*!
	 * Set the value of the Product input for this Choreo.
	*(required, string) Enter one of two parameters: time-series (to return all data between the Begin and End time parameters); glance for a subset of 5 often used parameters
	 */
	-(void)setProduct:(NSString*)Product {
		[super setInput:@"Product" toValue:Product];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest date in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherByCitiesUnsummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCitiesUnsummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve weather information for a specific list of cities.
 */
@implementation TMBNOAA_WeatherByCitiesUnsummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherByCitiesUnsummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherByCitiesUnsummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherByCitiesUnsummarized_ResultSet *results = [[[TMBNOAA_WeatherByCitiesUnsummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherByCitiesUnsummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherByCitiesUnsummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherByCitiesUnsummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherByCitiesSummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCitiesSummarized_Inputs

	/*!
	 * Set the value of the CitiesLevel input for this Choreo.
	*(required, integer) Enter a city grouping number. For example: enter 1, to obtain weather information for primary U.S. cities. See documentation for additional numbers.
	 */
	-(void)setCitiesLevel:(NSString*)CitiesLevel {
		[super setInput:@"CitiesLevel" toValue:CitiesLevel];
	}

	/*!
	 * Set the value of the Format input for this Choreo.
	*(required, string) Specify a timespan for which NDFD data will be summarized. Enter: 24 hourly, for a 24 hour summary, or: 12 hourly, for a 12 hour weather summary.
	 */
	-(void)setFormat:(NSString*)Format {
		[super setInput:@"Format" toValue:Format];
	}

	/*!
	 * Set the value of the NumberOfDays input for this Choreo.
	*(optional, integer) Specify the number of days to retieve data for. If null, data from the earliest date in the dabase is returned.
	 */
	-(void)setNumberOfDays:(NSString*)NumberOfDays {
		[super setInput:@"NumberOfDays" toValue:NumberOfDays];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest date in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherByCitiesSummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCitiesSummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve weather information for a specific list of cities.
 */
@implementation TMBNOAA_WeatherByCitiesSummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherByCitiesSummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherByCitiesSummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherByCitiesSummarized_ResultSet *results = [[[TMBNOAA_WeatherByCitiesSummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherByCitiesSummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherByCitiesSummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherByCitiesSummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherByCenterPointSubgridSummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCenterPointSubgridSummarized_Inputs

	/*!
	 * Set the value of the CenterPointLatitude input for this Choreo.
	*(required, decimal) Enter the latitude specifying the rectangle or the grid center that defines the area being queried. North latitude is positive.
	 */
	-(void)setCenterPointLatitude:(NSString*)CenterPointLatitude {
		[super setInput:@"CenterPointLatitude" toValue:CenterPointLatitude];
	}

	/*!
	 * Set the value of the CenterPointLongitude input for this Choreo.
	*(required, decimal) Enter the longitute specifying the rectangle or the grid center that defines the area being queried. West longitude is negative.
	 */
	-(void)setCenterPointLongitude:(NSString*)CenterPointLongitude {
		[super setInput:@"CenterPointLongitude" toValue:CenterPointLongitude];
	}

	/*!
	 * Set the value of the Format input for this Choreo.
	*(required, string) Specify a timespan for which NDFD data will be summarized. Enter: 24 hourly, for a 24 hour summary, or: 12 hourly, for a 12 hour weather summary.
	 */
	-(void)setFormat:(NSString*)Format {
		[super setInput:@"Format" toValue:Format];
	}

	/*!
	 * Set the value of the LatitudeDistance input for this Choreo.
	*(required, decimal) Specify the distance from the center point in the latitudinal direction to the rectangle's East/West oriented sides.
	 */
	-(void)setLatitudeDistance:(NSString*)LatitudeDistance {
		[super setInput:@"LatitudeDistance" toValue:LatitudeDistance];
	}

	/*!
	 * Set the value of the LongitudeDistance input for this Choreo.
	*(required, decimal) Specify the distance from the center point in the longitudinal direction to the rectangle's North/South oriented side.
	 */
	-(void)setLongitudeDistance:(NSString*)LongitudeDistance {
		[super setInput:@"LongitudeDistance" toValue:LongitudeDistance];
	}

	/*!
	 * Set the value of the NumberOfDays input for this Choreo.
	*(optional, integer) Specify the number of days to retieve data for. If null, data from the earliest date in the dabase is returned.
	 */
	-(void)setNumberOfDays:(NSString*)NumberOfDays {
		[super setInput:@"NumberOfDays" toValue:NumberOfDays];
	}

	/*!
	 * Set the value of the SquareResolution input for this Choreo.
	*(optional, decimal) Enter desired data resolution in kilometers.  Default is 5km.
	 */
	-(void)setSquareResolution:(NSString*)SquareResolution {
		[super setInput:@"SquareResolution" toValue:SquareResolution];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(required, date) Enter the start time for retrieval of NDWD data in following format: 2004-04-27 If null, the earliest date in the database is returned.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherByCenterPointSubgridSummarized Choreo.
 */
@implementation TMBNOAA_WeatherByCenterPointSubgridSummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve weather information for a rectangle defined by a center point and distances in the latitudinal and longitudinal directions.
 */
@implementation TMBNOAA_WeatherByCenterPointSubgridSummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherByCenterPointSubgridSummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherByCenterPointSubgridSummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherByCenterPointSubgridSummarized_ResultSet *results = [[[TMBNOAA_WeatherByCenterPointSubgridSummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherByCenterPointSubgridSummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherByCenterPointSubgridSummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherByCenterPointSubgridSummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the ListCityCoordinatesUnsummarized Choreo.
 */
@implementation TMBNOAA_ListCityCoordinatesUnsummarized_Inputs

	/*!
	 * Set the value of the CitiesLevel input for this Choreo.
	*(integer) Enter a city grouping number to retrieve its latitude and longitude coordinates. For example: enter 1, to obtain information for primary U.S. cities.
	 */
	-(void)setCitiesLevel:(NSString*)CitiesLevel {
		[super setInput:@"CitiesLevel" toValue:CitiesLevel];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the ListCityCoordinatesUnsummarized Choreo.
 */
@implementation TMBNOAA_ListCityCoordinatesUnsummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (XML) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve unsummarized latitude and longitude data for a specified list of cities.
 */
@implementation TMBNOAA_ListCityCoordinatesUnsummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_ListCityCoordinatesUnsummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/ListCityCoordinatesUnsummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_ListCityCoordinatesUnsummarized_ResultSet *results = [[[TMBNOAA_ListCityCoordinatesUnsummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the ListCityCoordinatesUnsummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_ListCityCoordinatesUnsummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_ListCityCoordinatesUnsummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherForPointsOnLineSummarized Choreo.
 */
@implementation TMBNOAA_WeatherForPointsOnLineSummarized_Inputs

	/*!
	 * Set the value of the Endpoint1Latitude input for this Choreo.
	*(required, integer) Enter the latitude of the first endpoint of the line for which weather data is requested. North latitude is positive.
	 */
	-(void)setEndpoint1Latitude:(NSString*)Endpoint1Latitude {
		[super setInput:@"Endpoint1Latitude" toValue:Endpoint1Latitude];
	}

	/*!
	 * Set the value of the Endpoint1Longitude input for this Choreo.
	*(required, integer) Enter the longitude of the first endpoint of the line for which weather data is requested. West longitude is negative.
	 */
	-(void)setEndpoint1Longitude:(NSString*)Endpoint1Longitude {
		[super setInput:@"Endpoint1Longitude" toValue:Endpoint1Longitude];
	}

	/*!
	 * Set the value of the Endpoint2Latitude input for this Choreo.
	*(required, integer) Enter the latitude of the second endpoint of the line for which weather data is requested. North latitude is positive.
	 */
	-(void)setEndpoint2Latitude:(NSString*)Endpoint2Latitude {
		[super setInput:@"Endpoint2Latitude" toValue:Endpoint2Latitude];
	}

	/*!
	 * Set the value of the Endpoint2Longitude input for this Choreo.
	*(required, integer) Enter the longitude of the second endpoint of the line for which weather data is requested. West longitude is negative.
	 */
	-(void)setEndpoint2Longitude:(NSString*)Endpoint2Longitude {
		[super setInput:@"Endpoint2Longitude" toValue:Endpoint2Longitude];
	}

	/*!
	 * Set the value of the Format input for this Choreo.
	*(required, string) Specify a timespan for which NDFD data will be summarized. Enter: 24 hourly, for a 24 hour summary, or: 12 hourly, for a 12 hour weather summary.
	 */
	-(void)setFormat:(NSString*)Format {
		[super setInput:@"Format" toValue:Format];
	}

	/*!
	 * Set the value of the NumberOfDays input for this Choreo.
	*(optional, integer) Specify the number of days to retieve data for. If null, data from the earliest date in the dabase is returned.
	 */
	-(void)setNumberOfDays:(NSString*)NumberOfDays {
		[super setInput:@"NumberOfDays" toValue:NumberOfDays];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest date in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherForPointsOnLineSummarized Choreo.
 */
@implementation TMBNOAA_WeatherForPointsOnLineSummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve weather information for all points on a line defined by a set of latitude and longitude coordinates.
 */
@implementation TMBNOAA_WeatherForPointsOnLineSummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherForPointsOnLineSummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherForPointsOnLineSummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherForPointsOnLineSummarized_ResultSet *results = [[[TMBNOAA_WeatherForPointsOnLineSummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherForPointsOnLineSummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherForPointsOnLineSummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherForPointsOnLineSummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherForSinglePointSummarized Choreo.
 */
@implementation TMBNOAA_WeatherForSinglePointSummarized_Inputs

	/*!
	 * Set the value of the Format input for this Choreo.
	*(required, string) Specify a timespan for which NDFD data will be summarized. Enter: 24 hourly, for a 24 hour summary, or: 12 hourly, for a 12 hour weather summary.
	 */
	-(void)setFormat:(NSString*)Format {
		[super setInput:@"Format" toValue:Format];
	}

	/*!
	 * Set the value of the Latitude input for this Choreo.
	*(required, decimal) Enter the latitude coordinates of the point for which weather data is requested. North latitude is positive.
	 */
	-(void)setLatitude:(NSString*)Latitude {
		[super setInput:@"Latitude" toValue:Latitude];
	}

	/*!
	 * Set the value of the Longitude input for this Choreo.
	*(required, decimal) Enter the longitude coordinate of the point for which weather data is requested. West longitude is negative.
	 */
	-(void)setLongitude:(NSString*)Longitude {
		[super setInput:@"Longitude" toValue:Longitude];
	}

	/*!
	 * Set the value of the NumberOfDays input for this Choreo.
	*(optional, integer) Specify the number of days to retieve data for. If null, data from the earliest date in the dabase is returned.
	 */
	-(void)setNumberOfDays:(NSString*)NumberOfDays {
		[super setInput:@"NumberOfDays" toValue:NumberOfDays];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest date in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherForSinglePointSummarized Choreo.
 */
@implementation TMBNOAA_WeatherForSinglePointSummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve weather information for a single point defined by latitude and longitude coordinates.
 */
@implementation TMBNOAA_WeatherForSinglePointSummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherForSinglePointSummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherForSinglePointSummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherForSinglePointSummarized_ResultSet *results = [[[TMBNOAA_WeatherForSinglePointSummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherForSinglePointSummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherForSinglePointSummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherForSinglePointSummarized_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherByZipcode Choreo.
 */
@implementation TMBNOAA_WeatherByZipcode_Inputs

	/*!
	 * Set the value of the EndDate input for this Choreo.
	*(optional, date) Enter today's date, or some future date in UTC format. Format: 2004-04-27T12:00. Defaults to NOW if not provided.
	 */
	-(void)setEndDate:(NSString*)EndDate {
		[super setInput:@"EndDate" toValue:EndDate];
	}

	/*!
	 * Set the value of the NDFDParameterName input for this Choreo.
	*(optional, string) Enter an additional weather parameter in the following format: phail=phail. Use only if Product is set to: glance.
	 */
	-(void)setNDFDParameterName:(NSString*)NDFDParameterName {
		[super setInput:@"NDFDParameterName" toValue:NDFDParameterName];
	}

	/*!
	 * Set the value of the Product input for this Choreo.
	*(required, string) Enter one of two parameters: time-series (to return all data between the Begin and End time parameters); glance for a subset of 5 often used parameters
	 */
	-(void)setProduct:(NSString*)Product {
		[super setInput:@"Product" toValue:Product];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest date in the database is returned.  Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

	/*!
	 * Set the value of the ZipCodeList input for this Choreo.
	*(required, integer) Enter the zipcode for which NDFD weather information will be retrieved.
	 */
	-(void)setZipCodeList:(NSString*)ZipCodeList {
		[super setInput:@"ZipCodeList" toValue:ZipCodeList];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherByZipcode Choreo.
 */
@implementation TMBNOAA_WeatherByZipcode_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve DWML-encoded NDFD data for a specified zipcode (in 50 U.S. States and Puerto Rico).
 */
@implementation TMBNOAA_WeatherByZipcode

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherByZipcode Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherByZipcode"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherByZipcode_ResultSet *results = [[[TMBNOAA_WeatherByZipcode_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherByZipcode Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherByZipcode_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherByZipcode_Inputs alloc] init] autorelease];
	}
@end

/*!
 * Input object with appropriate setters for specifying arguments to the WeatherForSinglePointUnsummarized Choreo.
 */
@implementation TMBNOAA_WeatherForSinglePointUnsummarized_Inputs

	/*!
	 * Set the value of the EndDate input for this Choreo.
	*(optional, date) Enter the end time for retrieval of NDWD information in UTC format. If null, the last available time in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setEndDate:(NSString*)EndDate {
		[super setInput:@"EndDate" toValue:EndDate];
	}

	/*!
	 * Set the value of the Latitude input for this Choreo.
	*(required, decimal) Enter the latitude coordinate of the point for which weather data is requested. North latitude is positive.
	 */
	-(void)setLatitude:(NSString*)Latitude {
		[super setInput:@"Latitude" toValue:Latitude];
	}

	/*!
	 * Set the value of the Longitude input for this Choreo.
	*(required, decimal) Enter the longitude coordinate of the point for which weather data is requested. West longitude is negative.
	 */
	-(void)setLongitude:(NSString*)Longitude {
		[super setInput:@"Longitude" toValue:Longitude];
	}

	/*!
	 * Set the value of the Product input for this Choreo.
	*(required, string) Enter one of two parameters: time-series (to return all data between the Begin and End time parameters); glance for a subset of 5 often used parameters
	 */
	-(void)setProduct:(NSString*)Product {
		[super setInput:@"Product" toValue:Product];
	}

	/*!
	 * Set the value of the StartDate input for this Choreo.
	*(optional, date) Enter the start time for retrieval of NDWD information in UTC format. If null, the earliest time in the database is returned. Format: 2004-04-27T12:00.
	 */
	-(void)setStartDate:(NSString*)StartDate {
		[super setInput:@"StartDate" toValue:StartDate];
	}

	/*!
	 * Set the value of the Unit input for this Choreo.
	*(optional, string) Enter the unit format the data will be displayed in. Default is: e, for Standard English (U.S. Standard).  Or: m, for Metric (SI Units).
	 */
	-(void)setUnit:(NSString*)Unit {
		[super setInput:@"Unit" toValue:Unit];
	}

@end

/*!
 * Results object with appropriate getters for retrieving outputs from the WeatherForSinglePointUnsummarized Choreo.
 */
@implementation TMBNOAA_WeatherForSinglePointUnsummarized_ResultSet

	-(id)initWithResponse:(NSDictionary*)document {
		return [super initWithResponse:document];
	}

	/*!
	 * Retrieve the value of the "Response" output from an execution of this Choreo.
	 * @return - NSString* (xml) Response from NDFD servers.
	 * @throws TMBExceptionNotFound if output does not exist. (Note an empty response is considered valid)
	 */
	-(NSString*)getResponse {
		return [super getOutputByName:@"Response"];
	}

@end

/*!
 * Retrieve unsummarized weather information for a single point defined by latitude and longitude coordinates.
 */
@implementation TMBNOAA_WeatherForSinglePointUnsummarized

	/*!
	 * Initialize the Choreo with a valid session
	 *
	 * @param session - A TMBTembooSession containing valid Temboo Application Key credentials
	 *
	 * @return - The initialized TMBNOAA_WeatherForSinglePointUnsummarized Choreo
	 */
	-(id)initWithSession:(TMBTembooSession *)session {
		TMBTembooUri *uri = [[[TMBTembooUri alloc] initWithString:@"/Library/NOAA/WeatherForSinglePointUnsummarized"] autorelease];
		return [super initWithSession:session andUri:uri];
	}

	/**
	 * TMBChoreographyDelegate protocol method - called when this Choreo's execution
	 * completes successfully. This class in turn calls the same function on the object
	 * (delegate) which was specified as when the choreo execution was initiated.
	 *
	 * @param response The execution response from the Temboo server
	 *
	 * @return void
	 */
	-(void)choreographyDidFinishExecuting:(NSDictionary*)response {
		TMBNOAA_WeatherForSinglePointUnsummarized_ResultSet *results = [[[TMBNOAA_WeatherForSinglePointUnsummarized_ResultSet alloc] initWithResponse:response] autorelease];
		[self.choreoDelegate choreographyDidFinishExecuting:results];
	}

	/*!
	 * Obtain an inputs object for the WeatherForSinglePointUnsummarized Choreo.
	 *
	 * @return - New inputs object
	 */
	-(TMBNOAA_WeatherForSinglePointUnsummarized_Inputs*)newInputSet {
		return [[[TMBNOAA_WeatherForSinglePointUnsummarized_Inputs alloc] init] autorelease];
	}
@end


text:
<!doctype html>

		<meta charset="ISO-8859-1">

		<title>reveal.js - The HTML Presentation Framework</title>

		<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
		<meta name="author" content="Hakim El Hattab">

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<link rel="stylesheet" href="css/reveal.min.css">
		<link rel="stylesheet" href="css/theme/default.css" id="theme">

		<link rel="stylesheet" href="lib/css/zenburn.css">

Crimes virtuais

Thiago Gonçalves Cardoso Resende

Marcelo César de Almeida Júnior

Matheus Souza Silva

Peterson Teixeira

O que são "crimes virtuais"?

Crimes virtuais são os delitos praticados através da internet que podem ser enquadrados no Código Penal Brasileiro e os infratores estão sujeitos às penas previstas na Lei.

Estes crimes podem levar a punições como pagamento de indenização ou prisão. As punições para menores de 18 anos são diferentes, podem ser prestação de serviços à comunidade ou até internação em uma instituição.

Categorias de Crimes Virtuais

        Crimes próprios : aqueles
que sejam praticados por computador e se realizem ou se consumem também
em meio eletrônico. Neles, a informática (segurança dos sistemas,
titularidade das informações e integridade dos dados, da máquina e
periféricos) é o objeto jurídico tutelado.

Crimes eletrônicos impuros ou impróprios: são aqueles em que o
agente se vale do computador como meio para produzir resultado
naturalístico, que ofenda o mundo físico ou o espaço "real", ameaçando
ou lesando outros bens, não-computacionais ou diversos da informática.

Tipos de Crimes

Ameaça – É crime escrever ou mostrar uma imagem que ameace
alguém, avisando que a pessoa será vítima de algum mal ainda que seja em
 tom de piada ou brincadeira. Mesmo se isso é feito de maneira anônima, é
 possível para a polícia e para o provedor descobrir quem foi o autor da
 ameaça.

Difamação, injúria e calúnia – São crimes contra a honra. Podem
ocorrer nas redes sociais, por exemplo, se alguém divulgar informações
falsas que prejudiquem a reputação de outra pessoa, ofendam a dignidade
do outro ou maldosamente acusem alguém de criminoso, desonesto ou
perigoso.

Discriminação –Escrever uma mensagem ou publicar uma imagem que
seja preconceituosa em relação a raça, cor, etnia, religião ou origem de
 uma pessoa. Isso acontece mais frequentemente em redes sociais – é só
lembrar das comunidades do tipo "Eu odeio…"

Estelionato – Ocorre quando o criminoso engana a vítima para
conseguir uma vantagem financeira. Pode acontecer em sites de leilões,
por exemplo, se o vendedor enganar o comprador recebendo o dinheiro da
transação sem entregar a mercadoria

    Falsa identidade – Ocorre quando alguém mente seu nome, idade,
estado civil, sexo e outras características com o objetivo de obter
alguma vantagem ou prejudicar outra pessoa. Pode acontecer numa rede
social, por exemplo, se um adulto mentir de má fé e se fizer passar por
um adolescente para se relacionar com usuários jovens

Phishing - É quando informações particulares ou sigilosas (como
número do CPF, da conta bancária e senha de acesso) são capturadas para
depois serem usadas em roubo ou fraude. Em inglês, pronuncia-se "fíchin"

Pirataria – É copiar ou reproduzir músicas, livros e outras
criações artísticas sem autorização do autor. Também é pirataria usar
softwares que são vendidos pelas empresas, mas o usuário instalou sem
pagar por eles. A pirataria é um grande problema para quem produz CDs,
filmes, livros e softwares. Na área de informática, aproximadamente 41%
dos softwares são piratas

Dano por difusão de código malicioso eletrônico, ou digital ou similar

Art. 163-A: Criar, inserir, ou difundir código malicioso em dispositivo de comunicação, rede de computadores, ou sistema informatizado.

Pena: Reclusão, de um (1) a três (3) anos, e multa.

    Invasão de dispositivo informático (Carolina Dieckmann)

Art. 154-A.  Invadir dispositivo informático alheio, conectado ou não à rede de computadores, mediante violação indevida de mecanismo de segurança e com o fim de obter, adulterar ou destruir dados ou informações sem autorização expressa ou tácita do titular do dispositivo ou instalar vulnerabilidades para obter vantagem ilícita:

Pena - detenção, de 3 (três) meses a 1 (um) ano, e multa.

Perguntas

    Quais as consequências da divulgação de conteúdo impróprio na internet ?

Quais ferramentas devemos usar para combater os crimes virtuais ?

As redes sociais são as responsáveis pela divagação de  conteúdos que denegri a imagem da pessoa ?

redpajama_set_name: RedPajamaGithub


text:
module MovieStone::Output
  class Asana < Mail

    private
    def initialize_fields
      super
      @to_addr   = MovieStone.config.asana[:project_addr]
      @from_addr = MovieStone.config.asana[:from_addr] || MovieStone.config.mail[:settings][:from_addr]
    end
  end
end


text:
Filter

			Woche:

				<select id='activityFilter' class='form-control' ng-model='activityIdFilter' ng-change='updateSelection()'>
					<option ng-repeat='activity in activities' value='{{activity._id}}'>{{activity.name}}</option>
				</select>

					<button class='btn btn-info' ng-click='clearActivitySelection()'>

					</button>

      	<button type='button' class='btn btn-primary btn-block' ng-click='getReportData()'>Laden</button>

	 Export to Excel
	 Export to Excel

			Woche
			Vorname
			Nachname

			Geburtstag
			Schulstufe

			Unverträglichkeiten
			Allergien
			Medikamente
			Diagnose
			Kann Schwimmen
			Darf allein nach Hause
			Kommentar Intern

			Wohnort
			Vorname Eltern
			Nachname Eltern
			Email Eltern
			Tel. Eltern
			Kontakt1
			Tel. Kontakt1
			Kontak2
			Tel. Kontakt2
			Media
			Anmeldedatum

			{{reg.activityId.name}}
			{{reg.firstNameChild}}
			{{reg.lastNameChild}}

			{{reg.birthdayChild | date: 'dd/MM/yyyy'}}
			{{reg.schoolChild}}
			{{reg.healthIncompatibility}}
			{{reg.healthAllergy}}
			{{reg.healthIllnes}}
			{{reg.disabilityDescription}}

			{{formatBool(reg.canSwim)}}
			{{formatBool(reg.canGoHomeAllone)}}
			{{reg.commentInternal}}

			{{reg.cityChild}}
			{{reg.firstNameParent}}
			{{reg.lastNameParent}}
			{{reg.emailParent}}
			{{reg.phoneNumberParent}}
			{{reg.nameContact1}}
			{{reg.telContact1}}
			{{reg.nameContact2}}
			{{reg.telContact2}}
			{{formatBool(reg.acceptsMediaPublication)}}
			{{reg.registrationDate | date: 'dd/MM/yyyy : hh.mm.ss'}}

			Woche
			Vorname
			Nachname
			Geburtstag
			Schulstufe
			Unverträglichkeiten
			Allergien
			Medikamente
			Diagnose

			Wohnort
			Vorname Eltern
			Nachname Eltern
			Email Eltern
			Tel. Eltern
			Kontakt1
			Tel. Kontakt1
			Kontak2
			Tel. Kontakt2
			Media
			Anmeldedatum

			{{reg.activityId.name}}
			{{reg.firstNameChild}}
			{{reg.lastNameChild}}
			{{reg.birthdayChild | date: 'dd/MM/yyyy'}}
			{{reg.schoolChild}}
			{{reg.healthIncompatibility}}
			{{reg.healthAllergy}}
			{{reg.healthIllnes}}
			{{reg.disabilityDescription}}

			{{reg.cityChild}}
			{{reg.firstNameParent}}
			{{reg.lastNameParent}}
			{{reg.emailParent}}
			{{reg.phoneNumberParent}}
			{{reg.nameContact1}}
			{{reg.telContact1}}
			{{reg.nameContact2}}
			{{reg.telContact2}}
			{{formatBool(reg.acceptsMediaPublication)}}
			{{reg.registrationDate | date: 'dd/MM/yyyy : hh.mm.ss'}}


text:
class Solution {
    public long numberOfWays(String s) {
        int length = s.length();
        int[] left = new int[2];
        int[] right = new int[2];
        int[][] leftCount = new int[2][length];
        int[][] rightCount = new int[2][length];

        for (int i = 0; i < length; i++) {
            int leftDigit = Character.getNumericValue(s.charAt(i));
            left[leftDigit]++;
            leftCount[0][i] = left[0];
            leftCount[1][i] = left[1];

            int rightIndex = length - i - 1;
            int rightDigit = Character.getNumericValue(s.charAt(rightIndex));
            right[rightDigit]++;
            rightCount[0][rightIndex] = right[0];
            rightCount[1][rightIndex] = right[1];
        }

        long result = 0l;
        for (int i = 1; i + 1 < length; i++) {
            char c = s.charAt(i);
            int flip = c == '0' ? 1 : 0;
            result += leftCount[flip][i - 1] * rightCount[flip][i + 1];
            System.out.println(i + " " + c + " : " + leftCount[flip][i - 1] + " " + rightCount[flip][i + 1] + " = " + result);
        }

        return result;
    }
}
//Runtime: 199 ms, faster than 21.94% of Java online submissions for Number of Ways to Select Buildings.
//Memory Usage: 98.3 MB, less than 40.40% of Java online submissions for Number of Ways to Select Buildings.


text:
from .. import Payment
from .. import Payments
from ..interfaces import IPaymentData
from ..interfaces import ISurcharge
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
from bda.plone.orders import interfaces as ifaces
from bda.plone.orders.common import OrderData
from plone import api
from plone.protect.authenticator import createToken
from tvl.payment.dps import dps
from tvl.payment.dps.dps_parameters import DPSConfig
from zExceptions import Redirect
from zope.i18nmessageid import MessageFactory
import logging
import os
import sys
import traceback

logger = logging.getLogger('bda.plone.payment')
_ = MessageFactory('bda.plone.payment')

DEPLOYMENT = os.environ.get('deployment', '')

class PxPayPayment(Payment):
    pid = 'pxpay_payment'

    @property
    def label(self):
        try:
            settings = ISurcharge(self.context)
        except TypeError:
            settings = None

        if settings:
            if settings.percent_surcharge and settings.fixed_surcharge:
                return _('pxpay_payment',
                         default=u'Credit card - DPS PaymentExpress - '
                                 u'surcharge of ${percent}% '
                                 u'and ${fixed} ${currency} '
                                 u'added to the order total',
                         mapping={
                             'percent': settings.percent_surcharge,
                             'fixed': settings.fixed_surcharge,
                             'currency': settings.currency
                             })
            elif settings.percent_surcharge:
                return _('pxpay_payment',
                         default=u'Credit card - DPS PaymentExpress - '
                                 u'${percent}% surcharge '
                                 u'added to the order total',
                         mapping={
                             'percent': settings.percent_surcharge,
                             })
            elif settings.fixed_surcharge:
                return _('pxpay_payment',
                         default=u'Credit card - DPS PaymentExpress - '
                                 u'surcharge of ${fixed} ${currency} '
                                 u'added to the order total',
                         mapping={
                             'fixed': settings.fixed_surcharge,
                             'currency': settings.currency,
                             })

        return _('pxpay_payment', 'Credit card - DPS PaymentExpress')

    def init_url(self, uid):
        return '%s/@@pxpay_payment?uid=%s' % (api.portal.get().absolute_url(),
                                              uid)

class PxPayError(Exception):
    """Raised if PxPay payment return an error.
    """

class PxPay(BrowserView):

    def __call__(self):
        base_url = api.portal.get().absolute_url()
        order_uid = self.request['uid']
        logger.info('Start')
        try:
            data = IPaymentData(self.context).data(order_uid)
            dps_parms = DPSConfig()
            req = dps.GenerateRequest()
            req.PxPayUserId = dps_parms.PxPayUserId
            req.PxPayKey = dps_parms.PxPayKey
            req.AmountInput = "%0.2f" % (float(data['amount']) / 100.0)
            req.CurrencyInput = data['currency']
            req.MerchantReference = data['ordernumber']
            req.TxnData1 = 'IPurchaseProcess'
            req.TxnData2 = order_uid
            req.add_txn_parameters(ordernumber=data['ordernumber'])
            if not api.user.is_anonymous():
                req.add_txn_parameters(
                    member_id=api.user.get_current().getMemberId())
            req.TxnType = 'Purchase'
            req.UrlSuccess = '{base_url}/{view}?_authenticator={token}'.format(
                    view='@@pxpay_payment_success',
                    base_url=base_url,
                    token=createToken()
                    )
            req.UrlFail = '%s/@@pxpay_payment_failed' % base_url
            logger.info("Auth: %s" % req)
            result = req.getResponse()
            logger.info(result)
            if not result.valid:
                logger.info("Auth Error: %s" % result)
                raise PxPayError('Problem Initialising Payment')
            redirect_url = result.URI
        except Exception, e:
            logger.error(u"Could not initialize payment: '%s'" % str(e))
            redirect_url = ('{base_url}/{view}?'
                            'uid={order_uid}_authenticator={token}').format(
                            view='@@pxpay_payment_failed',
                            base_url=base_url,
                            order_uid=order_uid,
                            token=createToken()
                            )

        raise Redirect(redirect_url)

def shopmaster_mail(context):
    props = getToolByName(context, 'portal_properties')
    return props.site_properties.email_from_address

def restore_user(old_security_manager, new_roles):
    if old_security_manager:
        user = api.user.get_current()
        if new_roles:
            api.user.revoke_roles(user=user, roles=new_roles)
        logger.info("restoring user: {} roles: {}".format(
            user, api.user.get_roles()))
        if new_roles:
            for role in new_roles:
                assert role not in api.user.get_roles()
        setSecurityManager(old_security_manager)

class PxPaySuccess(BrowserView):

    def verify(self):
        old_security_manager = None  # Used for anon notification IPN
        new_roles = None
        receipt = None
        success = None
        try:
            result = self.request.get('result', '')
            if result:
                dps_parms = DPSConfig()
                req = dps.ProcessResponse()
                req.PxPayUserId = dps_parms.PxPayUserId
                req.PxPayKey = dps_parms.PxPayKey
                req.Response = result
                receipt = req.getResponse()
                logger.info(receipt)

                uid = receipt.TxnData2
                if receipt.ResponseText == 'APPROVED':
                    success = True
                else:
                    success = False
                    logger.error(u"Payment completion failed: '%s' uid %s" %
                                 (receipt.MerchantReference, uid))
                ordernumber = receipt.MerchantReference
                tid = receipt.DpsTxnRef
                order_uid = IPaymentData(self.context).uid_for(ordernumber)
                order_uid = receipt.TxnData2
                payment = Payments(self.context).get('pxpay_payment')
                order = OrderData(self.context, uid=order_uid)
                self._receipt = receipt
                # Already Processed
                try:
                    receipt = order.receipt
                    success = False
                except AttributeError:
                    pass

            else:
                receipt = None
                success = False
                tid = None

            evt_data = {'tid': tid, 'receipt': receipt}

            if (api.user.is_anonymous() and receipt and
                    receipt.tvl_txn_parameters.get('member_id', None)):
                # We need to act as the user in case of anon ipn from DPS.
                # This is needed to send email and such if basket content is
                # not available to Anon users
                # Unfortunately we can't just use a context manager as things
                # happen in events outside the block
                old_security_manager = getSecurityManager()
                with api.env.adopt_roles(roles=['Manager']):
                    user = api.user.get(
                        # userid=receipt.tvl_txn_parameters['member_id'])
                        userid='amauser')
                    newSecurityManager(self.request, user)
                    # Need to have access to content
                    old_roles = api.user.get_roles()
                    if set(['SiteAdministrator',
                            'Manager']).isdisjoint(old_roles):
                        new_roles = ['SiteAdministrator']
                        api.user.grant_roles(
                            user=user, roles=new_roles)
                        logger.info("user {} roles: {} : new roles: {}".format(
                            api.user.get_current(), api.user.get_roles()))
                logger.info("promoting user: {} roles: {}".format(
                    api.user.get_current(), new_roles))

            # TID is added as part of event processing for success or fail.
            # ensure events are only triggered once.
            if tid in order.tid:
                logger.info("Payment with tid: {} has already been "
                            "returned".format(tid))
                return success
            elif success:
                payment.succeed(self.request, order_uid, evt_data)
                restore_user(old_security_manager, new_roles)
                return True
            else:
                payment.failed(self.request, order_uid, evt_data)
                restore_user(old_security_manager, new_roles)
                return False
        except Exception, e:
            restore_user(old_security_manager, new_roles)

            msg = "Receipt: {}\nsuccess: {}\n\n {}".format(
                receipt,
                success,
                ''.join(traceback.format_exception(*sys.exc_info())))

            api.portal.send_email(
                recipient='support@thevirtual.co.nz',
                subject="{} - {} PXPay Payment Error".format(
                    DEPLOYMENT, api.portal.get().Title()),
                body=msg)
            logger.error(u"Payment verification failed: '%s'" % str(e))
            return False

    @property
    def receipt(self):
        try:
            return self._receipt

        except AttributeError:
            return None

    @property
    def shopmaster_mail(self):
        return shopmaster_mail(self.context)

class PxPayFailed(BrowserView):

    def finalize(self):
        dps_parms = DPSConfig()
        result = self.request.get('result', '')
        if result:
            req = dps.ProcessResponse()
            req.PxPayUserId = dps_parms.PxPayUserId
            req.PxPayKey = dps_parms.PxPayKey
            req.Response = result

            receipt = req.getResponse()
            self._receipt = receipt
            logger.info(receipt)
            uid = receipt.TxnData2
            tid = receipt.DpsTxnRef
        else:
            uid = self.request.get('uid', '')
            tid = None
            receipt = None

        payment = Payments(self.context).get('pxpay_payment')
        payment.failed(self.request, uid, {'tid': tid,
                       'receipt': receipt})

    @property
    def receipt(self):
        try:
            return self._receipt
        except AttributeError:
            return None

    @property
    def shopmaster_mail(self):
        return shopmaster_mail(self.context)

def payment_success(event):
    if event.payment.pid == 'pxpay_payment':
        data = event.data
        order = OrderData(event.context, uid=event.order_uid)
        # Processed already
        if data['tid'] in order.tid:
            return
        order.salaried = ifaces.SALARIED_YES
        order.tid = data['tid']
        order.receipt = data['receipt']

def payment_failed(event):
    if event.payment.pid == 'pxpay_payment':
        data = event.data
        order = OrderData(event.context, uid=event.order_uid)
        # Processed already
        if data['tid'] in order.tid:
            return
        order.salaried = ifaces.SALARIED_FAILED
        order.tid = data['tid']
        order.receipt = data['receipt']


text:
<?php

namespace MySQLQueryExplain\Server\MySQL;

/**
 * @author Lukas Lukac <services@trki.sk>
 */
class ApplicationRepository extends BaseRepository
{
}


text:
import Iterator from './Iterator';

export default class SelectManyIterator extends Iterator {
  constructor(arr, callback) {
    super(arr);

    if (typeof callback !== 'function') {
      throw new Error('Callback must be a function');
    }

    this.callback = callback;
  }

  *[Symbol.iterator]() {
    for (let item of this.arr) {
      for (let subItem of this.callback(item)) {
        yield subItem;
      }
    }
  }
}


text:
module CapistranoDeploy
  module Multistage
    def self.load_into(configuration)
      configuration.load do
        set :multistage_config, Config.new(configuration)

        def define_stage(*args, &block)
          warn "[DEPRECATION] `define_stage` is deprecated, use `stage` instead"
          stage(*args, &block)
        end

        def stage(name, options={}, &block)
          set :default_stage, name.to_sym if options.delete(:default)
          multistage_config.stage(name, options)
          callbacks[:start].detect { |c| c.source == 'multistage:ensure' }.except << name.to_s

          task(name) do
            set :current_stage, name.to_s
            options.each do |k, v|
              set k, v if v
            end
            block.call if block
          end
        end

        namespace :multistage do
          task :ensure do
            unless exists?(:current_stage)
              if stage = multistage_config.inferred_stage
                find_and_execute_task(stage.name)
              elsif exists?(:default_stage)
                find_and_execute_task(default_stage)
              else
                stage_names = multistage_config.stages.map(&:name)
                abort "No stage specified. Please specify one of: #{stage_names.join(', ')} (e.g. `cap #{stage_names.first} #{ARGV.last}')"
              end
            end
          end
        end

        on :start, 'multistage:ensure'
      end
    end

    # Handles multistage configuration
    class Config
      attr_reader :config
      attr_reader :stages

      def initialize(config)
        @config = config
        @stages = []
      end

      def stage(name, options={})
        stages << Stage.new(name, options)
      end

      def inferred_stage
        if config.using_recipe?(:git)
          branch = config.local_branch
          stages.find { |stage| stage.options[:branch].to_s == branch }
        end
      end
    end

    class Stage
      attr_reader :name
      attr_reader :options

      def initialize(name, options={})
        @name    = name
        @options = options
      end
    end
  end
end


text:
'use strict';

const React = require('react');

const {
  Button,
  InputAccessoryView,
  Text,
  TextInput,
  View,
  StyleSheet,
  Slider,
  Switch,
  Alert,
} = require('react-native');
import type {KeyboardType} from 'react-native/Libraries/Components/TextInput/TextInput';

const TextInputSharedExamples = require('./TextInputSharedExamples.js');

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

class WithLabel extends React.Component<$FlowFixMeProps> {
  render(): React.Node {
    return (
      <View style={styles.labelContainer}>
        <View style={styles.label}>
          <Text>{this.props.label}</Text>
        </View>
        {this.props.children}
      </View>
    );
  }
}

class TextInputAccessoryViewChangeTextExample extends React.Component<
  {...},
  {text: string},
> {
  constructor(props: void | {...}) {
    super(props);
    this.state = {text: 'Placeholder Text'};
  }

  render(): React.Node {
    const inputAccessoryViewID = 'inputAccessoryView1';
    return (
      <View>
        <Text>Set InputAccessoryView with ID & reset text:</Text>
        <TextInput
          style={styles.default}
          inputAccessoryViewID={inputAccessoryViewID}
          onChangeText={text => this.setState({text})}
          value={this.state.text}
        />
        <InputAccessoryView nativeID={inputAccessoryViewID}>
          <View style={{backgroundColor: 'white'}}>
            <Button
              onPress={() => this.setState({text: 'Placeholder Text'})}
              title="Reset Text"
            />
          </View>
        </InputAccessoryView>
      </View>
    );
  }
}

class TextInputAccessoryViewChangeKeyboardExample extends React.Component<
  {...},
  {keyboardType: string, text: string},
> {
  constructor(props: void | {...}) {
    super(props);
    this.state = {text: '', keyboardType: 'default'};
  }

  _switchKeyboard = () => {
    this.setState({
      keyboardType:
        this.state.keyboardType === 'default' ? 'number-pad' : 'default',
    });
  };

  render(): React.Node {
    const inputAccessoryViewID = 'inputAccessoryView2';
    return (
      <View>
        <Text>Set InputAccessoryView with ID & switch keyboard:</Text>
        {/* $FlowFixMe[incompatible-use] */}
        <TextInput
          style={styles.default}
          inputAccessoryViewID={inputAccessoryViewID}
          onChangeText={text => this.setState({text})}
          value={this.state.text}
          // $FlowFixMe[incompatible-type]
          keyboardType={this.state.keyboardType}
          returnKeyType="done"
        />
        <InputAccessoryView nativeID={inputAccessoryViewID}>
          <View style={{backgroundColor: 'white'}}>
            <Button onPress={this._switchKeyboard} title="Switch Keyboard" />
          </View>
        </InputAccessoryView>
      </View>
    );
  }
}

class TextInputAccessoryViewDefaultDoneButtonExample extends React.Component<
  $ReadOnly<{|
    keyboardType: KeyboardType,
  |}>,
  {text: string},
> {
  constructor(props: void | $ReadOnly<{keyboardType: KeyboardType}>) {
    super(props);
    this.state = {text: ''};
  }

  render(): React.Node {
    return (
      <TextInput
        style={styles.default}
        onChangeText={text => this.setState({text})}
        value={this.state.text}
        keyboardType={this.props.keyboardType}
        returnKeyType="done"
      />
    );
  }
}

class RewriteExampleKana extends React.Component<$FlowFixMeProps, any> {
  constructor(props: any | void) {
    super(props);
    this.state = {text: ''};
  }
  render(): React.Node {
    return (
      <View style={styles.rewriteContainer}>
        <TextInput
          multiline={false}
          onChangeText={text => {
            this.setState({text: text.replace(/ひ/g, '日')});
          }}
          style={styles.default}
          value={this.state.text}
        />
      </View>
    );
  }
}

class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
  constructor(props: any | void) {
    super(props);
    this.state = {
      text: '',
      password: '',
      isSecureTextEntry: true,
    };
  }
  render(): React.Node {
    return (
      <View>
        <TextInput
          secureTextEntry={true}
          style={styles.default}
          defaultValue="abc"
          onChangeText={text => this.setState({text})}
          value={this.state.text}
        />
        <Text>Current text is: {this.state.text}</Text>
        <View
          style={{
            flex: 1,
            flexDirection: 'row',
          }}>
          <TextInput
            style={styles.default}
            defaultValue="cde"
            onChangeText={text => this.setState({password: text})}
            secureTextEntry={this.state.isSecureTextEntry}
            value={this.state.password}
          />
          <Switch
            onValueChange={value => {
              this.setState({isSecureTextEntry: value});
            }}
            style={{marginLeft: 4}}
            value={this.state.isSecureTextEntry}
          />
        </View>
      </View>
    );
  }
}

class AutogrowingTextInputExample extends React.Component<
  $FlowFixMeProps,
  $FlowFixMeState,
> {
  constructor(props: any | void) {
    super(props);

    this.state = {
      width: 100,
      multiline: true,
      text: '',
      contentSize: {
        width: 0,
        height: 0,
      },
    };
  }

  UNSAFE_componentWillReceiveProps(props: any) {
    this.setState({
      multiline: props.multiline,
    });
  }

  render(): React.Node {
    const {style, multiline, ...props} = this.props;
    return (
      <View>
        <Text>Width:</Text>
        <Slider
          value={100}
          minimumValue={0}
          maximumValue={100}
          step={10}
          onValueChange={value => this.setState({width: value})}
        />
        <Text>Multiline:</Text>
        <Switch
          value={this.state.multiline}
          onValueChange={value => this.setState({multiline: value})}
        />
        <Text>TextInput:</Text>
        <TextInput
          value="prop"
          multiline={this.state.multiline}
          style={[style, {width: this.state.width + '%'}]}
          onChangeText={value => this.setState({text: value})}
          onContentSizeChange={event =>
            this.setState({contentSize: event.nativeEvent.contentSize})
          }
          {...props}
        />
        <Text>Plain text value representation:</Text>
        <Text>{this.state.text}</Text>
        <Text>Content Size: {JSON.stringify(this.state.contentSize)}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  default: {
    borderWidth: StyleSheet.hairlineWidth,
    borderColor: '#0f0f0f',
    flex: 1,
    fontSize: 13,
    padding: 4,
  },
  multiline: {
    borderWidth: StyleSheet.hairlineWidth,
    borderColor: '#0f0f0f',
    flex: 1,
    fontSize: 13,
    height: 50,
    padding: 4,
    marginBottom: 4,
  },
  multilinePlaceholderStyles: {
    letterSpacing: 10,
    lineHeight: 20,
    textAlign: 'center',
  },
  multilineExpandable: {
    height: 'auto',
    maxHeight: 100,
  },
  multilineWithFontStyles: {
    color: 'blue',
    fontWeight: 'bold',
    fontSize: 18,
    fontFamily: 'Cochin',
    height: 60,
  },
  singlelinePlaceholderStyles: {
    letterSpacing: 10,
    textAlign: 'center',
  },
  labelContainer: {
    flexDirection: 'row',
    marginVertical: 2,
    flex: 1,
  },
  label: {
    width: 115,
    alignItems: 'flex-end',
    marginRight: 10,
    paddingTop: 2,
  },
  rewriteContainer: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  remainder: {
    textAlign: 'right',
    width: 24,
  },
});

exports.displayName = (undefined: ?string);
exports.title = 'TextInput';
exports.documentationURL = 'https://reactnative.dev/docs/textinput';
exports.category = 'Basic';
exports.description = 'Single and multi-line text inputs.';
exports.examples = ([
  ...TextInputSharedExamples,
  {
    title: 'Live Re-Write (ひ -> 日)',
    render: function (): React.Node {
      return <RewriteExampleKana />;
    },
  },
  {
    title: 'Keyboard Input Accessory View',
    render: function (): React.Node {
      return (
        <View>
          <TextInputAccessoryViewChangeTextExample />
          <TextInputAccessoryViewChangeKeyboardExample />
        </View>
      );
    },
  },
  {
    title: "Default Input Accessory View with returnKeyType = 'done'",
    render: function (): React.Node {
      const keyboardTypesWithDoneButton = [
        'number-pad',
        'phone-pad',
        'decimal-pad',
        'ascii-capable-number-pad',
      ];
      const examples = keyboardTypesWithDoneButton.map(type => {
        return (
          <WithLabel key={'keyboardType: ' + type} label={type}>
            <TextInputAccessoryViewDefaultDoneButtonExample
              key={type}
              keyboardType={type}
            />
          </WithLabel>
        );
      });
      return <View>{examples}</View>;
    },
  },
  {
    title: 'Nested content and `value` property',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="singleline">
            <TextInput style={styles.default} value="(value property)">
              (first raw text node)
              <Text style={{color: 'red'}}>(internal raw text node)</Text>
              (last raw text node)
            </TextInput>
          </WithLabel>
          <WithLabel label="multiline">
            <TextInput
              style={styles.default}
              multiline={true}
              value="(value property)">
              (first raw text node)
              <Text style={{color: 'red'}}>(internal raw text node)</Text>
              (last raw text node)
            </TextInput>
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'Keyboard appearance',
    render: function (): React.Node {
      const keyboardAppearance = ['default', 'light', 'dark'];
      const examples = keyboardAppearance.map(type => {
        return (
          <WithLabel key={type} label={type}>
            <TextInput keyboardAppearance={type} style={styles.default} />
          </WithLabel>
        );
      });
      return <View>{examples}</View>;
    },
  },
  {
    title: 'Return key types',
    render: function (): React.Node {
      const returnKeyTypes = [
        'default',
        'go',
        'google',
        'join',
        'next',
        'route',
        'search',
        'send',
        'yahoo',
        'done',
        'emergency-call',
      ];
      const examples = returnKeyTypes.map(type => {
        return (
          <WithLabel key={type} label={type}>
            <TextInput returnKeyType={type} style={styles.default} />
          </WithLabel>
        );
      });
      return <View>{examples}</View>;
    },
  },
  {
    title: 'Enable return key automatically',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="true">
            <TextInput
              enablesReturnKeyAutomatically={true}
              style={styles.default}
            />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'Secure text entry',
    render: function (): React.Node {
      return <SecureEntryExample />;
    },
  },
  {
    title: 'Colored input text',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            style={[styles.default, {color: 'blue'}]}
            defaultValue="Blue"
          />
          <TextInput
            style={[styles.default, {color: 'green'}]}
            defaultValue="Green"
          />
        </View>
      );
    },
  },
  {
    title: 'Colored highlight/cursor for text input',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            style={styles.default}
            selectionColor={'green'}
            defaultValue="Highlight me"
          />
          <TextInput
            style={styles.default}
            selectionColor={'rgba(86, 76, 205, 1)'}
            defaultValue="Highlight me"
          />
        </View>
      );
    },
  },
  {
    title: 'Clear button mode',
    render: function (): React.Node {
      const clearButtonModes = [
        'never',
        'while-editing',
        'unless-editing',
        'always',
      ];
      const examples = clearButtonModes.map(mode => {
        return (
          <WithLabel key={mode} label={mode}>
            <TextInput
              style={styles.default}
              clearButtonMode={mode}
              defaultValue={mode}
            />
          </WithLabel>
        );
      });
      return <View>{examples}</View>;
    },
  },
  {
    title: 'Clear and select',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="clearTextOnFocus">
            <TextInput
              placeholder="text is cleared on focus"
              defaultValue="text is cleared on focus"
              style={styles.default}
              clearTextOnFocus={true}
            />
          </WithLabel>
          <WithLabel label="selectTextOnFocus">
            <TextInput
              placeholder="text is selected on focus"
              defaultValue="text is selected on focus"
              style={styles.default}
              selectTextOnFocus={true}
            />
          </WithLabel>
          <WithLabel label="clearTextOnFocus (multiline)">
            <TextInput
              placeholder="text is cleared on focus"
              defaultValue="text is cleared on focus"
              style={styles.default}
              clearTextOnFocus={true}
              multiline={true}
            />
          </WithLabel>
          <WithLabel label="selectTextOnFocus (multiline)">
            <TextInput
              placeholder="text is selected on focus"
              defaultValue="text is selected on focus"
              style={styles.default}
              selectTextOnFocus={true}
              multiline={true}
            />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'Multiline blur on submit',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            style={styles.multiline}
            placeholder="blurOnSubmit = true"
            returnKeyType="next"
            blurOnSubmit={true}
            multiline={true}
            onSubmitEditing={event =>
              Alert.alert('Alert', event.nativeEvent.text)
            }
          />
        </View>
      );
    },
  },
  {
    title: 'Multiline',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            placeholder="multiline text input"
            multiline={true}
            style={styles.multiline}
          />
          <TextInput
            placeholder="multiline text input with font styles and placeholder"
            multiline={true}
            clearTextOnFocus={true}
            autoCorrect={true}
            autoCapitalize="words"
            placeholderTextColor="red"
            keyboardType="url"
            style={[styles.multiline, styles.multilineWithFontStyles]}
          />
          <TextInput
            placeholder="multiline text input with max length"
            maxLength={5}
            multiline={true}
            style={styles.multiline}
          />
          <TextInput
            placeholder="uneditable multiline text input"
            editable={false}
            multiline={true}
            style={styles.multiline}
          />
          <TextInput
            defaultValue="uneditable multiline text input with phone number detection: 88888888."
            editable={false}
            multiline={true}
            style={styles.multiline}
            dataDetectorTypes="phoneNumber"
          />
        </View>
      );
    },
  },
  {
    title: 'Editable and Read only',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            placeholder="editable text input using editable prop"
            style={styles.default}
            editable
          />
          <TextInput
            placeholder="uneditable text input using editable prop"
            style={styles.default}
            editable={false}
          />
          <TextInput
            placeholder="editable text input using readOnly prop"
            style={styles.default}
            readOnly={false}
          />
          <TextInput
            placeholder="uneditable text input using readOnly prop"
            style={styles.default}
            readOnly
          />
        </View>
      );
    },
  },
  {
    title: 'TextInput Intrinsic Size',
    render: function (): React.Node {
      return (
        <View>
          <Text>Singleline TextInput</Text>
          <View style={{height: 80}}>
            <TextInput
              style={{
                position: 'absolute',
                fontSize: 16,
                backgroundColor: '#eeeeee',
                borderColor: '#666666',
                borderWidth: 5,
                borderTopWidth: 20,
                borderRadius: 10,
                borderBottomRightRadius: 20,
                padding: 10,
                paddingTop: 20,
              }}
              testID="singleline_textinput"
              placeholder="Placeholder defines intrinsic size"
            />
          </View>
          <Text>Multiline TextInput</Text>
          <View style={{height: 130}}>
            <TextInput
              style={{
                position: 'absolute',
                fontSize: 16,
                backgroundColor: '#eeeeee',
                borderColor: '#666666',
                borderWidth: 5,
                borderTopWidth: 20,
                borderRadius: 10,
                borderBottomRightRadius: 20,
                padding: 10,
                paddingTop: 20,
                maxHeight: 100,
              }}
              testID="multiline_textinput"
              multiline={true}
              placeholder="Placeholder defines intrinsic size"
            />
          </View>
          <View>
            <TextInput
              style={{
                fontSize: 16,
                backgroundColor: '#eeeeee',
                borderColor: '#666666',
                borderWidth: 5,
                borderTopWidth: 20,
                borderRadius: 10,
                borderBottomRightRadius: 20,
                padding: 10,
                paddingTop: 20,
              }}
              testID="multiline_textinput_with_flex"
              multiline={true}
              placeholder="Placeholder defines intrinsic size"
            />
          </View>
        </View>
      );
    },
  },
  {
    title: 'Auto-expanding',
    render: function (): React.Node {
      return (
        <View>
          <TextInput
            placeholder="height increases with content"
            defaultValue="React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native."
            multiline={true}
            enablesReturnKeyAutomatically={true}
            returnKeyType="go"
            style={[styles.multiline, styles.multilineExpandable]}
          />
        </View>
      );
    },
  },
  {
    title: 'Auto-expanding',
    render: function (): React.Node {
      return (
        <View>
          <AutogrowingTextInputExample
            enablesReturnKeyAutomatically={true}
            returnKeyType="done"
            multiline={true}
            style={{
              maxHeight: 400,
              minHeight: 20,
              paddingTop: 0,
              backgroundColor: '#eeeeee',
              color: 'blue',
            }}>
            <Text style={{fontSize: 30, color: 'green'}}>huge</Text>
            generic generic generic
            <Text style={{fontSize: 6, color: 'red'}}>
              small small small small small small
            </Text>
            <Text>regular regular</Text>
            <Text style={{fontSize: 30, color: 'green'}}>
              huge huge huge huge huge
            </Text>
            generic generic generic
          </AutogrowingTextInputExample>
        </View>
      );
    },
  },
  {
    title: 'TextInput maxLength',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="maxLength: 5">
            <TextInput maxLength={5} style={styles.default} />
          </WithLabel>
          <WithLabel label="maxLength: 5 with placeholder">
            <TextInput
              maxLength={5}
              placeholder="ZIP code entry"
              style={styles.default}
            />
          </WithLabel>
          <WithLabel label="maxLength: 5 with default value already set">
            <TextInput
              maxLength={5}
              defaultValue="94025"
              style={styles.default}
            />
          </WithLabel>
          <WithLabel label="maxLength: 5 with very long default value already set">
            <TextInput
              maxLength={5}
              defaultValue="9402512345"
              style={styles.default}
            />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'Text Auto Complete',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="country">
            <TextInput autoComplete="country" style={styles.default} />
          </WithLabel>
          <WithLabel label="one-time-code">
            <TextInput autoComplete="one-time-code" style={styles.default} />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'Text Content Type',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="emailAddress">
            <TextInput textContentType="emailAddress" style={styles.default} />
          </WithLabel>
          <WithLabel label="name">
            <TextInput textContentType="name" style={styles.default} />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'TextInput Placeholder Styles',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="letterSpacing: 10 lineHeight: 20 textAlign: 'center'">
            <TextInput
              placeholder="multiline text input"
              multiline={true}
              style={[styles.multiline, styles.multilinePlaceholderStyles]}
            />
          </WithLabel>
          <WithLabel label="letterSpacing: 10 textAlign: 'center'">
            <TextInput
              placeholder="singleline"
              style={[styles.default, styles.singlelinePlaceholderStyles]}
            />
          </WithLabel>
        </View>
      );
    },
  },
  {
    title: 'showSoftInputOnFocus',
    render: function (): React.Node {
      return (
        <View>
          <WithLabel label="showSoftInputOnFocus: false">
            <TextInput showSoftInputOnFocus={false} style={[styles.default]} />
          </WithLabel>
        </View>
      );
    },
  },
]: Array<RNTesterModuleExample>);


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:foreground="?android:attr/selectableItemBackground"
    android:layout_marginTop="@dimen/space_5"
    android:layout_marginBottom="@dimen/space_5"
    android:layout_marginLeft="@dimen/space_10"
    android:layout_marginRight="@dimen/space_10">

    <LinearLayout
        android:padding="@dimen/space_10"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/story_title"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/space_5"
            android:textColor="@android:color/black"
            android:textSize="@dimen/font_18"
            android:text="这是一条很长很长很长很长的内容"/>

        <RelativeLayout
            android:layout_marginLeft="@dimen/space_15"
            android:layout_width="@dimen/space_107"
            android:layout_height="@dimen/space_80">

            <ImageView
                android:id="@+id/story_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/home_pic"
                android:layout_alignParentBottom="true"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"/>

        </RelativeLayout>

    </LinearLayout>

</android.support.v7.widget.CardView>


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using SharedLib;

namespace OdbcWrapper
{
    public class DataTable
    {
        private readonly DbDataReader _dataReader;
        private List<DataColumn> _columns = new List<DataColumn>();
        private List<DataRow> _rows = new List<DataRow>();
        internal System.Data.DataTable _schemaTable;

        public DataTable()
        {

        }

        public DataTable(DbDataReader dataReader)
            : this()
        {
            _dataReader = dataReader;
            Read();
        }

        public IEnumerable<DataColumn> Columns
        {
            get { return _columns; }
        }

        public IEnumerable<DataRow> Rows
        {
            get { return _rows; }
        }

        public int RowCount
        {
            get { return _rows.Count; }
        }

        private void Read()
        {
            _rows = new List<DataRow>();
            _columns = new List<DataColumn>();

            _schemaTable = _dataReader.GetSchemaTable();
            for (var i = 0; i < _schemaTable.Rows.Count; i++)
            {
                var row = _schemaTable.Rows.Cast<System.Data.DataRow>().ElementAt(i);
                var c = new DataColumn(this);

                c.ColumnName = row.Get<string>("BaseColumnName");
                if (string.IsNullOrEmpty(c.ColumnName))
                    c.ColumnName = row.Get<string>("ColumnName");
                c.Caption = row.Get<string>("ColumnName");
                if (string.IsNullOrEmpty(c.Caption))
                    c.Caption = row.Get<string>("BaseColumnName");

                c.AllowDBNull = row.Get<bool>("AllowDBNull");
                c.DataType = row.Get<Type>("DataType");
                c.DefaultValue = c.DataType.Default();
                _columns.Add(c);
            }

            foreach (DbDataRecord record in _dataReader)
            {
                var row = new DataRow(this, record);
                _rows.Add(row);
            }

        }

    }
}


text:
package org.oscm.app.vmware.db.importer;

/**
 * Reflects a single IP address configuration.
 */
public class IPAddress {

    private boolean isInUse;
    private String ipaddress;

    public IPAddress() {
        this.isInUse = false;
        this.ipaddress = "";
    }

    public String getIPAddress() {
        return ipaddress;
    }

    public void setIPAddress(String ipaddress) {
        this.ipaddress = ipaddress;
    }

    public boolean isInUse() {
        return isInUse;
    }

    public void setInUse(boolean inUse) {
        isInUse = inUse;
    }
}


text:
package org.multibit.hd.ui.views.screens.manage_wallet;

import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
import net.miginfocom.swing.MigLayout;
import org.multibit.hd.core.config.Configurations;
import org.multibit.hd.core.dto.BitcoinNetworkSummary;
import org.multibit.hd.core.dto.WalletSummary;
import org.multibit.hd.core.dto.WalletType;
import org.multibit.hd.core.events.BitcoinNetworkChangedEvent;
import org.multibit.hd.core.managers.InstallationManager;
import org.multibit.hd.core.managers.WalletManager;
import org.multibit.hd.core.services.CoreServices;
import org.multibit.hd.ui.MultiBitUI;
import org.multibit.hd.ui.events.view.ViewEvents;
import org.multibit.hd.ui.events.view.WizardHideEvent;
import org.multibit.hd.ui.languages.MessageKey;
import org.multibit.hd.ui.views.components.Buttons;
import org.multibit.hd.ui.views.components.Panels;
import org.multibit.hd.ui.views.screens.AbstractScreenView;
import org.multibit.hd.ui.views.screens.Screen;
import org.multibit.hd.ui.views.wizards.Wizards;
import org.multibit.hd.ui.views.wizards.edit_wallet.EditWalletState;
import org.multibit.hd.ui.views.wizards.edit_wallet.EditWalletWizardModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.File;

/**
 *
View to provide the following to application:

 *

 *
Provision of components and layout for the "manage wallet" detail display

 *

 *
 * @since 0.0.1
 */
public class ManageWalletScreenView extends AbstractScreenView<ManageWalletScreenModel> {

  private static final Logger log = LoggerFactory.getLogger(ManageWalletScreenView.class);

  private JButton showEmptyWalletButton;

  /**
   * @param panelModel The model backing this panel view
   * @param screen     The screen to filter events from components
   * @param title      The key to the main title of this panel view
   */
  public ManageWalletScreenView(ManageWalletScreenModel panelModel, Screen screen, MessageKey title) {
    super(panelModel, screen, title);
  }

  @Override
  public void newScreenModel() {

  }

  @Override
  public JPanel initialiseScreenViewPanel() {
    MigLayout layout = new MigLayout(
      Panels.migXYDetailLayout(),
      "6[]6[]6[]6[]6", // Column constraints
            "5%[]2[]5%" // Row constraints
    );

    JPanel contentPanel = Panels.newPanel(layout);

    JButton primaryButton = Buttons.newShowEditWalletButton(getShowEditWalletAction());

    showEmptyWalletButton = Buttons.newShowEmptyWalletButton(getShowEmptyWalletAction());

    // Initially show the button disabled - it is enabled when the network is synced
    showEmptyWalletButton.setEnabled(false);

    // Row 1
    contentPanel.add(primaryButton, MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    contentPanel.add(Buttons.newShowWalletDetailsButton(getShowWalletDetailsAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    contentPanel.add(showEmptyWalletButton, MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    // Repair is in top right for good visibility
    contentPanel.add(Buttons.newShowRepairWalletButton(getShowRepairWalletAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push,wrap");

    // Row 2
    contentPanel.add(Buttons.newShowHistoryScreenButton(getShowHistoryAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    WalletType walletType = WalletManager.INSTANCE.getCurrentWalletSummary().get().getWalletType();

    if (WalletType.TREZOR_HARD_WALLET.equals(walletType)) {
      contentPanel.add(Buttons.newShowChangePinButton(getShowChangePinAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    } else {
      contentPanel.add(Buttons.newShowChangePasswordButton(getShowChangePasswordAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push");
    }
    contentPanel.add(Buttons.newShowPaymentSettingsWizardButton(getShowPaymentSettingsAction()), MultiBitUI.LARGE_BUTTON_MIG + ",align center,push,wrap");

    setInitialised(true);

    return contentPanel;
  }

  @Override
   public boolean beforeShow() {
     // Ensure the empty wallet button is kept up to date
     Optional<BitcoinNetworkChangedEvent> changedEvent = CoreServices.getApplicationEventService().getLatestBitcoinNetworkChangedEvent();
     if (changedEvent.isPresent()) {
       updateEmptyButton(changedEvent.get());
     }
    return true;
  }

  @Override
  public void afterShow() {
    // Ensure the empty wallet button is kept up to date
    Optional<BitcoinNetworkChangedEvent> changedEvent = CoreServices.getApplicationEventService().getLatestBitcoinNetworkChangedEvent();
    if (changedEvent.isPresent()) {
      updateEmptyButton(changedEvent.get());
    }
  }

  /**
   * @param event The "Bitcoin network changed" event - one per block downloaded during synchronization
   */
  @Subscribe
  public void onBitcoinNetworkChangeEvent(final BitcoinNetworkChangedEvent event) {
    if (!isInitialised()) {
      return;
    }

    Preconditions.checkNotNull(event, "'event' must be present");
    Preconditions.checkNotNull(event.getSummary(), "'summary' must be present");

    BitcoinNetworkSummary summary = event.getSummary();

    Preconditions.checkNotNull(summary.getSeverity(), "'severity' must be present");

    // Keep the UI response to a minimum due to the volume of these events
    updateEmptyButton(event);
  }

  /**
   * @return An action to show the "edit wallet" tool
   */
  private AbstractAction getShowEditWalletAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newEditWalletWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "wallet details" tool
   */
  private AbstractAction getShowWalletDetailsAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newWalletDetailsWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "change password" tool
   */
  private AbstractAction getShowChangePasswordAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newChangePasswordWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "change PIN" tool
   */
  private AbstractAction getShowChangePinAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newChangePinWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "history" screen
   */
  private AbstractAction getShowHistoryAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Configurations.currentConfiguration.getAppearance().setCurrentScreen(Screen.HISTORY.name());
        ViewEvents.fireShowDetailScreenEvent(Screen.HISTORY);
      }
    };
  }

  /**
   * @return An action to show the "repair wallet" tool
   */
  private AbstractAction getShowRepairWalletAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newRepairWalletWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "empty wallet" tool
   */
  private AbstractAction getShowEmptyWalletAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newEmptyWalletWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   * @return An action to show the "payment settings" tool
   */
  private AbstractAction getShowPaymentSettingsAction() {
    return new AbstractAction() {
      @Override
      public void actionPerformed(ActionEvent e) {

        Panels.showLightBox(Wizards.newPaymentSettingsWizard().getWizardScreenHolder());
      }
    };
  }

  /**
   *
Handle the transfer of data from a closing wizard

   *
   * @param event The "wizard hide" event
   */
  @Subscribe
  public void onWizardHideEvent(WizardHideEvent event) {

    // Filter other events
    if (event.isExitCancel()) {
      return;
    }
    if (event.getPanelName().equals(EditWalletState.EDIT_WALLET.name())) {

      // Persist the data from the wizard model into wallet
      WalletSummary walletSummary = ((EditWalletWizardModel) event.getWizardModel()).getWalletSummary();

      File applicationDataDirectory = InstallationManager.getOrCreateApplicationDataDirectory();
      final File currentWalletSummaryFile = WalletManager.INSTANCE.getCurrentWalletSummaryFile(applicationDataDirectory).get();
      WalletManager.updateWalletSummary(currentWalletSummaryFile, walletSummary);
    }
  }

  /**
   *
Ensure that a wallet can only be emptied once synchronization has completed

   *
   * @param event The "Bitcoin network changed" event - one per block downloaded during synchronization
   */
  private void updateEmptyButton(BitcoinNetworkChangedEvent event) {
    boolean newEnabled;
    boolean canChange = true;

    // NOTE: Show empty wallet is disabled when the network is not available
    // because it is possible that a second wallet is generating transactions using
    // addresses that this one has not displayed yet. This would lead to the same
    // address being used twice.
    switch (event.getSummary().getSeverity()) {
      case RED:
        // Enable on RED only if unrestricted (allows FEST tests without a network)
        newEnabled = InstallationManager.unrestricted;
        log.trace("Severity = red");
        break;
      case AMBER:
        // Enable on AMBER only if unrestricted
        newEnabled = InstallationManager.unrestricted;
        log.trace("Severity = AMBER, newEnabled = " + newEnabled);
        break;
      case GREEN:
        // Enable on GREEN
        newEnabled = true;
        log.trace("Severity = GREEN, newEnabled = " + true);
        break;
      case PINK:
      case EMPTY:
        // Maintain the status quo
        newEnabled = showEmptyWalletButton.isEnabled();
        canChange = false;
        break;
      default:
        // Unknown status
        throw new IllegalStateException("Unknown event severity " + event.getSummary().getSeverity());
    }

    log.trace("BitcoinNetworkChangedEvent = {}, showEmptyWalletButton.isEnabled() = {}, newEnabled = {}, canChange = {}", event, showEmptyWalletButton.isEnabled(), newEnabled, canChange);

    if (canChange) {
      final boolean finalNewEnabled = newEnabled;

      // If button is not enabled and the newEnabled is false don't do anything
      if (showEmptyWalletButton.isEnabled() || newEnabled) {
        SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    log.debug("Changing button enable state, newEnabled = " + finalNewEnabled);
                    showEmptyWalletButton.setEnabled(finalNewEnabled);
                  }
                });
      }
    }
  }
}