Sunday, September 9, 2018

The .NET Framework Architecture


Common Language Specification (CLS)
Enables cross-language interoperability
Common Language Specification describes interoperability requirements
Inside CLS common type system (CTS) describe how different data types for the same constant should work together.
For example char array in C++ and Strings in C# can be used as sequence of alphabets.
CLS is what the languages must provide in order to work in the .NET Word.
This Specification is public so any one can write a language to work with .NET frame work but first to complete the CLS.
Over 15 languages  are  supported today by .Net.
C#, VB, Jscript, Visual C++ are from Microsoft, but there are  some other languages  also that use the same set of services as they came with CLS.
NET Classes (4 Areas)
ASP.NET:
ASP.NET provides the core Web infrastructure such as Web Forms development and Web Services.
Windows Forms:
User interface development on the Windows platform can be done using Windows Forms
ADO.NET:
Provide the means (functions, classes and so on..) for  data access.
Base Class Library:
Finally, the core base classes library (BCL) contains namespaces that group classes into common blocks of functionality for common and frequent use.
For example all the classes deals with files are in one namespace
Common Language Runtime (CLR)
CLR provide common runtime Environment for all .NET languages.
CLR purpose is to run and load Application compiled to Microsoft Intermediate Language (MSIL) or IL in short.
CLR manages basic services of .NET such as:
Memory management
Garbage collection
Exception Handling
Loading/Running Applications
CLR with Managed and Un-Managed code
CLR allow the applications to run the managed and unmanaged code.
Unmanaged code runs out side the CLR.
For example VB6/C++ code compiled w/o .NET
Managed code runs within the CLR and get benefits of the CLR  features( Memory management, Garbage Collection and So on).









NET Framework Base Class Library

BCL consists of classes that provide base functionality for .NET Framework
And many classes that make your life as developer easier
Library of classes used by all .NET applications
Contains large number of classes (Block of functionality, properties and events) grouped into namespaces
Each class within namespace has a unique name.
BCL’s namespaces group classes into common blocks of functionality.
For example all the classes deals with files are in one namespace i.e. System.IO
Some BCL namespaces…
System
That includes the basic data types like integer, string, time, Boolean and so on.
Some console and input/output, garbage collection and memory management functions.
System.Data
Including the classes dealing with data including ODBC, SQL server, data sources and so on.
System.IO
Have functionality about working with streams and disks i.e. moving data from one place to an other.
System.Text
Dealing about string and texts. Converts data from block of bytes to texts and so on.
System.Text.RegularExpresions
Providing some magic of string operations and matching of data.
System.Web
Provide design and run time support for web application.
System.Windows.Forms
Provides the support for using and designing the windows application and its controls.
System.Text.RegularExpresions
Providing some magic of string operations and matching of data.
System.Web
Provide design and run time support for web application.
System.Windows.Forms
Provides the support for using and designing the windows application and its controls.
System.Collections.Generic
Deals with the safe-type-caste provide conversion between data values.
If different names for the same data type are there in different language then this class ensures the .NET that actually they are the same. E.g. int in C++ is same to integer in VB.net and numeric of SQL.
System.Linq
Providing classes to link a source and enable the application to query the data.
Design for
A Simple window application  Add, Subtract, and Multiply

 




Addition Code

private void btnAdd_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result=num1+num2;
            rslt = result + "";
            txtResult.Text = rslt;
Subtraction Code
private void btnSub_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result = num1 - num2;
            rslt = result + "";
            txtResult.Text = rslt;
       }
Multiplication Code
private void btnMul_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result = num1 * num2;
            rslt = result + "";
            txtResult.Text = rslt;
        }





Thursday, August 30, 2018

Introduction


Introduction to C#

Officially Microsoft define C# as  a “simple, modern and object-oriented language derived from C and C++.”
But most independent observations would change this description to “derived from C, C++ and Java.”
Because syntactically C# is very similar to C++ and Java.
As many of the key words are the same for example the same braces ({}) to block a piece of code, (;) for separation of statements from each other and the way to get the data from external source which is out of .NET Environment.
To discuss more about C# language and its associated environment, the .NET Framework, as the most important technology for developers for many years, the following should be considered.
Net Framework as a run time environment for MS Windows 2000 and onward - is a fresh start for Microsoft rather extending the existing code base again and again.
As the point will come that the extension to existing code will become more complex with a passage of time. 
The time will come that compatibility will have no value for outdated products.
Finally, caused .Net Frame Work.
.NET is designed to provide a new environment where you can develop almost any application to run on OS (windows).
While C# is a new programming language that has been designed specifically to work with .NET.
Using, C# we can create a classic window desktop application, a database access component, a component of distributed application, a dynamic web page and XML web service.
C# provides a means for you to code up any type of software or component you need to write for the windows platform.
Using, C# we can create a classic window desktop application, a database access component, a component of distributed application, a dynamic web page and XML web service.
C# provides a means for you to code up any type of software or component you need to write for the windows platform.
Need of .NET and C#…
In order to understand the significance of .NET, it is useful to remind that in past history of operating systems, although they may look quite different on the surface, but all of the window operating systems from window 3.1 (introduced in 1992) through windows server 2003 have the same familiar Windows API at their core.
As we progress to the new versions of windows, huge numbers of new functions have been added to the API, but this has been a process of evolving and extending the API rather than replacing it
Microsoft choose this evolutionary approach to software for the obvious reason that it is concerned about the backward compatibility.
Over the years a huge base of third-party software has been written for windows, and windows wouldn’t have enjoyed the success it has had if every time Microsoft introduced a new technology that broke the existing code base!
Backward compatibility is an essential feature of Windows technologies but extending the existing code has a big disadvantage.
Every time technology evolves and add new features it becomes more complicated than it was before. 
So now it is clear that in case something had to change. Microsoft could not go on forever extending the same development tools and languages, always making them more and more complex in order to satisfy the conflicting demands of keeping up with the newest hardware and maintaining backward compatibility.
There comes a point where you have to take new start with a clean line if you want a simple yet sophisticated set of languages, environment and developer tools, which make it easy for developer to write state-of-the-art software.
This fresh start is what C# and .NET are all about. Clearly .NET is a framework (An API) for programmers of different skills.
While C# is a language that has been designed from scratch to work with .NET, as will as to take advantage of all the progress and OOP principles that have taken place over the past 20+ years.
We should make it clear that the backward compatibility has not been lost in the process. Existing programs will continue to work, and .NET designed with ability to work with these programs.
Presently communication between software components on windows almost entirely takes place using COM (Component Object Module).



