text:
<?php

/* $Id: SelectCustomer.php 7133 2015-02-07 03:23:51Z daintree $*/

include('includes/session.inc');
$Title = _('Search Customers');
include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
if (isset($_GET['Select'])) {
	$_SESSION['CustomerID'] = $_GET['Select'];
}
if (!isset($_SESSION['CustomerID'])) { //initialise if not already done
	$_SESSION['CustomerID'] = '';
}
if (isset($_GET['Area'])) {
	$_POST['Area'] = $_GET['Area'];
	$_POST['Search'] = 'Search';
	$_POST['Keywords'] = '';
	$_POST['CustCode'] = '';
	$_POST['CustPhone'] = '';
	$_POST['CustAdd'] = '';
	$_POST['CustType'] = '';
}
echo '
' . ' ' . _('Customers') . '
';
if (!isset($_SESSION['CustomerType'])) { //initialise if not already done
	$_SESSION['CustomerType'] = '';
}
// only run geocode if integration is turned on AND customer has been selected
if ($_SESSION['geocode_integration'] == 1 AND $_SESSION['CustomerID'] != "") {
	$sql = "SELECT * FROM geocode_param WHERE 1";
	$ErrMsg = _('An error occurred in retrieving the information');
	$result = DB_query($sql, $ErrMsg);
	$myrow = DB_fetch_array($result);
	$sql = "SELECT debtorsmaster.debtorno,
					debtorsmaster.name,
					custbranch.branchcode,
					custbranch.brname,
					custbranch.lat,
					custbranch.lng
				FROM debtorsmaster LEFT JOIN custbranch
				ON debtorsmaster.debtorno = custbranch.debtorno
				WHERE debtorsmaster.debtorno = '" . $_SESSION['CustomerID'] . "'
				ORDER BY debtorsmaster.debtorno";
	$ErrMsg = _('An error occurred in retrieving the information');
	$result2 = DB_query($sql, $ErrMsg);
	$myrow2 = DB_fetch_array($result2);
	$Lattitude = $myrow2['lat'];
	$Longitude = $myrow2['lng'];
	$API_Key = $myrow['geocode_key'];
	$center_long = $myrow['center_long'];
	$center_lat = $myrow['center_lat'];
	$map_height = $myrow['map_height'];
	$map_width = $myrow['map_width'];
	$map_host = $myrow['map_host'];
	echo '';
	echo ' ';
	echo '';
} //end if geocode integration is turned on AND a customer is selected

unset($result);
$msg = '';
if (isset($_POST['Go1']) OR isset($_POST['Go2'])) {
	$_POST['PageOffset'] = (isset($_POST['Go1']) ? $_POST['PageOffset1'] : $_POST['PageOffset2']);
	$_POST['Go'] = '';
}
if (!isset($_POST['PageOffset'])) {
	$_POST['PageOffset'] = 1;
} else {
	if ($_POST['PageOffset'] == 0) {
		$_POST['PageOffset'] = 1;
	}
}
if (isset($_POST['Search']) OR isset($_POST['CSV']) OR isset($_POST['Go']) OR isset($_POST['Next']) OR isset($_POST['Previous'])) {
	unset($_POST['JustSelectedACustomer']);
	if (isset($_POST['Search'])) {
		$_POST['PageOffset'] = 1;
	}

	if (($_POST['Keywords'] == '') AND ($_POST['CustCode'] == '') AND ($_POST['CustPhone'] == '') AND ($_POST['CustType'] == 'ALL') AND ($_POST['Area'] == 'ALL') AND ($_POST['CustAdd'] == '')) {
		//no criteria set then default to all customers
		$SQL = "SELECT debtorsmaster.debtorno,
					debtorsmaster.name,
					debtorsmaster.address1,
					debtorsmaster.address2,
					debtorsmaster.address3,
					debtorsmaster.address4,
					custbranch.branchcode,
					custbranch.brname,
					custbranch.contactname,
					debtortype.typename,
					custbranch.phoneno,
					custbranch.faxno,
					custbranch.email
				FROM debtorsmaster LEFT JOIN custbranch
				ON debtorsmaster.debtorno = custbranch.debtorno
				INNER JOIN debtortype
				ON debtorsmaster.typeid = debtortype.typeid";
	} else {
		$SearchKeywords = mb_strtoupper(trim(str_replace(' ', '%', $_POST['Keywords'])));
		$_POST['CustCode'] = mb_strtoupper(trim($_POST['CustCode']));
		$_POST['CustPhone'] = trim($_POST['CustPhone']);
		$_POST['CustAdd'] = trim($_POST['CustAdd']);
		$SQL = "SELECT debtorsmaster.debtorno,
						debtorsmaster.name,
						debtorsmaster.address1,
						debtorsmaster.address2,
						debtorsmaster.address3,
						debtorsmaster.address4,
						custbranch.branchcode,
						custbranch.brname,
						custbranch.contactname,
						debtortype.typename,
						custbranch.phoneno,
						custbranch.faxno,
						custbranch.email
					FROM debtorsmaster INNER JOIN debtortype
						ON debtorsmaster.typeid = debtortype.typeid
					LEFT JOIN custbranch
						ON debtorsmaster.debtorno = custbranch.debtorno
					WHERE debtorsmaster.name " . LIKE . " '%" . $SearchKeywords . "%'
					AND debtorsmaster.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%'
					AND (custbranch.phoneno " . LIKE . " '%" . $_POST['CustPhone'] . "%' OR custbranch.phoneno IS NULL)
					AND (debtorsmaster.address1 " . LIKE . " '%" . $_POST['CustAdd'] . "%'
						OR debtorsmaster.address2 " . LIKE . " '%" . $_POST['CustAdd'] . "%'
						OR debtorsmaster.address3 " . LIKE . " '%" . $_POST['CustAdd'] . "%'
						OR debtorsmaster.address4 " . LIKE . " '%" . $_POST['CustAdd'] . "%')";//If there is no custbranch set, the phoneno in custbranch will be null, so we add IS NULL condition otherwise those debtors without custbranches setting will be no searchable and it will make a inconsistence with customer receipt interface.

		if (mb_strlen($_POST['CustType']) > 0 AND $_POST['CustType'] != 'ALL') {
			$SQL .= " AND debtortype.typename = '" . $_POST['CustType'] . "'";
		}
		if (mb_strlen($_POST['Area']) > 0 AND $_POST['Area'] != 'ALL') {
			$SQL .= " AND custbranch.area = '" . $_POST['Area'] . "'";
		}
	} //one of keywords OR custcode OR custphone was more than a zero length string
	if ($_SESSION['SalesmanLogin'] != '') {
		$SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'";
	}
	$SQL .= " ORDER BY debtorsmaster.name";
	$ErrMsg = _('The searched customer records requested cannot be retrieved because');

	$result = DB_query($SQL, $ErrMsg);
	if (DB_num_rows($result) == 1) {
		$myrow = DB_fetch_array($result);
		$_SESSION['CustomerID'] = $myrow['debtorno'];
		$_SESSION['BranchCode'] = $myrow['branchcode'];
		unset($result);
		unset($_POST['Search']);
	} elseif (DB_num_rows($result) == 0) {
		prnMsg(_('No customer records contain the selected text') . ' - ' . _('please alter your search criteria AND try again'), 'info');
		echo '
';
	}
} //end of if search

if (isset($_POST['JustSelectedACustomer'])) {
	/*Need to figure out the number of the form variable that the user clicked on */
	for ($i = 0; $i < count($_POST); $i++) { //loop through the returned customers
		if (isset($_POST['SubmitCustomerSelection' . $i])) {
			break;
		}
	} //end loop through $_POST array
	if ($i == count($_POST)) {
		prnMsg(_('Unable to identify the selected customer'), 'error');
	} else {
		$_SESSION['CustomerID'] = $_POST['SelectedCustomer' . $i];
		$_SESSION['BranchCode'] = $_POST['SelectedBranch' . $i];
	}
} // end if Just Selected A Customer

if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
	if (!isset($_SESSION['BranchCode'])) {
		$SQL = "SELECT debtorsmaster.name,
					custbranch.phoneno
			FROM debtorsmaster INNER JOIN custbranch
			ON debtorsmaster.debtorno=custbranch.debtorno
			WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";

	} //!isset($_SESSION['BranchCode'])
	else {
		$SQL = "SELECT debtorsmaster.name,
					custbranch.phoneno
			FROM debtorsmaster INNER JOIN custbranch
			ON debtorsmaster.debtorno=custbranch.debtorno
			WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'
			AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'";
	}
	$ErrMsg = _('The customer name requested cannot be retrieved because');
	$result = DB_query($SQL, $ErrMsg);
	if ($myrow = DB_fetch_array($result)) {
		$CustomerName = htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false);
		$PhoneNo = $myrow['phoneno'];
	} //$myrow = DB_fetch_array($result)
	unset($result);

	echo '
' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName . ' - ' . $PhoneNo . _(' has been selected') . '
';
	echo '
' . _('Select a menu option to operate using this customer') . '.

';

	echo '

				' . _('Customer Inquiries') . '
				' . _('Customer Transactions') . '
				' . _('Customer Maintenance') . '

';
	echo '
';
	/* Customer Inquiry Options */
	echo '' . _('Customer Transaction Inquiries') . '
';
	echo '' . _('Customer Account statement on screen') . '
';
	echo '' . _('View Customer Details') . '
';
	echo '' . _('Print Customer Statement') . '
';
	echo '' . _('Order Inquiries') . '
';
	echo '' . _('Show purchases from this customer') . '
';
	wikiLink('Customer', $_SESSION['CustomerID']);
	echo '	';
	echo '' . _('Modify Outstanding Sales Orders') . '
';
	echo '' . _('Allocate Receipts OR Credit Notes') . '
';
	if (isset($_SESSION['CustomerID']) AND isset($_SESSION['BranchCode'])) {
		echo '' . _('Create a Counter Sale for this Customer') . '
';
	}
	echo '	';
	echo '' . _('Add a New Customer') . '
';
	echo '' . _('Modify Customer Details') . '
';
	echo '' . _('Add/Modify/Delete Customer Branches') . '
';
	echo '' . _('Special Customer Prices') . '
';
	echo '' . _('Customer EDI Configuration') . '
';
	echo '' . _('Customer Login Configuration') . '';
	echo '	';
	echo '

';
} //$_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])
else {
	echo '

				' . _('Customer Inquiries') . '
				' . _('Customer Transactions') . '
				' . _('Customer Maintenance') . '

';
	echo '

			';
	if (!isset($_SESSION['SalesmanLogin']) OR $_SESSION['SalesmanLogin'] == '') {
		echo '' . _('Add a New Customer') . '
';
	}
	echo '

';
}
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">';
echo '
';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if (mb_strlen($msg) > 1) {
	prnMsg($msg, 'info');
}
echo '
' . ' ' . _('Search for Customers') . '
';
echo '
';
echo '
' . _('Enter a partial Name') . ':	';
if (isset($_POST['Keywords'])) {
	echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />';
} else {
	echo '<input type="text" name="Keywords" size="20" maxlength="25" />';
}
echo '
	' . _('OR') . '	' . _('Enter a partial Code') . ':
	';
if (isset($_POST['CustCode'])) {
	echo '<input type="text" name="CustCode" pattern="[\w-]*" value="' . $_POST['CustCode'] . '" size="15" maxlength="18" />';
} else {
	echo '<input type="text" name="CustCode" pattern="[\w-]*" size="15" maxlength="18" />';
}
echo '

		' . _('OR') . '
		' . _('Enter a partial Phone Number') . ':
		';
if (isset($_POST['CustPhone'])) {
	echo '<input type="tel" name="CustPhone"  pattern="[0-9\-\s()+]*" value="' . $_POST['CustPhone'] . '" size="15" maxlength="18" />';
} else {
	echo '<input type="tel" name="CustPhone"  pattern="[0-9\-\s()+]* "size="15" maxlength="18" />';
}
echo '	';
echo '' . _('OR') . '
		' . _('Enter part of the Address') . ':
		';
if (isset($_POST['CustAdd'])) {
	echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25" />';
} else {
	echo '<input type="text" name="CustAdd" size="20" maxlength="25" />';
}
echo '
';
echo '

		' . _('OR') . '
		' . _('Choose a Type') . ':
		';
