Articles by "Software Engineering"

3D printing Aerodynamic engineering Aeronautical engineering Aeronautical engineering books Airports Architecture Artificial intelligence Automobiles Blast Resistant Design Books Bridges Building Codes Cabin Systems Civil Engineering Codes Concrete Conferences Construction Management Construction Materials Cooling Cryptocurrency Dams Do it Yourself Docks and Harbours Downloads Earthquake Engineering Electronics Engineering Engines Environmental Design & Construction Environmental Engineering Estimation Fluid Mechanics Fluid Mechanics Books Formwork design foundation engineering General Geotech Books Geotechnical Engineering Global Positioning System HVAC Hydraulics Hydraulics Books Hydro Power Hydrology Irrigation Engineering Machinery Magazines Management Books Masonry Mechanical Engineering Mechanics Mechanics Books Miscellaneous Books Modern Steel Construction Nanotechnology Natural Hazards Network Security Engineer Networking Systems News Noise and Attenuation Nuclear Engineering Nuclear Hazards to Buildings Pavement Design Prestressed Concrete Project Management Project Management Books Quantity Survey Quantity Survey Books railways RCC Structural Designing Remote Sensing Remote Sensing and GIS Books Renewable Energy Reports Resume Roads scholarships Smart devices Software Software Engineering Soil Mechanics Solar Energy Special Concrete Spreadsheets Steel Steel Spreadsheets Structural Analyses structures Structures Books Surveying Surveying Books Testing Thermodynamics Thesis Transportation Books Transportation Engineering Tunnel Engineering Wind Energy Zero Energy Buildings
Showing posts with label Software Engineering. Show all posts

Terrifying Warning Against AI-Based Weapons 'Slaughterbots'
Screenshot from the short film 'slaughterbots' showing people flee
during the rampage of AI based automated killing robots
The video taps into what could happen if AI killing machines became politicized tools of war -- the exact thing that tech leaders around the world fear most for our future.

Artificial intelligence is to the point where it barely needs humans to code itself. The applications seem endless. Automated services, generating content, basic care and services can all be greatly improved with the introduction of AI.


But what about weaponry?


This short film called Slaugherbots serves as a horrific prediction of what could happen should automated weaponry overrun the need for protection in our world.


[WARNING: The following video does contain violence and images of injury and even death. Viewer discretion is advised.]




For those who support AI-based weaponry, it's an object without feelings that can do the work of a military while saving officers from potentially devastating situations -- both mentally and physically. 

And while there aren't governments openly and brazenly funding it now, AI-driven weaponry was a big enough threat to send Elon Musk, Stephen Hawking, and other industry leaders to pen a letter to the United Nations begging them to preemptively work toward putting together solutions.


The video opens a bit like Tesla's semi truck reveal, actually. The press event swayed the audience into ooos and ahhhs as they watch miniaturized, AI-driven robots kill a group of "bad guys" during the demonstration. The press speaker encourages the enthusiasm, promising that all it takes to program these drone bots with a profile is someone's age, sex, fitness, uniform, and ethnicity.


However, as with a lot of technology, the drones fall into the wrong hands. The AIs get hacked and target one single group of politicians. They later break through concrete and glass to kill university students who had all shared a video exposing the injustices of the drones and their policies.


At the end of the video, you're left wondering if this is what Elon Musk sees when he rails against autonomous AI weaponry being developed.


And it's not just Musk. Stuart Russell works at the University of California Berkeley as a leading AI scientist. He said the world is closer to integrating autonomous weapons than we are self-driving cars.


"The technology illustrated in the film is simply an integration of existing capabilities. It is not science fiction. In fact, it is easier to achieve than self-driving cars, which require far higher standards of performance," Russell said in an interview with the Guardian.

Russell also pointed out similar issues in the video for the non-profit Stop Autonomous Weapons.
"I've worked in AI for more than 35 years," says Russell in the video. "Its potential to benefit humanity is enormous, even in defense, but allowing machines to choose to kill humans will be devastating to our security and freedom."


"Thousands of my fellow researchers agree. We have that opportunity to prevent the future you just saw, but the window to act is closing fast."


Those researchers include Noel Sharkey, emeritus professor of AI at Sheffield University who notably tried warning the robotics community about this issue in 2009.


“The movie made my hair stand on end as it crystallizes one possible futuristic outcome from the development of these hi-tech weapons,” he said. “There is an emerging arms race among the hi-tech nations to develop autonomous submarines, fighter jets, battleships and tanks that can find their own targets and apply violent force without the involvement of meaningful human decisions. It will only take one major war to unleash these new weapons with tragic humanitarian consequences and destabilization of global security.”

(Article added on special request.)
A nice and well organized resume plays a pivotal role in getting your documents through the first phase of recruitment. It not only shows one's credentials but also how one organizes information, how presentable he or she is and many other traits preferred by the recruiters. Below are some concise segments for network security engineer resume. Of course they can be tailored or expanded to fulfill individual requirements.

OBJECTIVE

Seeking a challenging, growth-oriented position where an intimate knowledge of network security can effectively contribute to the successful and profitable operation of an organization.

