text:
<!DOCTYPE HTML>

  <title>photo_blurred3</title>
  <meta name="description" content="website description" />
  <meta name="keywords" content="website keywords, website keywords" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

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

<a href="index.php?<? echo "username=$username&password=$password"; ?>">Welcome to EasyStock

Warehouse management website

Please log in before using

<a href="index.php?<? echo "username=$username&password=$password"; ?>">Home

<a href="add.php?<? echo "username=$username&password=$password"; ?>">Add

<a href="edit.php?<? echo "username=$username&password=$password"; ?>">Edit

<a href="remove.php?<? echo "username=$username&password=$password"; ?>">Remove

<a href="recieve.php?<? echo "username=$username&password=$password"; ?>">Recieve

<a href="sell.php?<? echo "username=$username&password=$password"; ?>">Sell

<a href="contact.php?<? echo "username=$username&password=$password"; ?>">Contact Us

Client login

                <form action="index.php" method="get">

User Name:

                            <input type="text" id="username" name="username" class="login_input" placeholder="username" value=<? echo $_GET["username"];?> >

Password:
                            <input type="password" id="password" name="password" class="login_input" placeholder="password" value=<? echo $_GET["password"];?> >

                            <input type="submit" name="submit" id="login_submit" value=" Login   " >    Register

                   </form>
                    <form action="index.php" >

                   <input type="submit" name="logOut" id="logout_submit" value=" Logout " /> </form>

Your stock

