Computer engineering - C# php asp .Net SAP SQL: April 2008

Friday, April 11, 2008

Linear Algebra - Sytems of linear equations

Here are some linear algebraic questions :P These are the question and will send their solution at next article.

1.Which condition must be placed on a, b, and c so that the following system of equations has a solution?



2. Determine if the given system has a nonzero solution.



3. Determine the values of a so that the given system of linear equations has (i) no solution,(ii) more than one solution, (iii) unique solution.



4. Consider the system of linear equations. Suppose that the system has only the trivial solution when all bi are zero. Show that this system has a unique solution for every other choice of the constants bi.

Thursday, April 10, 2008

Php Code for Membership Panel

These, the codes below is the part of an HTML code for the form of member login.





here is the starting point of the php codes:

ob_start();
include "baglantidosyasi.php";
/* First we get the inğut datas by POST method. */
$kullanici=$_POST["kullanici"];
$sifre=$_POST["sifre"];
$sifrelisifre=md5($sifre); /* Burada Sifreyi md5 leyelim */
/*We are checking username and the password if they are empty */
if(($kullanici=="")or($sifre=="")){
echo "Please do not enter space!!!";
}else{
/*If the pasword and the username is not empty*/
$uyesor=mysql_query("select kullanici,sifre from uyelik where kullanici='$kullanici' and sifre='$sifrelisifre'");
if(@mysql_num_rows($uyesor)>0){
echo "
Welcome $kullanici
";
setcookie("kullanici",$kullanici);
echo "Please Click For Backward HomePage";
}else{
echo "Not Success!...";
}
}
?>



ob_start();
/*Let's check out the cookies if they are empty then the enterance screen will appear*/
$cookie=$_COOKIE["kullanici"];
if($cookie==""){
echo 'Üye Ol | Üye Girişi Yap | ';
}else{
$tarih=date("d/m/y");
echo "Welcome $cookie | Now Date $tarih ";
}
?>



Baglantidosyasi.php

$hostadresi="localhost";
$kullaniciadi="";
$sifre="";
$ad="";
$dbadi="uyelik";
@$baglan=mysql_connect($hostadresi,"root","") or die ("Mysq Bagalkanadmi");
@mysql_select_db($dbadi,$baglan) or die ("vt Bagalkanadmi");
?>

Try to decode =))
Good Luck!!!

Tuesday, April 8, 2008

Design Report of a Dynamic Website

We choose Waterfall model because it gives the benefits of feedbacks that are very effective. This software development life-cycle model enhanced with the integral processes given below in Drawing.



Sequence Diagram for dynamic website:

Scenario:

 We have an project file to be uploaded in the projects part.
 To do this process, firstly we need to log in with and admin username and password. Checking out login process from users table at the database.
 Having done that, then the control panel for admin will be displayed.
 By using control panel, admin will upload the file from his/her own PC to the projects part of the website.



Comunication Diagram

Our comunication diagram has the same scenario with the sequence diagram above. It does not shows the liftime of the messages, instead it shows the interaction between the processes.

Sunday, April 6, 2008

Explanation of the Database Creation Code

Firstly as you have seen at the article from this one we have created 4 tables : report, employee, factory, part to store the datas.
--> Why we use dbms? We use them to store the datas in a tidy fashion. I mean assume that you are storing the entire data in the same file. In this condition you need to read all the file and try to get the data you need to use. Since we want to access the desired datas in an acceptabşe time period we need to use database systems. I think it is clear enough why we created 4 tables(dividing the entire data).

Then, in the code piece

create table report(
report_ssn int not null,
primary key (report_ssn))

We are creating the table report and we are saying that we gone store in this tale te report_ssn in iteger type and it is the primary key of our table.
--> What is primary key? Primary keys are the special fields in the table which are uniquely identifies a data in that table. For instance if i am storing your and my other friends' names ssn_nos and surnames in a table called friends, then i can find out your informations by typing your ssn number since it uniquely identifies you.

In this code piece

create table employee (
ssn int not null,
e_name varchar(20) not null,
salary int not null,
report_ssn int not null,
fac_id int not null,
primary key (ssn),
foreign key (report_ssn)references report(report_ssn))

We are creating the table employee and storing the required datas in the fields. We set our ssn field as primary key and report_ssn field from report table as foreign key.
-->What is foreign key?Foreign keys are used to combine two related tables. I mean if i want to know which employee report whom i combine the tables employee and report with a foreign key. A foreign key can be created if it is a primary key in which table we want to combine and if there is a limitation as at most one!

In this piece of code

alter table employee add
foreign key(fac_id) references factory(fac_id)

We are altering the table amployee. We are adding a foreign key from the table factory to combine two tables.By using the code 'alter table' you can add or delete some fields from the tables as well.

Whit these explanations you can examine the code i have written in the article before:))

Good Luck!!!

Friday, April 4, 2008

Creating Database System (DBMS)

Here is the question below! We will create a database according to these criterias:

You have just been hired as a consultant for a big airplane manufacturer. They want you to completely redesign their database system. Talking with the people in the company, you get the following information.
1-The database contains information about employees, factories and parts.
2-Each employee has a social security number (SSN), name and salary. An employee is uniquely identified by his/her SSN.
3-Each factory has an id, a name and a budget. The id uniquely identifies a factory.
4-Each part has an id and a name. The id uniquely identifies a part.
5-Each employee reports to at most one other employee.
6-Each employee works in at least one factory.
7-Each part is manufactured in exactly one factory.

Here is the answer of the question:

create table report(
report_ssn int not null,
primary key (report_ssn))

create table employee (
ssn int not null,
e_name varchar(20) not null,
salary int not null,
report_ssn int not null,
fac_id int not null,
primary key (ssn),
foreign key (report_ssn)references report(report_ssn))

create table factory (
fac_id int not null,
fac_name varchar(20) not null,
budget int not null,
ssn int not null,
primary key (fac_id),
foreign key (ssn)references employee(ssn))

create table part(
part_id int not null,
part_name varchar(10) not null,
fac_id int not null,
primary key (part_id,fac_id),
foreign key (fac_id) references factory (fac_id))

alter table employee add
foreign key(fac_id) references factory(fac_id)

Try to decode the code above firstly! I will explain the code at the next article (=

Hint: Since i could not captured the fac_id foreign key into the employee table when i am creating i added the foreign key by alter table.I could not captured that foreign key first since the table factory and the table employee include each other's primary key as foreign key.So i needed to create factory table first and than add the foreign key by alter table.