QUALIFICATIONS SUMMARY
Highly creative and client-focused Information Technology Professional with over four years of industry experience spanning the design, implementation, configuration, and support of LAN/WAN network security solutions for companies. Knowledge of TCP/IP, relationship management, security event analysis, and problem resolution skills as well as outstanding organizational, multitasking, and team building skills. Proven ability as a resourceful coordinator, quick to learn new skills in fast-paced IT environments.

PROFESSIONAL EXPERIENCE

Network Security
Analyst June 2010 - PRESENT
XYZ Consultants
Proficient in researching traffic patterns to identify false-positives and/or malicious traffic within IDS (Intrushield, TippingPoint, etc), IPS (Snort), scanners (Qualis), proxy (BlueCoat) and firewalls (CheckPoint, ASA, PIX, and Netscreen)
Ability to analyze a large volume of security events while maintaining a high quality of analysis
Identified data in firewall events to assist in troubleshooting
Assisted with IDS and IPS Security Event tuning and noise reduction
Proficient in suppressing messages on Firewall modules per customer and/or internal request
Proficient with the SourceFire IDS/IPS to update devices and perform health checks
Worked out of a SOC inbox and organized and routed issues to appropriate party in priority
Performed searches within Remedy to identify historical traffic for customer requests and/or internal needs
Worked out of Remedy on a daily basis to manage ticket, customer accounts, and device inventory
Proficient in handling multiple work queues in priority and escalated matters when appropriate
Provide excellent customer service and always receive positive feedback from management
Strong documentation and report creation skills
Act as a mentor to others on shift

HELP SUPPORT OCTOBER 2009 - June 2010
XYZ Consultants

Installed and troubleshot Snare Syslog configurations on high valued windows machines
Installed new servers / new applications on existing servers in support of internet and intranet environment
Install, configure, troubleshoot and maintain local area networks including workstation connectivity via hardware and software
Built and fixed computers by assembling and replacing components
Submitted firewall policy change requests to the firewall administrators
Developed system/network documentation
Received employee-of-the-month for providing excellent customer service

ADMINISTRATOR (Five Month Contract) APRIL 2009 - AUGUST 2009
XYZ Consultants

Responsible for troubleshooting network connectivity issues between client and partner machines
Addressed network topology and architectural issues
Responsible for installing Windows XP on new hire and client machines
Installed and configured network printers, fax machines, and projectors
Performed network administration and solve miscellaneous PC hardware and software issues.
Kept inventory for all office devices and machines
Follow all policies, procedures, and practices for office maintenance and operations

TECHNICIAN JULY 2008 - APRIL 2009
STU Consultants
Deliver and picked up, troubleshot, diagnose, and perform basic repairs on computer components
Staged mail servers with Windows 2003 Server
Participated in the conversion of 100 PCs from Windows 2000 to Windows 2003
Troubleshot local area network configurations and resolved hardware & software setups
Recommended policies and procedures for managing, maintaining, and supporting the Intranet/ Internet usage
Supported local area networks. Provided technical support and conducted test evaluation of new systems.
Provided hardware specifications for purchase orders

ADMIN ASSISTANT (INTERNSHIP)
JULY 2007 - JULY 2008
BRACTECH - SPRINGFIELD, VA
Designed and installed small Windows XP based LANs for business clients
Performed PC and network repairs on equipment
loaded software and upgraded user workstations as needed
Troubleshot and resolved many user issues
Maintained documentation on all completed assignments and configuration changes
Performed network testing and base lining

EDUCATION
Planning to pursue a Information Security degree at ABC College
o August 2005 - May 2006
o Pursued an education in Business Administration with a concentration in Management

REFERENCES

Available upon request
Don't forget to drop your comments below with your valuable feedback.

This is in part 2 of the tutorial ASP.NET: How To Create Project/Website In Visual Studio – Part 1.
Please go through this before you continue further.
Creating the Database Table
Here we will create a table called ‘LoginTable’ in our SQL Server. Please have a look at Figure-22 for the design structure of the table. This table contains two columns ‘Name’ and ‘Password’.
Please click on the photo for large view
Figure-22: Structure of the ‘LoginTable’

Now we will add the following data in this table 

Please click on the figure for large view
Figure-23: Data in the ‘LoginTable’
So the table at the back end is also prepared for our Tutorial.
Connecting The Database Table From Our Web Application
In the next step we will demonstrate how to connect the database table in windows authentication mode from our web application. There are several methods for this but here we will show the method of declaring a key ‘ConnectionString’ and its value in Web.config file. Add the following line under the <appsettings> section of web config:
<appSettings>
<add key=” ConnectionString” value=”Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Practice” />
</appSettings>
Here as our SQL Server belongs to the same machine we do not mention any server name in the ‘value’.
Integrated Security=SSPI refers windows authentication to connect to the database.
Initial Catalog specifies the Database name in which our table belongs. In our example we create the ‘LoginTable’ under ‘Practice’ database. You may create the table under different database. In that case you specify the database name in place of ‘Practice’.
Creating The Code Behind Page For Login.aspx To Make The Application Ready
The default method for implementing server side code in Visual Studio is to use code-behind pages. When we use code-behind pages, the programming logic is in a separate file than the visual elements of the page.
To go to the page behind page press F7 in the Design view of ‘Login.aspx’ page or from the solution explorer click ‘Login.aspx.cs’. At the top of this page you will find the default namespaces declared. Most of the general purpose .Net base classes are in a namespace called ‘system’. Now to connect with the SQL Server please adds another namespace ‘System.Data.SqlClient’ as shown in the Figure-24:
Please click on the figure for large view


