Friday, November 18, 2011

Students Progressive System.

Here we can analyze the students status with their individual assessments score and how they make the score higher with chart.

Here is the code for uploading assessments to the server.
 HTML Script:

<form enctype="multipart/form-data" action="upload.php" method="POST">
      <input type="file" name="fileUpload" />
   
      <input type="submit" value="Upload" />
</form>
PHP Script "upload.php":

//if you have selected, the shift from temporary memory to the destination folder
//with the integrated PHP function move_uploaded_file()
if (move_uploaded_file(
$_FILES['fileUpload']['tmp_name'],"./Students Files/".$_FILES['fileUpload']['name']))
{
echo '<p>File sent successfully</p>';
}
else{
//if the file is not uploaded, inform it with a message
echo '<p>We could not upload the file</p>';
}

banner design for the page:

Wednesday, November 2, 2011

Practical view of OOPs Concept in PHP and MySql

For the display of the Menu on each page which has been opened, there is created a class and declare their object on location where you want to display them in your php script.


PHP class script "menu.php":

class Menu{
function set_Menu()
{
echo"<a href='/default.php'>Home</a>";
echo " ";
echo"<a href='/tutorials.php'>Tutorials</a>";
}
}


PHP Script:

<div class="leftmenu">
<?php
include("menu.php");
$objVar = new Menu();
$objVar ->set_Menu();
?>
</div>

Here I have mentioned the few code blocks for relating to the database and it is reduced the complexity of the codings and software bugs.

<?php
//declare the parent class
class database
{
//create variable
var $con;
var $results;
public $msg;


//declare function for connecting database
function set_db()
{
//here is the code for connecting database
$this->con=mysql_connect("localhost","root","");
//end of the function
}

//declare getter function for connection to database
function get_db()
{
return $this->con;
//call another function if the connection was not established
return $this->get_exception();
}

//declare the exception function for the connection
function get_exception()
{
if (!$this->con)
  {
  return('Could not connect: ' . mysql_error());
  }
}

//declare the fucntion for selecting database
function select_db()
{
$this->db = mysql_select_db("lib_db", $this->con);
}

//declare the setter function for executing query
function set_query($query)
{
////sotring values by retriving parameter from the main php file
$this->results = mysql_query($query);
}

//declare the getter function for returning the values
function get_query()
{
return $this->results;
}

//declare the function for closing the mysql connection
function close_db()
{
//code for closing mysql connection
mysql_close($this->con);
}

function execute_query($sql)
{

if (!mysql_query($sql,$this->con))
  {
  return('Error: ' . mysql_error());
  }

}

function set_message($message)
{
$this->msg = $message;
}

function get_message()
{
return "<b><font size=5 type=verdana color=blue>".$this->msg."</font></b>";
}
}
 

Hereafter we call them at any time ,any location with any no of objects. See sample code...


//link class library
include("class_database.php");


//define object for the class
$objDB = new database();


//call their method for calling setter function
$objDB->set_db();


//calling getter function for connection
$objDB->get_db();


//calling the function for selecting database
$objDB->select_db();


//store all information after execute query.
$objDB->execute_query("INSERT INTO Books(TitleID,Notes)VALUES('$_POST[titleids]','$_POST[notes]')");

//calling setter function for message
$objDB->set_message("You have succesfully 1 record added");




Analog Stations- Control PCB Found with Controls

Analog stations offer “simple value” for new applications.  These tough and proven controls will directly replace Strand’s MicroControl line of analog stations.  Available from single to 12 channel with master, preset and take control functions.

But  here I have used 7 control analog equalizer for two channel speakers.









These universal stations are commonly supplied for 0-10VDC applications but can be used in applications up to 28VDC making them excellent choices for retrofitted almost any analog station. Specially for the MP3 song playing or dual channel video watching with front speaker of the surround system.


Completed Control PCB has been followed.



Thursday, October 27, 2011

Equlizer Project For Controlling wide band of Frequency.

Here is the Preamplifier unit for Sub-woofer and Central speaker.





For the separate channel of the Treble and bass sound, They have variable resistor for controlling the gain







 For controlling each channel such as Balance, Volume, Bass and Treble, they have included quad OP-Amp per each section using UPC4558



