Saturday, December 24, 2011

Realistic Water Reflection Effect

effect to create and you can add it to any photo you like, although it has to work best with images that don't already contain water in them. Here is the original image.


After making the filter effects, The below image seems like being closer to water source.


Tuesday, December 13, 2011

Students accounts with thier own folder

I have created this script for creating folder to upload their works during practical time. So when a student logged in to the system via network they have their own location to transfer the work files.

if (!file_exists($_SESSION['Folder']))
   {
   $thisdir = "E:\Sumith Bandara";
   mkdir($thisdir ."/".$_SESSION['Folder'] , 0777);
   
   header("location:control_panel.php");
   }//end file exists
   
For the val;idating the folder and get their names, The session variables are useful top perform the tasks. Here are the sample code for storing the value.

$sql_stu = "Select * from students where ID = '$row[id]'";
    $result_stu = mysql_query($sql_stu);
    $row_stu = mysql_fetch_array($result_stu);
    $folder_name = $row_stu['FirstName']." ".$row_stu['LastName']. " ".$row_stu['RegNo'];
    $_SESSION['Folder'] = $folder_name;

According to above code, the folder name will be created with row element which is retrived by the fetch array query.The site appearance will look like below.


Wednesday, November 30, 2011

Proposed DBMS diagram for Student Progressive System

Here I have written this php script to update their remote exercise folder with their own assessments. So students can upload them all into one directory with named by students. 

The log in section and new user registration section had managed totally by MySQL statements. For the administering section, I have allocated another script class which are related with sessions.

Every coding of the system has used OOP concepts in PHP. So It is more better and reliable than others.

My Pr-designed DBMS structured diagram is as follows.

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

Wednesday, September 7, 2011

Wall ready for demonstration of BEST (pvt) Ltd.






Mean by showing the entire path for the students with variety of choices. I feel them which has the powerful tools to encourage the nation with knowledge society. They are the BEST Team in competitive market.

  

Monday, September 5, 2011

code for Check if a table exists in MYSQL.

use this command:
mysql> show tables like 'your_table_name';

in your php script you can check:
if(row_count==1)
/* then table exists; */

You can also try .

SHOW TABLES;

or

SHOW TABLES 'your_table_name';

For checking DataBases:

SHOW DATABASES;

or

SHOW DATABASES 'your_db_name';

Getting mechine ID...!

Problem Description:
In order to activate or get passcodes for my license, I must provide a Host ID or Machine ID.

Solution:
When a license file is generated for a specific computer, it is locked to a number that is unique to that machine. For some UNIX machines, the 32-bit hostid is used. For Linux, Mac, and Windows machines, the ethernet (MAC) address is used. Optionally, on Windows computers, the IP Address can also be used.
 
Instructions for finding your Host ID or Machine ID:

Windows® (all)
For standalone licenses (including the Student version), the Host ID can be
  1. either the volume serial number of the C:\ drive (Option 1), or 
  2. the MAC Address (Physical Address) of the first Ethernet adapter (Option 2).For network licenses, the Host ID can be the MAC Address (Physical Address) of the first Ethernet adapter (Option 2) or 
  3. the IP Address of the first Ethernet adapter (Option 3).

Option 1: Volume Serial Number (Standalone licenses & Student Version only)
To obtain the Volume Serial Number, open a Command Prompt window, and run the command:

vol c:

Option 2: MAC Address (Physical Address, All licenses)
To obtain the MAC Address, open a Command Prompt window, and run the command:

getmac

Option 3: IP Address (Network licenses only)
To obtain the IP address, open a Command Prompt window, and run the command:

ipconfig


Tuesday, August 23, 2011

Load the MYSQL data into combo box element


The data from another table is used with HTML combo control, can maintain the accuracy of the database as well as relationship with them are verified with no objections.

my new code blocks will release on future in complete manner. Here are the few blocks only that can help for anyone with combo box control within form tag.
------------------------------
//Here is the place for connection with MYSQL

// Write out our query.
$query = "SELECT username FROM users";
// Execute it, or return the error message if there's a problem.
$result = mysql_query($query) or die(mysql_error());



Thursday, August 18, 2011

CSS interactive navigation menu...

For the DHTML Designing, we can achieve more effects with CSS. They have provided amazing functionality with designing objects in the Web site and it is getting rich and professional looking.

Here are the example coding of HTML.

The style sheet is looking like this.

ul.navigation
{
list-style:none; /* this line will remove any kind of bullet from the menu */
width: 160px; /* sets the menu width */
margin:0;
padding:0;
}

#menu a
{
display: block; /* this is a very important property here and it controls the way the menu elements are displayed - like block-level elements */
padding: 5px 3px 5px 10px; /* sets the padding properties */
font-weight:bold; /* sets the font weight */
background-color: #833331; /* sets the color of the background */
border-top: 1px solid #efefef; /* this code sets the line between the menu items */
}

#menu a:link
{
color: #efefef; /* sets the font color */
text-decoration: none;
}

#menu a:visited
{
color: #efefef;
text-decoration: none;
}

#menu a:hover
{
background:#100008 url(menu-arrow.gif) no-repeat left center; /* when the cursor is over, in the left side of the menu item background it will be display the arrow.gif picture */
text-decoration: underline;
text-indent:15px; /* this line of code move the text 15 px to the right */
}

#menu a:active
{
color: #efefef;
text-decoration: none;
}

Tuesday, August 16, 2011

Logout script in PHP 5...

Have set them all with Session variables in php and maintain the 100% security in the entire web site effectively.

here are the example code blocks for checking the user table in mysql database.

session_start();

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="lib_db"; // Database name
$tbl_name="members"; // Table name=

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and

password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
}
?>


I have verified the log-out script also as follows.

session_start();
session_destroy();
header("location:main_login.php");
?>


How display Log-in success message:
 
// Check if session is not registered , redirect back to main page.
// Put this code in first line of web page.
session_start();

if(!session_is_registered($_SESSION['myusername'])){
header("location:main_login.php");
}
?>;

Login Successful
session_start();
//echo $_SESSION['myusername'];
//echo $_SESSION['mypassword'];
?>





Table schema has been modified.


I have changed some little bit of Loan table as follows.

Here are code blocks of them.

CREATE TABLE Loans
(
LoanID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(LoanID),
BorrowerID int,
BookID int,
LoanDate date
);

Friday, August 12, 2011

CD Cover Design for Social Night of the RUSL


My last CD Cover for Social Night of the Rajarata University Of Sri Lanka.
This is 1st Draft Image.

Social network promotion



After Convert to vintage effect with Photoshop 7.0

This is the Original Image which I have selected.



Cargills Ceylon Ltd. Presentation Background Design







Monthly Tution Card example



with Photoshop CS3

Use Hidden field in HTML to navigate the information.



Here are some code blocks to navigate the ID value for updating the mysql query. But We can use the PHP session also with maximum performance and hihg reusable compatibility.

Thursday, August 4, 2011

Library Management System in web Server



source web site:
http://www.picnicpt-h.schools.nsw.edu.au/Faculty_Webs/TAS/IT/year12/InfoSysDB/2_3.htm
this database is refer with Library Management System.