Figure-24: Add the System.Data.SqlClient namespace in the code behind page

You can now find a function Page_Load() declared in the code behind page. This is a page event which runs every time the page is requested. Now it is not only the one page event. When an ASP.NET page is requested, there are a series of page events that occur. These events always occur in the same order, which is referred to as the page event life cycle. Let’s discuss on it in brief.
The page event life cycle consists of the following page events, which occur in the following order:
Page Request: The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled or whether a cached version of the page can be sent in response without running the page.
Start: In the start step, page properties such as Request and Response are set.
Page Initialization: This page event initializes the page by creating and initializing the web server controls on the page.
Load: This event runs every time the page is requested.
Validation: During validation, the Validate method of all validator controls is called, which sets the ‘IsValid’ property of individual validator controls and of the page.
Postback Event Handling: If the request is a postback, any event handlers are called.
Rendering: During the rendering phase, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page’s Response property.
Unload: Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded.
Now let’s back in our example. Here the user will enter the ’Name’ and ‘Password’ in our Login.aspx page and we will search our ‘LoginTable’ with those credentials to find any existing entry. If such entry exists then user will be redirected to the ‘Welcome.aspx’ page.
So at first we will create a Boolean function ‘SearchTable()’ which creates and opens a SQL connection. After that we will search the ‘LoginTable’ with the proper query (with the entered ‘Name’ and ‘Password’) and if any match found then the function will return true, otherwise it returns false. Please find the attached snapshot (Figure-25) to get the code.

Please click on the figure for large view

Figure-25: Details of the function ‘SearchTable()’
The code shown here is self explanatory but let’s again clarify two terms:
DataSet: These are complex objects that allow you to store multiple DataTables of data from a data source. DataSet objects are similar to a virtual database that is inside a web application.
DataAdapter: This object serves as a link between a DataSet object and a data source that can be used for retrieving and saving data. The SqlDataAdapter class is specific to a SQL Server version 7.0 or later database.
Now we will call this ‘SearchTable()’ function when the user click’s the ‘Submit’ button from Login.aspx page. Just go to the Design view of this page and click on the ‘Submit’ button. This will add the button click event at the code behind page like this:

Please click on the figure for large view
Figure-26: Click event function added on the code behind page
Now add these lines within this function to complete the application.

Please click on the figure for large view
Figure-27: Call the ‘SearchTable’ function and set the proper output
Now our web application is ready for testing.
Testing The Web Application
Now set the start page ‘Login.aspx’ by right clicking on the project in solution explorer and press F5 to run the application from localhost. If you are working in windows XP please install IIS from the ‘Additional Windows Components’ of Windows XP CD before running the application.
Here we can have three test scenarios:
Scenario 1:
User does not enter anything in the text boxes and press the ‘Submit’ button. In this case the ‘Required field Validators‘ will show ‘Required’ messages. Please have a look at the two figures below to understand the scenario:
Please click on the figure for large view


Figure-28: Click on ‘Submit’ without entering values in the text boxes
Please click on the figure for large view

Figure-29: Desired output for scenario 1

Scenario 2:
User will enter a valid ‘Name’ and ‘Password’ and click’s on ‘Submit’. User will be redirected to ‘Welcome.aspx’ page. Figure-30 and 31 will make yourself clear about this scenario:
Please click on the figure for large view
Figure-30: User enters a correct entry
Please click on the figure for large view
Figure-31: Desired output for correct entry

Scenario-3
User enters a wrong ‘Name’ or ‘Password’ or both and then he/she will be prompted by an error message at the bottom of ‘Login.aspx’ page. Here are the screenshot of the test case and desired output.
Please click on the figure for large view

Figure-32: User enters a wrong ‘Name’
Please click on the figure for large view



Figure-33: Desired output for scenario-3
So our application is working fine for the entire test scenarios.
Please leave your comments and feedback.