if (isset($_POST['CustType'])) {
	// Show Customer Type drop down list
	$result2 = DB_query("SELECT typeid, typename FROM debtortype ORDER BY typename");
	// Error if no customer types setup
	if (DB_num_rows($result2) == 0) {
		$DataError = 1;
		echo '' . _('Setup Types') . '';
		echo '
' . prnMsg(_('No Customer types defined'), 'error') . '
';
	} else {
		// If OK show select box with option selected
		echo '<select name="CustType">
				<option value="ALL">' . _('Any') . '</option>';
		while ($myrow = DB_fetch_array($result2)) {
			if ($_POST['CustType'] == $myrow['typename']) {
				echo '<option selected="selected" value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
			} //$_POST['CustType'] == $myrow['typename']
			else {
				echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
			}
		} //end while loop
		DB_data_seek($result2, 0);
		echo '</select>	';
	}
} else { //CustType is not set
	// No option selected="selected" yet, so show Customer Type drop down list
	$result2 = DB_query("SELECT typeid, typename FROM debtortype ORDER BY typename");
	// Error if no customer types setup
	if (DB_num_rows($result2) == 0) {
		$DataError = 1;
		echo '' . _('Setup Types') . '';
		echo '
' . prnMsg(_('No Customer types defined'), 'error') . '
';
	} else {
		// if OK show select box with available options to choose
		echo '<select name="CustType">
				<option value="ALL">' . _('Any') . '</option>';
		while ($myrow = DB_fetch_array($result2)) {
			echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
		} //end while loop
		DB_data_seek($result2, 0);
		echo '</select>	';
	}
}

/* Option to select a sales area */
echo '' . _('OR') . '
		' . _('Choose an Area') . ':	';
$result2 = DB_query("SELECT areacode, areadescription FROM areas");
// Error if no sales areas setup
if (DB_num_rows($result2) == 0) {
	$DataError = 1;
	echo '' . _('Setup Areas') . '';
	echo '
' . prnMsg(_('No Sales Areas defined'), 'error') . '
';
} else {
	// if OK show select box with available options to choose
	echo '<select name="Area">';
	echo '<option value="ALL">' . _('Any') . '</option>';
	while ($myrow = DB_fetch_array($result2)) {
		if (isset($_POST['Area']) AND $_POST['Area'] == $myrow['areacode']) {
			echo '<option selected="selected" value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>';
		} else {
			echo '<option value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>';
		}
	} //end while loop
	DB_data_seek($result2, 0);
	echo '</select>
';
}

echo '

';
echo '

		<input type="submit" name="Search" value="' . _('Search Now') . '" />
		<input type="submit" name="CSV" value="' . _('CSV Format') . '" />

';
if (isset($_SESSION['SalesmanLogin']) AND $_SESSION['SalesmanLogin'] != '') {
	prnMsg(_('Your account enables you to see only customers allocated to you'), 'warn', _('Note: Sales-person Login'));
}