The variable resistors are enabled dual controlling functionality for the Bass and treble sound. Entirely four variable resistors are used for controlling left and right channel.






Seven Band Graphic Equalizer system for Front speakers.

Back side of PCB



By using few comparator, we can make the controller with wide band of frequency.











Single PCB for one channel

double PCB for stereo




This circuit can control only 7 band of the sound. For buffer of the sound, they have used NE5534 op-Amp.

Wednesday, October 5, 2011

Form Validation

 -- NON EMPTY FIELDS VALIDATION
 --Here is the script for validate them all--
 <script type='text/javascript'>
function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus();
		return false;
	}
	return true;
}
</script>
 --This is the code for controllers in the form--
<form>
Required Field: <input type='text' id='req1'/>
<input type='button' 
	onclick="notEmpty
(document.getElementById('req1'), 'Please Enter a Value')"
	value='Check Field' />
</form>
 
-- ALL NUMBERS ONLY FIELDS 
<script type='text/javascript'>
function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
</script>
<form>
Numbers Only: <input type='text' id='numbers'/>
<input type='button' 
	onclick="isNumeric
(document.getElementById('numbers'), 'Numbers Only Please')"
	value='Check Field' />
</form> 
 
--ALL LETTERS CHECKING FIELDS
<script type='text/javascript'>
function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
</script>
<form>
Letters Only: <input type='text' id='letters'/>
<input type='button' 
	onclick="isAlphabet
(document.getElementById('letters'), 'Letters Only Please')"
	value='Check Field' />
</form> 
 
--FIELD SIZE VALIDATING
<script type='text/javascript'>
function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}
</script>
<form>
Username(6-8 characters): <input type='text' id='restrict'/>
<input type='button' 
	onclick="lengthRestriction
(document.getElementById('restrict'), 6, 8)"
	value='Check Field' />
</form>
 
--SELECTION BOX VALUE CHECKING
<script type='text/javascript'>
function madeSelection(elem, helperMsg){
	if(elem.value == "Please Choose"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}
</script>
<form>
Selection: <select id='selection'>
<option>Please Choose</option>
<option>CA</option>
<option>WI</option>
<option>XX</option>
</select>
<input type='button' 
	onclick="madeSelection
(document.getElementById('selection'), 'Please Choose Something')"
	value='Check Field' />
</form> 
 
--E-MAIL FIELDS CHECKING
<script type='text/javascript'>
function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
</script>
<form>
Email: <input type='text' id='emailer'/>
<input type='button' 
	onclick="emailValidator1
(document.getElementById('emailer'), 'Not a Valid Email')"
	value='Check Field' />
</form> 
 
--ALL FORM EVENTS VALIDATING
--HTML CODE
<form onsubmit='return formValidator()' >
First Name: <input type='text' id='firstname' /><br />
Address: <input type='text' id='addr' /><br />
Zip Code: <input type='text' id='zip' /><br />
State: <select id='state'>
	<option>Please Choose</option>
	<option>AL</option>
	<option>CA</option>
	<option>TX</option>
	<option>WI</option>
</select><br />
Username(6-8 characters): <input type='text' id='username' /><br />
Email: <input type='text' id='email' /><br />
<input type='submit' value='Check Form' /><br />
</form>
--JAVASCRIPT CODE 
function formValidator(){
	// Make quick references to our fields
	var firstname = document.getElementById('firstname');
	var addr = document.getElementById('addr');
	var zip = document.getElementById('zip');
	var state = document.getElementById('state');
	var username = document.getElementById('username');
	var email = document.getElementById('email');
	
	// Check each input in the order that it appears in the form!
	if(isAlphabet(firstname, "Please enter only letters for your name")){
		if(isAlphanumeric(addr, "Numbers and Letters Only for Address")){
			if(isNumeric(zip, "Please enter a valid zip code")){
				if(madeSelection(state, "Please Choose a State")){
					if(lengthRestriction(username, 6, 8)){
						if(emailValidator
(email, "Please enter a valid email address")){
							return true;
						}
					}
				}
			}
		}
	}
	
	
	return false;
	
}
 
Source Link http://www.tizag.com/javascriptT/javascriptform.php