Introduction
The term .Net gives us a feeling that it is something to do only with the Internet or network related applications. Though .Net provides strong environment for creating such applications, it is also possible to create many other types of applications (Windows form based applications, Console applications, Windows custom controls etc.)
.Net is Microsoft’s development model in which software becomes platform and device independent and data becomes available over the Internet. The .Net framework is the heart of .Net. Central to the .Net framework is its runtime execution environment known as the Common Language Runtime (CLR) and the code running under the control of the CLR is often termed as Managed Code.
In this tutorial we will show how to create a dynamic data driven web application in .Net environment and we also focus on understanding basic ASP.Net components for web application.
Problem Statement for this tutorial
We will create a web application which asks user to provide user id and password (both are required fields).We will store some user ids and corresponding passwords in database table. If a user id and password matches with the database entry at the back end then the user will be redirected to Welcome page, otherwise he /she will be prompted a Invalid Login message.
Approach
We will divide this into two parts. In first part we discuss how to create and design the web pages in VS 2008, how to add web controls in the pages, available validation controls and their features etc.
In second part we show the procedure to connect the web application with SQL Server and discuss about the ADO.Net controls and finally compile and run the application to verify its correctness.
Requirements
• Windows XP Professional with Service Pack 2/Windows Vista
• Internet Explorer 6 or later/Any Web Browser
• Visual Studio 2005/2008 Professional
• SQL Server 2005/2008 Developer Edition
• IIS (Internet Information Service) version 5.0 or later
Here we have set up the example with Visual Studio 2008 and SQL Server 2005 environment. But you can also proceed with VS 2005 version.
Installation
Both Visual Studio and SQL Server are not free. You need to purchase it from Microsoft but you can download the trial versions of both of these software from Microsoft. Here are the links:
http://www.microsoft.com/sqlserver/2005/en/us/trial-software.aspx (Download the developer version of SQL Server 2005)
If you are working in Windows XP then you need to install IIS in your machine. Go to
‘Start->Settings->Control Panel’.
Click On ‘Add/Remove Programs’ and then select ‘Add/Remove Windows Components’. Now from the Windows Component Wizard select Internet Information Services and click ‘next’ to proceed. You need to insert Windows XP Professional CD to complete the set up.
IIS 7.0 is included with Windows Vista.
Creating the Web Application
Once you launch the VS 2008 you will be presented with a window similar to the screen shot below:

Figure-1: Start Page of VS 2008
Figure-1: Start Page of VS 2008

The Start Page is the first page you see whenever you launch Visual Studio 2008 and this page guides you as you start projects, as well as search for help or resources. From the screen shot you can see the Recent Projects box at the left side of the page. This box contains the latest projects on which we have worked. From this box you can also create a new project or open an existing project that is not listed. The Getting Started box allows you to create new projects from existing code , create new web sites, pull up the MSDN help application. If you close the Start page from Document Window you can reactivate the Start Page by selecting View->Other Windows->Start Page option.
Now close the Start Page and from the Visual Studio Menu go to
File->New->Web Site
  like Figure-2(below)

Figure-2: Create New Web site from the Menu
Figure-2: Create New Web site from the Menu

Now you will see another window appears to select the template. Select the ASP.Net Web Site template and name it as “TutorialExample” like the screenshot below. Set the Language at the right side as Visual C# (it is the language that will be used at the code behind page which will be discussed later). You may also set it as Visual Basic but here we have used C# to show the example.

Figure-3: Create the “TutorialExample” web site
Figure-3: Create the “TutorialExample” web site

Now the Default.aspx page will be opened like the screenshot below. The Solution Explorer (at the right side) which provides an organized view of the project contains one folder (App_Data) and two files.

Figure-4: Default page and the Solution Explorer
Figure-4: Default page and the Solution Explorer

The App_Data folder is the default directory for database but here we will not use this folder as we will use separate SQL Server database. Application and directory level settings are stored in Web.Config file. Each Web Application has at least one Web.config file.
Now select the Default.aspx file in the Solution explorer and press F2 to rename it as Login.aspx (Screen shot below).

Figure-5: Rename Default.aspx as Login.aspx
Figure-5: Rename Default.aspx as Login.aspx

The document window is where you create the ASP.NET pages. This section of the IDE enables you to create ASP.NET pages either by dragging and dropping elements onto a design surface or by directly coding them. Visual Studio 2008 offers three views of a page: Design, Split and Source view but Visual Studio 2005 offers only two views: Design and Source. Figure-6 shows the document window in VS 2008 with Split View.

Figure-6: Split View of Login.aspx page in the document window
Figure-6: Split View of Login.aspx page in the document window

Now we will add server controls in our Login page. But before doing that we will briefly discuss what is a server control. ASP.NET server controls are components that run on the server and encapsulate UI and other related functionality . Server controls include Buttons, Text Boxes, Drop Down Lists etc. The following is an example of Button server control:
Server controls have a runat=”server” attribute. This means that the logic in the control runs on the server and not on the user’s browser. Server controls are different from HTML controls in that they run only on the client’s browser and have no action on the server. Another feature of server controls is that the view state, the settings and the user input of the control are automatically saved when the page is sent back and forth between the client and the server. Traditional HTML controls are stateless and revert to their default setting when the page is returned from the server to client.
Now let’s add web server controls within a table in our Login page. Place the following code in the source view to create a table first. Please look at Figure-7 to add a table.

Figure-7: Add a 3x3 table in the Login Page
Figure-7: Add a 3x3 table in the Login Page

Now if you go to the Design view you will find a table like Figure-8.

Figure-8: Table in the Design view
Figure-8: Table in the Design view

You can also change the style of this table (like set border, change border color ,width etc.) from the Design view. As an example we will just set a border for this table. Select the table in the design view and press ‘F4’. It will open the Properties Window which controls the properties of any item that is a part of your application. Now change the border type as shown in Figure-9:

Figure-9: Change the Border type of the table
Figure-9: Change the Border type of the table

You may also change the other properties from this window as experiment.
Now we will add controls within this table. At the right bottom of the page you can find an icon called ‘ToolBox’ which basically allows you to use a drag and drop operation on the controls in this application. When you click on it , you can find the available tools grouped by category. Please have a look on Figure-10 for details.

Figure-10: Tools grouped by Category in the Toolbox
Figure-10: Tools grouped by Category in the Toolbox