<?php
                            include "Person.php";
                            include "Product.php";

                            ////edit
                            if(isset($_GET["submitEdit"])){
                            $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");
                            $profit=$price-$cost;
                            //find user in database
                            $resultPerson=mysql_query("SELECT*FROM person WHERE user LIKE '$username%' AND password LIKE '$password%'",$conn);
                            $rsPerson=mysql_fetch_array($resultPerson);
                            //Update product primary key at person database
                             $strSQL="UPDATE person";
                             if($rsPerson[code1]==$productCode)$strSQL=$strSQL." SET code1='$code'";
                             elseif($rsPerson[code2]==$productCode)$strSQL=$strSQL." SET code2='$code'";
                             elseif($rsPerson[code3]==$productCode)$strSQL=$strSQL." SET code3='$code'";
                             elseif($rsPerson[code4]==$productCode)$strSQL=$strSQL." SET code4='$code'";
                             elseif($rsPerson[code5]==$productCode)$strSQL=$strSQL." SET code5='$code'";
                             elseif($rsPerson[code6]==$productCode)$strSQL=$strSQL." SET code6='$code'";
                             elseif($rsPerson[code7]==$productCode)$strSQL=$strSQL." SET code7='$code'";
                             elseif($rsPerson[code8]==$productCode)$strSQL=$strSQL." SET code8='$code'";
                             elseif($rsPerson[code9]==$productCode)$strSQL=$strSQL." SET code9='$code'";
                             elseif($rsPerson[code10]==$productCode)$strSQL=$strSQL." SET code10='$code'";
                            $strSQL=$strSQL." WHERE user='$username'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                            $strSQL="SELECT*FROM person";
                            $result=mysql_query($strSQL,$conn);
                            //Update all detail product
                           //fncUpdateRecord("product","code='$code'","code='$productCode'");
                           fncUpdateRecord("product","name='$name'","code='$code'");
                           fncUpdateRecord("product","amount='$amount'","code='$code'");
                           fncUpdateRecord("product","unitAmount='$unitAmount'","code='$code'");
                           fncUpdateRecord("product","netWeight='$netWeight'","code='$code'");
                           fncUpdateRecord("product","unitWeight='$unitNetWeight'","code='$code'");

                           fncUpdateRecord("product","currency='$currency'","code='$code'");
                           fncUpdateRecord("product","cost='$cost'","code='$code'");
                           fncUpdateRecord("product","price='$price'","code='$code'");
                           fncUpdateRecord("product","profit='$profit'","code='$code'");
                           fncUpdateRecord("product","sale='$sale'","code='$code'");

                           fncUpdateRecord("product","hierarchy='$hierarchy'","code='$code'");
                           fncUpdateRecord("product","certificate='$certificate'","code='$code'");
                           fncUpdateRecord("product","expire='$expire'","code='$code'");
                           fncUpdateRecord("product","authorization='$authorization'","code='$code'");

                           fncUpdateRecord("product","orderLeadTime='$orderLeadTime'","code='$code'");
                           fncUpdateRecord("product","unitOrderLeadTime='$unitOrderLeadTime'","code='$code'");
                           fncUpdateRecord("product","minimumPacking='$minimumPacking'","code='$code'");
                           fncUpdateRecord("product","unitMinimumPacking='$unitMinimumPacking'","code='$code'");
                           fncUpdateRecord("product","minimumOrder='$minimumOrder'","code='$code'");
                           fncUpdateRecord("product","paymentTerm='$paymentTerm'","code='$code'");
                           fncUpdateRecord("product","allocation='$allocation'","code='$code'");
                           mysql_close($conn);}

                            ////remove
                            if(isset($_GET["submitRemove"])){

                            $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");
                             $strSQL="UPDATE product";
                            $strSQL=$strSQL." SET lastCode='$productCode'";
                            //print $name;
                            //print $productCode;
                            $strSQL=$strSQL." WHERE code='$productCode'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                            $strSQL="UPDATE product";
                            $strSQL=$strSQL." SET code='0'";
                            //print $name;
                            //print $productCode;
                            $strSQL=$strSQL." WHERE code='$productCode'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                              //$strSQL=$strSQL." SET amount='$amountSell',sale='$saleSell'";

                            $strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);

                            $strSQL="UPDATE person SET code1='0' WHERE code1='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code2='0' WHERE code2='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code3='0' WHERE code3='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code4='0' WHERE code4='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code5='0' WHERE code5='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code6='0' WHERE code6='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code7='0' WHERE code7='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code8='0' WHERE code8='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code9='0' WHERE code9='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            $strSQL="UPDATE person SET code10='0' WHERE code10='$productCode'";mysql_query($strSQL,$conn);$strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);mysql_close($conn);

                        }

                             ////recieve
                            if(isset($_GET["submitRecieve"])){
                            $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");
                            //load
                            $result=mysql_query("SELECT*FROM product WHERE code LIKE '$productCode%'",$conn);
                            $rs=mysql_fetch_array($result);
                            //Set value to class then use function sell() to calculate
                            $productSell=new Product();
                            $productSell->setAmount($rs[amount]+$amount);
                            //$productSell->setCost($rs[cost]);
                            //$productSell->setPrice($rs[price]);
                            //$productSell->setSale($rs[sale]);
                            //$productSell->sell($amount);
                            //update detail to database
                            $amountRecieve=$productSell->getAmount();
                            //$saleSell=$productSell->getSale();
                            $strSQL="UPDATE product";
                            $strSQL=$strSQL." SET amount='$amountRecieve'";
                            $strSQL=$strSQL." WHERE code='$productCode'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                            $strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            mysql_close($conn);}

                            ////sell
                            if(isset($_GET["submitSell"])){
                            $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");
                            //load
                            $result=mysql_query("SELECT*FROM product WHERE code LIKE '$productCode%'",$conn);
                            $rs=mysql_fetch_array($result);
                            //Set value to class then use function sell() to calculate
                            $productSell=new Product();
                            $productSell->setAmount($rs[amount]);
                            $productSell->setCost($rs[cost]);
                            $productSell->setPrice($rs[price]);
                            $productSell->setSale($rs[sale]);
                            $productSell->sell($amount);
                            //update detail to database
                            $amountSell=$productSell->getAmount();
                            $saleSell=$productSell->getSale();
                            $strSQL="UPDATE product";
                            $strSQL=$strSQL." SET amount='$amountSell',sale='$saleSell'";
                            $strSQL=$strSQL." WHERE code='$productCode'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                            $strSQL="SELECT*FROM product";
                            $result=mysql_query($strSQL,$conn);
                            mysql_close($conn);}

                              ////register
                            if(isset($_GET["submitReg"])){

                             $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");

                           fncInsertRecord("person","code1","5555");
                            fncUpdateRecord("person","user='$username'","code1=5555");
                           fncUpdateRecord("person","password='$password'","code1=5555");
                           mysql_close($conn);

                        }

                            ////add
                            if(isset($_GET["submitAdd"])){
                            $conn=mysql_connect("localhost","root","password")or die("ไม่สามารถติดต่อกับเซิฟเวอ");
                            mysql_select_db("easystock",$conn)or die("ไม่สามารถเลือกฐานข้อมูล");
                           // $strSQL="INSERT INTO product(name,code,amount,unitAmount,netWeight,unitWeight,currency,cost,price,sale,hierarchy,certificate,expire,authorization,orderLeadTime,unitOrederLeadTime,minimumPacking,unitMinimumPacking,minimumOrder,paymentTerm,allocation)";
                          // $strSQL=$strSQL." VALUES('$name','$code','$amount','$unitAmount','$netWeight','$unitNetWeight','$currency','$cost','$price','$sale','$hierarchy','$certificate','$expire','$authorization','$orderLeadTime','$unitOrederLeadTime','$minimumPacking','$unitMinimumPacking','$minimumOrder','$paymentTerm','$allocation')";
                           // $strSQL="INSERT INTO product(name,code,amount,unitAmount,netWeight,unitWeight,currency,cost,price,profit,sale,hierarchy,certificate,expire,authorization,orderLeadTime,unitOrderLeadTime,minimumPacking,unitMinimumPacking,minimumOrder,paymentTerm,allocation)";
                            //$strSQL=$strSQL." VALUES('$name','$code','$amount','$unitAmount','$netWeight','$unitNetWeight','$currency','$cost','$price','$sale','$hierarchy','$certificate','$expire','$authorization','$orderLeadTime','$unitOrderLeadTime','$minimumPacking','$unitMinimumPacking','$minimumOrder','$unitMinimumPacking','$minimumOrder','$paymentTerm','$allocation')";
                            $profit=$price-$cost;
                           fncInsertRecord("product","code",$code);
                           fncUpdateRecord("product","name='$name'","code='$code'");
                           fncUpdateRecord("product","amount='$amount'","code='$code'");
                           fncUpdateRecord("product","unitAmount='$unitAmount'","code='$code'");
                           fncUpdateRecord("product","netWeight='$netWeight'","code='$code'");
                           fncUpdateRecord("product","unitWeight='$unitNetWeight'","code='$code'");

                           fncUpdateRecord("product","currency='$currency'","code='$code'");
                           fncUpdateRecord("product","cost='$cost'","code='$code'");
                           fncUpdateRecord("product","price='$price'","code='$code'");
                           fncUpdateRecord("product","profit='$profit'","code='$code'");
                           fncUpdateRecord("product","sale='$sale'","code='$code'");

                           fncUpdateRecord("product","hierarchy='$hierarchy'","code='$code'");
                           fncUpdateRecord("product","certificate='$certificate'","code='$code'");
                           fncUpdateRecord("product","expire='$expire'","code='$code'");
                           fncUpdateRecord("product","authorization='$authorization'","code='$code'");

                           fncUpdateRecord("product","orderLeadTime='$orderLeadTime'","code='$code'");
                           fncUpdateRecord("product","unitOrderLeadTime='$unitOrderLeadTime'","code='$code'");
                           fncUpdateRecord("product","minimumPacking='$minimumPacking'","code='$code'");
                           fncUpdateRecord("product","unitMinimumPacking='$unitMinimumPacking'","code='$code'");
                           fncUpdateRecord("product","minimumOrder='$minimumOrder'","code='$code'");
                           fncUpdateRecord("product","paymentTerm='$paymentTerm'","code='$code'");
                           fncUpdateRecord("product","allocation='$allocation'","code='$code'");

                            //mysql_query($strSQL,$conn) or die("ไม่สามารถเพิ่มข้อมูล");

                            //update person
                             $resultPerson=mysql_query("SELECT*FROM person WHERE user LIKE '$username%' AND password LIKE '$password%'",$conn);
                            $rsPerson=mysql_fetch_array($resultPerson);

                             $strSQL="UPDATE person";
                             if($rsPerson[code1]=="0"or$rsPerson[code1]=="5555")$strSQL=$strSQL." SET code1='$code'";
                             elseif($rsPerson[code2]=="0")$strSQL=$strSQL." SET code2='$code'";
                             elseif($rsPerson[code3]=="0")$strSQL=$strSQL." SET code3='$code'";
                             elseif($rsPerson[code4]=="0")$strSQL=$strSQL." SET code4='$code'";
                             elseif($rsPerson[code5]=="0")$strSQL=$strSQL." SET code5='$code'";
                             elseif($rsPerson[code6]=="0")$strSQL=$strSQL." SET code6='$code'";
                             elseif($rsPerson[code7]=="0")$strSQL=$strSQL." SET code7='$code'";
                             elseif($rsPerson[code8]=="0")$strSQL=$strSQL." SET code8='$code'";
                             elseif($rsPerson[code9]=="0")$strSQL=$strSQL." SET code9='$code'";
                             elseif($rsPerson[code10]=="0")$strSQL=$strSQL." SET code10='$code'";

                            //print $name;
                            //print $productCode;
                             $strSQL=$strSQL." WHERE user='$username'";
                            mysql_query($strSQL,$conn) or die("ไม่สามารถเปรับปรุงข้อมูล");
                            $strSQL="SELECT*FROM person";
                            $result=mysql_query($strSQL,$conn);
                            mysql_close($conn);}

                            ////represent
                            $conn=mysql_connect("localhost","root","password");
                            mysql_select_db("easystock",$conn);
                            //$result = mysql_query("SELECT * FROM uoc_std WHERE STD_FNAME LIKE '$_POST[keyword]%'  OR STD_LNAME LIKE '$_POST[keyword]%'");

                            $resultPerson=mysql_query("SELECT*FROM person WHERE user LIKE '$username%' AND password LIKE '$password%'",$conn)or die("กรุณาล๊อกอินด้วยรหัสผ่านที่ถูกต้อง");
                            $rsPerson=mysql_fetch_array($resultPerson)or die("กรุณากรอกรหัสผ่านที่ถูกต้อง");
                            $person=new Person();
                            $person->setUser($rsPerson[user]);
                            $person->setPassword($rsPerson[password]);

                            if($rsPerson[code1]!="0")$person->addProduct($rsPerson[code1]);
                            if($rsPerson[code2]!="0")$person->addProduct($rsPerson[code2]);
                            if($rsPerson[code3]!="0")$person->addProduct($rsPerson[code3]);
                            if($rsPerson[code4]!="0")$person->addProduct($rsPerson[code4]);
                            if($rsPerson[code5]!="0")$person->addProduct($rsPerson[code5]);
                            if($rsPerson[code6]!="0")$person->addProduct($rsPerson[code6]);
                            if($rsPerson[code7]!="0")$person->addProduct($rsPerson[code7]);
                            if($rsPerson[code8]!="0")$person->addProduct($rsPerson[code8]);
                            if($rsPerson[code9]!="0")$person->addProduct($rsPerson[code9]);
                            if($rsPerson[code10]!="0")$person->addProduct($rsPerson[code10]);
                            //print $person->getNumproduct()."
";

                            for($i=0;$i<=$person->getNumproduct()-1;$i++){
                              $code=$person->getProduct($i);

                            //$result=mysql_query("SELECT*FROM product WHERE code LIKE '$code%'",$conn);
                            //$rs=mysql_fetch_array($result);

                                    $rs=fncSelectRecord("product","code LIKE '$code%'");
                                    print "Product ".(int)($i+1)."

";

                            //general
                            print "Name : ".$rs[name]."
";print "Code : ".$rs[code]."
";print "Quantity : ".$rs[amount]."
";print "Unit quantity : ".$rs[unitAmount]."
";
                            print "NetWeight : ".$rs[netWeight]."
";print "Unit netweight : ".$rs[unitWeight]."
";
                            //finance
                            print "Currency : ".$rs[currency]."
";print "Cost : ".$rs[cost]."
";print "Sale price : ".$rs[price]."
";print "Profit : ".$rs[profit]."
";
                            print "Sales amount : ".$rs[sale]."
";
                            //feature
                            print "Hierarchy : ".$rs[hierarchy]."
";print "Certificate : ".$rs[certificate]."
";print "Expire : ".$rs[expire]."
";print "Authorization : ".$rs[authorization]."
";
                            //logistic

                            print "Order lead time : ".$rs[orderLeadTime]."
";print "Unit order lead time : ".$rs[unitOrderLeadTime]."
";print "Minimum Packing : ".$rs[minimumPacking]."
";
                            print "Minimum order : ".$rs[minimumOrder]."
";print "Payment term : ".$rs[paymentTerm]."
";
                            print "Location : ".$rs[allocation]."

";
                        }
                            mysql_close($conn);

                            /*

                            include "Product.php";
                            $odj=new Product();
                            $odj->setName($_GET["name"]);
                            $odj->setCode($_POST["code"]);
                            $odj->setAmount($_POST["amount"]);
                            $odj->setunitAmount($_POST["unitAmount"]);
                            $odj->setNetWeight($_POST["netWeight"]);
                            $odj->setUnitNetWeight($_POST["unitNetWeight"]);

                            $odj->setCurrency($_POST["currency"]);
                            $odj->setCost($_POST["cost"]);
                            $odj->setPrice($_POST["price"]);
                            //$odj->setProfit($_POST["profit"]);
                            $odj->setSale($_POST["sale"]);

                            $odj->setHierarchy($_POST["hierarchy"]);
                            $odj->setCertificate($_POST["certificate"]);
                            $odj->setExpire($_POST["expire"]);
                            $odj->setAuthorization($_POST["authorization"]);
                            $odj->setOrderLeadTime($_POST["orderLeadTime"]);
                            $odj->setUnitOrderLeadTime($_POST["unitOrederLeadTime"]);
                            $odj->setMinimumPacking($_POST["minimumPacking"]);
                            $odj->setUnitMinimumPacking($_POST["unitMinimumPacking"]);
                            $odj->setMinimumOrder($_POST["minimumOrder"]);
                            $odj->setPaymentTerm($_POST["paymentTerm"]);
                            $odj->setAllocation($_POST["allocation"]);

                            $odj->printAll();
                            */

                            /**** credit : http://www.thaicreate.com/php/php-mysql-used-function-database-query.html ****/
                            /**** function connection to database ****/

//$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");

//$objDB = mysql_select_db("mydatabase");

/**** function insert record ****/

function fncInsertRecord($strTable,$strField,$strValue)

{

$strSQL = "INSERT INTO $strTable ($strField) VALUES ($strValue) ";

return @mysql_query($strSQL);

}

/**** function select record ****/

function fncSelectRecord($strTable,$strCondition)

{

$strSQL = "SELECT * FROM $strTable WHERE $strCondition ";

$objQuery = @mysql_query($strSQL);

return @mysql_fetch_array($objQuery);

}

/*** function update record ****/

function fncUpdateRecord($strTable,$strCommand,$strCondition)

{

$strSQL = "UPDATE $strTable SET  $strCommand WHERE $strCondition ";

return @mysql_query($strSQL);

}

/**** function delete record ****/

function fncDeleteRecord($strTable,$strCondition)

{

$strSQL = "DELETE FROM $strTable WHERE $strCondition ";

return @mysql_query($strSQL);

}

                             ?>

<a href="index.php?<? echo "username=$username&password=$password"; ?>">Home | <a href="add.php?<? echo "username=$username&password=$password"; ?>">Add | <a href="edit.php?<? echo "username=$username&password=$password"; ?>">Edit | <a href="remove.php?<? echo "username=$username&password=$password"; ?>">Remove|<a href="recieve.php?<? echo "username=$username&password=$password"; ?>">Recieve  |<a href="sell.php?<? echo "username=$username&password=$password"; ?>">Sell | <a href="contact.php?<? echo "username=$username&password=$password"; ?>">Contact Us

Copyright © photo_blurred3 | design from css3templates.co.uk


text:
import os

from setuptools import setup

setup(
    name='iou',
    version='0.1.0',
    description='Promise-like data encapsulation for asynchronous behavior',
    url='https://github.com/reinecke/IOU',
    license='MIT',
    author='Eric Reinecke',
    author_email='reinecke.eric@gmail.com',
    classifiers=[
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
    ],
    install_requires=['requests'],
    packages=['iou'],
)

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

		<title></title>

            Despite it being named kernel, it is not the Cosmos kernel. It is instead an
            interface to control the state of the kernel regarding booting, restarting,
            shutting down etc. Despite an exhaustive search, we could not determine a more
            appropriate name and settled on Kernel, since it is a system level interface to
            the kernel.


text:
window.onload = function()
{

	//
	// Helper function to add a class to the body
	//
	Titanium.UI.addBodyClass = function(c)
	{
		var classes = document.body.className;
		document.body.className = classes + ' ' + c;
	};

	//
	// setup system property background image
	//
	Titanium.UI.setPropertyBackground = function()
	{
		Titanium.UI.addBodyClass('property_background');
	};

	//
	// create a progress bar
	//
	Titanium.UI.createProgressBar = function(id)
	{
		var el = document.getElementById(id);
		if (!el)
		{
			alert('createProgressBar: invalid element id ' + id);
			return;
		}

		el.className += ' progress_bar';
		var html = '

';
		el.innerHTML = html;
	};

	//
	// update progress bar
	//
	Titanium.UI.updateProgressBar = function(id,value)
	{
		var el = document.getElementById('progress_'+id);
		if (!el)
		{
			alert('updateProgressBar: invalid element id ' + id);
			return;
		}

		el.style.width = String(value) +"px";
	};

	//
	// Create a on/off switch
	//
	Titanium.UI.createSwitch = function(id, value, callback)
	{
		var el = document.getElementById(id);
		if (!el)
		{
			alert('createSwitch: invalid element id ' + id);
			return;
		}

		// create control
		el.className += " switch_container ";
		var html = '

';
		el.innerHTML = html;

		// set initial value
		var right = (value ==true)?'0px':'94px';
		document.getElementById("switch_" + id).style.right = right;

		// setup touch listener
		el.addEventListener('touchend',function()
		{
		   	var c = document.getElementById("switch_" + id);
			if (c.style.right == '0px')
			{
				c.style.right = '94px';
				c.setAttribute('switch','off');
				if (callback) callback(false);
			}
			else
			{
				c.style.right = '0px';
				c.setAttribute('switch','on');
				if (callback)callback(true);
			}
		},false);
	};

	//
	// create text element
	//
	Titanium.UI.createTextElement = function(id,bold)
	{
		var el = document.getElementById(id);
		if (!el)
		{
			alert('createTextElement: invalid element id ' + id);
			return;
		}
		el.className += 'label ';
		if (bold)
		{
			el.className+='bold';
		}
	};

	//
	// Define iPhone specific UI controls
	//
	if (Titanium.Platform.name.indexOf('iPhone') != -1)
	{
	    Titanium.UI.iPhoneNotificationCount = 0;

		//
		// Titanium Notification for iPhone
		//
		Titanium.UI.Notification = function(options)
		{

			// get latest html for notification
			this.getHTML = function()
			{
				if (Titanium.Platform.version == '3.0')
				{
					return '
' + this.message + '
';
				}
				return '
' + this.message + '
';

			}
			// show notification
			this.show = function()
			{
				var self = this;
				this.visible = true;

				// sroll to top
				window.scrollTo(0,0)

				// create element if not exists
				if (document.getElementById('titanium_iphone_notification_' + this.id) == null)
				{
					// set html - have to do appendChild, setting innerHTML jacks up the innerHTML
					var d = document.createElement('div');
					d.id = "titanium_iphone_notification_"+this.id;
					d.className = 'notification';
					d.innerHTML = this.getHTML();
					document.body.appendChild(d);
				}
				// otherwise update html
				else
				{
					document.getElementById('titanium_iphone_notification_' + this.id).innerHTML = this.getHTML();
				}

				// setup listeners
				var el = document.getElementById('titanium_iphone_notification_' + this.id);

				// close on touch
				el.ontouchstart = function()
				{
					self.visible = false;
					var el = document.getElementById('titanium_iphone_notification_'+ self.id);
					el.getElementsByTagName('DIV')[0].style.height = "0px";
					setTimeout(function(){el.innerHTML = ''},250);
					return false;

				};

				// close on scroll
				document.body.ontouchmove = function(e)
				{
					if (self.visible == true)
					{
						e.preventDefault();
					}
				}

				// setup autohide
				if (this.autohide == true)
				{
					setTimeout(function()
					{
						self.visible = false;
						var el = document.getElementById('titanium_iphone_notification_'+ self.id);
						el.getElementsByTagName('DIV')[0].style.height = "0px";
						setTimeout(function(){el.innerHTML = ''},250);
					},3000)
				}

				// show notification
				document.getElementById('titanium_iphone_notification_' + this.id).style.display = "block";
				document.getElementById('titanium_iphone_notification_' + this.id).getElementsByTagName('DIV')[0].style.height = this.height;
			};

			// set notification message
			this.setMessage = function(msg)
			{
				this.message = msg;
			};

			// initialization
			this.id = Titanium.UI.iPhoneNotificationCount++;
			this.autohide = true;
			this.visible = false;
			this.height = '60px';

			if (options)
			{
				// message
				if (options.message) this.message = options.message;

				this.backgroundColor('#333333');
				this.color('#ffffff');
			};

		};

		Titanium.UI.createNotification = function(options)
		{
			return new Titanium.UI.Notification(options);
		};

	}

	//
	// Create a Grouped View
	// id: the ID of the element
	// type: the type of grouped list.  there are 3 supported types:
	//		1. option - show a list of selectable options (1 active at a time)
	//		2. input - show a list of editable values. sub-types are: (switch, input, select, readonly)
	//      3. button - show a list of buttons (simply clickable)
	Titanium.UI.createGroupedView = function(id,type,data,callback)
	{
		var list = document.getElementById(id);

		if (!list)
		{
			alert('createGroupedView: invalid element id ' + id);
			return;
		}
		if (type != 'option' && type != 'input' && type != 'button')
		{
			alert('createGroupedView: invalid type ' + type);
			return;
		}

		//
		// row delegates for each supported type.  row delegates create structure for each type
		//
		function optionRowDelegate(data)
		{
			var image = '';
			var textPos = '';
			if (data.image)
			{
				image = ''
				textPos = 'style="position:relative;top:-4px"';
			}
			if (data.selected == true)
			{
				return ' '+ image + ' ' + data.title + '

';
			}
			return ' '+ image + ' ' + data.title + '

';
		};
		function buttonRowDelegate(data)
		{
			var image = '';
			var textPos = '';
			if (data.image)
			{
				image = ''
				textPos = 'style="position:relative;top:-4px"';

			}

			return '
 '+ image + ' ' + data.title + '
';
		};
		function inputRowDelegate(data)
		{
			var image = '';
			var textPos = ''
			if (data.image)
			{
				image = ''
				textPos = 'style="position:relative;top:-4px"';
			}
			switch (data.type)
			{
				case 'input':
				{
					return ' '+ image + ' ' + data.title + '<input id="'+data.id+'" type="text" value="'+data.value+'" />';
				}
				case 'select':
				{
					return ' '+ image + ' ' + data.title + ''+data.value+'';
				}
				case 'switch':
				{
					return '
 '+ image + '  '+data.title+'

';
				}
				case 'readonly':
				{
					return ' '+ image + ' ' + data.title + ''+data.value+'';
				}
			}
		};

		//
		// event delegates for each support type.  event delegates add input listeners and wire up any other required events
		//
		function optionEventDelegate(e,data, callback)
		{
			var classes = e.className;
			var touchReset = false;
			e.addEventListener('touchstart',function()
			{
				touchReset = false;
				var self = this;
				setTimeout(function()
				{
					if (touchReset == false)
					{
						// row selection classes
						self.className = classes + ' row_click';

						// add text effect
						self.getElementsByTagName('SPAN')[0].className = 'option_press_text';

						// add check effect if we are already active
						var selected = self.getElementsByClassName('option_selected');
						if (selected[0].style.display == 'block')
						{
							selected[0].className = 'option_press_check';
						}

					}
				},100);

			},false);
			e.addEventListener('touchmove',function()
			{
				touchReset = true;
			});

			e.addEventListener('touchend',function()
			{
				var self = this;

				setTimeout(function()
				{
					if (self.className.indexOf('row_click') != -1)
					{
						// remove selection class
						self.className = classes;

						// turn everything off
						var list = document.getElementById('group_list_' + id);
						var selectedIcons = list.getElementsByClassName('option_selected');
						for (var i=0;i<selectedIcons.length;i++)
						{
							selectedIcons[i].style.display = 'none';
						}
						var rows = list.getElementsByClassName('row');
						for (var i=0;i<rows.length;i++)
						{
							rows[i].setAttribute('selected','false');
							rows[i].getElementsByTagName('SPAN')[0].className = '';
						}

						// show check mark
						var x =  self.getElementsByClassName('option_press_check');
						if (x.length ==1) {x[0].className = 'option_selected';}
						var active = self.getElementsByClassName('option_selected');
						active[0].style.display = 'block';

						// add selected attribute
						self.setAttribute('selected','true');

						// add active text class
						self.getElementsByTagName('SPAN')[0].className = 'active';

						// execute row callback
						if (callback) callback(parseInt(self.getAttribute('row')));

					}

				},100)

			},false);

		};
		function buttonEventDelegate(e,data,callback)
		{
			var classes = e.className;
			var touchReset = false;
			e.addEventListener('touchstart',function()
			{
				touchReset = false;
				var self = this;
				setTimeout(function()
				{
					if (touchReset == false)
					{
						self.className = classes + ' row_click';
					}
				},100)
			},false);

			e.addEventListener('touchmove',function()
			{
				touchReset = true;
			});

			e.addEventListener('touchend',function()
			{
				var self = this;
				setTimeout(function()
				{
					if (self.className.indexOf('row_click') != -1)
					{
						self.className = classes;
						if (callback) callback(parseInt(self.getAttribute('row')));
					}
				},100);
			},false);
		};
		function inputEventDelegate(e,data,callback)
		{
			var el = document.getElementById(data.id);
			if (!el)return;

			switch(data.type)
			{
				case 'input':
				{
					el.onblur = function()
					{
						if (callback) callback({id:data.id,value:el.value});
					};
					break;
				}
				case 'switch':
				{
					Titanium.UI.createSwitch(data.id,data.value,function(value)
					{
						if (callback) callback({id:data.id,value:value})
					});
					break;
				}
				case 'select':
				{
					el.onclick = function()
					{
						if (callback) callback({id:data.id, value:parseInt(el.getAttribute('row'))});
					};

					break;
				}
			}
		};

		// map delegate functions
		var rowDelegate = (type=='option')?optionRowDelegate:(type=='input')?inputRowDelegate:buttonRowDelegate;
		var eventDelegate = (type=='option')?optionEventDelegate:(type=='input')?inputEventDelegate:buttonEventDelegate;

		// create basic row template
		var html = '
';
		for (var i=0;i<data.length;i++)
		{
			var classes = 'row ';
			// if row 1
			if (i==0)
			{
				classes += ' top';
			}
			// if last row
			else if (i==(data.length -1))
			{
				classes += ' bottom';
			}
			// if only one row
			if (i==(data.length -1) && i==0)
			{
				classes = 'row single_row';
			}
			html += '
';

			// now delegate to 'type' handler
			html += rowDelegate(data[i]);
			html += '
';
		}
		html += '
';
		list.innerHTML = html;

		// now call event delegates
		var rows = list.getElementsByClassName('row');
		for (var i=0;i<rows.length;i++)
		{
			eventDelegate(rows[i],data[i],callback);
		}

	};

	//
	// Create Table View
	//
	Titanium.UI.createTableView = function(id, data, callback)
	{
		var list = document.getElementById(id);
		if (!list)
		{
			alert('createTableView: invalid element id ' + id);
			return;
		}
		if (data)
		{
			var html = '';
			var count = (data.length < 9)?9:data.length;
			for (var i=0;i<count;i++)
			{
				html += "
";

				if (i < data.length)
				{
					var image = data[i].image;
					var text = data[i].title;
					var hasChild = data[i].hasChild;
					var hasDetail = data[i].hasDetail;
					var detailClass = (hasChild==true)?'arrow':(hasDetail==true)?'detail':'';
					var textPos = '';

					if (image)
					{
						textPos = 'style="position:relative;top:-2px"';
						html += '';
					}
					html += '' + text + '';
					html += '

';
				}
				html+= '
';

			}
		}
		list.innerHTML =  html;
		list.className += 'table_view_container';

		var rows = list.getElementsByClassName('table_view');
		for (var i=0;i<rows.length;i++)
		{
			if (data.length > i)
			{
				rows[i].addEventListener('touchstart',function()
				{
					this.setAttribute('reset','false');
					var self = this;
					setTimeout(function()
					{
						var reset = self.getAttribute('reset');
						if (reset == 'false')
						{
							var els = list.getElementsByClassName('table_view');
							for (var i=0;i<els.length;i++)
							{
								els[i].className = els[i].className.replace('row_click','');
								els[i].className = els[i].className.replace('highlight','');
							}
							var detail = self.getElementsByClassName('detail');
							if (detail.length !=0)
							{
								self.className += ' row_click';
							}
							else
							{
								self.className += ' row_click highlight';
							}
							var arrow = self.getElementsByClassName('arrow');
							if (arrow.length == 1)
							{
								arrow[0].className = 'arrow_touch';
							}
						}
					},140);
				},false);

				rows[i].addEventListener('touchmove',function(e)
				{
					if (this.className.indexOf('row_click')==-1)
					{
						this.setAttribute('reset','true');
					}
				},false);

				rows[i].addEventListener('touchend',function()
				{
					var self = this;
					setTimeout(function()
					{
						var reset = self.getAttribute('reset');
						if (self.className.indexOf('row_click') != -1 && reset == 'false')
						{
							if (callback) callback(parseInt(self.getAttribute('row')));
						}
						self.className = self.className.replace('row_click','');
						self.className = self.className.replace('highlight','');

						var arrow = self.getElementsByClassName('arrow_touch');
						if (arrow.length == 1)
						{
							arrow[0].className = 'arrow';
						}

					},140);
				},false);

			}
		}

	};

	// add platform class to body
	Titanium.UI.addBodyClass(Titanium.Platform.name);

	// call ready
	Titanium.UI.ready();

};


text:
#ifndef __KID_H__
#define __KID_H__

#include "animal_builder.h"

struct kid {
	char name[32];
};

void kid_init(struct kid *);

void kid_make_animal(struct kid *, struct animal_builder *builder);

#endif /* __KID_H__ */


text:
        {{ title_case($name) }}
            <tagselect :tags="{{ Laramin::model('Tag')->details() }}" nameinput="{{ $name }}" :old="{{ laramin_get_tags($id,laramin_get_active_menu()->first()) }}"></tagselect>


text:
import { PublicClientApplication } from './../../src/client/PublicClientApplication';
import { Configuration, InteractiveRequest } from './../../src/index';
import { ID_TOKEN_CLAIMS, mockAuthenticationResult, TEST_CONSTANTS } from '../utils/TestConstants';
import {
    ClientConfiguration, AuthenticationResult, AuthorizationCodeClient, RefreshTokenClient, UsernamePasswordClient,
    SilentFlowClient, ProtocolMode, Logger, LogLevel, ClientAuthError, AccountInfo
} from '@azure/msal-common';
import { CryptoProvider } from '../../src/crypto/CryptoProvider';
import { DeviceCodeRequest } from '../../src/request/DeviceCodeRequest';
import { AuthorizationCodeRequest } from '../../src/request/AuthorizationCodeRequest';
import { RefreshTokenRequest } from '../../src/request/RefreshTokenRequest';
import { AuthorizationUrlRequest } from "../../src/request/AuthorizationUrlRequest";
import { UsernamePasswordRequest } from '../../src/request/UsernamePasswordRequest';
import { SilentFlowRequest } from '../../src/request/SilentFlowRequest';
import { HttpClient } from '../../src/network/HttpClient';
import { mocked } from 'ts-jest/utils';
import http from "http";

import * as msalCommon from '@azure/msal-common';
import { fakeAuthority, setupAuthorityFactory_createDiscoveredInstance_mock, setupServerTelemetryManagerMock } from './test-fixtures';
import { getMsalCommonAutoMock } from '../utils/MockUtils';

import { NodeStorage } from '../../src/cache/NodeStorage'
import { version, name } from '../../package.json'

describe('PublicClientApplication', () => {

    const mockTelemetryManager: msalCommon.ServerTelemetryManager = setupServerTelemetryManagerMock();

    let appConfig: Configuration = {
        auth: {
            clientId: TEST_CONSTANTS.CLIENT_ID,
            authority: TEST_CONSTANTS.AUTHORITY,
        },
    };

    const expectedConfig: ClientConfiguration = {
        authOptions: {
            clientId: TEST_CONSTANTS.CLIENT_ID,
            authority: fakeAuthority,
            clientCapabilities: []
        },
    };

    beforeEach(() => {
        jest.clearAllMocks();

        mockTelemetryManager
        setupAuthorityFactory_createDiscoveredInstance_mock();
    });

    test('exports a class', () => {
        const authApp = new PublicClientApplication(appConfig);
        expect(authApp).toBeInstanceOf(PublicClientApplication);
    });

    test('acquireTokenByDeviceCode', async () => {
        const request: DeviceCodeRequest = {
            deviceCodeCallback: response => {
                console.log(response);
            },
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
        };

        const MockDeviceCodeClient2 = getMsalCommonAutoMock().DeviceCodeClient;

        jest.spyOn(msalCommon, 'DeviceCodeClient')
            .mockImplementation((conf) => new MockDeviceCodeClient2(conf));

        const fakeAuthResult = { "foo": "bar" }
        mocked(MockDeviceCodeClient2.prototype.acquireToken)
            .mockImplementation(() => Promise.resolve(fakeAuthResult as unknown as AuthenticationResult))

        const authApp = new PublicClientApplication(appConfig);
        const result = await authApp.acquireTokenByDeviceCode(request);
        expect(MockDeviceCodeClient2).toHaveBeenCalledTimes(1);
        expect(MockDeviceCodeClient2).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
        expect(result).toEqual(fakeAuthResult);
    });

    test('acquireTokenByAuthorizationCode', async () => {

        const request: AuthorizationCodeRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
        };

        const MockAuthorizationCodeClient = getMsalCommonAutoMock().AuthorizationCodeClient;

        jest.spyOn(msalCommon, 'AuthorizationCodeClient')
            .mockImplementation((config) => new MockAuthorizationCodeClient(config));

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByCode(request);

        expect(AuthorizationCodeClient).toHaveBeenCalledTimes(1);
        expect(AuthorizationCodeClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test("acquireTokenByAuthorizationCode with nonce", async () => {
        const request: AuthorizationCodeRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
            code: TEST_CONSTANTS.AUTHORIZATION_CODE
        };

        const cryptoProvider = new CryptoProvider();
        const authCodePayLoad = {
            nonce: cryptoProvider.createNewGuid(),
            code: TEST_CONSTANTS.AUTHORIZATION_CODE
        }

        const MockAuthorizationCodeClient = getMsalCommonAutoMock()
            .AuthorizationCodeClient;

        jest.spyOn(msalCommon, "AuthorizationCodeClient").mockImplementation(
            config => new MockAuthorizationCodeClient(config)
        );

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByCode(request, authCodePayLoad);

        expect(AuthorizationCodeClient).toHaveBeenCalledTimes(1);
        expect(AuthorizationCodeClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test("acquireTokenByAuthorizationCode with state validation", async () => {
        const request: AuthorizationCodeRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
            code: TEST_CONSTANTS.AUTHORIZATION_CODE
        };

        const cryptoProvider = new CryptoProvider();
        const authCodePayLoad = {
            nonce: cryptoProvider.createNewGuid(),
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
            state: cryptoProvider.createNewGuid()
        };

        const MockAuthorizationCodeClient = getMsalCommonAutoMock()
            .AuthorizationCodeClient;

        jest.spyOn(msalCommon, "AuthorizationCodeClient").mockImplementation(
            config => new MockAuthorizationCodeClient(config)
        );

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByCode(request, authCodePayLoad);

        expect(AuthorizationCodeClient).toHaveBeenCalledTimes(1);
        expect(AuthorizationCodeClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test('acquireTokenByRefreshToken', async () => {
        const request: RefreshTokenRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            refreshToken: TEST_CONSTANTS.REFRESH_TOKEN,
        };

        const mockRefreshTokenClient = getMsalCommonAutoMock().RefreshTokenClient;
        jest.spyOn(msalCommon, 'RefreshTokenClient')
            .mockImplementation((config) => new mockRefreshTokenClient(config));

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByRefreshToken(request);
        expect(RefreshTokenClient).toHaveBeenCalledTimes(1);
        expect(RefreshTokenClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test('acquireTokenSilent', async () => {
        const account: AccountInfo = {
            homeAccountId: "",
            environment: "",
            tenantId: "",
            username: "",
            localAccountId: "",
            name: "",
            idTokenClaims: ID_TOKEN_CLAIMS

        };
        const request: SilentFlowRequest = {
            account: account,
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE
        };

        const silentFlowClient = getMsalCommonAutoMock().SilentFlowClient;
        jest.spyOn(msalCommon, 'SilentFlowClient')
            .mockImplementation((config) => new silentFlowClient(config));

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenSilent(request);
        expect(SilentFlowClient).toHaveBeenCalledTimes(1);
        expect(SilentFlowClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test("acquireTokenInteractive", async () => {
        const authApp = new PublicClientApplication(appConfig);

        let redirectUri: string;

        const openBrowser = (url: string) => {
            expect(url.startsWith("https://login.microsoftonline.com")).toBe(true);
            http.get(`${redirectUri}?code=${TEST_CONSTANTS.AUTHORIZATION_CODE}`);
            return Promise.resolve();
        }
        const request: InteractiveRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            openBrowser: openBrowser
        };

        const MockAuthorizationCodeClient = getMsalCommonAutoMock().AuthorizationCodeClient;
        jest.spyOn(msalCommon, 'AuthorizationCodeClient').mockImplementation((config) => new MockAuthorizationCodeClient(config));

        jest.spyOn(MockAuthorizationCodeClient.prototype, "getAuthCodeUrl").mockImplementation((req) => {
            redirectUri = req.redirectUri;
            return Promise.resolve(TEST_CONSTANTS.AUTH_CODE_URL);
        });

        jest.spyOn(MockAuthorizationCodeClient.prototype, "acquireToken").mockImplementation((tokenRequest) => {
            expect(tokenRequest.scopes).toEqual([...TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE, ...TEST_CONSTANTS.DEFAULT_OIDC_SCOPES]);
            return Promise.resolve(mockAuthenticationResult);
        });

        const response = await authApp.acquireTokenInteractive(request);
        expect(response.idToken).toEqual(mockAuthenticationResult.idToken);
        expect(response.accessToken).toEqual(mockAuthenticationResult.accessToken);
        expect(response.account).toEqual(mockAuthenticationResult.account);
    });

    test('initializeBaseRequest passes a claims hash to acquireToken', async () => {
        const account: AccountInfo = {
            homeAccountId: "",
            environment: "",
            tenantId: "",
            username: "",
            localAccountId: "",
            name: "",
            idTokenClaims: ID_TOKEN_CLAIMS

        };
        const request: SilentFlowRequest = {
            account: account,
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            claims: TEST_CONSTANTS.CLAIMS,
        };

        const silentFlowClient = getMsalCommonAutoMock().SilentFlowClient;
        jest.spyOn(msalCommon, 'SilentFlowClient')
            .mockImplementation((config) => new silentFlowClient(config));

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenSilent(request);
        expect(silentFlowClient.prototype.acquireToken)
            .toHaveBeenCalledWith(expect.objectContaining({ requestedClaimsHash: expect.any(String) }))

        const submittedRequest = mocked(silentFlowClient.prototype.acquireToken).mock.calls[0][0];
        expect((submittedRequest as any)?.requestedClaimsHash?.length)
            .toBeGreaterThan(0);
    })

    test('create AuthorizationCode URL', async () => {
        const request: AuthorizationUrlRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
        };

        const authApp = new PublicClientApplication(appConfig);
        await authApp.getAuthCodeUrl(request);
        expect(AuthorizationCodeClient).toHaveBeenCalledTimes(1);
        expect(AuthorizationCodeClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test('acquireTokenByUsernamePassword', async () => {
        const request: UsernamePasswordRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            username: TEST_CONSTANTS.USERNAME,
            password: TEST_CONSTANTS.PASSWORD
        };

        const mockUsernamePasswordClient = getMsalCommonAutoMock().UsernamePasswordClient;
        jest.spyOn(msalCommon, 'UsernamePasswordClient')
            .mockImplementation((config) => new mockUsernamePasswordClient(config));

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByUsernamePassword(request);
        expect(UsernamePasswordClient).toHaveBeenCalledTimes(1);
        expect(UsernamePasswordClient).toHaveBeenCalledWith(
            expect.objectContaining(expectedConfig)
        );
    });

    test('acquireToken default authority', async () => {
        // No authority set in app configuration or request, should default to common authority
        const config: Configuration = {
            auth: {
                clientId: TEST_CONSTANTS.CLIENT_ID,
            },
        };

        const request: RefreshTokenRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            refreshToken: TEST_CONSTANTS.REFRESH_TOKEN,
        };

        const authorityMock = setupAuthorityFactory_createDiscoveredInstance_mock(fakeAuthority);

        const authApp = new PublicClientApplication(config);
        await authApp.acquireTokenByRefreshToken(request);
        expect(authorityMock.mock.calls[0][0]).toBe(TEST_CONSTANTS.DEFAULT_AUTHORITY);
        expect(authorityMock.mock.calls[0][1]).toBeInstanceOf(HttpClient);
        expect(authorityMock.mock.calls[0][2]).toBeInstanceOf(NodeStorage);
        expect(authorityMock.mock.calls[0][3]).toStrictEqual({
            protocolMode: ProtocolMode.AAD,
            knownAuthorities: [],
            azureRegionConfiguration: undefined,
            cloudDiscoveryMetadata: "",
            authorityMetadata: "",
            skipAuthorityMetadataCache: false
        });
        expect(authorityMock.mock.calls[0][4]).toBeInstanceOf(Logger);
        expect(RefreshTokenClient).toHaveBeenCalledTimes(1);
        expect(RefreshTokenClient).toHaveBeenCalledWith(expect.objectContaining(expectedConfig));
    });

    test('authority overridden by acquire token request parameters', async () => {
        // Authority set on client app, but should be overridden by authority passed in request
        const request: RefreshTokenRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            refreshToken: TEST_CONSTANTS.REFRESH_TOKEN,
            authority: TEST_CONSTANTS.ALTERNATE_AUTHORITY,
        };

        const authorityMock = setupAuthorityFactory_createDiscoveredInstance_mock()

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByRefreshToken(request);
        expect(authorityMock.mock.calls[0][0]).toBe(TEST_CONSTANTS.ALTERNATE_AUTHORITY);
        expect(authorityMock.mock.calls[0][1]).toBeInstanceOf(HttpClient);
        expect(authorityMock.mock.calls[0][2]).toBeInstanceOf(NodeStorage);
        expect(authorityMock.mock.calls[0][3]).toStrictEqual({
            protocolMode: ProtocolMode.AAD,
            knownAuthorities: [],
            azureRegionConfiguration: undefined,
            cloudDiscoveryMetadata: "",
            authorityMetadata: "",
            skipAuthorityMetadataCache: false
        });
        expect(authorityMock.mock.calls[0][4]).toBeInstanceOf(Logger);
        expect(RefreshTokenClient).toHaveBeenCalledTimes(1);
        expect(RefreshTokenClient).toHaveBeenCalledWith(expect.objectContaining(expectedConfig));
    });

    test('acquireToken when azureCloudOptions are set', async () => {
        // No authority set in app configuration or request, should default to common authority
        const config: Configuration = {
            auth: {
                clientId: TEST_CONSTANTS.CLIENT_ID,
                azureCloudOptions: {
                    azureCloudInstance: msalCommon.AzureCloudInstance.AzureUsGovernment,
                    tenant: ""
                }
            },
        };

        const request: RefreshTokenRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            refreshToken: TEST_CONSTANTS.REFRESH_TOKEN,
        };

        const authorityMock = setupAuthorityFactory_createDiscoveredInstance_mock(fakeAuthority);

        const authApp = new PublicClientApplication(config);
        await authApp.acquireTokenByRefreshToken(request);
        expect(authorityMock.mock.calls[0][0]).toBe(TEST_CONSTANTS.USGOV_AUTHORITY);
        expect(authorityMock.mock.calls[0][1]).toBeInstanceOf(HttpClient);
        expect(authorityMock.mock.calls[0][2]).toBeInstanceOf(NodeStorage);
        expect(authorityMock.mock.calls[0][3]).toStrictEqual({
            protocolMode: ProtocolMode.AAD,
            knownAuthorities: [],
            azureRegionConfiguration: undefined,
            cloudDiscoveryMetadata: "",
            authorityMetadata: "",
            skipAuthorityMetadataCache: false
        });
        expect(authorityMock.mock.calls[0][4]).toBeInstanceOf(Logger);
        expect(RefreshTokenClient).toHaveBeenCalledTimes(1);
        expect(RefreshTokenClient).toHaveBeenCalledWith(expect.objectContaining(expectedConfig));
    });

    test('acquireToken when azureCloudOptions and authority are set', async () => {
        // No authority set in app configuration or request, should default to common authority
        const config: Configuration = {
            auth: {
                clientId: TEST_CONSTANTS.CLIENT_ID,
                authority: TEST_CONSTANTS.ALTERNATE_AUTHORITY,
                azureCloudOptions: {
                    azureCloudInstance: msalCommon.AzureCloudInstance.AzureUsGovernment,
                    tenant: ""
                }
            },
        };

        const request: RefreshTokenRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            refreshToken: TEST_CONSTANTS.REFRESH_TOKEN,
        };

        const authorityMock = setupAuthorityFactory_createDiscoveredInstance_mock(fakeAuthority);

        const authApp = new PublicClientApplication(config);
        await authApp.acquireTokenByRefreshToken(request);
        expect(authorityMock.mock.calls[0][0]).toBe(TEST_CONSTANTS.USGOV_AUTHORITY);
        expect(authorityMock.mock.calls[0][1]).toBeInstanceOf(HttpClient);
        expect(authorityMock.mock.calls[0][2]).toBeInstanceOf(NodeStorage);
        expect(authorityMock.mock.calls[0][3]).toStrictEqual({
            protocolMode: ProtocolMode.AAD,
            knownAuthorities: [],
            azureRegionConfiguration: undefined,
            cloudDiscoveryMetadata: "",
            authorityMetadata: "",
            skipAuthorityMetadataCache: false
        });
        expect(authorityMock.mock.calls[0][4]).toBeInstanceOf(Logger);
        expect(RefreshTokenClient).toHaveBeenCalledTimes(1);
        expect(RefreshTokenClient).toHaveBeenCalledWith(expect.objectContaining(expectedConfig));
    });

    test("getLogger and setLogger", async () => {
        const authApp = new PublicClientApplication(appConfig);
        const logger = new Logger({
            loggerCallback: (level, message, containsPii) => {
                expect(message).toContain("Message");
                expect(message).toContain(LogLevel.Info);

                expect(level).toEqual(LogLevel.Info);
                expect(containsPii).toEqual(false);
            },
            piiLoggingEnabled: false
        }, name, version);

        authApp.setLogger(logger);

        expect(authApp.getLogger()).toEqual(logger);

        authApp.getLogger().info("Message");
    });

    test("should throw an error if state is not provided", async () => {
        const cryptoProvider = new CryptoProvider();
        const request: AuthorizationCodeRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
            correlationId: "test-correlationId",
            state: ""
        };

        const authCodePayLoad = {
            nonce: cryptoProvider.createNewGuid(),
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
            state: cryptoProvider.createNewGuid()
        };

        const MockAuthorizationCodeClient = getMsalCommonAutoMock()
            .AuthorizationCodeClient;

        jest.spyOn(msalCommon, "AuthorizationCodeClient").mockImplementation(
            config => new MockAuthorizationCodeClient(config)
        );

        const mockInfo = jest.fn();
        jest.mock("@azure/msal-common", () => {
            return {
                getLogger: () => ({
                    info: mockInfo
                })
            };
        });

        const authApp = new PublicClientApplication(appConfig);
        await authApp.acquireTokenByCode(request, authCodePayLoad);

        try {
            await authApp.acquireTokenByCode(request, authCodePayLoad);
        } catch (e) {
            expect(mockInfo).toBeCalledWith("acquireTokenByCode called");
            expect(mockInfo).toHaveBeenCalledWith(
                "acquireTokenByCode - validating state"
            );
            expect(authApp.acquireTokenByCode).toThrow(
                "State not found. Please verify that the request originated from msal."
            );
        }
    });

    test("should throw error when state and cachedSate don't match", async () => {
        const cryptoProvider = new CryptoProvider();
        const request: AuthorizationCodeRequest = {
            scopes: TEST_CONSTANTS.DEFAULT_GRAPH_SCOPE,
            redirectUri: TEST_CONSTANTS.REDIRECT_URI,
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
            correlationId: "test-correlationId",
            state: cryptoProvider.createNewGuid()
        };

        const authCodePayLoad = {
            nonce: cryptoProvider.createNewGuid(),
            code: TEST_CONSTANTS.AUTHORIZATION_CODE,
            state: "ed09b151-1b68-4c2c-8e95-y8dcfffffggh"
        };

        const MockAuthorizationCodeClient = getMsalCommonAutoMock()
            .AuthorizationCodeClient;

        jest.spyOn(msalCommon, "AuthorizationCodeClient").mockImplementation(
            config => new MockAuthorizationCodeClient(config)
        );

        const mockInfo = jest.fn();
        jest.mock("@azure/msal-common", () => {
            return {
                getLogger: () => ({
                    info: mockInfo
                })
            };
        });

        const authApp = new PublicClientApplication(appConfig);

        await expect(authApp.acquireTokenByCode(request, authCodePayLoad))
            .rejects.toMatchObject(ClientAuthError.createStateMismatchError());
    });

});


text:
The MIT License (MIT)

Copyright (c) 2014-2015 David McCuskey

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--]]

--====================================================================--
--== DMC Corona Widgets : Shape Button
--====================================================================--

-- Semantic Versioning Specification: http://semver.org/

local VERSION = "0.1.0"

--====================================================================--
--== DMC Widgets Setup
--====================================================================--

local dmc_widget_data, dmc_widget_func
dmc_widget_data = _G.__dmc_widget
dmc_widget_func = dmc_widget_data.func

--====================================================================--
--== DMC Widgets : Button Shape View
--====================================================================--

--====================================================================--
--== Imports

local Objects = require 'dmc_objects'
local Utils = require 'dmc_utils'

--== Components

local BaseView = require( dmc_widget_func.find( 'widget_button.view_base' ) )

--====================================================================--
--== Setup, Constants

-- setup some aliases to make code cleaner
local newClass = Objects.newClass

--== these are the Corona shapes which can be a button view
local TYPE_RECT = 'rect'
local TYPE_ROUNDED_RECT = 'roundedRect'
local TYPE_CIRCLE = 'circle'
local TYPE_POLYGON = 'polygon'

local VALID_SHAPES = {
	TYPE_RECT,
	TYPE_ROUNDED_RECT,
	TYPE_CIRCLE,
	TYPE_POLYGON,
}

local LOCAL_DEBUG = true

--====================================================================--
--== Support Functions

-- ensure we have a shape-type we know about
--
-- @param name string name of shape type, one of types above
--
local function validateShapeType( name )
	if not Utils.propertyIn( VALID_SHAPES, name ) then
		error( "newButton: unknown shape type: " .. tostring( name ) )
	end
	return name
end

-- build parameters for this shape
-- get defaults and layer in specific values
--
local function createShapeParams( v_type, v_name, params )
	-- print( "createShapeParams", v_type, v_name, params )
	local p
	local v_p = params[ v_name ] -- specific view parameters

	if v_type == TYPE_RECT then
		p = {
			width=params.width,
			height=params.height,
			fill_color=params.fill_color,
			stroke_width=params.stroke_width,
			stroke_color=params.stroke_color
		}

	elseif v_type == TYPE_ROUNDED_RECT then
		p = {
			width=params.width,
			height=params.height,
			fill_color=params.fill_color,
			stroke_width=params.stroke_width,
			stroke_color=params.stroke_color,
			corner_radius=params.corner_radius
		}

	elseif v_type == TYPE_CIRCLE then
		p = {
			width=params.width,
			height=params.height,
			fill_color=params.fill_color,
			stroke_width=params.stroke_width,
			stroke_color=params.stroke_color
		}

	elseif v_type == TYPE_POLYGON then
		p = {
			width=params.width,
			height=params.height,
			fill_color=params.fill_color,
			stroke_width=params.stroke_width,
			stroke_color=params.stroke_color
		}

	else -- default view
		error( "newButton: unknown shape type: " .. tostring( v_type ) )

	end

	-- layer in view specific values
	if v_p then
		p.width = v_p.width == nil and p.width or v_p.width
		p.height = v_p.height == nil and p.height or v_p.height
		p.fill_color = v_p.fill_color == nil and p.fill_color or v_p.fill_color
		p.stroke_color = v_p.stroke_color == nil and p.stroke_color or v_p.stroke_color
		p.stroke_width = v_p.stroke_width == nil and p.stroke_width or v_p.stroke_width
		p.corner_radius = v_p.corner_radius == nil and p.corner_radius or v_p.corner_radius
	end

	return p
end

-- create the actual corona display object
--
local function createShape( v_type, v_params )
	-- print( "createShape", v_type, v_params )

	if v_type == TYPE_RECT then
		return display.newRect( 0, 0, v_params.width, v_params.height )

	elseif v_type == TYPE_ROUNDED_RECT then
		return display.newRoundedRect( 0, 0, v_params.width, v_params.height, v_params.corner_radius )

	elseif v_type == TYPE_CIRCLE then
		-- TODO
		return display.newCircle( 0, 0, v_params.width, v_params.height )

	elseif v_type == TYPE_POLYGON then
		-- TODO
		return display.newPolygon( 0, 0, v_params.width, v_params.height )

	else -- default view
		error( "newButton: unknown shape type: " .. tostring( name ) )

	end
end

--====================================================================--
--== Button Shape View Class
--====================================================================--

local ShapeView = newClass( BaseView, {name="Shape View"} )

ShapeView.TYPE = 'shape'

--======================================================--
-- Start: Setup DMC Objects

function ShapeView:__init__( params )
	-- print( "ShapeView:__init__" )
	params = params or {}
	self:superCall( '__init__', params )
	--==--

	--== Sanity Check ==--

	if self.is_class then return end

	assert( type(params.shape)=='string', "expected string-type 'shape' parameter" )

	--== Create Properties ==--

	self._view_type = validateShapeType( params.shape )
	self._view_params = createShapeParams( self._view_type, self._view_name, params )

	--== Display Groups ==--
	--== Object References ==--
end

-- _createView()
--
function ShapeView:__createView__()
	-- print( "ShapeView:__createView__" )
	self:superCall( '__createView__' )
	--==--

	local v_params = self._view_params
	local o, tmp   -- object, temp

	--== create background

	o = createShape( self._view_type, v_params )
	o.x, o.y = 0, 0
	o.anchorX, o.anchorY = 0.5, 0.5
	tmp = v_params.fill_color
	if tmp and tmp.type=='gradient' then
		o:setFillColor( tmp )
	elseif tmp then
		o:setFillColor( unpack( tmp ) )
	end
	o.strokeWidth = v_params.stroke_width
	tmp = v_params.stroke_color
	if tmp and tmp.type=='gradient' then
		o:setStrokeColor( tmp )
	elseif tmp then
		o:setStrokeColor( unpack( tmp ) )
	end

	self.view:insert( 1, o ) -- insert over background
	self._view = o

end

function ShapeView:__undoCreateView__()
	-- print( "ShapeView:__undoCreateView__" )
	local o

	o = self._view
	o:removeSelf()
	self._view = nil

	--==--
	self:superCall( '__undoCreateView__' )
end

-- END: Setup DMC Objects
--======================================================--

--====================================================================--
--== Public Methods

-- none

--====================================================================--
--== Private Methods

-- none

--====================================================================--
--== Event Handlers

-- none

return ShapeView


text:
#ifndef BERRYSAVEABLESLIST_H_
#define BERRYSAVEABLESLIST_H_

#include "berryISaveablesLifecycleListener.h"

#include "berryISaveablesSource.h"
#include "berryIWorkbenchWindow.h"
#include "berryIWorkbenchPart.h"

#include "berryWorkbenchPart.h"

#include <map>
#include <set>
#include <list>
#include <vector>

namespace berry
{

/**
 * The model manager maintains a list of open saveable models.
 *
 * @see Saveable
 * @see ISaveablesSource
 */
class SaveablesList: public ISaveablesLifecycleListener
{

public:

  berryObjectMacro(SaveablesList)

private:

  ISaveablesLifecycleListener::Events events;

  // event source (mostly ISaveablesSource) -> Set of Saveable
  QHash<Object*, Saveable::Set> modelMap;

  // reference counting map, Saveable -> Integer
  QHash<Saveable::Pointer, int> modelRefCounts;

  QSet<ISaveablesSource::Pointer> nonPartSources;

  // returns true if this model has not yet been in getModels()
  bool AddModel(Object::Pointer source, Saveable::Pointer model);

  /**
   * returns true if the given key was added for the first time
   *
   * @param referenceMap
   * @param key
   * @return true if the ref count of the given key is now 1
   */
  bool IncrementRefCount(QHash<Saveable::Pointer, int>& referenceMap,
      Saveable::Pointer key);

  /**
   * returns true if the given key has been removed
   *
   * @param referenceMap
   * @param key
   * @return true if the ref count of the given key was 1
   */
  bool DecrementRefCount(QHash<Saveable::Pointer, int>& referenceMap,
      Saveable::Pointer key);

  // returns true if this model was removed from getModels();
  bool RemoveModel(Object::Pointer source, Saveable::Pointer model);

  void LogWarning(const QString& message, Object::Pointer source,
      Saveable::Pointer model);

  /**
   * Updates the set of non-part saveables sources.
   * @param source
   */
  void UpdateNonPartSource(ISaveablesSource::Pointer source);

  /**
   * @param source
   * @param modelArray
   */
  void RemoveModels(Object::Pointer source,
      const QList<Saveable::Pointer>& modelArray);

  /**
   * @param source
   * @param modelArray
   */
  void AddModels(Object::Pointer source,
      const QList<Saveable::Pointer>& modelArray);

  /**
   * @param event
   */
  void FireModelLifecycleEvent(SaveablesLifecycleEvent::Pointer event);

  /**
   * @param window
   * @param modelsClosing
   * @param canCancel
   * @return true if the user canceled
   */
  bool
      PromptForSavingIfNecessary(IWorkbenchWindow::Pointer window,
          const Saveable::Set& modelsClosing,
          const QHash<Saveable::Pointer, int>& modelsDecrementing,
          bool canCancel);

  /**
   * @param modelsClosing
   * @param modelsDecrementing
   */
  void FillModelsClosing(Saveable::Set& modelsClosing,
      const QHash<Saveable::Pointer, int>& modelsDecrementing);

  /**
   * Returns the saveable models provided by the given part. If the part does
   * not provide any models, a default model is returned representing the
   * part.
   *
   * @param part
   *            the workbench part
   * @return the saveable models
   */
  QList<Saveable::Pointer> GetSaveables(IWorkbenchPart::Pointer part);

  //TODO SaveablesList ListSelectionDialog
  //  class MyListSelectionDialog extends
  //     ListSelectionDialog {
  //   private final boolean canCancel;
  //   private Button checkbox;
  //   private boolean dontPromptSelection;
  //   private boolean stillOpenElsewhere;
  //
  //   private MyListSelectionDialog(Shell shell, Object input,
  //       IStructuredContentProvider contentprovider,
  //       ILabelProvider labelProvider, String message, boolean canCancel, boolean stillOpenElsewhere) {
  //     super(shell, input, contentprovider, labelProvider, message);
  //     this.canCancel = canCancel;
  //     this.stillOpenElsewhere = stillOpenElsewhere;
  //     if (!canCancel) {
  //       int shellStyle = getShellStyle();
  //       shellStyle &= ~SWT.CLOSE;
  //       setShellStyle(shellStyle);
  //     }
  //   }
  //
  //   /**
  //    * @return
  //    */
  //   public boolean getDontPromptSelection() {
  //     return dontPromptSelection;
  //   }
  //
  //   protected void createButtonsForButtonBar(Composite parent) {
  //     createButton(parent, IDialogConstants.OK_ID,
  //         IDialogConstants.OK_LABEL, true);
  //     if (canCancel) {
  //       createButton(parent, IDialogConstants.CANCEL_ID,
  //           IDialogConstants.CANCEL_LABEL, false);
  //     }
  //   }
  //
  //   protected Control createDialogArea(Composite parent) {
  //      Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
  //
  //      if (stillOpenElsewhere) {
  //        Composite checkboxComposite = new Composite(dialogAreaComposite, SWT.NONE);
  //        checkboxComposite.setLayout(new GridLayout(2, false));
  //
  //        checkbox = new Button(checkboxComposite, SWT.CHECK);
  //        checkbox.addSelectionListener(new SelectionAdapter() {
  //         public void widgetSelected(SelectionEvent e) {
  //           dontPromptSelection = checkbox.getSelection();
  //         }
  //        });
  //        GridData gd = new GridData();
  //        gd.horizontalAlignment = SWT.BEGINNING;
  //        checkbox.setLayoutData(gd);
  //
  //        Label label = new Label(checkboxComposite, SWT.NONE);
  //        label.setText(WorkbenchMessages.EditorManager_closeWithoutPromptingOption);
  //        gd = new GridData();
  //        gd.grabExcessHorizontalSpace = true;
  //        gd.horizontalAlignment = SWT.BEGINNING;
  //      }
  //
  //      return dialogAreaComposite;
  //   }
  // }

public:

  struct PostCloseInfo : public Object
  {
    berryObjectMacro(PostCloseInfo);

    QList<SmartPointer<WorkbenchPart> > partsClosing;

    QHash<Saveable::Pointer, int> modelsDecrementing;

    Saveable::Set modelsClosing;

  private:
    PostCloseInfo() {}

    friend class SaveablesList;
  };

  /**
   * Returns the list of open models managed by this model manager.
   *
   * @return a list of models
   */
  Saveable::Set GetOpenModels();

  /**
   * This implementation of handleModelLifecycleEvent must be called by
   * implementers of ISaveablesSource whenever the list of models of the model
   * source changes, or when the dirty state of models changes. The
   * ISaveablesSource instance must be passed as the source of the event
   * object.
   *

   * This method may also be called by objects that hold on to models but are
   * not workbench parts. In this case, the event source must be set to an
   * object that is not an instanceof IWorkbenchPart.
   *

   *

   * Corresponding open and close events must originate from the same
   * (identical) event source.
   *

   *

   * This method must be called on the UI thread.
   *

   */
  void HandleLifecycleEvent(const SaveablesLifecycleEvent::Pointer& event) override;

  /**
   * Adds the given listener to the list of listeners. Has no effect if the
   * same (identical) listener has already been added. The listener will be
   * notified about changes to the models managed by this model manager. Event
   * types include:

   * POST_OPEN when models were added to the list of models

   * POST_CLOSE when models were removed from the list of models

   * DIRTY_CHANGED when the dirty state of models changed
   *

   * Listeners should ignore all other event types, including PRE_CLOSE. There
   * is no guarantee that listeners are notified before models are closed.
   *
   * @param listener
   */
  void AddModelLifecycleListener(ISaveablesLifecycleListener* listener);

  /**
   * Removes the given listener from the list of listeners. Has no effect if
   * the given listener is not contained in the list.
   *
   * @param listener
   */
  void RemoveModelLifecycleListener(ISaveablesLifecycleListener* listener);

  /**
   * @param partsToClose
   * @param save
   * @param window
   * @return the post close info to be passed to postClose
   */
  PostCloseInfo::Pointer PreCloseParts(
      const QList<SmartPointer<IWorkbenchPart> >& partsToClose, bool save,
      IWorkbenchWindow::Pointer window);

  /**
   * Prompt the user to save the given saveables.
   * @param modelsToSave the saveables to be saved
   * @param shellProvider the provider used to obtain a shell in prompting is
   *            required. Clients can use a workbench window for this.
   * @param runnableContext a runnable context that will be used to provide a
   *            progress monitor while the save is taking place. Clients can
   *            use a workbench window for this.
   * @param canCancel whether the operation can be canceled
   * @param stillOpenElsewhere whether the models are referenced by open parts
   * @return true if the user canceled
   */
  bool PromptForSaving(const QList<Saveable::Pointer>& modelsToSave,
  /*final IShellProvider shellProvider, IRunnableContext runnableContext,*/
  bool canCancel, bool stillOpenElsewhere);

  /**
   * Save the given models.
   * @param finalModels the list of models to be saved
   * @param shellProvider the provider used to obtain a shell in prompting is
   *            required. Clients can use a workbench window for this.
   * @param runnableContext a runnable context that will be used to provide a
   *            progress monitor while the save is taking place. Clients can
   *            use a workbench window for this.
   * @return true if the operation was canceled
   */
  bool SaveModels(const QList<Saveable::Pointer>& finalModels
  /*final IShellProvider shellProvider, IRunnableContext runnableContext*/);

  /**
   * @param postCloseInfoObject
   */
  void PostClose(PostCloseInfo::Pointer postCloseInfoObject);

  /**
   * @param actualPart
   */
  void PostOpen(IWorkbenchPart::Pointer part);

  /**
   * @param actualPart
   */
  void DirtyChanged(IWorkbenchPart::Pointer part);

  /**
   * For testing purposes. Not to be called by clients.
   *
   * @param model
   * @return
   */
  QList<Object::Pointer> TestGetSourcesForModel(Saveable::Pointer model);

  /**
   * @return a list of ISaveablesSource objects registered with this saveables
   *         list which are not workbench parts.
   */
  QList<ISaveablesSource::Pointer> GetNonPartSources();

  /**
   * @param model
   */
  QList<IWorkbenchPart::Pointer> GetPartsForSaveable(
      Saveable::Pointer model);

};

}

#endif /* BERRYSAVEABLESLIST_H_ */


text:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="welcome">(ar) Welcome  %s!</string>
</resources>


text:
namespace autofill {
namespace i18ninput {

namespace {

const size_t kNumberOfAddressLinesUS = 6;

}  // namespace

TEST(AutofillDialogI18nInput, USShippingAddress) {
  DetailInputs inputs;
  std::string language_code;
  BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "US", &inputs,
                     &language_code);

  ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
  EXPECT_EQ(NAME_FULL, inputs[0].type);
  EXPECT_EQ(ADDRESS_HOME_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
  EXPECT_EQ("en", language_code);
}

TEST(AutofillDialogI18nInput, USBillingAddress) {
  DetailInputs inputs;
  BuildAddressInputs(common::ADDRESS_TYPE_BILLING, "US", &inputs, NULL);

  ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
  EXPECT_EQ(NAME_BILLING_FULL, inputs[0].type);
  EXPECT_EQ(ADDRESS_BILLING_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
}

TEST(AutofillDialogI18nInput, USCityStateAndZipCodeShareInputRow) {
  DetailInputs inputs;
  BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "US", &inputs, NULL);
  ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());

  int input_index = 2;

  // Inputs before or after [ City ] [ State ] [ Zip ] should be on other lines.
  EXPECT_NE(inputs[input_index - 1].length, DetailInput::SHORT);

  const DetailInput& city = inputs[input_index++];
  EXPECT_EQ(ADDRESS_HOME_CITY, city.type);
  EXPECT_EQ(city.length, DetailInput::SHORT);

  const DetailInput& state = inputs[input_index++];
  EXPECT_EQ(ADDRESS_HOME_STATE, state.type);
  EXPECT_EQ(state.length, DetailInput::SHORT);

  const DetailInput& zip = inputs[input_index++];
  EXPECT_EQ(ADDRESS_HOME_ZIP, zip.type);
  EXPECT_EQ(zip.length, DetailInput::SHORT);

  EXPECT_NE(inputs[input_index].length, DetailInput::SHORT);
}

TEST(AutofillDialogI18nInput, IvoryCoastNoStreetLine2) {
  DetailInputs inputs;
  std::string language_code;
  BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "CI", &inputs,
                     &language_code);
  for (size_t i = 0; i < inputs.size(); ++i) {
    EXPECT_NE(ADDRESS_HOME_LINE2, inputs[i].type);
  }
  EXPECT_EQ("fr", language_code);
}

}  // namespace i18ninput
}  // namespace autofill


text:
package org.emergent.bzr4j.commandline.syntax;

import org.emergent.bzr4j.commandline.commands.options.KeywordOption;
import org.emergent.bzr4j.commandline.commands.options.Option;

/**
 * @author Guillermo Gonzalez
 *
 */
public interface ILsOptions
{

    public final static String COMMAND = "xmlls"; //$NON-NLS-N$

    /**
     * Print paths relative to the root of the branch.
     */
    public static final Option FROM_ROOT = new Option( "--from-root" ); //$NON-NLS-N$

    /**
     * Print ignored files.
     */
    public static final Option IGNORED = new Option( "--ignored" ); //$NON-NLS-N$

    /**
     * List entries of a particular kind: file, directory, symlink.
     */
    public static final KeywordOption KIND = new KeywordOption( "--kind", "ARG" ); //$NON-NLS-N$

    /**
     * Print versioned files.
     */
    public static final Option VERSIONED = new Option( "--versioned" ); //$NON-NLS-N$

    /**
     * Print unknown files.
     */
    public static final Option UNKNOWN = new Option( "--unknown" ); //$NON-NLS-N$

    /**
     * Don't recurse into subdirectories.
     */
    public static final Option NON_RECURSIVE = new Option( "--non-recursive" ); //$NON-NLS-N$

    /**
     * See "help revisionspec" for details.
     */
    public static final KeywordOption REVISION = new KeywordOption( "--revision", "ARG" );
            //$NON-NLS-N$

    public final static String HELP = "List files in a tree.\\n    "; //$NON-NLS-N$
}


text:
package com.wang.hellounity.openglcsdndemo;

import android.content.res.AssetManager;

/**
 * Created by sj on 16/12/23.
 */
public class GLSurfaceImpl {
    static {
        System.loadLibrary("visionin");
    }

    public static native void initAsset(AssetManager am);

    public static native void onSurfaceCreated();

    public static native void onSurfaceChanged(int width, int height);

    public static native void onDrawFrame();

}