and then enjoy !!
Friday, February 15, 2013
Friday, August 24, 2012
windows 8 enterprise step by step installation
Simple steps to install windows 8 enterprise
it's not need to comment !
simple tour inside windows !
start screen
size of installed windows
start screen metro style
applications screen
if you need to play music
what about weather now !
it's not all about windows, try it now click here
Tuesday, July 10, 2012
C# Try catch .
n If you need handling
errors in your program use try/catch block .
n try/catch block can control the errors without
exit program .
n try/catch block consists
of two part
o
Try Block : put all
your code in this block .
o
Catch Block : write
code that will handling the error when it's occurred .
§ you can use type of Catch
to control specific error.
·
ArithmeticException : this
catch specialized in numerical errors
·
IndexOutOfRangeException : this catch specialized errors that occurred when an index is
outside the boundary of an array .
§ You can have multi catch
in your code each one specialized in specific error . in this case one block of
catch can be occurred .
Example 1:
public void
action()
{
try
{
int x = 5;
int y = 0;
int z = x / y;
}
catch
{
Console.WriteLine("an
error occurred");
}
}
or
try
{
int x = 5;
int
y = 0;
int z = x / y;
}
catch(ArithmeticException
ex)
{
Console.WriteLine("your
error is :");
Console.WriteLine(ex.Message);
}
Example 2 :
try
{
int[] x = new int[2];
x[0] = 85;
x[1] = 44;
x[2] = 33;
Console.WriteLine(x[2]);
}
catch(IndexOutOfRangeException
e)
{
Console.WriteLine("your
error is :");
Console.WriteLine(e.Message);
}
Example 3 :
public void action()
{
try
{
// write your code here
}
catch
(IndexOutOfRangeException err)
{
Console.WriteLine("your
error is :");
Console.WriteLine(err.Message);
}
catch (ArithmeticException
ex)
{
Console.WriteLine("your
error is :");
Console.WriteLine(ex.Message);
}
catch
{
Console.WriteLine("an
error occurred");
}
}
Tuesday, May 15, 2012
Using StringBuilder
Example 1
StringBuilder My_StringBuilder = new StringBuilder();
for (int x = 0; x
< 10; x ++ )
{
My_StringBuilder.Append(x);
}
MessageBox.Show(My_StringBuilder.ToString());
Example 2
StringBuilder
My_StringBuilder = new StringBuilder();
for (int x = 0; x
< 10; x ++ )
{
My_StringBuilder.Append(x).Append(",
");
}
MessageBox.Show(My_StringBuilder.ToString());
Example 3
StringBuilder My_StringBuilder = new StringBuilder();
My_StringBuilder.AppendLine("list of
Categories:");
My_StringBuilder.AppendLine("-------------------");
My_StringBuilder.Append("1-Category1").AppendLine();
My_StringBuilder.Append("2-Category2").AppendLine();
My_StringBuilder.Append("3-Category3").AppendLine();
MessageBox.Show(My_StringBuilder.ToString());
Example 4
StringBuilder My_StringBuilder = new StringBuilder("my string in my code");
My_StringBuilder.Replace("my",
"your");
MessageBox.Show(My_StringBuilder.ToString());
Example 5
StringBuilder
My_StringBuilder = new StringBuilder("my string in my code");
My_StringBuilder.Remove(9, 11);
MessageBox.Show(My_StringBuilder.ToString());
Saturday, May 12, 2012
Working with LINQ
Working
with LINQ (1)
Write the following code inside button in windows form .
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert",
"George",
"Harris", "David"
};
IEnumerable<string> query = from
s in names
where s.Length == 5
orderby s
select s.ToUpper();
foreach
(string item in
query)
MessageBox.Show(item);
Working with LINQ (2)
Step 1 : Create database
create database HRDB
Step 2 : creating the following table
create table People (
Name nvarchar(32) primary key not null,
Age int not
null,
CanCode bit not
null
)
Step 3 : Add the following data into People table
Step 4 : Add the following two lines above class form .
using
System.Data.Linq;
using
System.Data.Linq.Mapping;
Step 5 : Write the following block of code into project
[Table(Name = "People")]
public
class Person
{
[Column(DbType = "nvarchar(32)
not null")]
public string Name;
[Column]
public int Age;
[Column]
public bool CanCode;
}
Step 6 : Design form .
Step 7 : inside Show Data button, write the following code .
DataContext context = new DataContext(
"Data
Source=.;Initial Catalog=HRDB;Integrated Security=True");
Table<Person>
custs = context.GetTable<Person>();
var query = from c in custs
select
new
{
c.Name,
c.Age
};
foreach (var item in query)
{
listBox1.Items.Add(item.Name
+ "-" + item.Age);
}
Project Layers
Any project should consist of
three layer, Dataabase, Classes and forms layer. Each one of these layer
contain objects that need to create and develop.
Application Life cycle developing components
Database Layer, Contains objects such as Database files,
tables, View, Functions and Stored procedures. Programmer will create and
develop each of these objects.
Database Layer Components.
1-DatabaseFiles: that will
store all objects of the project.
2- Tables: tables created
to storing row data and normalize it.
3-Stored Procedures: SPs or
Stored Procedures keeps the actions that needed to be fired when project want.
4- Functions: Keeps all
answers for all questions needed to be answered for project.
5- Views: project needs
Views for displaying Reports.
After finishing Database layer,
programmer needs to call these objects from application. To do that, programmer
need to developing Classes Layer.
Classes Layer, created in the application development
environment by Classes files. Each of class refer to one object in the database
Layer.
For example, Emp_Tbl is a
table object in the database layer. For manipulate with this object its need to
create Class with name Cls_Emp, and so on with all tables in the
database.
Classes Layer Components.
Create Class file for each table
in the Database. Each class will contain blocks of code that will work with
Store Procedures and Functions that associated with specific table.
|
ID
|
Database Layer
|
Classes Layer
|
||
|
Table Name
|
Associated Objects
(Store Procedures, Functions) |
Blocks of code in Class
(Methods) |
Class Name
|
|
|
1
|
Dep_Tbl
|
Dep_Insert_SP
|
Dep_Insert
|
Cls_Dep
|
|
Dep_Update_SP
|
Dep_Update
|
|||
|
Dep_Delete_SP
|
Dep_Delete
|
|||
|
Dep_SelectALL_Fun
|
Dep_SelectALL
|
|||
|
Dep_GetInfo_Fun
|
Dep_GetInfo
|
|||
|
Dep_GetMax_Fun
|
Dep_GetMax
|
|||
|
2
|
…
|
…
|
…
|
…
|
On the other hand, Working with
Forms layer need first finish the previous layer in order to avoid errors,
change Requests issues and Work around.
Forms Layer, means Working with User interface of the
project and how to let the application interface to communicate with database
layer throw classes layer. Forms layer contains a set of files. Each file
consists of set of controls that will display for user to let him interacting
with data of project.
Forms layer Components.
One or more classes in the class's
layer will be act with one form in the forms layer.
|
ID
|
Table Name
|
Class Name
|
From Name
|
Form Search
|
|
1
|
Dep_Tbl
|
Cls_Dep
|
Frm_Dep
|
Frm_Dep_Search
|
|
2
|
…
|
…
|
…
|
…
|
Subscribe to:
Posts (Atom)










