Now expand the standard category which consists of Web Server Controls and drag a ‘TextBox’ control from it and drop it in the second column of the first row like Figure-11.

Figure-11: A TextBox is added in the second column of first row
Figure-11: A TextBox is added in the second column of first row

Now add another TextBox in the column below and a Button at the last like Figure-12.

Figure-12: Text Box and Button Controls are added
Figure-12: Text Box and Button Controls are added
 
Then write ‘Name’ and ‘Password’ like Figure-13: in the Table

Figure-13: Name and Password added
Figure-13: Name and Password added

Now Select the button control and press F4 to view the properties window. In properties change the ‘Text’ property from ‘Button’ to ‘Submit’ (shown in Figure-14)

Figure-14: Change the Text property of the Button control
Figure-14: Change the Text property of the Button control

After changing this property the design view of Login page will be like Figure-15

Figure-15: ‘Submit’ button  Added
Figure-15: ‘Submit’ button Added

At last we will add validation controls for two text boxes. The ASP.Net page framework includes different types of validation controls . Here we are adding small description of different types of validation controls:
CompareValidator: Compares an input control to another input control
CustomValidator: Allows you to write your own code to create the validation expression.
RangeValidator: This can verify that the user input is between two values.
RegularExpressionValidator: Verifies that the entry matches a pattern that has been specified by a regular expression.
RequiredFieldValidator: Checks whether a value has been entered into a control or not.
ValidationSummary: Displays a summary of all of the validation errors for all of the validation controls on the page.
In our application user need to provide both ‘Name’ and ‘Password’ and these are required fields. So we will add two RequiredFieldValidator for the two TextBoxes. Now drag two ‘RequiredFieldValidator’ from the ‘Validation’ category of ToolBox and place them at the last column of the first two rows of the table.
Here is the screenshot:

Figure-16: Two RequiredFieldValidators are added
Figure-16: Two RequiredFieldValidators are added

Now select the two RequiredFieldValidators one by one and set the ‘ControlToValidate’ property as ‘TextBox1’ and ‘TextBox2’ respectively . Set the ‘ErrorMessage’ property of both of them as ‘Required’. Please look at the screenshot below for details:

Figure-17: Change the properties of the RequiredFieldValidator1 (same for the second)
Figure-17: Change the properties of the RequiredFieldValidator1 (same for the second)

As a result of this if an user press the ‘Submit’ button keeping the TextBox1 or TextBox2 blank, then he/she will get a ‘Required’ message beside the appropriate TextBox .
At last we will add a asp:label control below the table. If a user enters a wrong ‘Name’ or ‘Password’ then this control will show the proper error message. From the properties window set the ‘ForeColor
Red’ and leave ‘Text’ blank as shown in Figure-18.

Figure-18: Change the ‘ForeColor’ and ‘Text’ properties of ’ Label1’
Figure-18: Change the ‘ForeColor’ and ‘Text’ properties of ’ Label1’ 

So our Login.aspx page is ready. Now we will add another web page called ‘Welcome.aspx’ into our project. This page will contain just one one ‘label’ control which will show a welcome message after successful login.
To add another web page in our project just right click on the project in the Solution Explorer and select ‘Add New Item’ (Shown in Figure-19)

Figure-19: Select ‘Add New Item’ to add another page
Figure-19: Select ‘Add New Item’ to add another page

From the appeared templates select ‘Web Form’ and Name it as ‘Welcome.aspx’ (screenshot below)

Figure-20: Add ‘Welcome.aspx’ page in the project
Figure-20: Add ‘Welcome.aspx’ page in the project

Now in the design view drag and drop a ‘Label’ control from the toolbox and change the properties like the attached snapshot.

Figure-21: Add welcome label in ‘Welcome.aspx’ page
Figure-21: Add welcome label in ‘Welcome.aspx’ page

Now designs of both the pages are ready now and it is the end for Part-I Article. We will create the required table in SQL Server and show how to connect the web application with the database in  Part II Article.



Introduction

I have seen many tutorials on ASP.NET but most of them start with coding and writing your first ASP.NET Program. But here I have written this tutorial for explaining why there is a need for ASP.NET when classy ASP is working fine and what are the underlying technology behind ASP.NET, What programming model ASP.NET Provides to programmers. Now let us get started.
ASP.NET is the new offering for Web developers from the Microsoft .It is not simply the next-generation of ASP; in fact, it is a completely re-engineered and enhanced technology that offers much, much more than traditional ASP and can increase productivity significantly.
Because it has evolved from ASP, ASP.NET looks very similar to its predecessor—but only at first sight. Some items look very familiar, and they remind us of ASP. But concepts like Web Forms, Web Services, or Server Controls gives ASP.NET the power to build real Web applications.

Looking Back : Active Server Pages (ASP)

Microsoft Active Server Pages (ASP) is a server-side scripting technology. ASP is a technology that Microsoft created to ease the development of interactive Web applications. With ASP you can use client-side scripts as well as server-side scripts. Maybe you want to validate user input or access a database. ASP provides solutions for transaction processing and managing session state. Asp is one of the most successful language used in web development.

Problems with Traditional ASP