if (isset($result)) {
	unset($_SESSION['CustomerID']);
	$ListCount = DB_num_rows($result);
	$ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']);
	if (!isset($_POST['CSV'])) {
		if (isset($_POST['Next'])) {
			if ($_POST['PageOffset'] < $ListPageMax) {
				$_POST['PageOffset'] = $_POST['PageOffset'] + 1;
			}
		}
		if (isset($_POST['Previous'])) {
			if ($_POST['PageOffset'] > 1) {
				$_POST['PageOffset'] = $_POST['PageOffset'] - 1;
			}
		}
		echo '<input type="hidden" name="PageOffset" value="' . $_POST['PageOffset'] . '" />';
		if ($ListPageMax > 1) {
			echo '

  ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': ';
			echo '<select name="PageOffset1">';
			$ListPage = 1;
			while ($ListPage <= $ListPageMax) {
				if ($ListPage == $_POST['PageOffset']) {
					echo '<option value="' . $ListPage . '" selected="selected">' . $ListPage . '</option>';
				} else {
					echo '<option value="' . $ListPage . '">' . $ListPage . '</option>';
				}
				$ListPage++;
			}
			echo '</select>
				<input type="submit" name="Go1" value="' . _('Go') . '" />
				<input type="submit" name="Previous" value="' . _('Previous') . '" />
				<input type="submit" name="Next" value="' . _('Next') . '" />';
			echo '
';
		}
		echo '

';

		echo '

				' . _('Code') . '
				' . _('Customer Name') . '
				' . _('Branch') . '
				' . _('Contact') . '
				' . _('Type') . '
				' . _('Phone') . '
				' . _('Fax') . '
				' . _('Email') . '

';
		$k = 0; //row counter to determine background colour
		$RowIndex = 0;
	} //end if NOT producing a CSV file
	if (DB_num_rows($result) <> 0) {
		if (isset($_POST['CSV'])) { //producing a CSV file of customers
			$FileName = $_SESSION['reports_dir'] . '/Customer_Listing_' . Date('Y-m-d') . '.csv';
			echo '

' . _('Click to view the csv Search Result') . '
';
			$fp = fopen($FileName, 'w');
			while ($myrow2 = DB_fetch_array($result)) {
				fwrite($fp, $myrow2['debtorno'] . ',' . str_replace(',', '', $myrow2['name']) . ',' . str_replace(',', '', $myrow2['address1']) . ',' . str_replace(',', '', $myrow2['address2']) . ',' . str_replace(',', '', $myrow2['address3']) . ',' . str_replace(',', '', $myrow2['address4']) . ',' . str_replace(',', '', $myrow2['contactname']) . ',' . str_replace(',', '', $myrow2['typename']) . ',' . $myrow2['phoneno'] . ',' . $myrow2['faxno'] . ',' . $myrow2['email'] . "\n");
			} //end loop through customers returned
		} //end if producing a CSV
		if (!isset($_POST['CSV'])) {
			DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']);
		}
		$i = 0; //counter for input controls
		while (($myrow = DB_fetch_array($result)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) {
			if ($k == 1) {
				echo '
';
				$k = 0;
			} else {
				echo '
';
				$k = 1;
			}
			echo '<input type="submit" name="SubmitCustomerSelection' . $i . '" value="' . htmlspecialchars($myrow['debtorno'] . ' ' . $myrow['branchcode'], ENT_QUOTES, 'UTF-8', false) . '" />
				<input type="hidden" name="SelectedCustomer' . $i . '" value="' . $myrow['debtorno'] . '" />
				<input type="hidden" name="SelectedBranch' . $i . '" value="' . $myrow['branchcode'] . '" />
				' . htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false) . '
				' . htmlspecialchars($myrow['brname'], ENT_QUOTES, 'UTF-8', false) . '
				' . $myrow['contactname'] . '
				' . $myrow['typename'] . '
				' . $myrow['phoneno'] . '
				' . $myrow['faxno'] . '
				' . $myrow['email'] . '

';
			$i++;
			$RowIndex++;
			//end of page full new headings if
		} //end loop through customers
		echo '
';
		echo '<input type="hidden" name="JustSelectedACustomer" value="Yes" />';
	} //end if there are customers to show
} //end if results to show

if (!isset($_POST['CSV'])) {
	if (isset($ListPageMax) AND $ListPageMax > 1) {
		echo '

  ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': ';
		echo '<select name="PageOffset2">';
		$ListPage = 1;
		while ($ListPage <= $ListPageMax) {
			if ($ListPage == $_POST['PageOffset']) {
				echo '<option value="' . $ListPage . '" selected="selected">' . $ListPage . '</option>';
			} //$ListPage == $_POST['PageOffset']
			else {
				echo '<option value="' . $ListPage . '">' . $ListPage . '</option>';
			}
			$ListPage++;
		} //$ListPage <= $ListPageMax
		echo '</select>
			<input type="submit" name="Go2" value="' . _('Go') . '" />
			<input type="submit" name="Previous" value="' . _('Previous') . '" />
			<input type="submit" name="Next" value="' . _('Next') . '" />';
		echo '
';
	}//end if results to show
}

echo '

      </form>';
// Only display the geocode map if the integration is turned on, AND there is a latitude/longitude to display
if (isset($_SESSION['CustomerID']) AND $_SESSION['CustomerID'] != '') {
	if ($_SESSION['geocode_integration'] == 1) {
		echo '
';
		if ($Lattitude == 0) {
			echo '
' . _('Mapping is enabled, but no Mapping data to display for this Customer.') . '
';
		} else {
			echo '

							' . _('Customer Mapping') . '

' . _('Mapping is enabled, Map will display below.') . '

';
		}
	} //end if Geocode integration is turned on
	// Extended Customer Info only if selected in Configuration
	if ($_SESSION['Extended_CustomerInfo'] == 1) {
		if ($_SESSION['CustomerID'] != '') {
			$sql = "SELECT debtortype.typeid,
							debtortype.typename
						FROM debtorsmaster INNER JOIN debtortype
					ON debtorsmaster.typeid = debtortype.typeid
					WHERE debtorsmaster.debtorno = '" . $_SESSION['CustomerID'] . "'";
			$ErrMsg = _('An error occurred in retrieving the information');
			$result = DB_query($sql, $ErrMsg);
			$myrow = DB_fetch_array($result);
			$CustomerType = $myrow['typeid'];
			$CustomerTypeName = $myrow['typename'];
			// Customer Data
			echo '
';
			// Select some basic data about the Customer
			$SQL = "SELECT debtorsmaster.clientsince,
						(TO_DAYS(date(now())) - TO_DAYS(date(debtorsmaster.clientsince))) as customersincedays,
						(TO_DAYS(date(now())) - TO_DAYS(date(debtorsmaster.lastpaiddate))) as lastpaiddays,
						debtorsmaster.paymentterms,
						debtorsmaster.lastpaid,
						debtorsmaster.lastpaiddate,
						currencies.decimalplaces AS currdecimalplaces
					FROM debtorsmaster INNER JOIN currencies
					ON debtorsmaster.currcode=currencies.currabrev
					WHERE debtorsmaster.debtorno ='" . $_SESSION['CustomerID'] . "'";
			$DataResult = DB_query($SQL);
			$myrow = DB_fetch_array($DataResult);
			// Select some more data about the customer
			$SQL = "SELECT sum(ovamount+ovgst) as total
					FROM debtortrans
					WHERE debtorno = '" . $_SESSION['CustomerID'] . "'
					AND type !=12";
			$Total1Result = DB_query($SQL);
			$row = DB_fetch_array($Total1Result);
			echo '
';
			echo '
' . _('Customer Data') . '
';
			echo '
';
			/* Customer Data */
			if ($myrow['lastpaiddate'] == 0) {
				echo _('No receipts from this customer.') . '

';
			} else {
				echo _('Last Paid Date:') . '
					 ' . ConvertSQLDate($myrow['lastpaiddate']) . '
					' . $myrow['lastpaiddays'] . ' ' . _('days') . '

';
			}
			echo '
' . _('Last Paid Amount (inc tax):') . '
					 ' . locale_number_format($myrow['lastpaid'], $myrow['currdecimalplaces']) . '

';
			echo '
' . _('Customer since:') . '
					 ' . ConvertSQLDate($myrow['clientsince']) . '
					' . $myrow['customersincedays'] . ' ' . _('days') . '

';
			if ($row['total'] == 0) {
				echo '

						' . _('No Spend from this Customer.') . '

';
			} else {
				echo '

						' . _('Total Spend from this Customer (inc tax):') . '
						' . locale_number_format($row['total'], $myrow['currdecimalplaces']) . '

';
			}
			echo '

					' . _('Customer Type:') . '
					' . $CustomerTypeName . '

';
			echo '
';
		} //end if $_SESSION['CustomerID'] != ''
		// Customer Contacts
		$sql = "SELECT * FROM custcontacts
				WHERE debtorno='" . $_SESSION['CustomerID'] . "'
				ORDER BY contid";
		$result = DB_query($sql);
		if (DB_num_rows($result) <> 0) {
			echo '

' . ' ' . _('Customer Contacts') . '
';
			echo '

';
			echo '

					' . _('Name') . '
					' . _('Role') . '
					' . _('Phone Number') . '
					' . _('Email') . '
					' . _('Notes') . '
					' . _('Edit') . '
					' . _('Delete') . '
					 ' . _('Add New Contact') . '

';
			$k = 0; //row colour counter
			while ($myrow = DB_fetch_array($result)) {
				if ($k == 1) {
					echo '
';
					$k = 0;
				} //$k == 1
				else {
					echo '
';
					$k = 1;
				}
				echo '' . $myrow[2] . '
					' . $myrow[3] . '
					' . $myrow[4] . '
					' . $myrow[6] . '
					' . $myrow[5] . '
					' . _('Edit') . '
					' . _('Delete') . '

';
			} //END WHILE LIST LOOP
			echo '
';
		} //end if there are contact rows returned
		else {
			if ($_SESSION['CustomerID'] != '') {
				echo '

' . ' ' . _('Add New Contact') . '
';
			}
		}
		// Customer Notes
		$sql = "SELECT noteid,
						debtorno,
						href,
						note,
						date,
						priority
				FROM custnotes
				WHERE debtorno='" . $_SESSION['CustomerID'] . "'
				ORDER BY date DESC";
		$result = DB_query($sql);
		if (DB_num_rows($result) <> 0) {
			echo '

' . ' ' . _('Customer Notes') . '

';
			echo '
';
			echo '

					' . _('Date') . '
					' . _('Note') . '
					' . _('Hyperlink') . '
					' . _('Priority') . '
					' . _('Edit') . '
					' . _('Delete') . '
					 ' . ' ' . _('Add New Note') . '

';
			$k = 0; //row colour counter
			while ($myrow = DB_fetch_array($result)) {
				if ($k == 1) {
					echo '
';
					$k = 0;
				} //$k == 1
				else {
					echo '
';
					$k = 1;
				}
				echo '' . ConvertSQLDate($myrow['date']) . '
					' . $myrow['note'] . '
					' . $myrow['href'] . '
					' . $myrow['priority'] . '
					' . _('Edit') . '
					' . _('Delete') . '

';
			} //END WHILE LIST LOOP
			echo '
';
		} //end if there are  customer notes to display
		else {
			if ($_SESSION['CustomerID'] != '') {
				echo '

' . ' ' . _('Add New Note for this Customer') . '
';
			}
		}
		// Custome Type Notes
		$sql = "SELECT * FROM debtortypenotes
				WHERE typeid='" . $CustomerType . "'
				ORDER BY date DESC";
		$result = DB_query($sql);
		if (DB_num_rows($result) <> 0) {
			echo '

' . ' ' . _('Customer Type (Group) Notes for:' . ' ' . $CustomerTypeName . '') . '

';
			echo '
';
			echo '

				 	' . _('Date') . '
				  	' . _('Note') . '
				   	' . _('File Link / Reference / URL') . '
				   	' . _('Priority') . '
				   	' . _('Edit') . '
				   	' . _('Delete') . '
				   	' . _('Add New Group Note') . '

';
			$k = 0; //row colour counter
			while ($myrow = DB_fetch_array($result)) {
				if ($k == 1) {
					echo '
';
					$k = 0;
				} else {
					echo '
';
					$k = 1;
				}
				echo '' . $myrow[4] . '
					' . $myrow[3] . '
					' . $myrow[2] . '
					' . $myrow[5] . '
					' . _('Edit') . '
					' . _('Delete') . '

';
			} //END WHILE LIST LOOP
			echo '
';
		} // end if there are customer group notes to display
		else {
			if ($_SESSION['CustomerID'] != '') {
				echo '

' . ' ' . _('Add New Group Note') . '

';
			}
		}
	} //end if Extended_CustomerInfo is turned on
} //end if isset($_SESSION['CustomerID']) AND $_SESSION['CustomerID'] != ''
include('includes/footer.inc');
?>


text:
//---------------------------------------------------------------------
// <copyright file="enum_tests.cpp" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

#include "e2e_tests.h"
#include "odata_wcf_service.h"
#include "odata/codegen/odata_entityset_query_executor.h"
#include "odata/codegen/odata_singleton_query_executor.h"
#include "odata/codegen/odata_primitive_query_executor.h"
#include "odata/codegen/odata_complex_query_executor.h"
#include "odata/codegen/odata_void_query_executor.h"
#include "odata/codegen/odata_enum_query_executor.h"

namespace tests { namespace e2e { namespace odata {

using namespace odata_wcf_service;

SUITE(enum_tests_raw_client)
{
TEST_FIXTURE(e2e_raw_client, query_enum_in_entity)
{
	auto entities = client.get_entities(U("Products")).get();
	auto firstEntity = entities[0];
	std::shared_ptr<odata_value> skinColor;
	firstEntity->get_property_value(U("SkinColor"), skinColor);
	VERIFY_ARE_EQUAL(skinColor->get_value_type()->get_type_kind(), Enum);

	auto skinColorEnum = std::dynamic_pointer_cast<odata_enum_value>(skinColor);
	VERIFY_ARE_EQUAL(U("Red"), skinColorEnum->to_string());
}

TEST_FIXTURE(e2e_raw_client, query_enum_property)
{
	auto data = client.get_data_from_server(U("Products(5)/SkinColor")).get();
	VERIFY_ARE_EQUAL(data.size(), 1);

	auto skinColor = std::dynamic_pointer_cast<odata_enum_value>(data[0]);
	VERIFY_ARE_EQUAL(U("Red"), skinColor->to_string());
}

TEST_FIXTURE(e2e_raw_client, update_enum_property)
{
	auto model = client.get_model().get();

	//check the old value
	auto old_data = client.get_data_from_server(U("Products(5)")).get();
	auto old_entity = std::dynamic_pointer_cast<odata_entity_value>(old_data[0]);
	std::shared_ptr<odata_value> old_value;
	old_entity->get_property_value(U("UserAccess"), old_value);
	auto old_enum = std::dynamic_pointer_cast<odata_enum_value>(old_value);
	VERIFY_ARE_EQUAL(U("None"), old_enum->to_string());

	//update the entity with patch
	auto access_level_type = model->find_enum_type(U("AccessLevel"));
	auto new_access = std::make_shared<odata_enum_value>(access_level_type, U("ReadWrite"));
	old_entity->set_value(U("UserAccess"), std::dynamic_pointer_cast<odata_value>(new_access));

	auto response_code = client.patch_entity(U("Products"), old_entity).get();
	VERIFY_ARE_EQUAL(204, response_code);

	//check the new value
	auto new_data = client.get_data_from_server(U("Products(5)")).get();
	auto new_entity = std::dynamic_pointer_cast<odata_entity_value>(new_data[0]);
	std::shared_ptr<odata_value> new_value;
	new_entity->get_property_value(U("UserAccess"), new_value);
	auto new_enum = std::dynamic_pointer_cast<odata_enum_value>(new_value);
	VERIFY_ARE_EQUAL(U("ReadWrite"), new_enum->to_string());
}

}

SUITE(enum_tests)
{

TEST_FIXTURE(e2e_test_case, query_with_enum)
{
	auto products = service_context->create_products_query()->key(U("5"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, products.size());

	auto product = products[0];
	VERIFY_ARE_EQUAL(Red, *(product->get_skincolor())); //Nullable property is a shared_ptr
	VERIFY_ARE_EQUAL(None, *(product->get_useraccess()));  //Non-nulllable property is the actual enum value
	VERIFY_ARE_EQUAL(3, product->get_covercolors().size());
	VERIFY_ARE_EQUAL(Blue, product->get_covercolors()[2]);

	auto skin_color = service_context->create_query<odata_enum_query_executor<Color, enum_type_resolver>, odata_query_builder>(U("Products(5)/SkinColor"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, skin_color.size());
	VERIFY_ARE_EQUAL(Red, skin_color[0]);
	auto user_access = service_context->create_query<odata_enum_query_executor<AccessLevel, enum_type_resolver>, odata_query_builder>(U("Products(5)/UserAccess"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, user_access.size());
	VERIFY_ARE_EQUAL(None, user_access[0]);
	auto cover_colors = service_context->create_query<odata_enum_query_executor<Color, enum_type_resolver>, odata_query_builder>(U("Products(5)/CoverColors"))->execute_query().get();
	VERIFY_ARE_EQUAL(3, cover_colors.size());
	VERIFY_ARE_EQUAL(Blue, cover_colors[2]);
}

TEST_FIXTURE(e2e_test_case, update_with_enum)
{
	auto products = service_context->create_products_query()->key(U("5"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, products.size());

	auto product = products[0];
	product->set_skincolor(Green);
	product->set_useraccess(ReadWrite);
	std::vector<Color> new_cover_colors;
	new_cover_colors.push_back(Green);
	new_cover_colors.push_back(Blue);
	product->set_covercolors(new_cover_colors);

	auto status_code = service_context->update_object(product).get();
	VERIFY_ARE_EQUAL(204, status_code);

	auto skin_color = service_context->create_query<odata_enum_query_executor<Color, enum_type_resolver>, odata_query_builder>(U("Products(5)/SkinColor"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, skin_color.size());
	VERIFY_ARE_EQUAL(Green, skin_color[0]);
	auto user_access = service_context->create_query<odata_enum_query_executor<AccessLevel, enum_type_resolver>, odata_query_builder>(U("Products(5)/UserAccess"))->execute_query().get();
	VERIFY_ARE_EQUAL(1, user_access.size());
	VERIFY_ARE_EQUAL(ReadWrite, user_access[0]);
	auto cover_colors = service_context->create_query<odata_enum_query_executor<Color, enum_type_resolver>, odata_query_builder>(U("Products(5)/CoverColors"))->execute_query().get();
	VERIFY_ARE_EQUAL(2, cover_colors.size());
	VERIFY_ARE_EQUAL(Blue, cover_colors[1]);
}

}

}}}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>
<meta charset=utf-8>
<title>Redirecting...</title>
<link rel=canonical href="../領/index.html">
<meta http-equiv=refresh content="0; url='../領/index.html'">

Redirecting...

Click here if you are not redirected.


text:
using System;
using System.Runtime.Serialization;
using Net.Bluewalk.Slide.API.JsonConverters;
using Newtonsoft.Json;

namespace Net.Bluewalk.Slide.API.Domain.Responses
{
    /// <summary>
    /// Class RoutineSunset.
    /// </summary>
    public class RoutineSunset
    {
        [JsonConverter(typeof(TimeSpanConverter))]
        [JsonProperty("time")]
        public TimeSpan Time { get; set; }

        [JsonProperty("position")]
        public byte Position { get; set; }

        [JsonProperty("offset")]
        public int Offset { get; set; }

        [JsonProperty("at_home")]
        public bool AtHome { get; set; }

        [JsonConverter(typeof(WeekdaysConverter))]
        [JsonProperty("weekdays")]
        public Weekdays Weekdays { get; set; }
    }
}


text:
/**
  @file     is_size.h
  @brief    confirms whether a type can be converted to the corresponding address.
  @author   HRYKY
  @version  $Id: is_size.h 351 2014-05-27 10:18:20Z hryky.private@gmail.com $
 */
#ifndef IS_SIZE_H_20140330125919207
#define IS_SIZE_H_20140330125919207
#include "hryky/stdint.h"
#include "hryky/type_traits/integral_constant.h"
//------------------------------------------------------------------------------
// defines macros
//------------------------------------------------------------------------------
#define hryky_template_param \
	typename ValueT
#define hryky_template_arg \
	ValueT
//------------------------------------------------------------------------------
// declares types
//------------------------------------------------------------------------------
namespace hryky
{
	/// confirms whether a type can be converted to the corresponding address.
	template <typename ValueT>
	class IsSize;

} // namespace hryky
//------------------------------------------------------------------------------
// declares classes
//------------------------------------------------------------------------------
/**
  @brief confirms whether a type can be converted to the corresponding address.
 */
template <hryky_template_param>
class hryky::IsSize
{
public :
	typedef false_type type;
};
//------------------------------------------------------------------------------
// specializes classes
//------------------------------------------------------------------------------
namespace hryky
{
/**
  allows size_t
 */
template <>
class IsSize<size_t>
{
public :
	typedef true_type type;
};
/**
  allows intptr_t
 */
template <>
class IsSize<intptr_t>
{
public :
	typedef true_type type;
};
#if !HRYKY_PLATFORM_WINDOWS && (40801 > hryky_gcc_version)
/**
  allows uintptr_t
 */
template <>
class IsSize<uintptr_t>
{
public :
	typedef true_type type;
};
#endif // !HRYKY_PLATFORM_WINDOWS
} // namespace hryky
//------------------------------------------------------------------------------
// defines public member functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// defines protected member functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// defines private member functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// declares global functions
//------------------------------------------------------------------------------
namespace hryky
{
} // namespace hryky
//------------------------------------------------------------------------------
// defines global functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// revokes the temporary macros
//------------------------------------------------------------------------------
#undef hryky_template_param
#undef hryky_template_arg
#endif // IS_SIZE_H_20140330125919207
// end of file


text:
namespace net {

namespace {

class TestNetworkDelegate : public net::NetworkDelegate {
 public:
  TestNetworkDelegate() : got_pac_error_(false) {}
  virtual ~TestNetworkDelegate() {}

  bool got_pac_error() const { return got_pac_error_; }

 private:
  // net::NetworkDelegate implementation.
  virtual int OnBeforeURLRequest(URLRequest* request,
                                 const CompletionCallback& callback,
                                 GURL* new_url) OVERRIDE {
    return OK;
  }
  virtual int OnBeforeSendHeaders(URLRequest* request,
                                  const CompletionCallback& callback,
                                  HttpRequestHeaders* headers) OVERRIDE {
    return OK;
  }
  virtual void OnSendHeaders(URLRequest* request,
                             const HttpRequestHeaders& headers) OVERRIDE {}
  virtual int OnHeadersReceived(
      URLRequest* request,
      const CompletionCallback& callback,
      const HttpResponseHeaders* original_response_headers,
      scoped_refptr<HttpResponseHeaders>* override_response_headers) OVERRIDE {
    return net::OK;
  }
  virtual void OnBeforeRedirect(URLRequest* request,
                                const GURL& new_location) OVERRIDE {}
  virtual void OnResponseStarted(URLRequest* request) OVERRIDE {}
  virtual void OnRawBytesRead(const URLRequest& request,
                              int bytes_read) OVERRIDE {}
  virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE {}
  virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {}

  virtual void OnPACScriptError(int line_number,
                                const string16& error) OVERRIDE {
    got_pac_error_ = true;
  }
  virtual AuthRequiredResponse OnAuthRequired(
      URLRequest* request,
      const AuthChallengeInfo& auth_info,
      const AuthCallback& callback,
      AuthCredentials* credentials) OVERRIDE {
    return AUTH_REQUIRED_RESPONSE_NO_ACTION;
  }
  virtual bool OnCanGetCookies(const URLRequest& request,
                               const CookieList& cookie_list) OVERRIDE {
    return true;
  }
  virtual bool OnCanSetCookie(const URLRequest& request,
                              const std::string& cookie_line,
                              CookieOptions* options) OVERRIDE {
    return true;
  }
  virtual bool OnCanAccessFile(const net::URLRequest& request,
                               const FilePath& path) const OVERRIDE {
    return true;
  }
  virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE {
    return false;
  }
  virtual int OnBeforeSocketStreamConnect(
      SocketStream* stream,
      const CompletionCallback& callback) OVERRIDE {
    return OK;
  }
  virtual void OnRequestWaitStateChange(const net::URLRequest& request,
                                        RequestWaitState state) OVERRIDE {
  }

  bool got_pac_error_;
};

}  // namespace

// Check that the OnPACScriptError method can be called from an arbitrary
// thread.
TEST(NetworkDelegateErrorObserverTest, CallOnThread) {
  base::Thread thread("test_thread");
  thread.Start();
  TestNetworkDelegate network_delegate;
  NetworkDelegateErrorObserver
      observer(&network_delegate,
               base::MessageLoopProxy::current());
  thread.message_loop()->PostTask(
      FROM_HERE,
      base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError,
                 base::Unretained(&observer), 42, string16()));
  thread.Stop();
  MessageLoop::current()->RunAllPending();
  ASSERT_TRUE(network_delegate.got_pac_error());
}

// Check that passing a NULL network delegate works.
TEST(NetworkDelegateErrorObserverTest, NoDelegate) {
  base::Thread thread("test_thread");
  thread.Start();
  NetworkDelegateErrorObserver
      observer(NULL, base::MessageLoopProxy::current());
  thread.message_loop()->PostTask(
      FROM_HERE,
      base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError,
                 base::Unretained(&observer), 42, string16()));
  thread.Stop();
  MessageLoop::current()->RunAllPending();
  // Shouldn't have crashed until here...
}

}  // namespace net


text:
package com.letv.sarrsdesktop.blockcanaryex.jrt;

import java.util.concurrent.TimeUnit;

/**
 * author: zhoulei date: 2017/2/28.
 */
public class MethodInfo {
    private String cls;
    private String method;
    private String paramTypes;
    private long costRealTimeNano;
    private long costThreadTime;

    private static final int MS_NANO = 1000000;

    public long getCostRealTimeMs() {
        if(costRealTimeNano < MS_NANO && costRealTimeNano > MS_NANO / 2) {
            //if costRealTimeNano > 0.5ms, return 1ms
            return 1;
        }
        return TimeUnit.NANOSECONDS.toMillis(costRealTimeNano);
    }

    public long getCostRealTimeNano() {
        return this.costRealTimeNano;
    }

    public void setCostRealTimeNano(long costRealTimeNano) {
        this.costRealTimeNano = costRealTimeNano;
    }

    public long getCostThreadTime() {
        return costThreadTime;
    }

    public void setCostThreadTime(long costThreadTime) {
        this.costThreadTime = costThreadTime;
    }

    public String getClassName() {
        return cls;
    }

    public String getClassSimpleName() {
        return getClassSimpleName(cls);
    }

    public void setCls(String cls) {
        this.cls = cls;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public void setParamTypes(String paramTypes) {
        this.paramTypes = paramTypes;
    }

    private String getClassSimpleName(String clazz) {
        int dot = clazz.lastIndexOf('.');
        if (dot != -1) {
            return clazz.substring(dot + 1);
        }

        return clazz;
    }

    public String getMethodName() {
        return method;
    }

    public String getSimpleParamTypes() {
        if (paramTypes != null && paramTypes.length() > 0) {
            String[] types = paramTypes.split(",");
            StringBuilder simpleParamTypesBuilder = new StringBuilder();
            for (int i = 0; i < types.length; i++) {
                simpleParamTypesBuilder.append(getClassSimpleName(types[i]));
                if (i != types.length - 1) {
                    simpleParamTypesBuilder.append(",");
                }
            }
            return simpleParamTypesBuilder.toString();
        } else {
            return "";
        }
    }

    public String getParamTypes() {
        return paramTypes;
    }

    public boolean isConstructor() {
        return getClassSimpleName().equals(getMethodName());
    }

    public boolean isClassInitializer() {
        return "<clinit>".equals(method);
    }

    public String generateMethodInfo(boolean simpleParamType) {
        StringBuilder methodInfoBuilder = new StringBuilder();
        methodInfoBuilder.append(cls)
                .append(".")
                .append(method)
                .append("(");
        if (paramTypes != null) {
            methodInfoBuilder.append(simpleParamType ? getSimpleParamTypes() : paramTypes);
        }
        return methodInfoBuilder.append(")").toString();
    }

    @Override
    public String toString() {
        return generateMethodInfo(true) + " costRealTime:" + getCostRealTimeMs() + "ms" + " costThreadTime:" + getCostThreadTime() + "ms";
    }
}


text:
package com.aripd.aricl.identicon;

import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;
import org.primefaces.renderkit.CoreRenderer;
import org.primefaces.util.WidgetBuilder;

@FacesRenderer(componentFamily = Identicon.COMPONENT_FAMILY, rendererType = Identicon.DEFAULT_RENDERER)
public class IdenticonRenderer extends CoreRenderer {

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        if (context == null) {
            throw new NullPointerException("No context defined!");
        }

        Identicon identicon = (Identicon) component;

        encodeMarkup(context, identicon);
        encodeScript(context, identicon);
    }

    protected void encodeMarkup(FacesContext context, Identicon identicon) throws IOException {
        ResponseWriter writer = context.getResponseWriter();

        String style = identicon.getStyle();
        String styleClass = identicon.getStyleClass();
        String alt = identicon.getAlt();
        String title = identicon.getTitle();

        writer.startElement("img", identicon);
        writer.writeAttribute("id", identicon.getClientId(), null);
        writer.writeAttribute("class", styleClass, "styleClass");
        writer.writeAttribute("style", style, "style");
        writer.writeAttribute("alt", alt, "alt");
        writer.writeAttribute("title", title, "title");
        if (identicon.getWidth() != null) {
            writer.writeAttribute("width", identicon.getWidth(), "width");
        }
        if (identicon.getHeight() != null) {
            writer.writeAttribute("height", identicon.getHeight(), "height");
        }
        writer.endElement("img");

    }

    protected void encodeScript(FacesContext context, Identicon identicon) throws IOException {

        String clientId = identicon.getClientId();
        String widgetVar = identicon.resolveWidgetVar();

        WidgetBuilder wb = getWidgetBuilder(context);

        wb.init(Identicon.class.getSimpleName(), widgetVar, clientId);
        wb.attr("text", identicon.getText());

        if (identicon.getSalt() != null) {
            wb.attr("salt", identicon.getSalt());
        }

        if (identicon.getRounds() != null) {
            wb.attr("rounds", identicon.getRounds());
        }

        if (identicon.getSize() != null) {
            wb.attr("size", identicon.getSize());
        }

        if (identicon.getOutputType() != null) {
            wb.attr("outputType", identicon.getOutputType());
        }

        if (identicon.getHashVariant() != null) {
            wb.attr("hashVariant", identicon.getHashVariant());
        }

        wb.finish();
    }

}


text:
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:

_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._

## Getting Started

We have full documentation on how to get started contributing here:

<!---
If your repo has certain guidelines for contribution, put them here ahead of the general k8s resources
-->

- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
- [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing)
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers

## Mentorship

- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!

<!---
Custom Information - if you're copying this template for the first time you can add custom content here, for example:

## Contact Information

- [Slack channel](https://kubernetes.slack.com/messages/kubernetes-users) - Replace `kubernetes-users` with your slack channel string, this will send users directly to your channel.
- [Mailing list](URL)

-->


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<Window size="285,186" roundcorner="5,5">
	<Container bkimage="notify_pop_bk.png">
	<Container name="pa_content" pos="0,30,285,186"/>
        <Button name="pa_close1" float="true" pos="255,2,283,33" width="24" height="24" normalimage="pt_close_normal.png" hotimage="pt_close_hover.png" pushedimage="pt_close_push.png" />
	</Container>
</Window>


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { inject } from 'mobx-react';

/* eslint react/prop-types: ['error', { ignore: ['stylesStore'] }] */
@inject('stylesStore')
export default class StyleWrapperReadonly extends Component {
  static propTypes = {
    // eslint-disable-next-line react/no-unused-prop-types
    id: PropTypes.string.isRequired,
    children: PropTypes.element.isRequired,
  };

  elRef = ref => (this.el = ref);

  render() {
    const { id, stylesStore, children } = this.props;
    const style = stylesStore.getStyle(id);
    const onlyChildren = React.Children.only(children);
    const newChildren = React.cloneElement(onlyChildren, {
      ref: this.elRef,
      style,
    });

    return newChildren;
  }
}


text:
namespace Diadoc {
namespace Api {
namespace Proto {
namespace Workflows {
namespace ParticipantType {

namespace {

const ::google::protobuf::EnumDescriptor* ParticipantType_descriptor_ = NULL;

}  // namespace

void protobuf_AssignDesc_Workflows_2fParticipantType_2eproto() {
  protobuf_AddDesc_Workflows_2fParticipantType_2eproto();
  const ::google::protobuf::FileDescriptor* file =
    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
      "Workflows/ParticipantType.proto");
  GOOGLE_CHECK(file != NULL);
  ParticipantType_descriptor_ = file->enum_type(0);
}

namespace {

GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
                 &protobuf_AssignDesc_Workflows_2fParticipantType_2eproto);
}

void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
}

}  // namespace

void protobuf_ShutdownFile_Workflows_2fParticipantType_2eproto() {
}

void protobuf_AddDesc_Workflows_2fParticipantType_2eproto() {
  static bool already_here = false;
  if (already_here) return;
  already_here = true;
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
    "\n\037Workflows/ParticipantType.proto\022*Diado"
    "c.Api.Proto.Workflows.ParticipantType*D\n"
    "\017ParticipantType\022\013\n\007Unknown\020\000\022\n\n\006Sender\020"
    "\001\022\t\n\005Proxy\020\002\022\r\n\tRecipient\020\003", 147);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "Workflows/ParticipantType.proto", &protobuf_RegisterTypes);
  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Workflows_2fParticipantType_2eproto);
}

// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_Workflows_2fParticipantType_2eproto {
  StaticDescriptorInitializer_Workflows_2fParticipantType_2eproto() {
    protobuf_AddDesc_Workflows_2fParticipantType_2eproto();
  }
} static_descriptor_initializer_Workflows_2fParticipantType_2eproto_;
const ::google::protobuf::EnumDescriptor* ParticipantType_descriptor() {
  protobuf_AssignDescriptorsOnce();
  return ParticipantType_descriptor_;
}
bool ParticipantType_IsValid(int value) {
  switch(value) {
    case 0:
    case 1:
    case 2:
    case 3:
      return true;
    default:
      return false;
  }
}

// @@protoc_insertion_point(namespace_scope)

}  // namespace ParticipantType
}  // namespace Workflows
}  // namespace Proto
}  // namespace Api
}  // namespace Diadoc