Sunday, July 23, 2017

Network Cable

The following are types of cables used in computer networks.
Network Cable
The network cable is used to connect to and transfer data between computers and the network. There are several types of network cables and the right type to use, depends on the structure and topology of your network. The examples of network cables are Twisted pair, Coax, Ethernet and fiber optic junction.
Unshielded Twisted Pair-UTP
The UTP (unshielded twisted pair) is used in many Ethernet networks. It consists of four couples who accommodated in the cable covering. Each pair is rotated in some additional twists to disturbance of other devices on the network. The structure of this type of cable increases the reliability and helps minimize network failures.
Coaxial Cable
The coaxial cable or coax another important type of network cable. It has a copper conductor in the middle of it and a plastic coating acts as an insulator between the Central conductor and a metal shield. The cable is then covered with a coating. The lining can think or thick-thicker padding that less flexible is an extra protection.
Ethernet Cable
The Ethernet crossover cable is used to a computer network consists of two or more computers to connect. This type of network cable eliminates the need for network switches and routers. The cable also connects computers using their network adapters, such as a network interface card (NIC).
Fiber Optic Cable
The fiber optic grid is used for networks that extend over large distances. The fiber optic cable consists of several layers, protective lining. Also sends light in contrast to electrical signals as other cables. This feature of fiber optic cable makes it an ideal cable for  large amounts of electrical interference in the network. It transmits information at high speed and is therefore used in large network environments such as those used by large companies.

Network Threats or Viruses

There are many network threats today, which are spread over the internet. The most common include the following.
1-Viruses
2-Worms
3-Trojan horses 
4-Spyware 
5-Zero-day attacks, also called zero-hour attacks 
6-Denial of service attacks 

1-Viruses
-    A virus is a computer code (written with the express intention to replicate itself) that can attach itself to a program, file, hardware and can spread computer to computer.
-    As a virus move from one computer to another it damages hardware, software and files also.

2-Worms
-    Worms are subclasses of viruses, it can spread itself without user action across the network.
-    Worms are just like viruses, but the worms have ability to spread themselves so automatically and rapidly.
-    For example, if there is a worm in your system, then it can send itself by email to all of your contacts and then these computers further send worms. This causes a heavy stream of network traffic, which can slow down business networks by using network bandwidth.

3-Trojan Horses
-    Trojan horses appear to be software, but they compromise with your security and can damage your network hardware, files. 



4-Spyware
-    Spyware is a general term that is used to describe software which performs the following actions on your computer without your consent (permission).
1-    Advertising
2-    Collection of personal information.
3-    Changing the configuration of your computer.
Above action can slow down or damage your computer.
Spyware can come in the following ways.
1-    Application/software installation.
2-    Email.
3-    Web sites.

5-Zero Day/Zero Hour Attack
-    Zero day/zero hour attacks those tries to destroy computer hardware, files and software and about which vendors have no information.
-    There is no security available for zero day/zero hour attacks.

6-Denial of Service Attack
-    DOS or DDOS is an attempt to make resources unavailable to its intended user.
-    One common method of DOS or DDOS is penetrating the target machine with external communication requests.  


Sunday, July 16, 2017

شما مى توانيد و شما قهرمان هستيد

اشپيگل آلمان به نقل از مسلم شيرزاد: 'دل شير ندارى، سفر عشق مكن'
بخش از نوشته مجله اشپيگل آلمان كه به چاپ رسيد: مسلم شيرزاد رييس ٢٧ ساله دانشگاه جهان نور يك ستاره رسانه يى است، او مدت شش سال گرداننده برنامه هاى برجسته سياسى تلويزيون طلوع بوده است.
شيرزاد مى گويد به ٥٠ كشور سفر نموده، اما اروپا براى اروپايى ها، آستراليا براى آستراليايى ها و افغانستان براى ما خوب است، ما آينده عالى داريم
وقتى از شيرزاد پرسيده مى شود، اما فساد، بيكارى و ناامنى افغانستان چطور؟
شيرزاد با متل افغانى پاسخ مى دهد: دل شير ندارى سفر عشق مكن
.درسى كه شيرزاد به دانشجويانش در دانشگاه جهان نور مى دهد اينست كه من بالاى شما اعتماد دارم، شما مى توانيد و شما قهرمان هستيد

از صفحه مسلم شیرزاد

Tuesday, September 6, 2016

همیشه مهربان خواهم ماند .
حتی اگر کسی قدر مهربانیم را نداند.
من خدایی دارم که به جای همه برایم جبران میکند….

The .NET Framework Architecture

Common Language Specification (CLS) Enables cross-language interoperability Common Language Specification describes interoperabili...