There are many problems with ASP if you think of needs for Today's powerful Web applications.
  1. Interpreted and Loosely-Typed Code
    ASP scripting code is usually written in languages such as JScript or VBScript. The script-execution engine that Active Server Pages relies on interprets code line by line, every time the page is called. In addition, although variables are supported, they are all loosely typed as variants and bound to particular types only when the code is run. Both these factors impede performance, and late binding of types makes it harder to catch errors when you are writing code.

  2. Mixes layout (HTML) and logic (scripting code)
    ASP files frequently combine script code with HTML. This results in ASP scripts that are lengthy, difficult to read, and switch frequently between code and HTML. The interspersion of HTML with ASP code is particularly problematic for larger web applications, where content must be kept separate from business logic.

  3. Limited Development and Debugging ToolsMicrosoft Visual InterDev, Macromedia Visual UltraDev, and other tools have attempted to increase the productivity of ASP programmers by providing graphical development environments. However, these tools never achieved the ease of use or the level of acceptance achieved by Microsoft Windows application development tools, such as Visual Basic or Microsoft Access. ASP developers still rely heavily or exclusively on Notepad.

    Debugging is an unavoidable part of any software development process, and the debugging tools for ASP have been minimal. Most ASP programmers
    resort to embedding temporary Response. Write statements in their code to trace the progress of its execution.

  4. No real state management
    Session state is only maintained if the client browser supports cookies. Session state information can only be held by using the ASP Session object. And you have to implement additional code if you, for example, want to identify a user.

  5. Update files only when server is down
    If your Web application makes use of components, copying new files to your application should only be done when the Web server is stopped. Otherwise it is like pulling the rug from under your application's feet, because the components may be in use (and locked) and must be registered.

  6. Obscure Configuration Settings
    The configuration information for an ASP web application (such as session state and server timeouts) is stored in the IIS metabase. Because the metabase is stored in a proprietary format, it can only be modified on the server machine with utilities such as the Internet Service Manager. With limited support for programmatically manipulating or extracting these settings, it is often an arduous task to port an ASP application from one server to another.

Introducing ASP.NET

ASP.NET was developed in direct response to the problems that developers had with classic ASP. Since ASP is in such wide use, however, Microsoft ensured that ASP scripts execute without modification on a machine with the .NET Framework (the ASP engine, ASP.DLL, is not modified when installing the .NET Framework). Thus, IIS can house both ASP and ASP.NET scripts on the same machine.

Advantages of ASP.NET

  1. Separation of Code from HTML
    To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently. This makes it much easier for teams of programmers and designers to collaborate efficiently.

  2. Support for compiled languages
    developer can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

  3. Use services provided by the .NET Framework
    The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.

  4. Graphical Development Environment
    Visual Studio .NET provides a very rich development environment for Web
    developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code, but also for HTML and XML.

  5. State management
    To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across Web farms, and state information can be recovered, even if the server fails or the connection breaks down.

  6. Update files while the server is running!
    Components of your application can be updated while the server is online and clients are connected. The Framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

  7. XML-Based Configuration FilesConfiguration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

ASP.NET Overview

Here are some point that gives the quick overview of ASP.NET.
  • ASP.NET provides services to allow the creation, deployment, and execution of Web Applications and Web Services
  • Like ASP, ASP.NET is a server-side technology
  • Web Applications are built using Web Forms. ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.
  • Web Forms are designed to make building web-based applications as easy as building Visual Basic applications

ASP.NET Architecture

ASP.NET is based on the fundamental architecture of .NET Framework. Visual studio provide a uniform way to combine the various features of this Architecture.
Architechture of Asp.Net
Architecture is explained form bottom to top in the following discussion.
  1. At the bottom of the Architecture is Common Language Runtime. NET Framework common language runtime resides on top of the operating system services. The common language runtime loads and executes code that targets the runtime. This code is therefore called managed code. The runtime gives you, for example, the ability for cross-language integration.
  2. .NET Framework provides a rich set of class libraries. These include base classes, like networking and input/output classes, a data class library for data access, and classes for use by programming tools, such as debugging services. All of them are brought together by the Services Framework, which sits on top of the common language runtime.
  3. ADO.NET is Microsoft’s ActiveX Data Object (ADO) model for the .NET Framework. ADO.NET is not simply the migration of the popular ADO model to the managed environment but a completely new paradigm for data access and manipulation.

    ADO.NET is intended specifically for developing web applications. This is evident from its two major design principles:
    1. Disconnected Datasets—In ADO.NET, almost all data manipulation is done outside the context of an open database connection.
    2. Effortless Data Exchange with XML—Datasets can converse in the universal data format of the Web, namely XML.
  4. The 4th layer of the framework consists of the Windows application model and, in parallel, the Web application model.
    The Web application model-in the slide presented as ASP.NET-includes Web Forms and Web Services.
    ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.

    Web Services brings you a model to bind different applications over the Internet. This model is based on existing infrastructure and applications and is therefore standard-based, simple, and adaptable.

    Web Services are software solutions delivered via Internet to any device. Today, that means Web browsers on computers, for the most part, but the device-agnostic design of .NET will eliminate this limitation.
  5. One of the obvious themes of .NET is unification and interoperability between various programming languages. In order to achieve this; certain rules must be laid and all the languages must follow these rules. In other words we can not have languages running around creating their own extensions and their own fancy new data types. CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow.
  6. The CLR and the .NET Frameworks in general, however, are designed in such a way that code written in one language can not only seamlessly be used by another language. Hence ASP.NET can be programmed in any of the .NET compatible language whether it is VB.NET, C#, Managed C++ or JScript.NET.