// @@protoc_insertion_point(global_scope)


text:
namespace GafferScene
{

class GAFFERSCENE_API PrimitiveVariables : public ObjectProcessor
{

	public :

		PrimitiveVariables( const std::string &name=defaultName<PrimitiveVariables>() );
		~PrimitiveVariables() override;

		GAFFER_GRAPHCOMPONENT_DECLARE_TYPE( GafferScene::PrimitiveVariables, PrimitiveVariablesTypeId, ObjectProcessor );

		Gaffer::CompoundDataPlug *primitiveVariablesPlug();
		const Gaffer::CompoundDataPlug *primitiveVariablesPlug() const;

	protected :

		bool affectsProcessedObject( const Gaffer::Plug *input ) const override;
		void hashProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::MurmurHash &h ) const override;
		IECore::ConstObjectPtr computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, const IECore::Object *inputObject ) const override;

	private :

		static size_t g_firstPlugIndex;

};

IE_CORE_DECLAREPTR( PrimitiveVariables )

} // namespace GafferScene

#endif // GAFFERSCENE_PRIMITIVEVARIABLES_H


text:
'use strict';

require('assert');
const should = require('should');
const cash = require('../dist/index.js');

describe('clear', function () {
  it('should exist and be a function', function () {
    should.exist(cash.clear);
  });

  it('should run without throwing', function () {
    (function () {
      cash.clear();
    }).should.not.throw();
  });
});


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Embed Test</title>

