text:
<repo_name>gracemorgan/PHP-and-HTML-<file_sep>/query_attr.php

<title> PHP SQL Example </title>

 Query

<form action="" method="post">
	Which table to query: <input type="text" name="table" />

	Which attributes to query (seperated by,): <input type="text" name="attribute"/>

	<input type="submit" />
</form>

<?php
	$server = "upsql";
	$sqlUsername = "sqlgkm5110";
	$sqlPassword = "<PASSWORD>";
	$databaseName = "gkm5110";

	$connectionInfo = array('Database'=>$databaseName, 'UID'=>$sqlUsername, 'PWD'=>$<PASSWORD>, 'Encrypt'=>'0', 'ReturnDatesAsStrings'=>true );
	$connection = sqlsrv_connect( $server, $connectionInfo )
		or die("ERROR: database parameters are not correct");
		if (!empty($_POST['table'])) {
		// get the table name
		$table = $_POST['table'];
		if (!empty($_POST['attribute'])) {
			$attribute=$_POST ['attribute'];
			$query = "SELECT $attribute FROM $table";}
		else {
			$query= "SELECT * FROM $table";}

		// print the query
		echo "Query: ".$query."
";

		// Execute SQL query
		$result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch rows in the table
		while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) {
			echo "
\n";
			foreach ($row as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}

		echo "
";
	}

	// close the connection with database
	sqlsrv_close( $connection);
?>

<file_sep>/AdoptionHistory.php
<?php
	//include information required to access database
	require 'authentication.php';

	//start a session
	session_start();
	$errorMessage = 'Enter Adoption History';

	//still logged in?
	if (!isset($_SESSION['db_is_logged_in'])
		|| $_SESSION['db_is_logged_in'] != true) {
		//not logged in, move to login page
		header('Location: AdoptaPetLogin.php');
		exit;
	} else {

		//logged in
		// Prepare query
		if(isset ($_POST['Adoption_History'])) {
			$table = "Adoption_History";
			$petname = $_POST['petName'];
			$date = $_POST ['date'];
			$adoptee= $_POST ['adoptee'];
			$adopter=$_POST ['adopter'];
			$location=$_POST['adoptionLocation'];
			$petid=$_POST['petid'];
			$query = "INSERT INTO $table VALUES ('$petname', '$date','$adoptee','$adopter','$location','$petid')";

		// Execute query
		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// close the connection
		sqlsrv_close($connection);
	}}
?>
<!DOCTYPE html>

<title>Enter Adoption History</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

		  <?php include 'navbar.php'; ?>

Adopt a Pet Enter Adoption History

		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

		 <?php echo $errorMessage ?>

		<form action="" method="post" name="frmLogin" id="frmLogin">

		   Pet Name
		   <input name="petName" type="text" id="petName">

		   Adoption Date
		   <input name="date" type="text" id="date">

		   Adoptee
		   <input name="adoptee" type="text" id="adoptee">

		   Adopter
		   <input name="adopter" type="text" id="adopter">

		   Animal Type
		   <input name="animaltype" type="text" id="animaltype">

		   Pet ID
		   <input name="petid" type="text" id="petid">

		   <input name="btnLogin" type="submit" id="btnLogin" value="Submit">

		</form>

<file_sep>/UserSignup.php
<?php

	//include database information and user information
	require 'authentication.php';

	//never forget to start the session
	session_start();
	$errorMessage = 'Create a user account';

	//are user ID and Password provided?
	if (isset($_POST['txtUserId']) && isset($_POST['txtPassword']) &&
		isset($_POST['retxtPassword'])) {

		//get userID and Password
		$loginUserId = $_POST['txtUserId'];
		$loginPassword = $_POST['txtPassword'];
		$reLoginPassword = $_POST['retxtPassword'];
		$firstName = $_POST['firstName'];
		$lastName = $_POST['lastName'];
		$email = $_POST['email'];
		$background = $_POST ['backgroundCheck'];
		$zip = $_POST['zipCode'];
		$phone = $_POST ['phone'];

		if ($loginPassword == $reLoginPassword) {

		//connect to the database
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");

		//table to store username and password
		$userTable = "user_table";

		$ps = md5($loginPassword);

		//table for user profile
		$userTable = "user_table";

		// Formulate the SQL statment to find the user
		$query = "INSERT INTO $userTable VALUES ('$firstName','$lastName', '$loginUserId', '$ps', '$background','$email', '$phone', '$zip')";

		// Execute the query
		$query_result = sqlsrv_query($connection, $query)
			or die( "SQL Query ERROR. User can not be created.");

		// Go to the login page
		header('Location: AdoptaPetLogin.php');
		exit;
		} else {
		$errorMessage = "Passwords do not match";
		}
	}
?>

<!DOCTYPE html>

<title>User Signup</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt a Pet Signup

		<title>Adopt a Pet User Signup</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

		 <?php echo $errorMessage ?>

		<form action="" method="post" name="frmLogin" id="frmLogin">

		   Select User ID *
		   <input name="txtUserId" type="text" id="txtUserId">

		   Type Password *
		   <input name="txtPassword" type="<PASSWORD>" id="txtPassword">

		   Retype Password *
		   <input name="retxtPassword" type="<PASSWORD>" id="retxtPassword">

		   First Name
		   <input name="firstName" type="text" id="firstName">

		   Last Name
		   <input name="lastName" type="text" id="lastName">

		   Email Address
		   <input name="email" type="text" id="email">

		   Background Check
		   <input name="backgroundCheck" type="text" id="backgroundCheck">

		   Phone Number
		   <input name="phone" type="text" id="phone">

		   Zip Code
		   <input name="zipCode" type="text" id="zipCode">

		   <input name="btnLogin" type="submit" id="btnLogin" value="Sign In">

		</form>

<file_sep>/SearchPets.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>

<title>Search Adoptable Pets</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt a Pet Search Pets

You must be logged in to search adoptable pets.

		If you do not have an account, please sign up for an account here before searching pets.

		Search all adoptable pets here.

		Search adoptable pets by a keyword here.

<file_sep>/lotterygame.php

 Lottery Game

<file_sep>/arraytable.php
<?php
	$color= array("red","yellow","blue");
	echo"
";
	echo"
";
	echo"id	";
	echo"Color	";
	echo"
";
	for($i=0;$i<sizeof($color);$i++){
		echo"
";
		echo"$i	";
		echo"$color[$i]	";
		echo "
";
	}
	echo"
";<file_sep>/AdoptablePets.php
<!DOCTYPE html>

<title>All Adoptable Pets</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

		  <?php include 'navbar.php'; ?>
		  <?php require 'authentication.php';?>

Adopt a Pet All Pets

  <?php

		// connect to the server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");

		// prepare SQL query

		$query = "SELECT * FROM PET";

		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";

		// close the connection with database

		sqlsrv_close($connection);

	?>

 <form method="post">

 Search Pet ID to learn adoption history

		<input type="text" name="petid" />

		<input type="submit" value="Search"/>
		</form>

	<?php

		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
			if (!empty($_POST['petid'])){
				$petid=$_POST['petid'];

		// prepare SQL query
		$query = "SELECT * FROM ADOPTION_HISTORY WHERE PetID=$petid";
		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";
			}
		// close the connection with database
		sqlsrv_close($connection);
	?>

 <form method="post">

 Search Program ID to get contact information to adopt

		<input type="text" name="keyword" />

		<input type="submit" value="Search"/>
		</form>

	<?php

		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
			if (!empty($_POST['keyword'])){
				$pid=$_POST['keyword'];

		// prepare SQL query
		$query = "SELECT * FROM ADOPTION_PROGRAM WHERE ProgramID=$pid";
		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";
			}
		// close the connection with database
		sqlsrv_close($connection);
	?>