Quick Start :To ASP.NET

After this short excursion with some background information on the .NET Framework, we will now focus on ASP.NET.

File name extensions

Web applications written with ASP.NET will consist of many files with different file name extensions. The most common are listed here. Native ASP.NET files by default have the extension .aspx (which is, of course, an extension to .asp) or .ascx. Web Services normally have the extension .asmx.
Your file names containing the business logic will depend on the language you use. So, for example, a C# file would have the extension .aspx.cs. You already learned about the configuration file Web.Config.
Another one worth mentioning is the ASP.NET application file Global.asax - in the ASP world formerly known as Global.asa. But now there is also a code behind file Global.asax.vb, for example, if the file contains Visual Basic.NET code. Global.asax is an optional file that resides in the root directory of your application, and it contains global logic for your application.

All of these are text files

All of these files are text files, and therefore human readable and writeable.

The easiest way to start

The easiest way to start with ASP.NET is to take a simple ASP page and change the file name extension to .aspx.

Page Syntax

Here is quick introduction of syntax used in ASP.NET

Directives

You can use directives to specify optional settings used by the page compiler when processing ASP.NET files. For each directive you can set different attributes. One example is the language directive at the beginning of a page defining the default programming language.

Code Declaration Blocks

Code declaration blocks are lines of code enclosed in <script> tags. They contain the runat=server attribute, which tells ASP.NET that these controls can be accessed on the server and on the client. Optionally you can specify the language for the block. The code block itself consists of the definition of member variables and methods.

Code Render Blocks

Render blocks contain inline code or inline expressions enclosed by the character sequences shown here. The language used inside those blocks could be specified through a directive like the one shown before.

HTML Control Syntax

You can declare several standard HTML elements as HTML server controls. Use the element as you are familiar with in HTML and add the attribute runat=server. This causes the HTML element to be treated as a server control. It is now programmatically accessible by using a unique ID. HTML server controls must reside within a <form> section that also has the attribute runat=server.

Custom Control Syntax

There are two different kinds of custom controls. On the one hand there are the controls that ship with .NET, and on the other hand you can create your own custom controls. Using custom server controls is the best way to encapsulate common programmatic functionality.
Just specify elements as you did with HTML elements, but add a tag prefix, which is an alias for the fully qualified namespace of the control. Again you must include the runat=server attribute. If you want to get programmatic access to the control, just add an Id attribute.
You can include properties for each server control to characterize its behavior. For example, you can set the maximum length of a TextBox. Those properties might have sub properties; you know this principle from HTML. Now you have the ability to specify, for example, the size and type of the font you use (font-size and font-type).
The last attribute is dedicated to event binding. This can be used to bind the control to a specific event. If you implement your own method MyClick, this method will be executed when the corresponding button is clicked if you use the server control event binding shown in the slide.

Data Binding Expression

You can create bindings between server controls and data sources. The data binding expression is enclosed by the character sequences <%# and %>. The data-binding model provided by ASP.NET is hierarchical. That means you can create bindings between server control properties and superior data sources.

Server-side Object Tags

If you need to create an instance of an object on the server, use server-side object tags. When the page is compiled, an instance of the specified object is created. To specify the object use the identifier attribute. You can declare (and instantiate) .NET objects using class as the identifier, and COM objects using either progid or classid.

Server-side Include Directives

With server-side include directives you can include raw contents of a file anywhere in your ASP.NET file. Specify the type of the path to filename with the pathtype attribute. Use either File, when specifying a relative path, or Virtual, when using a full virtual path.

Server-side Comments

To prevent server code from executing, use these character sequences to comment it out. You can comment out full blocks - not just single lines.

First ASP.NET Program.

Now let us have our First ASP.NET program.
Let’s look at both the markup and the C# portions of a simple web forms application that generates a movie line-up dynamically through software.

Markup Portion

Web form application part 1 -- SimpleWebForm.aspx

<% @Page Language="C#" Inherits="MoviePage" Src="SimpleWebForm.cs" %> 

<html>
<body background="Texture.bmp">

<TITLE>Supermegacineplexadrome!</TITLE>

<H1 align="center"><FONT color="white" size="7">Welcome to <br>Supermegacineplexadrome!</FONT></H1>

<P align="left"><FONT color="lime" size="5"><STRONG>

<U>Showtimes for <%WriteDate();%></U>

</STRONG></FONT></P>

<FONT size="5" color="yellow"><%WriteMovies();%></FONT>

</body>
</html>
And this is where the C# part of a web forms application comes in.

Web form application part 2 - SimpleWebForm.cs

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

public class MoviePage:Page 
{
    protected void WriteDate()
    {
        Response.Write(DateTime.Now.ToString());
    }