Embed Test


text:
package org.neo4j.cypher.internal.compatibility

import java.io.PrintWriter
import java.util

import org.neo4j.cypher.internal._
import org.neo4j.cypher.internal.compiler.v2_2
import org.neo4j.cypher.internal.compiler.v2_2.executionplan.{ExecutionPlan => ExecutionPlan_v2_2, InternalExecutionResult}
import org.neo4j.cypher.internal.compiler.v2_2.planDescription.InternalPlanDescription.Arguments.{DbHits, Planner, Rows, Version}
import org.neo4j.cypher.internal.compiler.v2_2.planDescription.{Argument, InternalPlanDescription, PlanDescriptionArgumentSerializer}
import org.neo4j.cypher.internal.compiler.v2_2.spi.MapToPublicExceptions
import org.neo4j.cypher.internal.compiler.v2_2.tracing.rewriters.RewriterStepSequencer
import org.neo4j.cypher.internal.compiler.v2_2.{CypherCompilerFactory, CypherException => CypherException_v2_2, InputPosition => InputPositionForV_2_2, _}
import org.neo4j.cypher.internal.compiler.v2_3.CompilationPhaseTracer
import org.neo4j.cypher.internal.compiler.v2_3.helpers.iteratorToVisitable
import org.neo4j.cypher.internal.spi.v2_2.{TransactionBoundGraphStatistics, TransactionBoundPlanContext, TransactionBoundQueryContext}
import org.neo4j.cypher.javacompat.ProfilerStatistics
import org.neo4j.cypher.{ArithmeticException, CypherTypeException, EntityNotFoundException, FailedIndexException, HintException, IncomparableValuesException, IndexHintException, InternalException, InvalidArgumentException, InvalidSemanticsException, LabelScanHintException, LoadCsvStatusWrapCypherException, LoadExternalResourceException, MergeConstraintConflictException, NodeStillHasRelationshipsException, ParameterNotFoundException, ParameterWrongTypeException, PatternException, PeriodicCommitInOpenTransactionException, ProfilerStatisticsNotReadyException, SyntaxException, UniquePathNotUniqueException, UnknownLabelException, _}
import org.neo4j.graphdb.Result.ResultVisitor
import org.neo4j.graphdb.{GraphDatabaseService, QueryExecutionType, ResourceIterator}
import org.neo4j.helpers.Clock
import org.neo4j.kernel.GraphDatabaseAPI
import org.neo4j.kernel.api.{KernelAPI, Statement}
import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, QuerySession}
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.Log

import scala.collection.JavaConverters._
import scala.util.Try

object helpers {
  implicit def monitorFailure(t: Throwable)(implicit monitor: QueryExecutionMonitor, session: QuerySession): Unit = {
    monitor.endFailure(session, t)
  }
}

object exceptionHandlerFor2_2 extends MapToPublicExceptions[CypherException] {
  def syntaxException(message: String, query: String, offset: Option[Int]) = new SyntaxException(message, query, offset)

  def arithmeticException(message: String, cause: Throwable) = new ArithmeticException(message, cause)

  def profilerStatisticsNotReadyException() = {
    throw new ProfilerStatisticsNotReadyException()
  }

  def incomparableValuesException(lhs: String, rhs: String) = new IncomparableValuesException(lhs, rhs)

  def unknownLabelException(s: String) = new UnknownLabelException(s)

  def patternException(message: String) = new PatternException(message)

  def invalidArgumentException(message: String, cause: Throwable) = new InvalidArgumentException(message, cause)

  def mergeConstraintConflictException(message: String) = new MergeConstraintConflictException(message)

  def internalException(message: String) = new InternalException(message)

  def loadCsvStatusWrapCypherException(extraInfo: String, cause: CypherException_v2_2) =
    new LoadCsvStatusWrapCypherException(extraInfo, cause.mapToPublic(exceptionHandlerFor2_2))

  def loadExternalResourceException(message: String, cause: Throwable) = throw new LoadExternalResourceException(message, cause)

  def parameterNotFoundException(message: String, cause: Throwable) = throw new ParameterNotFoundException(message, cause)

  def uniquePathNotUniqueException(message: String) = throw new UniquePathNotUniqueException(message, null)

  def entityNotFoundException(message: String, cause: Throwable) = throw new EntityNotFoundException(message, cause)

  def cypherTypeException(message: String, cause: Throwable) = throw new CypherTypeException(message, cause)

  def hintException(message: String): CypherException = throw new HintException(message, null)

  def labelScanHintException(identifier: String, label: String, message: String) = throw new LabelScanHintException(identifier, label, message)

  def invalidSemanticException(message: String) = throw new InvalidSemanticsException(message)

  def parameterWrongTypeException(message: String, cause: Throwable) = throw new ParameterWrongTypeException(message, cause)

  def nodeStillHasRelationshipsException(nodeId: Long, cause: Throwable) = throw new NodeStillHasRelationshipsException(nodeId, cause)

  def indexHintException(identifier: String, label: String, property: String, message: String) = throw new IndexHintException(identifier, label, property, message, null)

  def periodicCommitInOpenTransactionException() = throw new PeriodicCommitInOpenTransactionException

  def runSafely[T](body: => T)(implicit f: Throwable => Unit = (_) => ()) = {
    try {
      body
    }
    catch {
      case e: CypherException_v2_2 =>
        f(e)
        throw e.mapToPublic(exceptionHandlerFor2_2)
      case e: Throwable =>
        f(e)
        throw e
    }
  }

  def failedIndexException(indexName: String): CypherException = throw new FailedIndexException(indexName)
}

import scala.reflect.ClassTag

case class WrappedMonitors2_2(kernelMonitors: KernelMonitors) extends Monitors {
  def addMonitorListener[T](monitor: T, tags: String*) {
    kernelMonitors.addMonitorListener(monitor, tags: _*)
  }
  def newMonitor[T <: AnyRef : ClassTag](tags: String*): T = {
    val clazz = implicitly[ClassTag[T]].runtimeClass.asInstanceOf[Class[T]]
    kernelMonitors.newMonitor(clazz, tags: _*)
  }
}

trait CompatibilityFor2_2 {
  import org.neo4j.cypher.internal.compatibility.helpers._

  val graph: GraphDatabaseService
  val queryCacheSize: Int
  val kernelMonitors: KernelMonitors
  val kernelAPI: KernelAPI

  protected val rewriterSequencer: (String) => RewriterStepSequencer = {
    import org.neo4j.cypher.internal.compiler.v2_2.tracing.rewriters.RewriterStepSequencer._
    import org.neo4j.helpers.Assertion._

    if (assertionsEnabled()) newValidating _ else newPlain _
  }

  protected val compiler: v2_2.CypherCompiler

  implicit val executionMonitor = kernelMonitors.newMonitor(classOf[QueryExecutionMonitor])

  def produceParsedQuery(preParsedQuery: PreParsedQuery, tracer: CompilationPhaseTracer) = new ParsedQuery {
    val offset_2_3 = preParsedQuery.offset
    val offset_2_2 = InputPositionForV_2_2(offset_2_3.offset, offset_2_3.line, offset_2_3.column)
    val preparedQueryForV_2_2 = Try(compiler.prepareQuery(preParsedQuery.statement, Some(RawQuery(preParsedQuery.rawStatement, offset_2_2))))

    def isPeriodicCommit = preparedQueryForV_2_2.map(_.isPeriodicCommit).getOrElse(false)

    def plan(statement: Statement, tracer: CompilationPhaseTracer): (ExecutionPlan, Map[String, Any]) = exceptionHandlerFor2_2.runSafely {
      val planContext = new TransactionBoundPlanContext(statement, graph)
      val (planImpl, extractedParameters) = compiler.planPreparedQuery(preparedQueryForV_2_2.get, planContext)
      (new ExecutionPlanWrapper(planImpl), extractedParameters)
    }

    def hasErrors = preparedQueryForV_2_2.isFailure
  }

  class ExecutionPlanWrapper(inner: ExecutionPlan_v2_2) extends ExecutionPlan {

    private def queryContext(graph: GraphDatabaseAPI, txInfo: TransactionInfo) = {
      val ctx = new TransactionBoundQueryContext(graph, txInfo.tx, txInfo.isTopLevelTx, txInfo.statement)
      new ExceptionTranslatingQueryContextFor2_2(ctx)
    }

    def run(graph: GraphDatabaseAPI, txInfo: TransactionInfo, executionMode: CypherExecutionMode, params: Map[String, Any], session: QuerySession): ExtendedExecutionResult = {
      implicit val s = session
      val internalMode = executionMode match {
        case CypherExecutionMode.normal  => NormalMode
        case CypherExecutionMode.profile => ProfileMode
        case CypherExecutionMode.explain => ExplainMode
      }
      exceptionHandlerFor2_2.runSafely {
        ExecutionResultWrapperFor2_2(inner.run(queryContext(graph, txInfo), internalMode, params), inner.plannerUsed)
      }
    }

    def isPeriodicCommit = inner.isPeriodicCommit

    def isStale(lastCommittedTxId: LastCommittedTxIdProvider, statement: Statement) =
      inner.isStale(lastCommittedTxId, TransactionBoundGraphStatistics(statement))
  }
}