Fluffy

Charlie

        <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxITEhUSExIVFRUXFRUVFRcVFRUVFRYVFRUWFxUXFRUYHSggGBolGxUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGhAQGi0lHyUtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIALcBEwMBIg<KEY>CiKOK4SuEphKAUh0pSmSuArg0SArspkrgKAaJAnymtScuOGypWKJpUgcmUWxXJIT3KFSmm47BdNBw4R+KfoHyw9ka6k4EbhIJXFrkdST4GlcTiE1AIlwuXSoXFAInLoCa1SgIgsaQmpzimhccOAXHpyYVxxG0FdIwpogQoqgxlBgW2V12TB+X0lCTJEAeqsLmnt6/wIDpiR9fUdlyDQ6oJ52M/JVZI6yeG7Iu5cWmJMFVl9dtBL<KEY> alt="House" style="width:100%">

Marley

Coco

        <img src="data:image/jpeg;base<KEY>0kFStiVWdULtEklUN3ZTFhCZJAySSSD//2Q==" alt="House" style="width:99%">

Chloe

<file_sep>/navbar.php

<!DOCTYPE html>

<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

     Adopt A Pet

      Login
      Signup
      Search Pets
	  Register a Pet for Adoption
	  Logout

<file_sep>/AdoptaPetLogin.php
<?php

	//include database information and user information
	require 'authentication.php';

	//never forget to start the session
	session_start();
	$errorMessage = '';

	//are user ID and Password provided?
	if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {

		//get userID and Password
		$loginUserId = $_POST['txtUserId'];
		$loginPassword = $_POST['txtPassword'];

		//connect to the database
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");

		// Authenticate the user
		if (authenticateUser($connection, $loginUserId, $loginPassword))
		{
			//the user id and password match,
			// set the session
			$_SESSION['db_is_logged_in'] = true;
			$_SESSION['userID'] = $loginUserId;

			// after login we move to the main page
			header('Location: AdoptaPet.php');
			exit;
		} else {
			$errorMessage = 'Sorry, wrong username / password';
		}
	}
?>
<!DOCTYPE html>

<title>Adopt a Pet Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt a Pet Login

	 <?php echo $errorMessage ?>

If you don't have an account, please sign up.

		<form action="" method="post" name="frmLogin" id="frmLogin">

					User ID
					<input name="txtUserId" type="text" id="txtUserId">

					Password
					<input name="txtPassword" type="<PASSWORD>" id="txtPassword">

					<input name="btnLogin" type="submit" id="btnLogin" value="Login">

		</form>

<file_sep>/RegisterPet.php

<?php
	//include information required to access database
	require 'authentication.php';

	//start a session
	session_start();
	$errorMessage = 'Register a Pet';

	//still logged in?
	if (!isset($_SESSION['db_is_logged_in'])
		|| $_SESSION['db_is_logged_in'] != true) {
		//not logged in, move to login page
		header('Location: AdoptaPetLogin.php');
		exit;
	} else {

		//logged in
		// Prepare query
		if(isset ($_POST['Pet'])) {
			$table = "Pet";
			$petname = $_POST['petName'];
			$age = $_POST ['age'];
			$breed= $_POST ['breed'];
			$gender=$_POST ['gender'];
			$animaltype=$_POST['animaltype'];
			$uid=$_POST['userid'];
			$pid=$_POST['programid'];
			$query = "INSERT INTO $table VALUES ('$petname', '$age','$breed','$gender','$animaltype','$uid','$pid')";

		// Execute query
		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// close the connection
		sqlsrv_close($connection);
	}}
?>
<!DOCTYPE html>

<title>Register a Pet for Adoption</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

		  <?php include 'navbar.php'; ?>

Adopt a Pet Register Pet for Adoption

		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

		 <?php echo $errorMessage ?>

		<form action="" method="post" name="frmLogin" id="frmLogin">

		   Pet Name
		   <input name="petName" type="text" id="petName">

		   Age
		   <input name="age" type="text" id="age">

		   Breed
		   <input name="breed" type="text" id="breed">

		   Gender
		   <input name="gender" type="text" id="gender">

		   Animal Type
		   <input name="animaltype" type="text" id="animal">

		   User ID
		   <input name="userid" type="text" id="userid">

		   Program ID
		   <input name="programid" type="text" id="programid">

		   <input name="btnLogin" type="submit" id="btnLogin" value="Submit">

		</form>

If the pet has been previously adopted, fill out this form.

<file_sep>/Search.php
<!DOCTYPE html>

<title> Search Adoptable Pets</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

		  <?php include 'navbar.php'; ?>

Adopt a Pet Search

		<form method="post">

 Keyword Search

		<input type="text" name="keyword" />

		<input type="submit" value="Search"/>
		</form>

	<?php
		require 'authentication.php';

		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
			if (!empty($_POST['keyword'])){
				$keyword=$_POST['keyword'];

		// prepare SQL query
		$query = "SELECT * FROM PET WHERE ((Pet.PetName LIKE '%".$keyword."%') OR (Age LIKE '%".$keyword."%')OR (Gender LIKE '%".$keyword."%')
		OR (AnimalType LIKE '%".$keyword."%') OR (Breed LIKE '%".$keyword."%') OR (CurrentLocation LIKE '%".$keyword."%'))" ;

		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";
			}
		// close the connection with database
		sqlsrv_close($connection);
	?>

 <form method="post">

 Search Pet ID to learn adoption history

		<input type="text" name="petid" />

		<input type="submit" value="Search"/>
		</form>

	<?php

		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
			if (!empty($_POST['petid'])){
				$petid=$_POST['petid'];

		// prepare SQL query
		$query = "SELECT * FROM ADOPTION_HISTORY WHERE PetID=$petid";
		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";
			}
		// close the connection with database
		sqlsrv_close($connection);
	?>

 <form method="post">

 Search Program ID to get contact information to adopt

		<input type="text" name="programid" />

		<input type="submit" value="Search"/>
		</form>

	<?php

		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
			if (!empty($_POST['programid'])){
				$pid=$_POST['programid'];

		// prepare SQL query
		$query = "SELECT * FROM ADOPTION_PROGRAM WHERE ProgramID=$pid";
		// Execute SQL query
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Output query results: HTML table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($query_result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch table records
		while ($line = sqlsrv_fetch_array($query_result, SQLSRV_FETCH_ASSOC)) {
			echo "
\n";
			foreach ($line as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}
		echo "
";
			}
		// close the connection with database
		sqlsrv_close($connection);
	?>

<file_sep>/AdoptaPet.php
<!DOCTYPE html>

<title>Adopt a Pet</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt A Pet

To begin, please login your account here.

If you do not have an account, please sign up for an account here.

<file_sep>/numgame.php

 A Simple PHP Page

<?php
$x=rand(1,10);
$y=rand(1,10);
$z=max($x,$y);
echo "The first random number is $x
";
echo "The second random number is $y
";
echo "The larger value of the two random numbers is $z
";
?>

<file_sep>/case4.php

<title> PHP SQL Example </title>

 Case 4: Browse the employee information for a particular project.- Automatic Coding

 You want to search the employees associated with which project?

<form action="" method="post">

<?php
	$server = "upsql";
	$sqlUsername = "IST210FA1700109";
	$sqlPassword = "<PASSWORD>";
	$databaseName = "IST210-jxw394-FA17-001-Team09";

	$connectionInfo = array('Database'=>$databaseName, 'UID'=>$sqlUsername, 'PWD'=>$sqlPassword, 'Encrypt'=>'0', 'ReturnDatesAsStrings'=>true );
	$connection = sqlsrv_connect( $server, $connectionInfo )
		or die("ERROR: database parameters are not correct");

	// Prepare SQL query
	$query = "SELECT ProjectName, ProjectID FROM Project";

	// Execute SQL query
	$result = sqlsrv_query($connection, $query)
		or die( "ERROR: Query is wrong");

	echo "<select name=\"projectID\">";
	// fetch table records
	while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) {
		// EmployeeNumber
		$id = $row['ProjectID'];
		$name=$row['ProjectName'];
		$project= $name;
		echo "<option value=\"$id\"> $project </option>";
	}
	echo "</select>";

	// close the connection with database
	sqlsrv_close($connection);
?>

<input type="submit" value="Submit"/>

<?php
	$connectionInfo = array('Database'=>$databaseName, 'UID'=>$sqlUsername, 'PWD'=>$sqlPassword, 'Encrypt'=>'0', 'ReturnDatesAsStrings'=>true );
	$connection = sqlsrv_connect( $server, $connectionInfo )
		or die("ERROR: database parameters are not correct");

	if (!empty($_POST['projectID'])) {

		// get the employeeID
		$projectid = $_POST['projectID'];

		// prepare SQL query
		$query = "SELECT *
					FROM Employee
					WHERE EmployeeNumber IN
					(SELECT EmployeeNumber FROM Assignment WHERE Assignment.ProjectID='$projectid')";

		// print the query
		echo "Query: ".$query."
";

		// Execute SQL query
		$result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// Display results in a table
		echo "
";
		echo "
";

		// fetch attribute names
		foreach( sqlsrv_field_metadata($result) as $fieldMetadata)
			echo "".$fieldMetadata['Name']."	";
		echo "
";

		// fetch rows in the table
		while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) {
			echo "
\n";
			foreach ($row as $cell) {
				echo " $cell 	";
			}
			echo "
\n";
		}

		echo "
";
	}

	// close the connection with database
	sqlsrv_close( $connection);