    protected void WriteMovies()
    {
        Response.Write("<P>The Glass Ghost (R) 1:05 pm, 3:25 pm, 7:00 pm</P>");
        Response.Write("<P>Untamed Harmony (PG-13) 12:50 pm, 3:25 pm, " + <br>                       "6:55 pm</P>");
        Response.Write("<P>Forever Nowhere (PG) 3:30 pm, 8:35 pm</P>");
        Response.Write("<P>Without Justice (R) 12:45 pm, 6:45 pm</P>");
    }
}

Execution Cycle :

Now let's see what’s happening on the server side. You will shortly understand how server controls fit in.
A request for an .aspx file causes the ASP.NET runtime to parse the file for code that can be compiled. It then generates a page class that instantiates and populates a tree of server control instances. This page class represents the ASP.NET page.
Now an execution sequence is started in which, for example, the ASP.NET page walks its entire list of controls, asking each one to render itself.
The controls paint themselves to the page. This means they make themselves visible by generating HTML output to the browser client.

Execution Process

We need to have a look at what’s happening to your code in ASP.NET.

Compilation, when page is requested the first time

The first time a page is requested, the code is compiled. Compiling code in .NET means that a compiler in a first step emits Microsoft intermediate language (MSIL) and produces metadata—if you compile your source code to managed code. In a following step MSIL has to be converted to native code.

Microsoft intermediate language (MSIL)

Microsoft intermediate language is code in an assembly language–like style. It is CPU independent and therefore can be efficiently converted to native code.
The conversion in turn can be CPU-specific and optimized. The intermediate language provides a hardware abstraction layer.
MSIL is executed by the common language runtime.

Common language runtime

The common language runtime contains just-in-time (JIT) compilers to convert the MSIL into native code. This is done on the same computer architecture that the code should run on.
The runtime manages the code when it is compiled into MSIL—the code is therefore called managed code.

ASP.NET Applications and Configuration

Overview

Like ASP, ASP.NET encapsulates its entities within a web application. A web application is an abstract term for all the resources available within the confines of an IIS virtual directory. For example, a web application may consist of one or more ASP.NET pages, assemblies, web services configuration files, graphics, and more. In this section we explore two fundamental components of a web application, namely global application files (Global.asax) and configuration files (Web.config).

Global.asax

Global.asax is a file used to declare application-level events and objects. Global.asax is the ASP.NET extension of the ASP Global.asa file. Code to handle application events (such as the start and end of an application) reside in Global.asax. Such event code cannot reside in the ASP.NET page or web service code itself, since during the start or end of the application, its code has not yet been loaded (or unloaded). Global.asax is also used to declare data that is available across different application requests or across different browser sessions. This process is known as application and session state management.
The Global.asax file must reside in the IIS virtual root. Remember that a virtual root can be thought of as the container of a web application. Events and state specified in the global file are then applied to all resources housed within the web application. If, for example, Global.asax defines a state application variable, all .aspx files within the virtual root will be able to access the variable.
Like an ASP.NET page, the Global.asax file is compiled upon the arrival of the first request for any resource in the application. The similarity continues when changes are made to the Global.asax file; ASP.NET automatically notices the changes, recompiles the file, and directs all new requests to the newest compilation. A Global.asax file is automatically created when you create a new web application project in the VS.NET IDE.

Application Directives

Application directives are placed at the top of the Global.asax file and provide information used to compile the global file. Three application directives are defined, namely Application, Assembly, and Import. Each directive is applied with the following syntax:
<%@ appDirective appAttribute=Value ...%> 

Web.config

In ASP, configuration settings for an application (such as session state) are stored in the IIS metabase. There are two major disadvantages with this scheme. First, settings are not stored in a human-readable manner but in a proprietary, binary format. Second, the settings are not easily ported from one host machine to another.(It is difficult to transfer information from an IIS’s metabase or Windows Registry to another machine, even if it has the same version of Windows.)
Web.config solves both of the aforementioned issues by storing configuration information as XML. Unlike Registry or metabase entries, XML documents are human-readable and can be modified with any text editor. Second, XML files are far more portable, involving a simple file transfer to switch machines.
Unlike Global.asax, Web.config can reside in any directory, which may or may not be a virtual root. The Web.config settings are then applied to all resources accessed within that directory, as well as its subdirectories. One consequence is that an IIS instance may have many web.config files. Attributes are applied in a hierarchical fashion. In other words, the web.config file at the lowest level directory is used.
Since Web.config is based on XML, it is extensible and flexible for a wide variety of applications. It is important, however, to note that the Web.config file is optional. A default Web.config file, used by all ASP.NET application resources, can be found on the local machine at:
\%winroot%\Microsoft.Net\Framework\version\CONFIG\machine.config

Summary

ASP.NET is an evolution of Microsoft’s Active Server Page (ASP) technology. Using ASP.NET, you can rapidly develop highly advanced web applications based on the .NET framework. Visual Studio Web Form Designer, which allows the design of web applications in an intuitive, graphical method similar to Visual Basic 6. ASP.NET ships with web controls wrapping each of the standard HTML controls, in addition to several controls specific to .NET. One such example is validation controls, which intuitively validate user input without the need for extensive client-side script.
In many respects, ASP.NET provides major improvements over ASP, and can definitely be considered a viable alternative for rapidly developing web-based applications.



Author Name

Engineeersdaily

Contact Form

Name

Email *

Message *

Powered by Blogger.