case class ExecutionResultWrapperFor2_2(inner: InternalExecutionResult, planner: PlannerName)(implicit monitor: QueryExecutionMonitor, session: QuerySession) extends ExtendedExecutionResult {

  self =>

  import org.neo4j.cypher.internal.compatibility.helpers._
  def planDescriptionRequested = exceptionHandlerFor2_2.runSafely {inner.planDescriptionRequested}

  private def endQueryExecution() = {
    monitor.endSuccess(session) // this method is expected to be idempotent
  }

  def javaIterator: ResourceIterator[util.Map[String, Any]] = {
    val innerJavaIterator = inner.javaIterator
    exceptionHandlerFor2_2.runSafely {
      if ( !innerJavaIterator.hasNext ) {
        endQueryExecution()
      }
    }
    new ResourceIterator[util.Map[String, Any]] {
      def close() = exceptionHandlerFor2_2.runSafely {
        endQueryExecution()
        innerJavaIterator.close()
      }
      def next() = exceptionHandlerFor2_2.runSafely {innerJavaIterator.next}
      def hasNext = exceptionHandlerFor2_2.runSafely{
        val next = innerJavaIterator.hasNext
        if (!next) {
          endQueryExecution()
        }
        next
      }
      def remove() =  exceptionHandlerFor2_2.runSafely{innerJavaIterator.remove()}
    }

  }

  def columnAs[T](column: String) = exceptionHandlerFor2_2.runSafely {
    inner.columnAs[T](column)
  }

  def columns = exceptionHandlerFor2_2.runSafely{inner.columns}

  def javaColumns = exceptionHandlerFor2_2.runSafely{inner.javaColumns}

  def queryStatistics() = exceptionHandlerFor2_2.runSafely {
    val i = inner.queryStatistics()
    QueryStatistics(nodesCreated = i.nodesCreated,
      relationshipsCreated = i.relationshipsCreated,
      propertiesSet = i.propertiesSet,
      nodesDeleted = i.nodesDeleted,
      relationshipsDeleted = i.relationshipsDeleted,
      labelsAdded = i.labelsAdded,
      labelsRemoved = i.labelsRemoved,
      indexesAdded = i.indexesAdded,
      indexesRemoved = i.indexesRemoved,
      constraintsAdded = i.constraintsAdded,
      constraintsRemoved = i.constraintsRemoved)
  }

  def dumpToString(writer: PrintWriter) = exceptionHandlerFor2_2.runSafely{inner.dumpToString(writer)}

  def dumpToString() = exceptionHandlerFor2_2.runSafely{inner.dumpToString()}

  def javaColumnAs[T](column: String) = exceptionHandlerFor2_2.runSafely{inner.javaColumnAs[T](column)}

  def executionPlanDescription(): ExtendedPlanDescription =
    exceptionHandlerFor2_2.runSafely {
      convert(
        inner.executionPlanDescription().
          addArgument(Version("CYPHER 2.2")).
          addArgument(Planner(planner.name))
    )
  }

  def close() = exceptionHandlerFor2_2.runSafely {
    endQueryExecution()
    inner.close()
  }

  def next() = exceptionHandlerFor2_2.runSafely{ inner.next() }

  def hasNext = exceptionHandlerFor2_2.runSafely {
    val next = inner.hasNext
    if (!next) {
      endQueryExecution()
    }
    next
  }

  def convert(i: InternalPlanDescription): ExtendedPlanDescription = exceptionHandlerFor2_2.runSafely {
    CompatibilityPlanDescription(i, CypherVersion.v2_2, planner)
  }

  def executionType: QueryExecutionType = exceptionHandlerFor2_2.runSafely {inner.executionType}

  def notifications = Seq.empty

  def accept[EX <: Exception](visitor: ResultVisitor[EX]) = {
    try {
      exceptionHandlerFor2_2.runSafely {iteratorToVisitable.accept(self, visitor)}
    } finally {
      self.close()
    }
  }
}

case class CompatibilityPlanDescription(inner: InternalPlanDescription, version: CypherVersion, planner: PlannerName)
  extends ExtendedPlanDescription {

  self =>

  override def children = extendedChildren

  def extendedChildren = exceptionHandlerFor2_2.runSafely {
    inner.children.toSeq.map(CompatibilityPlanDescription.apply(_, version, planner))
  }

  def arguments: Map[String, AnyRef] = exceptionHandlerFor2_2.runSafely {
    inner.arguments.map { arg => arg.name -> PlanDescriptionArgumentSerializer.serialize(arg) }.toMap
  }

  def identifiers = exceptionHandlerFor2_2.runSafely { inner.orderedIdentifiers.toSet }

  override def hasProfilerStatistics = exceptionHandlerFor2_2.runSafely { inner.arguments.exists(_.isInstanceOf[DbHits]) }

  def name = exceptionHandlerFor2_2.runSafely { inner.name }

  def asJava: javacompat.PlanDescription = exceptionHandlerFor2_2.runSafely { asJava(self) }

  override def toString: String = {
    val NL = System.lineSeparator()
    exceptionHandlerFor2_2.runSafely { s"Compiler CYPHER ${version.name}$NL${NL}Planner ${planner.name.toUpperCase}$NL$NL$inner" }
  }

  def asJava(in: ExtendedPlanDescription): javacompat.PlanDescription = new javacompat.PlanDescription {
    def getProfilerStatistics: ProfilerStatistics = new ProfilerStatistics {
      def getDbHits: Long = extract { case DbHits(count) => count}

      def getRows: Long = extract { case Rows(count) => count}

      private def extract(f: PartialFunction[Argument, Long]): Long =
        inner.arguments.collectFirst(f).getOrElse(throw new InternalException("Don't have profiler stats"))
    }

    def getName: String = name

    def hasProfilerStatistics: Boolean = self.hasProfilerStatistics

    def getArguments: util.Map[String, AnyRef] = arguments.asJava

    def getIdentifiers: util.Set[String] = identifiers.asJava

    def getChildren: util.List[javacompat.PlanDescription] = in.extendedChildren.toList.map(_.asJava).asJava

    override def toString: String = self.toString
  }
}

case class StringInfoLogger2_2(log: Log) extends InfoLogger {
  def info(message: String) {
    log.info(message)
  }
}

case class CompatibilityFor2_2Cost(graph: GraphDatabaseService,
                                   queryCacheSize: Int,
                                   statsDivergenceThreshold: Double,
                                   queryPlanTTL: Long,
                                   clock: Clock,
                                   kernelMonitors: KernelMonitors,
                                   kernelAPI: KernelAPI,
                                   log: Log,
                                   planner: CypherPlanner) extends CompatibilityFor2_2 {

  protected val compiler = {
    val plannerName = planner match {
      case CypherPlanner.default => ConservativePlannerName
      case CypherPlanner.cost => CostPlannerName
      case CypherPlanner.greedy => CostPlannerName
      case CypherPlanner.idp => IDPPlannerName
      case CypherPlanner.dp => DPPlannerName
      case _ => throw new IllegalArgumentException(s"unknown cost based planner: ${planner.name}")
    }

    CypherCompilerFactory.costBasedCompiler(
      graph, queryCacheSize, statsDivergenceThreshold, queryPlanTTL, clock, WrappedMonitors2_2(kernelMonitors),
      StringInfoLogger2_2(log), Some(plannerName), rewriterSequencer
    )
  }
}

case class CompatibilityFor2_2Rule(graph: GraphDatabaseService,
                                   queryCacheSize: Int,
                                   statsDivergenceThreshold: Double,
                                   queryPlanTTL: Long,
                                   clock: Clock,
                                   kernelMonitors: KernelMonitors,
                                   kernelAPI: KernelAPI) extends CompatibilityFor2_2 {

  protected val compiler = CypherCompilerFactory.ruleBasedCompiler(
    graph, queryCacheSize, statsDivergenceThreshold, queryPlanTTL, clock, WrappedMonitors2_2(kernelMonitors),
    rewriterSequencer
  )
}


text:
ActiveRecord::Schema.define(:version => 17) do

  create_table "items", :force => true do |t|
    t.integer "user_id"
    t.integer "category_id"
    t.date    "date"
    t.integer "value"
    t.text    "description"
  end

  add_index "items", ["user_id"], :name => "index_items_on_user_id"
  add_index "items", ["date"], :name => "index_items_on_date"

  create_table "jobs", :force => true do |t|
    t.integer  "user_id"
    t.string   "name"
    t.boolean  "active",                                   :default => true
    t.datetime "created_at"
    t.decimal  "rate",       :precision => 6, :scale => 2
  end

  add_index "jobs", ["user_id"], :name => "index_projects_on_user_id"

  create_table "paychecks", :force => true do |t|
    t.integer  "job_id"
    t.integer  "item_id"
    t.datetime "created_at"
    t.string   "description"
    t.decimal  "value",       :precision => 8, :scale => 2
  end

  add_index "paychecks", ["job_id"], :name => "index_paychecks_on_job_id"
  add_index "paychecks", ["item_id"], :name => "index_paychecks_on_item_id"

  create_table "recurrings", :force => true do |t|
    t.integer "user_id"
    t.integer "category_id"
    t.integer "day"
    t.integer "value"
    t.text    "description"
  end

  add_index "recurrings", ["user_id"], :name => "index_recurrings_on_user_id"
  add_index "recurrings", ["day"], :name => "index_recurrings_on_day"

  create_table "taggings", :force => true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "tag_id"
    t.integer  "item_id"
  end

  create_table "tags", :force => true do |t|
    t.string "name"
  end

  create_table "tasks", :force => true do |t|
    t.integer  "job_id"
    t.datetime "created_at"
    t.date     "date"
    t.integer  "minutes"
    t.string   "description"
    t.integer  "paycheck_id"
  end

  add_index "tasks", ["job_id"], :name => "index_tasks_on_project_id"
  add_index "tasks", ["paycheck_id"], :name => "index_tasks_on_paycheck_id"

  create_table "users", :force => true do |t|
    t.string   "email",         :default => "",                    :null => false
    t.string   "password_salt", :default => "",                    :null => false
    t.string   "password_hash", :default => "",                    :null => false
    t.string   "time_zone"
    t.datetime "created_at",    :default => '2007-05-24 15:49:54'
  end

  add_index "users", ["email"], :name => "index_users_on_email"

end


text:
using Microsoft.EntityFrameworkCore;

namespace DockerTestProject.Models {
    public class DTPContext : DbContext {
        public DTPContext(DbContextOptions<DTPContext> options) : base(options) {

        }

        public DbSet<Profile> Profiles { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder) {
          modelBuilder.Entity<Profile>(b => {
            b.HasKey(e => e.Id);
            b.Property(e => e.Id).ValueGeneratedOnAdd();
          });
        }
    }
}


text:
//-----------------------------------NOTICE----------------------------------//
// Some of this file is automatically filled in by a Python script.  Only    //
// add custom code in the designated areas or it will be overwritten during  //
// the next update.                                                          //
//-----------------------------------NOTICE----------------------------------//

#ifndef _BHKPRISMATICCONSTRAINT_H_
#define _BHKPRISMATICCONSTRAINT_H_

//--BEGIN FILE HEAD CUSTOM CODE--//
//--END CUSTOM CODE--//

#include "bhkConstraint.h"
namespace Niflib
{
	class bhkPrismaticConstraint;
	typedef Ref<bhkPrismaticConstraint> bhkPrismaticConstraintRef;

	/*! A prismatic constraint. */
	class bhkPrismaticConstraint : public bhkConstraint
	{
	public:
		/*! Constructor */
		NIFLIB_API bhkPrismaticConstraint();

		/*! Destructor */
		NIFLIB_API virtual ~bhkPrismaticConstraint();

		/*!
		 * A constant value which uniquly identifies objects of this type.
		 */
		NIFLIB_API static const Type TYPE;

		/*!
		 * A factory function used during file reading to create an instance of this type of object.
		 * \return A pointer to a newly allocated instance of this type of object.
		 */
		NIFLIB_API static NiObject * Create();