?>
</form>
<file_sep>/ProgramSignup.php
<?php
	//include information required to access database
	require 'authentication.php';

	//start a session
	session_start();
	$errorMessage = 'Enter Adoption Information';

	//still logged in?
	if (!isset($_SESSION['db_is_logged_in'])
		|| $_SESSION['db_is_logged_in'] != true) {
		//not logged in, move to login page
		header('Location: AdoptaPetLogin.php');
		exit;
	} else {

		//logged in
		// Prepare query
		if(isset ($_POST['Adoption_Program'])) {
			$table = "Adoption_Program";
			$name = $_POST['programName'];
			$location = $_POST['programLocation'];
			$email = $_POST['programEmail'];
			$phone = $_POST ['programPhone'];
			$type = $_POST['programType'];
			$authen = $_POST ['authentication'];
			$query = "INSERT INTO $program VALUES ('$name','$location', '$email', '$phone', '$type','$authen')";

		// Execute query
		// Connect database server
		$connection = sqlsrv_connect( $server, $connectionInfo )
			or die("ERROR: selecting database server failed");
		$query_result = sqlsrv_query($connection, $query)
			or die( "ERROR: Query is wrong");

		// close the connection
		sqlsrv_close($connection);
	}}
?>

<!DOCTYPE html>

<title>Program Signup</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt a Pet Program Signup

		<title>Adopt a Pet User Signup</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

		<title>Program Signup</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

		 <?php echo $errorMessage ?>

		<form action="" method="post" name="frmLogin" id="frmLogin">

		   Program Name
		   <input name="programName" type="text" id="programName">

		   Program Location
		   <input name="programLocation" type="text" id="programLocation">

		   Email Address
		   <input name="programEmail" type="text" id="programEmail">

		   Phone Number
		   <input name="programPhone" type="text" id="programPhone">

		   Program Type
		   <input name="programType" type="text" id="programType">

		   Authentication
		   <input name="authentication" type="text" id="authentication">

		   <input name="btnLogin" type="submit" id="btnLogin" value="Register">

		</form>

<file_sep>/AdoptaPetSignup.php
<!DOCTYPE html>

<title>Adopt a Pet Signup</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

<?php include 'navbar.php'; ?>

Adopt a Pet Signup

To register to be a user, you can sign up here.

	 In order to register a pet for adoption, you need to be signed up to be an official adoption program.
	 First create your user account, and then register to be an adoption program here.

<file_sep>/README.md
# PHP-and-HTML-
Basic PHP and HTML code including connecting multiple pages, HTML forms, and connecting SQL and PHP

languages: Hack Markdown PHP

repo_language: Hack

repo_name: gracemorgan/PHP-and-HTML-


text:
<file_sep>import React, { useState, useEffect } from "react";
import NasaBttn from "./NasaBttn";
import NasaBlock from "./NasaBlock";
import moment from "moment";
import axios from "axios";
import styled from "styled-components";

const NasaApi = props => {
  const [nasa, setNasa] = useState([]);
  const [urlDate, setUrlDate] = useState(moment().format("YYYY-MM-DD"));
  const [date, setDate] = useState(moment().format("YYYY-MM-DD"));

  useEffect(() => {
    axios
      .get(
        `https://api.nasa.gov/planetary/apod?api_key=<KEY>&date=${urlDate}`
      )
      .then(result => {
        setNasa(result.data);
      })
      .catch(err => {
        console.log(err);
      });
  }, [urlDate]); //<-- Makes it fire once

  const MainWrapper = styled.div`
    background-image: linear-gradient(50deg, #06070b, #3e5067cf), url(${nasa.url});
    width: 40vw;
    height: auto;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    margin: 1% 10%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-flow: column;
    /* border: 2px solid rgba(255, 200, 255, 0.26); */
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: -10px -10px 30px rgba(255, 255, 255, 0.1), 15px 15px 25px rgba(0,0,0,0.5);
    border-radius: 50px;
    border: 5px ridge rgba(81, 104, 134, 0.3);
  `;

  const Browse = styled.div`
    width: 50vw;
    display:flex;
    justify-content: center;
    align-items: center;
  `;

  let dateArray = [];
  let fDateArray = [];
  const [counter, setCounter] = useState(1);
  const [fcounter, fsetCounter] = useState(0);
  let newDate = false;

  function backDate(e) {
    let a = moment();
    let b = moment("2018-09-20");
    for (let m = a; m.isAfter(b); m.subtract(1, "day")) {
      dateArray.push(m.format("YYYY-MM-DD"));
    }

    for (let i = 0; i < dateArray.length; i++) {
      if (counter === i) {
        console.log(counter);
        setCounter(counter + 1);
        setUrlDate(dateArray[i]);
      }
    }
  }

  function forwardDate(e) {
    let a = moment();
    let b = moment(urlDate);
    for (let m = b; m.isBefore(a); m.add(1, "day")) {
      fDateArray.push(m.format("YYYY-MM-DD"));
    }
    for (let i = 0; i < fDateArray.length; i++) {
      if (counter > i) {
        // console.log(counter);
        setCounter(counter - 1);
        setUrlDate(fDateArray[1]);
      }
    }
    if (fcounter === fDateArray.length) {
      fsetCounter(0);
    }
  }

  return (
    <>
    <Browse>
    <NasaBttn backDate={backDate} forwardDate={forwardDate} setUrlDate={setUrlDate} date={urlDate} />
    </Browse>

      <NasaBlock
        key={nasa.toString()} //did not have to map over because it is not an array
        nasa={nasa}
      />

    </>
  );
};