		/*!
		 * Summarizes the information contained in this object in English.
		 * \param[in] verbose Determines whether or not detailed information about large areas of data will be printed out.
		 * \return A string containing a summary of the information within the object in English.  This is the function that Niflyze calls to generate its analysis, so the output is the same.
		 */
		NIFLIB_API virtual string asString(bool verbose = false) const;

		/*!
		 * Used to determine the type of a particular instance of this object.
		 * \return The type constant for the actual type of the object.
		 */
		NIFLIB_API virtual const Type & GetType() const;

		/***Begin Example Naive Implementation****

		// Pivot A.
		// \return The current value.
		Vector4 GetPivotA() const;

		// Pivot A.
		// \param[in] value The new value.
		void SetPivotA( const Vector4 & value );

		// 4x4 rotation matrix, rotates the child entity.
		// \return The current value.
		array<4,Vector4 >  GetRotationMatrixA() const;

		// 4x4 rotation matrix, rotates the child entity.
		// \param[in] value The new value.
		void SetRotationMatrixA( const array<4,Vector4 >&  value );

		// Pivot B.
		// \return The current value.
		Vector4 GetPivotB() const;

		// Pivot B.
		// \param[in] value The new value.
		void SetPivotB( const Vector4 & value );

		// Describes the axis the object is able to travel along. Unit vector.
		// \return The current value.
		Vector4 GetSlidingB() const;

		// Describes the axis the object is able to travel along. Unit vector.
		// \param[in] value The new value.
		void SetSlidingB( const Vector4 & value );

		// Plane normal. Describes the plane the object is able to move on.
		// \return The current value.
		Vector4 GetPlaneB() const;

		// Plane normal. Describes the plane the object is able to move on.
		// \param[in] value The new value.
		void SetPlaneB( const Vector4 & value );

		// Describes the axis the object is able to travel along. Unit vector.
		// \return The current value.
		Vector4 GetSlidingA() const;

		// Describes the axis the object is able to travel along. Unit vector.
		// \param[in] value The new value.
		void SetSlidingA( const Vector4 & value );

		// Rotation axis.
		// \return The current value.
		Vector4 GetRotationA() const;

		// Rotation axis.
		// \param[in] value The new value.
		void SetRotationA( const Vector4 & value );

		// Plane normal. Describes the plane the object is able to move on.
		// \return The current value.
		Vector4 GetPlaneA() const;

		// Plane normal. Describes the plane the object is able to move on.
		// \param[in] value The new value.
		void SetPlaneA( const Vector4 & value );

		// Pivot.
		// \return The current value.
		Vector4 GetPivotA() const;

		// Pivot.
		// \param[in] value The new value.
		void SetPivotA( const Vector4 & value );

		// Describes the axis the object is able to travel along in B coordinates. Unit
		// vector.
		// \return The current value.
		Vector4 GetSlidingB() const;

		// Describes the axis the object is able to travel along in B coordinates. Unit
		// vector.
		// \param[in] value The new value.
		void SetSlidingB( const Vector4 & value );

		// Rotation axis.
		// \return The current value.
		Vector4 GetRotationB() const;

		// Rotation axis.
		// \param[in] value The new value.
		void SetRotationB( const Vector4 & value );

		// Plane normal. Describes the plane the object is able to move on in B
		// coordinates.
		// \return The current value.
		Vector4 GetPlaneB() const;

		// Plane normal. Describes the plane the object is able to move on in B
		// coordinates.
		// \param[in] value The new value.
		void SetPlaneB( const Vector4 & value );

		// Pivot in B coordinates.
		// \return The current value.
		Vector4 GetPivotB() const;

		// Pivot in B coordinates.
		// \param[in] value The new value.
		void SetPivotB( const Vector4 & value );

		// Describe the min distance the object is able to travel.
		// \return The current value.
		float GetMinDistance() const;

		// Describe the min distance the object is able to travel.
		// \param[in] value The new value.
		void SetMinDistance( float value );

		// Describe the max distance the object is able to travel.
		// \return The current value.
		float GetMaxDistance() const;

		// Describe the max distance the object is able to travel.
		// \param[in] value The new value.
		void SetMaxDistance( float value );

		// Friction.
		// \return The current value.
		float GetFriction() const;

		// Friction.
		// \param[in] value The new value.
		void SetFriction( float value );

		****End Example Naive Implementation***/

		//--BEGIN MISC CUSTOM CODE--//
		//--END CUSTOM CODE--//
	protected:
		/*! Pivot A. */
		Vector4 pivotA;
		/*! 4x4 rotation matrix, rotates the child entity. */
		array<4, Vector4 > rotationMatrixA;
		/*! Pivot B. */
		Vector4 pivotB;
		/*! Describes the axis the object is able to travel along. Unit vector. */
		Vector4 slidingB;
		/*! Plane normal. Describes the plane the object is able to move on. */
		Vector4 planeB;
		/*! Describes the axis the object is able to travel along. Unit vector. */
		Vector4 slidingA;
		/*! Rotation axis. */
		Vector4 rotationA;
		/*! Plane normal. Describes the plane the object is able to move on. */
		Vector4 planeA;
		/*! Rotation axis. */
		Vector4 rotationB;
		/*! Describe the min distance the object is able to travel. */
		float minDistance;
		/*! Describe the max distance the object is able to travel. */
		float maxDistance;
		/*! Friction. */
		float friction;
		/*! Unknown. Do not set this to anything over 0 as it will crash the game. */
		byte unknownByte1;
	public:
		/*! NIFLIB_HIDDEN function.  For internal use only. */
		NIFLIB_HIDDEN virtual void Read(istream& in, list<unsigned int> & link_stack, const NifInfo & info);
		/*! NIFLIB_HIDDEN function.  For internal use only. */
		NIFLIB_HIDDEN virtual void Write(ostream& out, const map<NiObjectRef, unsigned int> & link_map, list<NiObject *> & missing_link_stack, const NifInfo & info) const;
		/*! NIFLIB_HIDDEN function.  For internal use only. */
		NIFLIB_HIDDEN virtual void FixLinks(const map<unsigned int, NiObjectRef> & objects, list<unsigned int> & link_stack, list<NiObjectRef> & missing_link_stack, const NifInfo & info);
		/*! NIFLIB_HIDDEN function.  For internal use only. */
		NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
		/*! NIFLIB_HIDDEN function.  For internal use only. */
		NIFLIB_HIDDEN virtual list<NiObject *> GetPtrs() const;
	};

	//--BEGIN FILE FOOT CUSTOM CODE--//
	//--END CUSTOM CODE--//
} //End Niflib namespace
#endif


text:
===================

All user interfaces design are in this `template` folder

**How to view the Templates**
> - To Compile the SCSS and build the CSS, run `$ gulp`

> - Once you have built the CSS, open `index.html` in your web browser to view the customized Bootstrap template.

> - To customize the build further, modify the variables in the `css/variables.scss` file.

**Author:** Aminujatto Abdulqahhar


text:
<?hh // partial
namespace Test\HTTP;
use Decouple\Test\TestCase;
use Decouple\HTTP\Request\Request;
use Decouple\HTTP\Request\Uri;
use Decouple\HTTP\Router\Route\FunctionRoute;
use Test\HTTP\Fixture\RouteDependency;
use Decouple\Decoupler\Decoupler;
class RouteTest extends TestCase {
  public function execute() : void {
    $dependencies = Map {
      "Test\HTTP\Fixture\RouteDependency" => new RouteDependency()
    };

    $uri = new Uri('foo/bar');
    $decoupler = new Decoupler($dependencies);
    $request = new Request($uri, Map {'baz'=>true}, Map {}, Map {});
    $route = new FunctionRoute('foo/([^/]+)');
    $route->from(function(RouteDependency $dep) : mixed {
      return $dep->double(21);
    });
    $function = $route->execute($request);
    $result = $decoupler->injectFunction($function);
    $this->assertEquals($result, 42);
  }
}


text:
#ifndef ABSTRACTCONTAINER___H
#define ABSTRACTCONTAINER___H

#include <map>
#include <vector>
#include "Logger.hpp"

/**
 *  Abstract container that provide two functionnalities :
 *  - a map like accessor using string as keys and T as values
 *  - a main stream vector accessor
 * The thing is used to as a CommandContainer in the pilot
 **/
template< class T >
class AbstractContainer{
public:
    AbstractContainer(){}

	virtual ~AbstractContainer(){
	   for(typename std::map<std::string,T*>::iterator it = _c.begin() ; it != _c.end() ; ++it){
	      Logger::Instance() << "Deleting " << it->first;
	      delete it->second;
	   }
	}

	bool Set(const std::string & s, T * t){
       if( _c.find(s) == _c.end() ){
           _c[s] = t;
		   return true;
       }
	   else{
	       Logger::Instance() << "Error : key already present in container";
		   return false;
	   }
	}

	T * Get(const std::string & s){
       if( _c.find(s) != _c.end() ){
           return _c[s];
       }
	   else{
	       Logger::Instance() << "Error : key not present in container";
		   return NULL;
	   }
	}

	bool AddToMainStream(const std::string & s){
       if( _c.find(s) == _c.end() ){
	      Logger::Instance() << "Error : trying to add to main stream an unknow command";
		  return false;
       }
	   _l.push_back(Get(s));
	   return true;
	}

	const std::vector<T*> GetMainStream(){
	   return _l;
	}

	///@todo pretty iterator

private:
    std::map<std::string,T*> _c;
	std::vector<T*>          _l;
};

#endif // ABSTRACTCONTAINER___H


text:
debops.radvd
############

|Travis CI| |test-suite| |Ansible Galaxy|

.. |Travis CI| image:: http://img.shields.io/travis/debops/ansible-radvd.svg?style=flat
   :target: http://travis-ci.org/debops/ansible-radvd

.. |test-suite| image:: http://img.shields.io/badge/test--suite-ansible--radvd-blue.svg?style=flat
   :target: https://github.com/debops/test-suite/tree/master/ansible-radvd/

.. |Ansible Galaxy| image:: http://img.shields.io/badge/galaxy-debops.radvd-660198.svg?style=flat
   :target: https://galaxy.ansible.com/list#/roles/2096

``debops.radvd`` role manages `Router Advertisement Daemon`_.
``radvd`` periodically sends router advertisements and other hosts on the
network will automatically pick them up. This results in them obtaining an
IPv6 address and internet connectivity.

.. _Router Advertisement Daemon: https://en.wikipedia.org/wiki/Radvd)

.. contents:: Table of Contents
   :local:
   :depth: 2
   :backlinks: top

Installation
~~~~~~~~~~~~

This role requires at least Ansible ``v1.7.0``. To install it, run::

    ansible-galaxy install debops.radvd

Role variables
~~~~~~~~~~~~~~

List of default variables available in the inventory::

    ---

    # ---- Default options ----

    # Network interface to configure
    # By default, configure on interface created by 'debops.subnetwork' role
    radvd_default_interface: 'br2'

    # Options for default interface, specified as YAML text block
    radvd_default_interface_options: |
      AdvSendAdvert on;
      MaxRtrAdvInterval {{ radvd_max_advert_interval }};
      {% if radvd_default_dhcpv6 is defined and radvd_default_dhcpv6 %}
      AdvManagedFlag on;
      AdvOtherConfigFlag on;
      {% endif %}

    # Options defined for default prefixes as YAML text block
    radvd_default_prefix_options: ''

    # Enable or disable support for DHCPv6 server in default configuration
    radvd_default_dhcpv6: True

    # ---- DNS and search domains ----

    # Local subdomain leaf to advertise in DNSSL
    radvd_default_subdomain: 'lan'

    # List of search domains to advertise in DNSSL
    radvd_default_domains: [ '{{ radvd_default_subdomain }}.{{ ansible_fqdn }}', '{{ ansible_domain }}' ]

    # ---- radvd configuration ----

    # Maximum time between router advertisements, in seconds
    radvd_max_advert_interval: '60'

    # See radvd.conf(5) for documentation of available options. Each section is
    # specified with lowercase name, section options are specified as YAML text
    # blocks (semicolons at the end of each line are required).
    radvd_interfaces:

        # Default interface created by 'debops.subnetwork' role
      - interface: '{{ radvd_default_interface }}'
        comment: 'Default configuration for local network'

        # Interface options as YAML text block
        options: '{{ radvd_default_interface_options }}'

        # List of prefixes advertised on this interface
        prefixes:
          - prefix: '::/64'
            options: '{{ radvd_default_prefix_options }}'

        # List of configured routes for this interface
        routes: []
          #- route: ''
          #  options: |

        # List of nameservers advertised on this interface
        nameservers: []
          #- rdnss: []
          #  options: |

        # List of search domains advertised on this interface
        domains:
          - dnssl: '{{ radvd_default_domains }}'

        # List of clients to advertise to, if not defined, advertise to all hosts
        # on this interface
        clients: []

Authors and license
~~~~~~~~~~~~~~~~~~~

``debops.radvd`` role was written by:

- Maciej Delmanowski | `e-mail <mailto:drybjed@gmail.com>`__ | `Twitter <https://twitter.com/drybjed>`__ | `GitHub <https://github.com/drybjed>`__

License: `GPLv3 <https://tldrlegal.com/license/gnu-general-public-license-v3-%28gpl-3%29>`_


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>All In One Aluminum | Vidrios y Aluminios en Playa del Carmen</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        Toggle navigation

                    </button>

                            Inicio

                            Nosotros

                            Servicios

                            Galería

                            Clientes

                            Contacto

Portfolio Item
                    Subheading

Home

Portfolio Item

Project Description

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra euismod odio, gravida pellentesque urna varius vitae. Sed dui lorem, adipiscing in adipiscing et, interdum nec metus. Mauris ultricies, justo eu convallis placerat, felis enim.

Project Details

Lorem Ipsum

Dolor Sit Amet

Consectetur

Adipiscing Elit

Related Projects

Copyright © Your Website 2014


text:
default_run_options[:pty] = true

set :application, "sirport"
set :deploy_to, "/home/you/app"
set :user, "you"
set :use_sudo, false
set :scm, :git
set :rails_env, 'production'
set :repository, "git@github.com:you/sirport.git"
set :branch, "master"
set :deploy_via, :remote_cache
set :keep_releases, 5

set :bundle_without, [:development]

server "yourdomain.com", :app, :web, :db, :primary => true

set :sync_backups, 3

before 'deploy:restart', 'deploy:migrate'
after 'deploy', 'deploy:cleanup'

set :bundle_without, [:development, :test]

after 'deploy:update_code', 'deploy:symlink_configs'
after 'deploy:update', 'foreman:export'
after 'deploy:update', 'foreman:restart'

namespace :deploy do
  desc 'Link the .env environment and Procfile from shared/config into the new deploy directory'
  task :symlink_configs, :roles => :app do
    run <<-CMD
      cd #{latest_release} && ln -nfs #{shared_path}/config/.env #{latest_release}/.env
    CMD

    run <<-CMD
      cd #{latest_release} && ln -nfs #{shared_path}/config/Procfile #{latest_release}/Procfile
    CMD
  end
end

namespace :foreman do
  desc "Export the Procfile to Ubuntu's upstart scripts"
  task :export, :roles => :app do
    run "cd #{latest_release} && rvmsudo bundle exec foreman export upstart /etc/init -a #{application} -u #{user} -l #{deploy_to}/upstart_logs"
  end

  desc 'Start the application services'
  task :start, :roles => :app do
    sudo "sudo start #{application}"
  end

  desc 'Stop the application services'
  task :stop, :roles => :app do
    sudo "sudo stop #{application}"
  end

  desc 'Restart the application services'
  task :restart, :roles => :app do
    run "sudo start #{application} || sudo restart #{application}"
  end
end

# If you want to use rvm on your server and have it maintained by Capistrano, uncomment these lines:
#   set :rvm_ruby_string, '1.9.3-p286@sirport'
#   set :rvm_type, :user
#   before 'deploy', 'rvm:install_rvm'
#   before 'deploy', 'rvm:install_ruby'
#   require "rvm/capistrano"

# Load Capistrano additions
Dir[File.expand_path("../../lib/capistrano/*.rb", __FILE__)].each{|f| load f }

require "bundler/capistrano"
load 'deploy/assets'


text:
import h from './spec-helper';
import SourceCode from '../src/source-code';
var bb = require('bluebird');

/**
 * source-code
 */
describe('SourceCode:', function() {

  var sourceCode;

  it('should load from CODE string', function() {
    var sample_code = [
      'var path = require(\'path\');',
      '',
      'var sum = function(a, b) {',
      '  return a + b;',
      '}',
    ].join('\n');
    sourceCode = new SourceCode({ code: sample_code });

    // check ast
    h.expect(sourceCode.ast).to.not.be.undefined;
    var bodyArray = sourceCode.ast.program.body;
    h.expect(bodyArray).to.be.an.array;
    h.expect(bodyArray[0].type).to.be.equal('VariableDeclaration');
    h.expect(bodyArray[1].type).to.be.equal('VariableDeclaration');

    // check code
    h.expect(sourceCode.code).to.equal([
      'var path = require(\'path\');',
      '',
      'var sum = function(a, b) {',
      '  return a + b;',
      '}',
    ].join('\n'));
  });

  it('should load from AST string', function() {
    // get first AST
    var sample_code_string_1 = [
      'var path = require(\'path\');',
      '',
      'var sum = function(a, b) {',
      '  return a + b;',
      '}',
    ].join('\n');
    var sourceCode1 = new SourceCode({ code: sample_code_string_1 });

    // load from AST
    var sourceCode2 = new SourceCode({ ast: sourceCode1.ast });

    var bodyArray = sourceCode2.ast.program.body;
    h.expect(bodyArray).to.be.an.array;
    h.expect(bodyArray[0].type).to.be.equal('VariableDeclaration');
    h.expect(bodyArray[1].type).to.be.equal('VariableDeclaration');

    // check code
    h.expect(sourceCode2.code).to.equal([
      'var path = require(\'path\');',
      '',
      'var sum = function(a, b) {',
      '  return a + b;',
      '}',
    ].join('\n'));
  });

  it('should throw an errors when the origin string is wrong', function() {
    var wrong_source = [
      'var sum = function(a, b) {',
      '  return a + b;',
      '}',
      'var path = require(\'path\';); // this is a comment', // do not fix this
      'var sum2 = function(a, b) {',
      '  return a + b;',
      '}',
    ].join('\n');

    // TODO: read error to test properly
    h.expect(() => new SourceCode({ code: wrong_source })).to.throw;

    // // load from AST
    // var sourceCode2 = new SourceCode({ ast: sourceCode1.ast });
    //
    // var bodyArray = sourceCode2.ast.program.body;
    // h.expect(bodyArray).to.be.an.array;
    // h.expect(bodyArray[0].type).to.be.equal('VariableDeclaration');
    // h.expect(bodyArray[1].type).to.be.equal('VariableDeclaration');
    //
    // // check code
    // h.expect(sourceCode2.code).to.equal([
    //   'var path = require(\'path\');',
    //   '',
    //   'var sum = function(a, b) {',
    //   '  return a + b;',
    //   '}',
    // ].join('\n'));
  });

  it('should load a javascript FILE (promises)', function() {
    var sourceCodePromise = new SourceCode({ file: __filename });
    sourceCodePromise.then(function (sourceCodeInstance) {
      h.expect(sourceCodeInstance.code).to.not.be.undefined;
      h.expect(sourceCodeInstance.ast).to.not.be.undefined;
    });
  });

  it('should load a javascript FILE (promises + generators yield)', function() {
    return bb.coroutine(function* () {
      sourceCode = yield new SourceCode({ file: __filename });
      h.expect(sourceCode.code).to.not.be.undefined;
      h.expect(sourceCode.ast).to.not.be.undefined;
    })();
  });

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

});


text:
package org.molasdin.wbase.jsf.spring.scope;

import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.Scope;

import javax.faces.context.FacesContext;
import java.util.Map;

public class JsfViewScope implements Scope {

    public Object get(String name, ObjectFactory<?> objectFactory) {
        if (FacesContext.getCurrentInstance().getViewRoot() != null) {
            Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
            if (viewMap.containsKey(name)) {
                return viewMap.get(name);
            } else {
                Object object = objectFactory.getObject();
                viewMap.put(name, object);
                return object;
            }
        } else {
            return null;
        }
    }

    public Object remove(String name) {
        if (FacesContext.getCurrentInstance().getViewRoot() != null) {
            return FacesContext.getCurrentInstance().getViewRoot().getViewMap().remove(name);
        } else {
            return null;
        }
    }

    public void registerDestructionCallback(String name, Runnable callback) {
        // Do nothing
    }

    public Object resolveContextualObject(String key) {
        return null;
    }

    public String getConversationId() {
        return null;
    }
}


text:
namespace Google.Cloud.AIPlatform.V1.Snippets
{
    // [START aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_sync_flattened]
    using Google.Cloud.AIPlatform.V1;

    public sealed partial class GeneratedTensorboardServiceClientSnippets
    {
        /// <summary>Snippet for GetTensorboardExperiment</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void GetTensorboardExperiment()
        {
            // Create client
            TensorboardServiceClient tensorboardServiceClient = TensorboardServiceClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/tensorboards/[TENSORBOARD]/experiments/[EXPERIMENT]";
            // Make the request
            TensorboardExperiment response = tensorboardServiceClient.GetTensorboardExperiment(name);
        }
    }
    // [END aiplatform_v1_generated_TensorboardService_GetTensorboardExperiment_sync_flattened]
}


text:
$VERBOSE = nil
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

require "minitest/autorun"
require "webmock/minitest"

require "shopify_api"
require_relative "../../test_helper"

class ApplicationCredit202204Test < Test::Unit::TestCase
  def setup
    super

    test_session = ShopifyAPI::Auth::Session.new(id: "id", shop: "test-shop.myshopify.io", access_token: "this_is_a_test_token")
    ShopifyAPI::Context.activate_session(test_session)
    modify_context(api_version: "2022-04")
  end

  def teardown
    super

    ShopifyAPI::Context.deactivate_session
  end

  sig do
    void
  end
  def test_1()
    stub_request(:post, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
      .with(
        headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
        body: { "application_credit" => hash_including({"description" => "application credit for refund", "amount" => 5.0}) }
      )
      .to_return(status: 200, body: JSON.generate({"application_credit" => {"id" => 1031636127, "amount" => "5.00", "description" => "application credit for refund", "test" => nil}}), headers: {})

    application_credit = ShopifyAPI::ApplicationCredit.new
    application_credit.description = "application credit for refund"
    application_credit.amount = 5.0
    application_credit.save()

    assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
  end

  sig do
    void
  end
  def test_2()
    stub_request(:post, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
      .with(
        headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json", "Content-Type"=>"application/json"},
        body: { "application_credit" => hash_including({"description" => "application credit for refund", "amount" => 5.0, "test" => true}) }
      )
      .to_return(status: 200, body: JSON.generate({"application_credit" => {"id" => 1031636128, "amount" => "5.00", "description" => "application credit for refund", "test" => true}}), headers: {})

    application_credit = ShopifyAPI::ApplicationCredit.new
    application_credit.description = "application credit for refund"
    application_credit.amount = 5.0
    application_credit.test = true
    application_credit.save()

    assert_requested(:post, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
  end

  sig do
    void
  end
  def test_3()
    stub_request(:get, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
      .with(
        headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
        body: {}
      )
      .to_return(status: 200, body: JSON.generate({"application_credits" => [{"id" => 140583599, "amount" => "5.00", "description" => "credit for application refund", "test" => nil}]}), headers: {})

    ShopifyAPI::ApplicationCredit.all()

    assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits.json")
  end

  sig do
    void
  end
  def test_4()
    stub_request(:get, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits/140583599.json")
      .with(
        headers: {"X-Shopify-Access-Token"=>"this_is_a_test_token", "Accept"=>"application/json"},
        body: {}
      )
      .to_return(status: 200, body: JSON.generate({"application_credit" => {"id" => 140583599, "amount" => "5.00", "description" => "credit for application refund", "test" => nil}}), headers: {})

    ShopifyAPI::ApplicationCredit.find(
      id: 140583599,
    )

    assert_requested(:get, "https://test-shop.myshopify.io/admin/api/2022-04/application_credits/140583599.json")
  end

end