export default NasaApi;
<file_sep>import React, {useState} from "react";
import styled from "styled-components";
import {
  faArrowAltCircleLeft,
  faArrowAltCircleRight
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Calendar from "react-calendar";
import moment from "moment";
import 'react-calendar/dist/Calendar.css';

export default function NasaBttn(props) {
  const ArrowBttn = styled.button`
    text-decoration: none;
    background-color: transparent;
    border: transparent;
    border-radius: 40px;
    height: 5vh;
    margin: 4% 0;

    ${props =>
      props.type === "hover" ? `&:hover{background-color: #2196f3};` : null}
  `;
  const Input = styled.input`
    text-align: center;
    border-radius: 45px;
    margin: 5vh 2vw;
    border: none;
    color: white;
    background-color: #323348;
    padding: 2%;
    box-shadow: -10px -10px 30px rgba(255, 255, 255, 0.1), 15px 15px 25px rgba(0,0,0,0.5);
  `;

  const [date, setDate] = useState(new Date())

  const OnChange = (date) => {
    props.setUrlDate(moment(date).format("YYYY-MM-DD"))
    // setDate(new Date(date))
  }

  console.log("props.date", new Date(props.date))
  console.log("date", date)
  return (

      <ArrowBttn
        onClick={props.backDate}
        value={props.date}
        type="hover"
        className="left"
      >

          <FontAwesomeIcon icon={faArrowAltCircleLeft} />

      </ArrowBttn>
      <Input className="calendar" type='date' value={props.date} onChange={(e) => props.setUrlDate(e.target.value)} />
      {/* <Calendar activeStartDate={date} defaultValue={new Date(props.date)} onClickDay={OnChange} onChange={OnChange}/> */}
      <ArrowBttn onClick={props.forwardDate} type="hover" className="right">

          <FontAwesomeIcon icon={faArrowAltCircleRight} />

      </ArrowBttn>

  );
}

branch_name: refs/heads/master

repo_language: JavaScript


text:
<file_sep>using System;
using System.Collections.Generic;
using System.Text;

namespace GenericDictonaryModel
{
    class MyDictonary<TKey,TValue>
    {
        TKey[] tkey;
        TValue[] tvalue;

        public MyDictonary()
        {
            tkey = new TKey[0];
            tvalue = new TValue[0];
        }

        public void Add(TKey itemKey,TValue itemValue)
        {
            TKey[] tempArrKey = tkey;
            TValue[] tempArrValue = tvalue;
            tkey = new TKey[tkey.Length + 1];
            tvalue = new TValue[tvalue.Length + 1];
            for (int i = 0; i < tempArrKey.Length; i++)
            {
                tkey[i] = tempArrKey[i];
                tvalue[i] = tempArrValue[i];
            }

            tkey[tkey.Length - 1] = itemKey;
            tvalue[tkey.Length - 1] = itemValue;

        }

        public void printAll()
        {
            for (int i = 0; i < tkey.Length; i++)
            {
                Console.WriteLine(tkey[i] + " Key , Value : " +tvalue[i]);
            }
        }

    }
}
<file_sep>using System;

namespace GenericDictonaryModel
{
    class Program
    {
        static void Main(string[] args)
        {
            MyDictonary<int, string> myDict = new MyDictonary<int, string>();
            myDict.Add(1, "Yazılım");
            myDict.Add(2, "Kodlama");

            myDict.printAll();
            Console.WriteLine("******Printed******");
            myDict.Add(4, "Eğitimi");
            myDict.Add(5, "Teşekkürler <3");
            myDict.printAll();

        }
    }
}

repo_language: C#

repo_name: csametsahin/GenericDictonaryModel


text:
<file_sep>
TinDog Starting

A training website for design, it use bootstrap, html and css.

  Desktop version

  Mobile version

repo_language: Markdown

repo_name: pikooli/Tindog


text:
<file_sep>import React from "react"
import NavBar from "./navbar"
import {Button,Card} from "react-bootstrap"
import Carousel from 'react-multi-carousel';
import 'react-multi-carousel/lib/styles.css';
const responsive = {
    desktop: {
        breakpoint: { max: 3000, min: 1024 },
        items: 3,
        slidesToSlide: 3 // optional, default to 1.
    },
    tablet: {
        breakpoint: { max: 1024, min: 464 },
        items: 2,
        slidesToSlide: 2 // optional, default to 1.
    },
    mobile: {
        breakpoint: { max: 464, min: 0 },
        items: 1,
        slidesToSlide: 1 // optional, default to 1.
    }
};const responsive1 = {
    desktop: {
        breakpoint: { max: 3000, min: 1024 },
        items: 4,
        slidesToSlide: 4 // optional, default to 1.
    },
    tablet: {
        breakpoint: { max: 1024, min: 464 },
        items: 2,
        slidesToSlide: 2 // optional, default to 1.
    },
    mobile: {
        breakpoint: { max: 464, min: 0 },
        items: 1,
        slidesToSlide: 1 // optional, default to 1.
    }
};
const CustomButtonGroup = ({ next, previous }) => {
    return (

         previous()}>
         next()}>

    );
  };

const SideBar = () => {

    return (<>

                        Home

                        My Music

                        Podcast

                         Video

                <Card  className="gradient" style={{ width: '14rem',marginTop:"120%",marginLeft:"12px",color:"white"}}>
                <Card.Body>
                    <Card.Subtitle className="mb-2" >
Upgrade to Pro
</Card.Subtitle>
                    <Card.Text>
                    Some quick example text to build on the card title and
                    </Card.Text>

                    <Button variant="outline-secondary" className="white-outline" block >Secondary</Button>

                </Card.Body>
                </Card>

                <NavBar />

Top Picks

                            <Carousel
                                swipeable={false}
                                draggable={false}
                                showDots={false}
                                responsive={responsive}
                                // means to render carousel on server-side.
                                infinite={true}
                                keyBoardControl={true}

                                containerClassName="carousel-container"
                                removeArrowOnDeviceType={["tablet", "mobile"]}

                                dotListClassName="custom-dot-list-style"
                                itemClassName="carousel-item-padding-40-px"
                                arrows={false}
                                renderButtonGroupOutside={true}
                                customButtonGroup={<CustomButtonGroup />}
                            >

                            </Carousel>

Popular Artists

                            <Carousel
                                swipeable={false}
                                draggable={false}
                                showDots={false}
                                responsive={responsive1}
                                // means to render carousel on server-side.
                                infinite={true}
                                keyBoardControl={true}

                                containerClassName="carousel-container"
                                removeArrowOnDeviceType={["tablet", "mobile"]}

                                dotListClassName="custom-dot-list-style"
                                itemClassName="carousel-item-padding-40-px"
                                arrows={false}
                                renderButtonGroupOutside={true}
                                customButtonGroup={<CustomButtonGroup />}
                            >

                            </Carousel>

        </>)
}
export default SideBar<file_sep>import React from "react"
import { Nav,Navbar,FormControl,Form} from "react-bootstrap"
const NavBar=()=>{

    return(<>
    <Navbar  expand="lg" style={{position:"sticky",borderBottom:"1px lightgrey solid"}}>

    <Navbar.Toggle aria-controls="basic-navbar-nav" />

    <Navbar.Collapse id="basic-navbar-nav">
    <Form inline className="mr-auto">

        <FormControl type="text" placeholder="Search artists songs ..." className="mr-sm-2 form-control-borderless" />

      </Form>

        <img class="c-avatar-img" src="https://icon-library.com/images/no-user-image-icon/no-user-image-icon-21.jpg" alt="<EMAIL>" />

    </Navbar.Collapse>

  </Navbar>
  </>)
}

export default  NavBar<file_sep>#wrapper {
    padding-left: 0;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
    overflow: hidden;
}

#wrapper.toggled {
    padding-left: 250px;
    overflow: hidden;
}

#sidebar-wrapper {
    z-index: 100;
    position: fixed;
    left: 250px;
    width: 0;
    height: 100%;
    margin-left: -250px;
    overflow-y: auto;
    background: #fff;
    border-right: 1px lightgrey solid;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}

#wrapper.toggled #sidebar-wrapper {
    width: 250px;
}

#page-content-wrapper {
    position: absolute;
    width: 100%;
    overflow-x: hidden;
}

.xyz {
    min-width: 360px;
}

#wrapper.toggled #page-content-wrapper {
    position: relative;
    margin-right: 0px;
}

.fixed-brand {
    width: auto;
}

/* Sidebar Styles */

.sidebar-nav {
    position: fixed;
    top: 0;
    width: 250px;
    margin: 0;
    padding: 0;
    list-style: none;
    margin-top: 2px;
}

.sidebar-nav li {
    text-indent: 15px;
    line-height: 40px;
}

.sidebar-nav li a {
    display: block;
    font-size: 1.3rem;
    text-decoration: none;
    color: grey;
}

.sidebar-nav li a:hover {
    text-decoration: none;
    color: #00b2ff;
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
    text-decoration: none;
}

.sidebar-nav>.sidebar-brand {
    height: 65px;
    font-size: 18px;
    line-height: 60px;
}

.sidebar-nav>.sidebar-brand a {
    color: #999999;
}

.sidebar-nav>.sidebar-brand a:hover {
    color: #fff;
    background: none;
}

.no-margin {
    margin: 0;
}

.c-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50em;
    width: 40px;
    height: 40px;
    font-size: 14.4px;
}

.c-avatar-img {
    width: 100%;
    height: auto;
    padding: 1px;
    border-radius: 50em;
    border: 2px lightgrey solid;
}

/* equal card height */

.row-equal>div[class*='col-'] {
    display: flex;
    flex: 1 0 auto;
}

.row-equal .card {
    width: 100%;
}

.react-multi-carousel-item .movie img {
    width: 345px;
    height: 345px;
    border-radius: 15px;
}

.react-multi-carousel-item .artists img {
    width: 250px;
    height: 250px;
    border-radius: 50%;
}

.remove-outline {
    color: #6c757d;
    border-color: transparent!important;
}

.white-outline {
    color: white;
    border-color: white!important;
}

.gradient {
    position: absolute;
    width: 100%;
    top: 0%;
    left: 0%;
    border-radius: 10px;
    background: linear-gradient(45deg, rgb(90 46 213), rgb(5 214 254), rgb(138 252 212));
}

#footer {
    bottom: 0px;
    width: 100%;
    position: sticky;
    height: 60px;
    background-color: #f5f5f5;
    z-index: 200;
    border-top: 1px lightgrey solid;
}

.footer-block {
    margin: 20px 0;
}

div.action {
    text-align: center;
    margin-left: -50px;
}

div.action .previous,
div.action .next {
    font-size: 15px;
    margin: 0 10px;
    color: grey;
}

div.action .play {
    font-size: 40px;
    margin: 0 25px;
    color: grey;
}

div.options {
    text-align: center;
    margin: 25px 0 35px 0;
    display: block;
}

div.options a {
    color: #999;
    margin: 0 15px;
}

div.options a.active {
    color: #e74c3c;
}

div.volume-slider {
    text-align: center;
    margin-top: 0px;
    display: block;
    height: 140px;
    background: #303030;
    position: absolute;
    z-index: 97;
    width: 100%;
}

div.volume-slider-inner {
    padding: 60px 0 0 0;
}

div.volume-slider div.volume-slider-inner i {
    color: #666;
    padding: 0 6px;
}

div.length input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 8px;
    width: 8px;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

div.volume-slider input[type='range'] {
    height: 2px;
    width: 180px;
    background: #999;
    -webkit-appearance: none;
    border: none;
    outline: 0;
}

div.volume-slider input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 15px;
    width: 15px;
    border-radius: 30px;
    background: #ffffff;
    cursor: pointer;
}

div.volume-slider a.close {
    position: absolute;
    color: #DDD;
    right: 14px;
    top: 10px;
    font-size: 18px;
}

div.length {
    color: #999;
    font-size: 16px;
}

div.length output {
    margin-left: -15px;
}

div.length label {
    margin-right: -15px;
}

div.length input[type="range"] {
    width: 100%;
    height: 2px;
    border: none;
    outline: 0;
    margin-top: 10px;
}

.grey {
    color: grey;
}

.grey:hover {
    color: #00b2ff;
}

.form-control-borderless {
    border: none;
}

.form-control-borderless:hover,
.form-control-borderless:active,
.form-control-borderless:focus {
    border: none;
    outline: none;
    box-shadow: none;
}

::-moz-selection {
    /* Code for Firefox */
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, .0);
}

::selection {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, .0);
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
}

@media (min-width: 768px) {
    #wrapper {
        padding-left: 250px;
    }
    .fixed-brand {
        width: 250px;
    }
    #wrapper.toggled {
        padding-left: 0;
    }
    #sidebar-wrapper {
        width: 253px;
    }
    #wrapper.toggled #sidebar-wrapper {
        width: 250px;
    }
    #wrapper.toggled-2 #sidebar-wrapper {
        width: 50px;
    }
    #wrapper.toggled-2 #sidebar-wrapper:hover {
        width: 250px;
    }
    #page-content-wrapper {
        position: relative;
        -webkit-transition: all 0.5s ease;
        -moz-transition: all 0.5s ease;
        -o-transition: all 0.5s ease;
        transition: all 0.5s ease;
    }
    #wrapper.toggled #page-content-wrapper {
        position: relative;
        margin-right: 0;
        padding-left: 250px;
    }
    #wrapper.toggled-2 #page-content-wrapper {
        position: relative;
        margin-right: 0;
        margin-left: -200px;
        -webkit-transition: all 0.5s ease;
        -moz-transition: all 0.5s ease;
        -o-transition: all 0.5s ease;
        transition: all 0.5s ease;
        width: auto;
    }
}

@media (max-width: 768px) {
    #sidebar-wrapper {
        position: initial;
    }
}

languages: JavaScript CSS

repo_name: shubhMonter/shadhin


text:
<file_sep><!DOCTYPE html>

<title>Page Title</title>
<link rel="stylesheet" href="css/title.css">

<file_sep><!DOCTYPE html>

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

        <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
        <link rel="stylesheet" href="./css/style.css">
		<link rel="stylesheet" href="css/projects.css">
        <link rel="stylesheet" href="./css/plugin/slick/slick.css">
        <link rel="stylesheet" href="./css/plugin/slick/slick-theme.css">
        <link rel="stylesheet" href="/css/title.css">

                14+

                Partners

                55+

                Projects Done

                89+

                Happy Clients

                150+

                Meetings

        <link href='http://fonts.googleapis.com/css?family=Titillium+Web:400,200,300,600,700' rel='stylesheet' type='text/css'>

					Web Application
					11 May 2017

 Web Application

					Online Game
					11 January 2018

 Online Game

					Online Shopping
					11 August 2018

 ShopOnline

					Crytocurrency
					14 March 2019

 Bitcoin Salesman

					Library Aggretator
					25 July 2019

 Book Store

The Web Application

 Due to the exponential growth in technological advandces and the social media workforce, Our company roots itself in the combination of both passions.

The Game Online

 Teenager wins big by Playing Fortnite. You too can stand a chance to compete against the best gamers known in the Gaming world.

The Online Shopping

 TTAP Dev offers the best deals on the latest technological trends.

The Crypto Currency

 Crypto-mining, crypto-investment and even crypto-jacking( If you know, you know;) can be done here!

The Digital Library

 For the latest books click below.

online shop

crypto currency

bottom

About us...

We are a self-made content creation company comprised of a group of individuals working in the Information Technology field. Our wbsite aims to deliver the lastest and most relevent content pertaining to the worlds of web applications, online gaming, online shopping, digital libraries and crypto currency.

<NAME>

<NAME>

<NAME>

<NAME>

<file_sep>//1. Default Behaviour
var completes = document.querySelectorAll(".complete");
var toggleButton = document.getElementById("toggleButton");

function toggleComplete(){
  var lastComplete = completes[completes.length - 1];
  lastComplete.classList.toggle('complete');
}
toggleButton.onclick = toggleComplete();

//2. Select Single Project element
var one = document.getElementById("one");
var two = document.getElementById("two");
var three = document.getElementById("three");
var four = document.getElementById("four");
var five = document.getElementById("five");

function toggleSingleComplete(proj){
	//alert(proj);
	switch(proj) {
		case "1":
			val = completes[0].classList.toggle('complete');
			completes[1].classList.toggle('complete',false);
			completes[2].classList.toggle('complete',false);
			completes[3].classList.toggle('complete',false);
			completes[4].classList.toggle('complete',false);

			if(val)
				document.getElementById("proj1").style.display = "block";
			else
				document.getElementById("proj1").style.display = "none";
			document.getElementById("proj2").style.display = "none";
			document.getElementById("proj3").style.display = "none";
			document.getElementById("proj4").style.display = "none";
			document.getElementById("proj5").style.display = "none";
			break;
		case "2":
			completes[0].classList.toggle('complete',false);
			val = completes[1].classList.toggle('complete');
			completes[2].classList.toggle('complete',false);
			completes[3].classList.toggle('complete',false);
			completes[4].classList.toggle('complete',false);

			document.getElementById("proj1").style.display = "none";
			if(val)
				document.getElementById("proj2").style.display = "block";
			else
				document.getElementById("proj2").style.display = "none";
			document.getElementById("proj3").style.display = "none";
			document.getElementById("proj4").style.display = "none";
			document.getElementById("proj5").style.display = "none";
			break;
		case "3":
			completes[0].classList.toggle('complete',false);
			completes[1].classList.toggle('complete',false);
			val = completes[2].classList.toggle('complete');
			completes[3].classList.toggle('complete',false);
			completes[4].classList.toggle('complete',false);

			document.getElementById("proj1").style.display = "none";
			document.getElementById("proj2").style.display = "none";
			if(val)
				document.getElementById("proj3").style.display = "block";
			else
				document.getElementById("proj3").style.display = "none";
			document.getElementById("proj4").style.display = "none";
			document.getElementById("proj5").style.display = "none";
			break;
		case "4":
			completes[0].classList.toggle('complete',false);
			completes[1].classList.toggle('complete',false);
			completes[2].classList.toggle('complete',false);
			val = completes[3].classList.toggle('complete');
			completes[4].classList.toggle('complete',false);

			document.getElementById("proj1").style.display = "none";
			document.getElementById("proj2").style.display = "none";
			document.getElementById("proj3").style.display = "none";
			if(val)
				document.getElementById("proj4").style.display = "block";
			else
				document.getElementById("proj4").style.display = "none";
			document.getElementById("proj5").style.display = "none";
			break;
		case "5":
			completes[0].classList.toggle('complete',false);
			completes[1].classList.toggle('complete',false);
			completes[2].classList.toggle('complete',false);
			completes[3].classList.toggle('complete',false);
			val = completes[4].classList.toggle('complete');

			document.getElementById("proj1").style.display = "none";
			document.getElementById("proj2").style.display = "none";
			document.getElementById("proj3").style.display = "none";
			document.getElementById("proj4").style.display = "none";
			if(val)
				document.getElementById("proj5").style.display = "block";
			else
				document.getElementById("proj5").style.display = "none";
			break;
		default:
			completes[0].classList.toggle('complete',false);
			completes[1].classList.toggle('complete',false);
			completes[2].classList.toggle('complete',false);
			completes[3].classList.toggle('complete',false);
			completes[4].classList.toggle('complete',false);

			document.getElementById("proj1").style.display = "none";
			document.getElementById("proj2").style.display = "none";
			document.getElementById("proj3").style.display = "none";
			document.getElementById("proj4").style.display = "none";
			document.getElementById("proj5").style.display = "none";
	}

}

/*
document.getElementById("one").onclick = toggleSingleComplete(1);
document.getElementById("two").onclick = toggleSingleComplete(2);
document.getElementById("three").onclick = toggleSingleComplete(3);
document.getElementById("four").onclick = toggleSingleComplete(4);
document.getElementById("five").onclick = toggleSingleComplete(5);*/

one.addEventListener("click", function() {
	toggleSingleComplete("1");
});

two.addEventListener("click", function() {
	toggleSingleComplete("2");
});

three.addEventListener("click", function() {
	toggleSingleComplete("3");
});
four.addEventListener("click", function() {
	toggleSingleComplete("4");
});
five.addEventListener("click", function() {
	toggleSingleComplete("5");
});

/**/
<file_sep><!DOCTYPE html>

	<title></title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/books.css">

The Web Application

Hacker's handbook

The highly successful security book returns with a new edition, completely updated Web applications are the front door to most organizations...

R650.00

Console wars

Console Wars: Sega, Nintendo, and the Battle That Defined a Generation is a 2014 non-fiction novel written by <NAME>...

R226.00

Blood, Sweat, and Pixels:

The Triumphant, Turbulent Stories...

The creative and technical logistics that go into building today's hottest games can be more harrowings...

R371.94

Learning Web App Development:

Build Quickly with Proven...

Grasp the fundamentals of web application development by building...

R289.68

TH1RT3EN

The serial killer isn't on trial, he's on the jury

"Thirteen is the legal thriller <NAME>, <NAME>, and <NAME> are raving about and readers can't put down. It's the murder trial of the century"...

R259.29

The Haunting of Hill House

...

The Haunting of Hill House is a 1959 gothic horror novel by American author <NAME>. A finalist for the National Book Award and considered one of the best literary ghost stories published during the 20th century, it has been made into two feature films and a...

R185.17

<file_sep>package com.example.first;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.TextView;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.MalformedURLException;
import java.net.HttpURLConnection;

import javax.net.ssl.HttpsURLConnection;

public class SecondActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        TextView title = (TextView) findViewById(R.id.homeTitle1);
        title.setText("Activity One");
        Intent a = new Intent(this, MainActivity.class);

        BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
        navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {

                switch (item.getItemId())
                {
                    case R.id.navigation_disc:

                        break;

                    case R.id.navigation_logout:
                        Intent a = new Intent(SecondActivity.this, MainActivity.class);
                        startActivity(a);
                        break;

                    case R.id.navigation_login:

                        break;
                }
                return false;
            }
        });
    }

    public void getMovies()
    {
        String str = "o";
        try {
            URL url = new URL("https://api.themoviedb.org/3/search/movie?api_key=<KEY>&language=en-US&query="+str+"&page=1&include_adult=false");

            try {
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();

                try
                {
                    InputStream results = new BufferedInputStream(connection.getInputStream());

                }
                finally
                {
                    connection.disconnect();
                }

            }
            catch(IOException e)
            {
                throw new RuntimeException();
            }
        }
        catch(MalformedURLException e)
        {
            throw new RuntimeException(e);
        }

    }

}<file_sep># imy_320_ttap_dev
### IMY 320 Website Design
[Project Proposal](https://github.com/percywarapudi/2019_IMY320_Stitches/blob/master/IMY%20320%20Group%20Design%20and%20Development%20Assignment%20Final.pdf)

### Contributors

| Name                  | Student no. |
| ---------------------:| -----------:|
| <NAME>          |    04396235 |
| <NAME>  |    17110310 |
| <NAME>      |    17095230 |
| <NAME>           |    15209190 |

languages: HTML Java Hack Markdown JavaScript

repo_language: HTML


text:
<file_sep>-- phpMyAdmin SQL Dump
-- version 4.0.10.20
-- https://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Aug 18, 2021 at 01:40 PM
-- Server version: 5.1.72-community
-- PHP Version: 7.4.16

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `ci_secureapi`
--

-- --------------------------------------------------------

--
-- Table structure for table `client`
--

CREATE TABLE IF NOT EXISTS `client` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `retainer_fee` varchar(255) DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `client`
--

INSERT INTO `client` (`id`, `name`, `email`, `retainer_fee`, `updated_at`, `created_at`) VALUES
(1, '<NAME>', '<EMAIL>', '27006693', NULL, NULL),
(2, '<NAME>', '<EMAIL>', '84667427', NULL, NULL),
(3, '<NAME>', '<EMAIL>', '47758098', NULL, NULL),
(4, '<NAME>', '<EMAIL>', '26470431', NULL, NULL),
(5, '<NAME>', '<EMAIL>', '96216444', NULL, NULL),
(6, 'Prof. <NAME> Jr.', '<EMAIL>', '50365658', NULL, NULL),
(7, 'Prof. <NAME> Jr.', '<EMAIL>', '9960099', NULL, NULL),
(8, '<NAME>', '<EMAIL>', '14048416', NULL, NULL),
(9, '<NAME>', '<EMAIL>', '41231060', NULL, NULL),
(10, '<NAME>', '<EMAIL>', '82855671', NULL, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE IF NOT EXISTS `migrations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `version` varchar(255) NOT NULL,
  `class` text NOT NULL,
  `group` varchar(255) NOT NULL,
  `namespace` varchar(255) NOT NULL,
  `time` int(11) NOT NULL,
  `batch` int(11) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `version`, `class`, `group`, `namespace`, `time`, `batch`) VALUES
(1, '2020-11-02-213453', 'App\\Database\\Migrations\\AddClient', 'default', 'App', 1629263111, 1),
(2, '2020-11-02-213501', 'App\\Database\\Migrations\\AddUser', 'default', 'App', 1629263111, 1);

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=2 ;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `name`, `email`, `password`, `updated_at`, `created_at`) VALUES
(1, 'admin', '<EMAIL>', <PASSWORD>', NULL, NULL);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

branch_name: refs/heads/main

repo_language: SQL


text:
<file_sep>
#include "bitalino.h"

#include <string>
#include <stdio.h>

#ifdef _WIN32

#include <conio.h>

bool keypressed(void)
{
	return (_kbhit() != 0);
}

#else // Linux or Mac OS

#include <sys/select.h>

bool keypressed(void)
{
   fd_set   readfds;
   FD_ZERO(&readfds);
   FD_SET(0, &readfds);

   timeval  readtimeout;
   readtimeout.tv_sec = 0;
   readtimeout.tv_usec = 0;

   return (select(FD_SETSIZE, &readfds, NULL, NULL, &readtimeout) == 1);
}

#endif

int main()
{
   try
   {
      // uncomment this block to search for Bluetooth devices (Windows and Linux)
      /*
      BITalino::VDevInfo devs = BITalino::find();
      for(int i = 0; i < devs.size(); i++)
      	printf("%s - %s\n", devs[i].macAddr.c_str(), devs[i].name.c_str());
      return 0;
      */

      puts("Connecting to device...");

	  //std::string strDevice = "98:d3:31:b1:83:ea";  // "COM5" //PARAM
	  std::string strDevice = "98:d3:31:b1:83:b0"; // "COM9"

      // use one of the lines below
      BITalino dev(strDevice.c_str());  // device MAC address (Windows and Linux)

      //BITalino dev("COM5");  // Bluetooth virtual COM port or USB-UART COM port (Windows)

      //BITalino dev("/dev/ttyUSB0");  // USB-UART device (Linux)
      //BITalino dev("/dev/rfcomm0");  // Bluetooth virtual serial port (Linux)

      //BITalino dev("/dev/tty.usbserial-A1000QIz");  // USB-UART device (Mac OS)
      //BITalino dev("/dev/tty.bitalino-DevB");  // Bluetooth virtual serial port (Mac OS)

      puts("Connected to device. Press Enter to exit.");

      std::string ver = dev.version();    // get device version string
      printf("BITalino version: %s\n", ver.c_str());

      dev.battery(10);  // set battery threshold (optional)

	  int iSamplingFrequency = 100; //PARAM 10, 100, 1000,

      dev.start(iSamplingFrequency, {0, 1, 2, 3, 4, 5});   // start acquisition of all channels at 1000 Hz
      // use block below if your compiler doesn't support vector initializer lists
      /*
      BITalino::Vint chans;
      chans.push_back(0);
      chans.push_back(1);
      chans.push_back(2);
      chans.push_back(3);
      chans.push_back(4);
      chans.push_back(5);
      dev.start(1000, chans);
      */

      //dev.trigger({false, false, true, false});  // for original BITalino
      //dev.trigger({true, false});                // for BITalino 2
      // use block below if your compiler doesn't support vector initializer lists
      /*
      BITalino::Vbool outputs;
      outputs.push_back(false);
      outputs.push_back(false);
      outputs.push_back(true);
      outputs.push_back(false);
      dev.trigger(outputs);
      */

      BITalino::VFrame frames(100); // initialize the frames vector with 100 frames
      do
      {
         dev.read(frames); // get 100 frames from device
         const BITalino::Frame &f = frames[0];  // get a reference to the first frame of each 100 frames block
         printf("%d : %d %d %d %d ; %d %d %d %d %d %d\n",   // dump the first frame
                f.seq,
                f.digital[0], f.digital[1], f.digital[2], f.digital[3],
                f.analog[0], f.analog[1], f.analog[2], f.analog[3], f.analog[4], f.analog[5]);

      } while (!keypressed()); // until a key is pressed

      dev.stop(); // stop acquisition
   } // dev is destroyed here (it goes out of scope)
   catch(BITalino::Exception &e)
   {
      printf("BITalino exception: %s\n", e.getDescription());
   }

   return 0;
}
<file_sep>
/*
 * Include Files
 *
 */
#include "simstruc.h"

/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
#include <math.h>
#include <string>
#include <iostream>
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define y_width 4

/*
 * Create external references here.
 *
 */
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* extern double func(double a); */
extern void myStart(real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1,
                        SimStruct *S);

extern void myUpdate(real_T *outputAnalog, real_T *outputDigital,
			real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1);

void myTerminate(real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1);
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */

/*
 * Start function
 *
 */
void simulinkBitalino_Start_wrapper(real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1,
			SimStruct *S)
{
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
/*
 * Custom Start code goes here.
 */

myStart(xD, pW, device, p_width0, samplingfrequency, p_width1, S);
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
 * Output function
 *
 */
void simulinkBitalino_Outputs_wrapper(real_T *outputAnalog,
			real_T *outputDigital,
			const real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1,
			SimStruct *S)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
/* This sample sets the output equal to the input
      y0[0] = u0[0];
 For complex signals use: y0[0].re = u0[0].re;
      y0[0].im = u0[0].im;
      y1[0].re = u1[0].re;
      y1[0].im = u1[0].im;
 */
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}

/*
 * Updates function
 *
 */
void simulinkBitalino_Update_wrapper(real_T *outputAnalog,
			real_T *outputDigital,
			real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1,
			SimStruct *S)
{
/* %%%-SFUNWIZ_wrapper_Update_Changes_BEGIN --- EDIT HERE TO _END */
/*
 * Code example
 *   xD[0] = u0[0];
 */

myUpdate(outputAnalog, outputDigital, xD, pW, device, p_width0, samplingfrequency, p_width1);
/* %%%-SFUNWIZ_wrapper_Update_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
 * Terminate function
 *
 */
void simulinkBitalino_Terminate_wrapper(real_T *xD,
			void **pW,
			const uint16_T *device, const int_T p_width0,
			const uint16_T *samplingfrequency, const int_T p_width1,
			SimStruct *S)
{
/* %%%-SFUNWIZ_wrapper_Terminate_Changes_BEGIN --- EDIT HERE TO _END */
/*
 * Custom Terminate code goes here.
 */

myTerminate(xD, pW, device, p_width0, samplingfrequency, p_width1);
/* %%%-SFUNWIZ_wrapper_Terminate_Changes_END --- EDIT HERE TO _BEGIN */
}

<file_sep>function blkStruct = slblocks
% This function specifies that the library should appear
% in the Library Browser
% and be cached in the browser repository

Browser.Library = 'simulinkBitalino_lib';
% 'mylib' is the name of the library

Browser.Name = 'CHL Bitalino';
%Browser.Name = 'Virtual Character Toolbox';
% 'My Library' is the library name that appears in the Library Browser

blkStruct.Browser = Browser;

<file_sep>cmake_minimum_required(VERSION 2.6)
PROJECT(testBitalino)

IF(WIN32)
 set(LIBS ${LIBS} ws2_32.lib)
ELSE(WIN32)
# set(IpSystemTypePath ip/posix)
ENDIF(WIN32)

#include_directories(
#  oscpack_1_1_0
#)

#link_directories(
#  oscpack_1_1_0/build/Release
#  ../oscpack_1_1_0/build/Release # if we build in the build subdir...
#)

ADD_EXECUTABLE(testBitalino testBitalino.cpp bitalino.cpp)
TARGET_LINK_LIBRARIES(testBitalino ${LIBS})

<file_sep>set_param('simulinkBitalino','EnableLBRepository','on');

# README simulinkBitalino module

This block reads measurements from a [BITalino](https://bitalino.com/en/) 'DYI physiology' device via Bluetooth.

Only tested on Windows.

- Bitalino code from: https://github.com/BITalinoWorld/cpp-api

## Workflow
- The basis of the module is the s-function generator on Matlab: `simulinkBitalino_dev.slx`
  - The block in this model will create the files `simulinkBitalino.cpp` and `simulinkBitalino_wrapper.cpp`
  - Do **not** edit these files.
  - Exclusively edit the custom code in `simulinkBitalino_mycode.cpp`
- Compile the code either from within `simulinkBitalino_dev.slx` or using `compile.bat`
- The library file is `simulinkBitalino.slx`

- "If you want the library to appear in the Library Browser, enable the model property EnableLBRepository before you save the library."
   `set_param(gcs,'EnableLBRepository','on');`

## Install
- Default location is `%USERPROFILE%\Documents\MATLAB\simulinkBitalino`

<file_sep>@echo OFF

set INSTALL_DIR=%USERPROFILE%\Documents\MATLAB\simulinkBitalino
echo copying files to %INSTALL_DIR%

mkdir %INSTALL_DIR%
copy simulinkBitalino_lib.slx      %INSTALL_DIR%
copy slblocks.m        %INSTALL_DIR%
copy simulinkBitalino.mexw64  %INSTALL_DIR%

pause
<file_sep>#include <mex.h>
#include "simstruc.h"

#include <string>
#include <iostream>
#include <sstream>
#include <conio.h>
#include "bitalino.h"

static const int iNrAnalogChannels = 4;
static const int iNrDigitalChannels = 4;

std::string int_array_to_string(const uint16_T * int_array, int size_of_array) {
  std::ostringstream oss("");

  for (int temp = 0; temp < size_of_array; temp++) {
    oss << (char)int_array[temp];
  }
  std::string str = oss.str();
  std::size_t found = str.find('\0');
  str = str.substr(0, found);
  return str;
}

void myStart(real_T *xD,
             void **pW,
             const uint16_T *device, const int_T p_width0,
             const uint16_T *samplingfrequency, const int_T p_width1,
             SimStruct *S) {
  try
    {

      std::string strDevice = int_array_to_string(device, p_width0);

      //std::string strDevice = "98:d3:31:b1:83:ea";  // "COM5" //PARAM
      // strDevice = "98:d3:31:b1:83:b0"; // "COM9"

      std::cerr << "Connecting to device \"" << strDevice << "\"" << std::endl;

      // use one of the lines below
      //      BITalino dev(strDevice.c_str());  // device MAC address (Windows and Linux)

      BITalino *dev = new BITalino(strDevice.c_str());
      pW[0] = (void *)dev;

      //BITalino dev("COM5");  // Bluetooth virtual COM port or USB-UART COM port (Windows)

      //BITalino dev("/dev/ttyUSB0");  // USB-UART device (Linux)
      //BITalino dev("/dev/rfcomm0");  // Bluetooth virtual serial port (Linux)

      //BITalino dev("/dev/tty.usbserial-A1000QIz");  // USB-UART device (Mac OS)
      //BITalino dev("/dev/tty.bitalino-DevB");  // Bluetooth virtual serial port (Mac OS)

      std::cerr << "Connection successful" << std::endl;

      std::string ver = dev->version();    // get device version string
      std::cerr << "BITalino version: " << ver.c_str() << std::endl;

      dev->battery(10);  // set battery threshold (optional)

      int iSamplingFrequency = 100; //PARAM 10, 100, 1000,

      dev->start(iSamplingFrequency, {0, 1, 2, 3, 4, 5});   // start acquisition of all channels at 1000 Hz
    }
  catch(BITalino::Exception &e)
    {
      std::cerr << "BITalino exception: " << e.getDescription() << std::endl;
      std::string strError = "BITalino error: " + std::string(e.getDescription());
      ssSetErrorStatus(S,strError.c_str());
    }

}

void myUpdate(real_T *outputAnalog,
              real_T *outputDigital,
              real_T *xD,
              void **pW,
              const uint16_T *device, const int_T p_width0,
              const uint16_T *samplingfrequency, const int_T p_width1){

  BITalino *dev = (BITalino *)pW[0];
  BITalino::VFrame frames(1); // initialize the frames vector with 100 frames

  dev->read(frames); // get 100 frames from device
  const BITalino::Frame &f = frames[0];  // get a reference to the first frame of each 100 frames block

  /*
    printf("%d : %d %d %d %d ; %d %d %d %d %d %d\n",   // dump the first frame
    f.seq,
    f.digital[0], f.digital[1], f.digital[2], f.digital[3],
    f.analog[0], f.analog[1], f.analog[2], f.analog[3], f.analog[4], f.analog[5]);
  */

  for(int i1=0; i1<iNrAnalogChannels; i1++){
    outputAnalog[i1] = f.analog[i1];
  }

  for(int i1=0; i1<iNrDigitalChannels; i1++){
    outputDigital[i1] = f.digital[i1];
  }

}

void myTerminate(real_T *xD,
                 void **pW,
                 const uint16_T *device, const int_T p_width0,
                 const uint16_T *samplingfrequency, const int_T p_width1){

  BITalino *dev = (BITalino *)pW[0];
  dev->stop();
  delete dev;

}

languages: CMake Markdown Batchfile MATLAB C++

repo_language: CMake

repo_name: bernuly/simulinkBitalino